Re: BGE afficher une mini map avec une texture

Posté par ares le 30/3/2016 18:09:14
Voila le script.

######################################################
#
# RenderToTexture.py Blender 2.50
#
# Tutorial for using RenderToTexture.py can be found at
#
# www.tutorialsforblender3d.com
#
# Released under the Creative Commons Attribution 3.0 Unported License.
#
# If you use this code, please include this information header.
#
######################################################

#import GameLogic
#it does not matter if you import GameLogic or bge.logic. bge.logic is "just" another alias for GameLogic.
import GameLogic,bge

# get current scene
over_scene = GameLogic.getCurrentScene()
scene = bge.logic.getSceneList()[0]

# get the current controller
controller = GameLogic.getCurrentController()

# get object script is attached to
obj = controller.owner

# check to see RenderToTexture has been added
if "RenderToTexture" in obj:

# update the texture
obj["RenderToTexture"].refresh(True)


# if RenderToTexture hasn't been added
else:

# import VideoTexture module
import VideoTexture

# get a list of objects in the scene
objList = scene.objects
#print(objList)

# get camera name being used for render to texture
camName = obj['cam']

# get camera object
cam = objList[camName]

# get the texture material ID
matID = VideoTexture.materialID(obj, "MA" + obj['material'])

# set the texture
renderToTexture = VideoTexture.Texture(obj, matID)

# get the texture image
#VideoTexture.ImageRender(scene,cam).filter

renderToTexture.source = VideoTexture.ImageRender(scene,cam)
s=2**6
#renderToTexture.source.capsize = [s,s]
#print(VideoTexture.ImageRender(scene,cam).filter)

# save RenderToTexture as an object variable
obj["RenderToTexture"] = renderToTexture


Apres ma minimal, je la place comme il faut pour que ca fonctionne :) Je m'adapterai !!

Cette contribution était de : http://blenderclan.tuxfamily.org/html/newbb/viewtopic.php?forum=3&topic_id=45788&post_id=551423