ImageMirror: capsize

capsize
  • set/get the maximum resolution of the source image

Type: 

  • integer list: [ pixel_width, pixel_height]

pixel_width:

  • source resolution width in pixels.
  • Type:  integer
pixel_height:
  • source resolution height in pixels.
  • Type:  integer
Note:
  • capsize is the resolution of the source image.
  • capsize is not the size of the mirror that the source image is being displayed on.
Example:
  • capsize =  a source resolution of 32 pixels by 32 pixels
  • display mirror size = 256 pixels by 256 pixels
     
  • source image of 32x32 pixels will be stretched to same size as display.
Sample Code

###################### get capsize of source image

# import bge module
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get list of objects in scene
objList = scene.objects

# get object named Mirror
obj = objList["Mirror"]

# get the mirror material ID
# Name of my Mirror material is Reflect
matID = bge.texture.materialID(obj, "MAReflect")

# get a list of the cameras
camList = scene.cameras

# get the camera named PlayerOne
cam = camList["PlayerOne"]
           
# texture I'm using for the mirror is in first texture channel
texChannel = 0

# get the texture
mirror = bge.texture.Texture(obj, matID, texChannel)

# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)

# get capsize
size = mirror.source.capsize

# save mirror as an object variable
obj["Mirror"] = mirror

# update mirror
mirror.refresh(True)

Sample Code

###################### set capsize of source image

# import bge module
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get list of objects in scene
objList = scene.objects

# get object named Mirror
obj = objList["Mirror"]

# get the mirror material ID
# Name of my Mirror material is Reflect
matID = bge.texture.materialID(obj, "MAReflect")

# get a list of the cameras
camList = scene.cameras

# get the camera named PlayerOne
cam = camList["PlayerOne"]
           
# texture I'm using for the mirror is in first texture channel
texChannel = 0

# get the texture
mirror = bge.texture.Texture(obj, matID, texChannel)

# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)

# set capsize
mirror.source.capsize = [128, 128]

# save mirror as an object variable
obj["Mirror"] = mirror

# update mirror
mirror.refresh(True)