Exemple #1
0
    def _printShaderErrors(self, shader, source):
        """"""
        log = Buffer(GL_BYTE, len(source))
        length = Buffer(GL_INT, 1)

        print('Shader Code:')
        glGetShaderSource(shader, len(log), length, log)

        line = 1
        msg = "  1 "

        for i in range(length[0]):
            if chr(log[i-1]) == '\n':
                line += 1
                msg += "%3d %s" %(line, chr(log[i]))
            else:
                msg += chr(log[i])

        print(msg)

        glGetShaderInfoLog(shader, len(log), length, log)
        print("Error in GLSL Shader:\n")
        msg = ""
        for i in range(length[0]):
            msg += chr(log[i])

        print (msg)
        logic.endGame()
Exemple #2
0
def reallyRestart():
    if useDebug:
        print('Restarting is not supported in Debug Mode')
    else:
        import subprocess
        subprocess.Popen(logic.binaryPlayerPath)
        logic.endGame()
Exemple #3
0
def endGame():
    '''terminate the runtime gracefully'''
    if useMultitouch:
        multitouch.stopDevices()
    logic.endGame()
    config.write()
    logging.info('Gracefully terminated: \t' + str(time.asctime()))
    def _printShaderErrors(self, shader, source):
        """"""
        log = Buffer(GL_BYTE, len(source))
        length = Buffer(GL_INT, 1)

        print('Shader Code:')
        glGetShaderSource(shader, len(log), length, log)

        line = 1
        msg = "  1 "

        for i in range(length[0]):
            if chr(log[i - 1]) == '\n':
                line += 1
                msg += "%3d %s" % (line, chr(log[i]))
            else:
                msg += chr(log[i])

        print(msg)

        glGetShaderInfoLog(shader, len(log), length, log)
        print("Error in GLSL Shader:\n")
        msg = ""
        for i in range(length[0]):
            msg += chr(log[i])

        print(msg)
        logic.endGame()
def init(cont):

    # get main evertims module
    gl.evertims = Evertims()

    # set debug mode
    gl.evertims.setDebugMode(DEBUG)

    # define EVERTs elements: room, listener and source
    scene = gl.getCurrentScene()
    gl.evertims.addRoom(scene.objects['Room'])
    gl.evertims.addSource(scene.objects['source'])
    gl.evertims.addListener(scene.objects['listener_1'])

    # limit listener / source position updates in EVERTims Client
    gl.evertims.setMovementUpdateThreshold(MOVE_UPDATE_THRESHOLD_VALUE_LOC,
                                           MOVE_UPDATE_THRESHOLD_VALUE_ROT)

    # init newtork connections
    gl.evertims.initConnection_write(IP_EVERT, PORT_W)
    gl.evertims.initConnection_read(IP_LOCAL, PORT_R)

    # activate raytracing
    gl.evertims.activateRayTracingFeedback(True)

    # check if evertims module is ready to start
    if gl.evertims.isReady():
        # start EVERTims client
        gl.evertims.startClientSimulation()

    else:
        print(
            '\n###### EVERTims SIMULATION ABORTED ###### \nYou should create at least 1 room, 1 listener, 1 source, \nand define EVERTims client parameters.\n'
        )
        gl.endGame()  # quit game
Exemple #6
0
	def draw_map(self):
		for y in range(self.height):
			for x in range(self.width):
				self.sys.own.worldPosition = [x*S,y*S,0]
				if self.map[x][y].block:
					index = self.map[x][y].block_index
					try:
						mesh = self.map[x][y].block+str(index)
						tile = logic.getCurrentScene().addObject(mesh,self.sys.own)
						self.map[x][y].block = tile
					except ValueError:
						raise Exception("**********\nStairs at {} {} are reested! \nCorrect block for index {} not found!\n**********".format(x,y,index))
						logic.endGame()
		
				#draw props
				if self.map[x][y].prop:
					p = self.map[x][y].prop
					self.sys.own.worldPosition = [(x*S)+rand(-1,1),(y*S)+rand(-1,1), 2]
					if p == 'LifePotion':
						self.sys.own.worldPosition.z = 0
					prop = logic.getCurrentScene().addObject(p, self.sys.own)
					ori = prop.worldOrientation.to_euler()
					ori.z = rand(0,628)*0.01
					prop.worldOrientation = ori
					if p == 'Zombie':
						self.monsters.append(prop)
					elif p == 'LifePotion':
						self.items.append(prop)
Exemple #7
0
def init():
    """
    called from logic brick
    """
    if not hasattr(logic, 'setRender'):
        print("ERROR: You require a patched Blender with bge.logic.setRender() method")
        return logic.endGame()

    scene = logic.getCurrentScene()
    camera = scene.objects.get('Camera.VR')

    if not camera:
        print("ERROR: Missing special Camera.VR object")
        return logic.endGame()

    backend = camera['backend']

    hmd = HMD(backend)

    if not hmd.start():
        return logic.endGame()

    """
    waiting for the following fix to use logic.globalDict instead of globals
    https://developer.blender.org/T46870

    (this is fixed, but it has not been merged in decklink yet)
    """
    logic.hmd = hmd
Exemple #8
0
 def update(self):
     if not self.is_open:
         # menu's not open, listen to in-game hotkeys
         R.setMousePosition(*self.screen_center)
         self.cursor.localPosition = self.mouse.raySource
         if G.keyboard.events[self.kh_menu] == RELEASED:
             self.toggle_menu()
         elif G.keyboard.events[self.kh_view_toggle] == RELEASED:
             controls.movement_controls.view_toggle()
         return
     # menu is open
     self.cursor.localPosition = self.mouse.raySource
     obj = self.mouse.hitObject
     if obj and 'highlight' in obj and obj['highlight']:
         self.menu_highlight.localPosition = obj.position
         self.menu_highlight.localPosition.z = obj.position.z - 1.0
         self.menu_highlight.setVisible(True)
         if E.LEFTMOUSE in G.mouse.active_events and 'start_game' in obj:
             print('mouse button', obj)
             if obj.name == 'choose_fly':
                 try:
                     #controls.start_game()
                     self.toggle_menu(False)
                 except Exception as e:
                     print(e)
             elif obj.name == 'choose_exit':
                 G.endGame()
def reallyRestart():
	if useDebug:
		print('Restarting is not supported in Debug Mode')
	else:
		import subprocess
		subprocess.Popen(logic.binaryPlayerPath)
		logic.endGame()
def init(cont):

    # get main evertims module
    gl.evertims = Evertims()

    # set debug mode
    gl.evertims.setDebugMode(DEBUG)

    # define EVERTs elements: room, listener and source
    scene = gl.getCurrentScene()
    gl.evertims.addRoom(scene.objects['Room'])
    gl.evertims.addSource(scene.objects['source'])
    gl.evertims.addListener(scene.objects['listener_1'])

    # limit listener / source position updates in EVERTims Client
    gl.evertims.setMovementUpdateThreshold(MOVE_UPDATE_THRESHOLD_VALUE_LOC, MOVE_UPDATE_THRESHOLD_VALUE_ROT)

    # init newtork connections
    gl.evertims.initConnection_write(IP_EVERT, PORT_W)
    gl.evertims.initConnection_read(IP_LOCAL, PORT_R)

    # activate raytracing
    gl.evertims.activateRayTracingFeedback(True)

    # check if evertims module is ready to start
    if gl.evertims.isReady():
        # start EVERTims client
        gl.evertims.startClientSimulation()

    else:
        print ('\n###### EVERTims SIMULATION ABORTED ###### \nYou should create at least 1 room, 1 listener, 1 source, \nand define EVERTims client parameters.\n')
        gl.endGame() # quit game
Exemple #11
0
    def draw_map(self):
        for y in range(self.height):
            for x in range(self.width):
                self.sys.own.worldPosition = [x * S, y * S, 0]
                if self.map[x][y].block:
                    index = self.map[x][y].block_index
                    try:
                        mesh = self.map[x][y].block + str(index)
                        tile = logic.getCurrentScene().addObject(
                            mesh, self.sys.own)
                        self.map[x][y].block = tile
                    except ValueError:
                        raise Exception(
                            "**********\nStairs at {} {} are reested! \nCorrect block for index {} not found!\n**********"
                            .format(x, y, index))
                        logic.endGame()

                #draw props
                if self.map[x][y].prop:
                    p = self.map[x][y].prop
                    self.sys.own.worldPosition = [(x * S) + rand(-1, 1),
                                                  (y * S) + rand(-1, 1), 2]
                    if p == 'LifePotion':
                        self.sys.own.worldPosition.z = 0
                    prop = logic.getCurrentScene().addObject(p, self.sys.own)
                    ori = prop.worldOrientation.to_euler()
                    ori.z = rand(0, 628) * 0.01
                    prop.worldOrientation = ori
                    if p == 'Zombie':
                        self.monsters.append(prop)
                    elif p == 'LifePotion':
                        self.items.append(prop)
Exemple #12
0
def init():
    """
    setup render callback, create gpu offscreen
    """
    if not hasattr(logic, 'setRender'):
        print(
            "You require a patched Blender with bge.logic.setRender() method")
        logic.endGame()

    scene = logic.getCurrentScene()
    scene.post_draw.append(draw)
    camera = scene.objects.get('Camera.VR')

    if not camera:
        print("You need a \"Camera.VR\" object")
        logic.endGame()

    offscreen = render.offScreenCreate(512, 512, 0,
                                       render.RAS_OFS_RENDER_TEXTURE)
    color_texture = offscreen.color
    image_render = texture.ImageRender(scene, camera, offscreen)
    image_render.alpha = True

    logic.globalDict['offscreen'] = offscreen
    logic.globalDict['color_texture'] = color_texture
    logic.globalDict['image_render'] = image_render
def endGame():
	'''terminate the runtime gracefully'''
	if useMultitouch:
		multitouch.stopDevices()
	logic.endGame()
	config.write()
	logging.info('Gracefully terminated: \t' + str(time.asctime()))
Exemple #14
0
	def Quit(self):
		cont = logic.getCurrentController()
		scene = logic.getCurrentScene()
		mouse = cont.sensors['Mouse']
		mouseEvents = logic.mouse.events
		click = mouseEvents[events.LEFTMOUSE]
		if click:
			logic.endGame()
Exemple #15
0
 def Quit(self):
     cont = logic.getCurrentController()
     scene = logic.getCurrentScene()
     mouse = cont.sensors['Mouse']
     mouseEvents = logic.mouse.events
     click = mouseEvents[events.LEFTMOUSE]
     if click:
         logic.endGame()
Exemple #16
0
def main_loop():
    if logic.begin == 1:
        import Game
        out = logic.game.update()  #Update the game
        #If we have a winner, game is done!
        if out != "":
            print(" WINNER : " + out)
            logic.endGame()
def shutdownOSVR():
    if running:
        from bge.logic import endGame

        clientKit.instance.context.shutdown()
        global running
        running = False
        print("OSVR shutting down, exiting.")

        endGame()
def shutdownOSVR():
    if running:
        from bge.logic import endGame

        clientKit.instance.context.shutdown()
        global running
        running = False
        print("OSVR shutting down, exiting.")

        endGame()
Exemple #19
0
    def gameOver(self):
        """
        The game time is over
        """
        self.logger.debug('Game Over')

        TODO
        """
        do something funky
        """
        logic.endGame()
Exemple #20
0
def end_game_on_exception():
    """
    Ends the game if an exception is raised.
    :return: None
    """

    exc = sys.exc_info()

    if exc[0]:  # An exception has been raised; end the game

        # if not allow_missing_functions and not "'module' object has no attribute" in str(sys.last_value):
        # It's an actual error, not just an object's function that hasn't been implemented

        logic.endGame()
Exemple #21
0
def end_game_on_exception():
    """
    Ends the game if an exception is raised.
    :return: None
    """

    exc = sys.exc_info()

    if exc[0]:  # An exception has been raised; end the game

        # if not allow_missing_functions and not "'module' object has no attribute" in str(sys.last_value):
        # It's an actual error, not just an object's function that hasn't been implemented

        logic.endGame()
Exemple #22
0
    def run(self):
        master, slave = pty.openpty()
        socatProcess = Popen('socat -d -d pty,raw,echo=0 pty,raw,echo=0,link=' + path + 'mbed', shell=True, stdin=PIPE, stdout=slave, stderr=slave, close_fds=True, preexec_fn=os.setsid)
        stdout = os.fdopen(master)
        
        portOne = stdout.readline()
        portTwo = stdout.readline()
        
        portOne = portOne[portOne.find("/", 20):-1]
        portTwo = portTwo[portTwo.find("/", 20):-1]
        
        port = serial.Serial(portOne, 115200, writeTimeout=0)
        
        print("Set the mbed serial port to: " + portTwo)
        print("          or to the symlink: " + path + "mbed")

        while True:
            if(object['QuitState'] == 1):
                print("Quiting... Please wait...")
                print("Closing port...")
                port.close()
                print("SIGTERM to socat...")
                os.killpg(socatProcess.pid, signal.SIGTERM)
                print("Done.")
                break
            
            if(port.inWaiting() >= 4):
                data = port.read(4)
                
                if(chr(data[3]) == '\n'):
                    if(chr(data[0]) == 'h'):
                        object['DesiredHeading'] = AVNavDecode(data[1], data[2])
                    elif(chr(data[0]) == 'p'):
                        object['DesiredPower'] = AVNavDecode(data[1], data[2])
                    elif(chr(data[0]) == 'd'):
                        object['DesiredDepth'] = AVNavDecode(data[1], data[2])
                    elif(chr(data[0]) == 'r'):
                        object['DesiredDropper'] = AVNavDecode(data[1], data[2])
                    else:
                        pass
                else:
                    pass
            else:
                sendData = AVNavEncode()
                for i in range(0, 11):
                    port.write(sendData[i].encode('ascii', 'replace'))
                time.sleep(0.1)
        logic.endGame()
Exemple #23
0
def end(controller):
    """
    called when ending BGE (e.g. to properly close network connections)
    """
    if controller.sensors[0].positive:

        # close socket
        logic.socket.close()
        controller.owner['SocketConnected'] = False
        controller.owner['End'] = True
        print('close socket')

        # close cv2 window
        cv2.destroyAllWindows()

        # end game engine
        logic.endGame()
Exemple #24
0
def end(controller):
    """
    called when ending BGE (e.g. to properly close network connections)
    """
    if controller.sensors[0].positive:

        # close socket
        logic.socket.close()
        controller.owner['SocketConnected'] = False
        controller.owner['End'] = True
        print('close socket')

        # close cv2 window
        cv2.destroyAllWindows()

        # end game engine
        logic.endGame()
Exemple #25
0
    def key_kayboard_action(self):

        # Send keys with certain delay
        for key in keyboard.events:
            if keyboard.events[key] == JUST_ACTIVATED or keyboard.events[
                    key] == JUST_RELEASED:
                # print(key)
                ''' Leave Game '''
                if key == 130:
                    #kill_player = {"act":"update_pos","user":self.user.name , "data":{"position":"kill"}}
                    #self.ws.send( json.dumps( kill_player ) )
                    time.sleep(0.1)
                    self.GAME_ON = False
                    #self.ws.close()
                    logic.endGame()

                else:
                    act = 'key_pressed' if keyboard.events[
                        key] == JUST_ACTIVATED else 'key_released'
                    self.send_action_to_server(act, key)
Exemple #26
0
    def ST_Paused(self):
        status = self.MENU.RUN()

        if status == "Quit":
            logic.endGame()

        if status == "Keymap":
            self.doBlackOut()
            self.MENU.destroy()
            self.active_state = None
            world.openBlend("KEYMAP")

        if status == "Launcher":
            self.doBlackOut()
            self.MENU.destroy()
            self.active_state = None
            world.openBlend("LAUNCHER")

        if status == "Resume" or keymap.SYSTEM["ESCAPE"].tap() == True:
            self.doSceneResume()
def main():
    """
    Create dynamic textures
    """
    scenes = logic.scenes if hasattr(logic, 'scenes') else {}

    if not check_objects(scenes):
        logic.endGame()
        return

    scene_vr = scenes.get('Scene.VR')
    scene_projection = scenes.get('Scene.Projection')

    dummy_objects = {ob.name : ob for ob in scene_projection.objects if ob.name.startswith("Dummy.") }
    logic.projection = ProjectionsVR(scene_vr, dummy_objects)

    objects = scene_projection.objects
    logic.shader_object = ShaderObject(
            objects.get('HEADTRACK.PROJECTION.HEAD'),
            objects.get('Dummy'),
            )
def main():
    """
    Create dynamic textures
    """
    scenes = logic.scenes if hasattr(logic, 'scenes') else {}

    if not check_objects(scenes):
        logic.endGame()
        return

    scene_vr = scenes.get('Scene.VR')
    scene_projection = scenes.get('Scene.Projection')

    dummy_objects = {
        ob.name: ob
        for ob in scene_projection.objects if ob.name.startswith("Dummy.")
    }
    logic.projection = ProjectionsVR(scene_vr, dummy_objects)

    objects = scene_projection.objects
    logic.shader_object = ShaderObject(
        objects.get('HEADTRACK.PROJECTION.HEAD'),
        objects.get('Dummy'),
    )
Exemple #29
0
def end():

    # Fin de get_shot
    if gl.phase == "get shot":
        if gl.numero >= gl.nombre_shot_total:
            print("Fin de get_shot")
            gl.endGame()

        # Fin de la partition
        if gl.partitions:  # bug
            if gl.numero >= len(gl.partitions[0]):
                gl.endGame()

    # Fin de music to shot
    if gl.phase == "music to shot":
        if gl.numero >= len(gl.partitions[0]):
            print(
                "Fin de la conversion du json en images avec moins de 2000 shot"
            )
            music_to_shot_init()

        if gl.numero >= gl.nombre_shot_total:
            print("Fin de la conversion du json en images")
            music_to_shot_init()
Exemple #30
0
def init():
    """
    setup render callback, create gpu offscreen
    """
    if not hasattr(logic, 'setRender'):
        print("You require a patched Blender with bge.logic.setRender() method")
        logic.endGame()

    scene = logic.getCurrentScene()
    scene.post_draw.append(draw)
    camera = scene.objects.get('Camera.VR')

    if not camera:
        print("You need a \"Camera.VR\" object")
        logic.endGame()

    offscreen = render.offScreenCreate(512, 512, 0, render.RAS_OFS_RENDER_TEXTURE)
    color_texture = offscreen.color
    image_render = texture.ImageRender(scene, camera, offscreen)
    image_render.alpha = True

    logic.globalDict['offscreen'] = offscreen
    logic.globalDict['color_texture'] = color_texture
    logic.globalDict['image_render'] = image_render
def init(cont):
    """run once"""
    ob = cont.owner
    objects = logic.getCurrentScene().objects

    dummy_a_rgb = objects.get('Dummy.A.RGB')
    dummy_a_depth = objects.get('Dummy.A.Depth')
    dummy_b_rgb = objects.get('Dummy.B.RGB')
    dummy_b_depth = objects.get('Dummy.B.Depth')

    kinect_a = objects.get('Kinect.A')
    kinect_a_matrix = kinect_a.worldTransform if kinect_a else Matrix()

    kinect_b = objects.get('Kinect.B')
    kinect_b_matrix = kinect_b.worldTransform if kinect_b else Matrix()

    if not (dummy_a_rgb and dummy_a_depth):
        print("Scene is missing dummy objects")
        logic.endGame()

    # initialize
    width = 640
    height = 480

    #data = 'RUN_AND_WAVE'
    #data = 'WAVING'
    #data = 'RUNNING'
    #data = 'WEBGL'
    #data = 'KINECT'
    #data = 'KINECT_CALIBRATION-1'
    #data = 'KINECT_CALIBRATION-2.1'
    #data = 'KINECT_CALIBRATION-2.2'
    data = 'STOOL'

    if data == 'RUN_AND_WAVE':
        logic.cloud_a = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/running-rgb/")
        logic.cloud_a.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 110, True)
        basedir = logic.expandPath("//../data/running-depth/")
        logic.cloud_a.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 110,
                                      False)

        logic.cloud_b = PointCloud(width, height, kinect_b_matrix)
        basedir = logic.expandPath("//../data/waving-rgb/")
        logic.cloud_b.addTextureImage(dummy_b_rgb, basedir, 'B.RGB', 91, True)
        basedir = logic.expandPath("//../data/waving-depth/")
        logic.cloud_b.addTextureImage(dummy_b_depth, basedir, 'B.Depth', 91,
                                      False)

    elif data == 'RUNNING':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/running-rgb/")
        logic.cloud.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 110, True)
        basedir = logic.expandPath("//../data/running-depth/")
        logic.cloud.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 110,
                                    False)

    elif data == 'WAVING':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/waving-rgb/")
        logic.cloud.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 91, True)
        basedir = logic.expandPath("//../data/waving-depth/")
        logic.cloud.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 91,
                                    False)

    elif data == 'WEBGL':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/webgl/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'kinect.webm',
                                    'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'kinect.webm',
                                    'A.Depth', False)

    elif data == 'KINECT':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/kinect/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'rgb.mov', 'A.RGB',
                                    True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'depth.mov',
                                    'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-1':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath(
            "//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb,
                                    basedir + 'kinect2-calibration-1.mov',
                                    'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth,
                                    basedir + 'kinect2-calibration-1.mov',
                                    'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-2.1':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath(
            "//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb,
                                    basedir + 'kinect2-calibration-2.1.mov',
                                    'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth,
                                    basedir + 'kinect2-calibration-2.1.mov',
                                    'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-2.2':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath(
            "//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb,
                                    basedir + 'kinect2-calibration-2.2.mov',
                                    'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth,
                                    basedir + 'kinect2-calibration-2.2.mov',
                                    'A.Depth', False)

    elif data == 'STOOL':
        logic.cloud_a = PointCloud(256,
                                   212,
                                   kinect_a_matrix,
                                   near=0.0,
                                   far=8.0)
        basedir = logic.expandPath("//../data/stool-rgb/")
        logic.cloud_a.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 50, True)
        basedir = logic.expandPath("//../data/stool-depth/")
        logic.cloud_a.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 50,
                                      False)
Exemple #32
0
 def terminate():
     game_logic.endGame()
import bgl

# early import
from .settings import *
from .helpers import *
from .appinfo import *

# python modules
import os, sys, time, imp, platform, logging, math, pdb

# setup temp file paths, needed for logging
path = os.path.normpath(os.path.expanduser('~/Flipbook/'+str(AppVersion)))
if createPath(path):
	logic.tempFilePath = path
else:
	logic.endGame()
	raise IOError("Cannot create temp folder at " + str(path))

# setup logging
logging.basicConfig(filename=os.path.join(logic.tempFilePath, 'debug.log'), filemode='w', level=logging.DEBUG)
logging.debug('Started:\t' + str(time.asctime()))
logging.debug('Python:\t' + str(sys.version))
logging.debug('OS:\t\t' + str(platform.platform())+ ' as ' + str(platform.node()))
logging.debug('releaseOS: \t' + str(releaseOS))
logging.debug('Temp File Path:\t' + str(logic.tempFilePath))

try:
	from . import datastore
	from . import space3d
	from . import gui
	from . import shader
def init(cont):
	'''initializes the application'''
	try:
		logic.mouse.visible = True

		# gpu detection and ssao enabler
		vendor = bgl.glGetString(bgl.GL_VENDOR)
		renderer = bgl.glGetString(bgl.GL_RENDERER)
		version = bgl.glGetString(bgl.GL_VERSION)

		logging.debug("GL Vendor:\t" + str(vendor))
		logging.debug("GL Renderer:\t" + str(renderer))
		logging.debug("GL Version:\t" + str(version))

		fancyGPU = not "intel" in vendor.lower()

		if useAmbientOcclusion and fancyGPU:
			logging.debug("Using SSAO")
			cont.activate(cont.actuators['ssao'])
		else:
			logging.debug("Not using SSAO")


		# overlay scene enabler
		if useSceneOverlay:
			cont.activate(cont.actuators['scene2D'])
			logging.debug("Using 2D overlay")
		else:
			logging.debug("Not using 2D overlay")

		# more file paths
		if 'mac' in releaseOS:
			if useDebug:
				logic.binaryPlayerPath = logic.expandPath("//binMac/flipbook.app/Contents/MacOS/blenderplayer")
			else:
				logic.binaryPlayerPath = logic.expandPath("//../MacOS/blenderplayer")
			logic.binaryBlenderPath = logic.binaryPlayerPath[:-6]
		elif 'win' in releaseOS:
			logic.binaryPlayerPath = logic.expandPath("//MolecularFlipbook.exe")
			logic.binaryBlenderPath = logic.expandPath("//blender.exe")

		# check paths:
		if os.path.exists(logic.binaryPlayerPath):
			logging.debug('binaryPlayer:\t' + str(logic.binaryPlayerPath))
		else:
			logging.warning('binaryPlayerPath is not verified. Full functionality is improbable')

		if os.path.exists(logic.binaryBlenderPath):
			logging.debug('binaryBlender:\t' + str(logic.binaryBlenderPath))
		else:
			logging.warning('binaryBlenderPath is not verified. Full functionality is improbable')


		# load config
		configPath = os.path.join(logic.tempFilePath, 'config')
		config.load(configPath)

		# initialize bgui
		logic.gui = gui.MyUI()

		# global aliases
		logic.scene = logic.getCurrentScene()						# blender scene alias
		logic.scene2D = None										# overlay 2d ui
		logic.viewCamObject = logic.scene.objects['camera3D']		# camera object
		logic.widgetObject = logic.scene.objects['widget']			# widget object
		logic.controllerObject = logic.scene.objects['controller']	# controller empty
		logic.widgetList = ['rx','ry','rz','x','y','z', 'widget']
		logic.widgetRenderList = ['x.render', 'y.render', 'z.render', 'rx.render', 'ry.render', 'rz.render', 'widget']
		logic.pivotObject = logic.scene.objects['pivot']			# pivot object, used for multiobject transform
		logic.markerKey = logic.scene.objects['markerKey'] 			# used to mark protein

		logic.mousePosDelta = [0,0]									#
		logic.mouseUp = False
		logic.mouseDown = False
		logic.tap = False
		logic.idleTimer = 0.0										#
		logic.mouseExitHack = False

		# variables used by space 3d navigation
		logic.mousePosOld = [0,0]
		logic.mousePosOffset = [0,0]
		logic.viewLocTarget = [0.0,0.0,0.0]
		logic.viewZoomTarget = 10.0
		logic.viewZoomCurrent = 10.0
		logic.viewRotTarget = [-0.5,0,1]
		logic.viewRotCurrent = [0,0,0]

		# mouse stuff
		logic.mouseLock = 0											# 0 = No Lock; 1 = View Manipulation, 2 = Object Manipulation, 3 = UI Manipulation
		logic.multitouch = False
		logic.boxSelect = False
		logic.boxSelectCoord = [0,0,0,0]

		# UI stuff
		logic.clickLInit = None
		logic.clickRInit = None
		logic.keyCounter = 0 										# track  keyboard input delay

		logic.sleeping = False
		logic.watch = {} 											# set this var to have the debugger automatically show the value
		logic.registeredFunctions = []								# list of functions to be run every frame
		logic.deferredFunctions = [] 								# list of functions to be run occasionally

		# var used for object manipulation
		logic.offsetPos = [0,0,0]									#
		logic.rotating = False
		logic.moving = False

		# session
		logic.filePath = None
		logic.videoPath = None
		logic.imagePath = None

		logic.projectName = 'Untitled'
		
		# hacks
		logic.objCounter = 1 										# track how many obj bge has spawned
		logic.blobberSliderPriority = False 						#hack

		# init widgets shader
		for w in logic.widgetRenderList:
			shader.initWidget(logic.scene.objects[w], 'manipulator')

		# init sky
		rgba = logic.mvb.bgColor[:]
		rgba.append(1.0)
		shader.initSky(logic.scene.objects['Sphere'], 'sky', color = rgba)

		# add the first slide on startup
		logic.timeline.slideAdd(silent=True)

		# start undo stack
		logic.undo = undo.init()

		# start pluggable system
		logic.pluggable = pluggable.init()

		logic.logger.new('Welcome to')
		logic.logger.new('Molecular Flipbook')

		# init updater
		if logic.config['lastUpdate']:
			elapsedTime = int(time.time() - logic.config['lastUpdate'])
			if elapsedTime > 86400 * updateInterval:
				logic.deferredFunctions.append(updater.check)
				config.set('lastUpdate', time.time())
		else:
			logic.deferredFunctions.append(updater.check)
			config.set('lastUpdate', time.time())

		# Done Init
		logging.debug('3D scene initialization done')

		# load file
		logging.debug(sys.argv)
		from . import fileInterface
		
		if len(sys.argv) > 1:
			try:
				path = sys.argv[1]
				if path.endswith('.flipbook'):
					fileInterface.load(path=sys.argv[1])
			except Exception as E:
				logic.logger.new('Unable to load File', type='WARNING')
				logging.warning(str(E))

		# init tutorial system
		from . import tutorial
		logic.tutorial = tutorial.init()

		if logic.config['useTutorial'] and useTutorial and not logic.filePath:
			logic.tutorial.start()

		if useMultitouch:
			try:
				logging.debug('Using Multitouch')
				from . import multitouch
			except:
				logging.warning('Multitouch trackpad(s) not found')



		logic.pluggable.system.appStart.notify()

	except:
		logic.endGame()
		logging.exception('Initialization Error')
		print ('Initialization Error: Check log for more information.')
		print ('_'*80)
Exemple #35
0
def end():
	logic.endGame()
Exemple #36
0
def trial():
    logic.globalDict["freeze"] = True
    s = logic.globalDict["saveString"]
    if not "game_start" in logic.globalDict:
        return
    if not logic.globalDict["hacky_bool"]:
        logic.globalDict["hacky_bool"] = True
        return
    logic.globalDict["hacky_bool"] = False
    if logic.globalDict["trial_number"] == 0:
        logic.globalDict["hacky_bool"] = True
    else:
        s = s[:-1]
        s += ']'
    logic.globalDict["trial_number"] += 1
    if logic.globalDict["trial_number"] > 2:
        s += '}]}'
        f = open('output'+str(logic.globalDict["randNum"]) + '.json', 'a')
        f.write(s)
        f.close()
        logic.endGame()
        return
    controller = logic.getCurrentController()
    obj = controller.owner
    print("here! trial " + str(logic.globalDict["trial_number"])) 
    if logic.globalDict["trial_number"] != 1:
        s += '},'
    logic.globalDict["saveString"] = ""
    logic.globalDict["saveString"] += '{"number":' + str(logic.globalDict["trial_number"]) + ','
    logic.globalDict["saveString"] += '"obstacles": ['
    
    # get the current scene
    scene = logic.getCurrentScene()
    
    # and use it to get a list of the objects in the scene
    objList = scene.objects
    
    currPositions = logic.globalDict["positions"]
    currPositions = currPositions[logic.globalDict["trial_number"]]
    
    for i in range(7):
        string = "Cylinder" + str(i+1) 
        curr = objList[string]
        (x,y) = currPositions[i]
        curr.position = [x,y,0]
        curr.visible = False
        logic.globalDict["saveString"] += '{"number": ' + str(i+1) + ',"location": [' + str(x) + ',' + str(y) + ']}'
        if i != 6:
            logic.globalDict["saveString"] += ','
        test = "meow"       
	
    test = "woof"
    logic.globalDict["saveString"] += '],'
    logic.globalDict["saveString"] += '"output":['
        
    #objList["A1"].visible = False
    #print(objList["A1"].visible)
    objList["Bounds"].position = [0,0,0]
    objList["Body"].position = [0,0,.7]
    objList["Body"].orientation = [0,0,0]
    camera = objList["Camera"]
    camera.orientation = [1.57,0,0]
        
    logic.globalDict["prev_time"] = 0
    logic.globalDict["prev_pos"] = (0,0)
    camera["timer"] = 0
    f = open('output' + str(logic.globalDict["randNum"]) + '.json','a')
    f.write(s)
    f.close()
    logic.globalDict["trial_start"] = True
        
Exemple #37
0
def init(cont):
    '''initializes the application'''
    try:
        logic.mouse.visible = True

        # gpu detection and ssao enabler
        vendor = bgl.glGetString(bgl.GL_VENDOR)
        renderer = bgl.glGetString(bgl.GL_RENDERER)
        version = bgl.glGetString(bgl.GL_VERSION)

        logging.debug("GL Vendor:\t" + str(vendor))
        logging.debug("GL Renderer:\t" + str(renderer))
        logging.debug("GL Version:\t" + str(version))

        fancyGPU = not "intel" in vendor.lower()

        if useAmbientOcclusion and fancyGPU:
            logging.debug("Using SSAO")
            cont.activate(cont.actuators['ssao'])
        else:
            logging.debug("Not using SSAO")

        # overlay scene enabler
        if useSceneOverlay:
            cont.activate(cont.actuators['scene2D'])
            logging.debug("Using 2D overlay")
        else:
            logging.debug("Not using 2D overlay")

        # more file paths
        if 'mac' in releaseOS:
            if useDebug:
                logic.binaryPlayerPath = logic.expandPath(
                    "//binMac/flipbook.app/Contents/MacOS/blenderplayer")
            else:
                logic.binaryPlayerPath = logic.expandPath(
                    "//../MacOS/blenderplayer")
            logic.binaryBlenderPath = logic.binaryPlayerPath[:-6]
        elif 'win' in releaseOS:
            logic.binaryPlayerPath = logic.expandPath(
                "//MolecularFlipbook.exe")
            logic.binaryBlenderPath = logic.expandPath("//blender.exe")

        # check paths:
        if os.path.exists(logic.binaryPlayerPath):
            logging.debug('binaryPlayer:\t' + str(logic.binaryPlayerPath))
        else:
            logging.warning(
                'binaryPlayerPath is not verified. Full functionality is improbable'
            )

        if os.path.exists(logic.binaryBlenderPath):
            logging.debug('binaryBlender:\t' + str(logic.binaryBlenderPath))
        else:
            logging.warning(
                'binaryBlenderPath is not verified. Full functionality is improbable'
            )

        # load config
        configPath = os.path.join(logic.tempFilePath, 'config')
        config.load(configPath)

        # initialize bgui
        logic.gui = gui.MyUI()

        # global aliases
        logic.scene = logic.getCurrentScene()  # blender scene alias
        logic.scene2D = None  # overlay 2d ui
        logic.viewCamObject = logic.scene.objects['camera3D']  # camera object
        logic.widgetObject = logic.scene.objects['widget']  # widget object
        logic.controllerObject = logic.scene.objects[
            'controller']  # controller empty
        logic.widgetList = ['rx', 'ry', 'rz', 'x', 'y', 'z', 'widget']
        logic.widgetRenderList = [
            'x.render', 'y.render', 'z.render', 'rx.render', 'ry.render',
            'rz.render', 'widget'
        ]
        logic.pivotObject = logic.scene.objects[
            'pivot']  # pivot object, used for multiobject transform
        logic.markerKey = logic.scene.objects[
            'markerKey']  # used to mark protein

        logic.mousePosDelta = [0, 0]  #
        logic.mouseUp = False
        logic.mouseDown = False
        logic.tap = False
        logic.idleTimer = 0.0  #
        logic.mouseExitHack = False

        # variables used by space 3d navigation
        logic.mousePosOld = [0, 0]
        logic.mousePosOffset = [0, 0]
        logic.viewLocTarget = [0.0, 0.0, 0.0]
        logic.viewZoomTarget = 10.0
        logic.viewZoomCurrent = 10.0
        logic.viewRotTarget = [-0.5, 0, 1]
        logic.viewRotCurrent = [0, 0, 0]

        # mouse stuff
        logic.mouseLock = 0  # 0 = No Lock; 1 = View Manipulation, 2 = Object Manipulation, 3 = UI Manipulation
        logic.multitouch = False
        logic.boxSelect = False
        logic.boxSelectCoord = [0, 0, 0, 0]

        # UI stuff
        logic.clickLInit = None
        logic.clickRInit = None
        logic.keyCounter = 0  # track  keyboard input delay

        logic.sleeping = False
        logic.watch = {
        }  # set this var to have the debugger automatically show the value
        logic.registeredFunctions = [
        ]  # list of functions to be run every frame
        logic.deferredFunctions = [
        ]  # list of functions to be run occasionally

        # var used for object manipulation
        logic.offsetPos = [0, 0, 0]  #
        logic.rotating = False
        logic.moving = False

        # session
        logic.filePath = None
        logic.videoPath = None
        logic.imagePath = None

        logic.projectName = 'Untitled'

        # hacks
        logic.objCounter = 1  # track how many obj bge has spawned
        logic.blobberSliderPriority = False  #hack

        # init widgets shader
        for w in logic.widgetRenderList:
            shader.initWidget(logic.scene.objects[w], 'manipulator')

        # init sky
        rgba = logic.mvb.bgColor[:]
        rgba.append(1.0)
        shader.initSky(logic.scene.objects['Sphere'], 'sky', color=rgba)

        # add the first slide on startup
        logic.timeline.slideAdd(silent=True)

        # start undo stack
        logic.undo = undo.init()

        # start pluggable system
        logic.pluggable = pluggable.init()

        logic.logger.new('Welcome to')
        logic.logger.new('Molecular Flipbook')

        # init updater
        if logic.config['lastUpdate']:
            elapsedTime = int(time.time() - logic.config['lastUpdate'])
            if elapsedTime > 86400 * updateInterval:
                logic.deferredFunctions.append(updater.check)
                config.set('lastUpdate', time.time())
        else:
            logic.deferredFunctions.append(updater.check)
            config.set('lastUpdate', time.time())

        # Done Init
        logging.debug('3D scene initialization done')

        # load file
        logging.debug(sys.argv)
        from . import fileInterface

        if len(sys.argv) > 1:
            try:
                path = sys.argv[1]
                if path.endswith('.flipbook'):
                    fileInterface.load(path=sys.argv[1])
            except Exception as E:
                logic.logger.new('Unable to load File', type='WARNING')
                logging.warning(str(E))

        # init tutorial system
        from . import tutorial
        logic.tutorial = tutorial.init()

        if logic.config['useTutorial'] and useTutorial and not logic.filePath:
            logic.tutorial.start()

        if useMultitouch:
            try:
                logging.debug('Using Multitouch')
                from . import multitouch
            except:
                logging.warning('Multitouch trackpad(s) not found')

        logic.pluggable.system.appStart.notify()

    except:
        logic.endGame()
        logging.exception('Initialization Error')
        print('Initialization Error: Check log for more information.')
        print('_' * 80)
Exemple #38
0
import bgl

# early import
from .settings import *
from .helpers import *
from .appinfo import *

# python modules
import os, sys, time, imp, platform, logging, math, pdb

# setup temp file paths, needed for logging
path = os.path.normpath(os.path.expanduser('~/Flipbook/' + str(AppVersion)))
if createPath(path):
    logic.tempFilePath = path
else:
    logic.endGame()
    raise IOError("Cannot create temp folder at " + str(path))

# setup logging
logging.basicConfig(filename=os.path.join(logic.tempFilePath, 'debug.log'),
                    filemode='w',
                    level=logging.DEBUG)
logging.debug('Started:\t' + str(time.asctime()))
logging.debug('Python:\t' + str(sys.version))
logging.debug('OS:\t\t' + str(platform.platform()) + ' as ' +
              str(platform.node()))
logging.debug('releaseOS: \t' + str(releaseOS))
logging.debug('Temp File Path:\t' + str(logic.tempFilePath))

try:
    from . import datastore
Exemple #39
0
def end_game():
	logic.endGame()
Exemple #40
0
def manageKeys(cont):

    owner = cont.owner
    scene = owner.scene
    camera = scene.active_camera
    cursor = scene.objects["Cursor"]
    info = scene.objects["Info"]

    cursor.localPosition[0] = (logic.mouse.position[0] -
                               0.5) * camera.ortho_scale
    cursor.localPosition[1] = (logic.mouse.position[1] - 0.5
                               ) * -camera.ortho_scale * keymap.MOUSELOOK.ratio
    cursor.localPosition[2] = -2

    if logic.FREEZE != None:
        status = logic.FREEZE()
        info.text = status
        if status == "END":
            logic.FREEZE = None
        return

    ms = logic.mouse.events
    wu = events.WHEELUPMOUSE
    wd = events.WHEELDOWNMOUSE

    rate = owner["SCROLL"] - owner.worldPosition[1]

    if ms[wu] in [1, 2] and owner["SCROLL"] > 0:
        owner["SCROLL"] -= 2
    if ms[wd] in [1, 2] and owner["SCROLL"] < owner["LENGTH"]:
        owner["SCROLL"] += 2

    owner.worldPosition[1] += rate * 0.1

    rayto = cursor.worldPosition.copy()
    rayto[2] += -1

    rayOBJ = cursor.rayCastTo(rayto, camera.far, "RAYCAST")

    if rayOBJ:
        rayOBJ["RAYCAST"] = True
        split = rayOBJ.name.split(".")
        if rayOBJ.name == "Back":
            map = logic.globalDict["CURRENT"]["Level"]
            if map == None or map not in logic.globalDict["BLENDS"]:
                info.text = "Return to the Launcher"
                if ms[events.LEFTMOUSE] == 1:
                    settings.openWorldBlend("LAUNCHER")
            else:
                info.text = "Return to Game"
                if ms[events.LEFTMOUSE] == 1:
                    scn = logic.globalDict["CURRENT"]["Scene"]
                    settings.openWorldBlend(map, scn)

        elif rayOBJ.name == "Save":
            info.text = "Save the Current Configuration"
            if ms[events.LEFTMOUSE] == 1:
                settings.SaveBinds()

        elif rayOBJ.name == "Quit":
            info.text = "Exit the Utility"
            if ms[events.LEFTMOUSE] == 1:
                logic.endGame()

        else:
            info.text = rayOBJ.get("DOCSTRING", "")

    else:
        info.text = ""

    if keymap.SYSTEM["SCREENSHOT"].tap() == True:
        logic.globalDict["SCREENSHOT"]["Trigger"] = True

    scene.objects["Save"]["RAYCAST"] = False
Exemple #41
0
 def sleepExit():  #
     ''' >>> Comeback Soon ! <<< '''
     logic.endGame()
Exemple #42
0
def quitGame():
    logic.endGame()
Exemple #43
0
def end():
    server.end()
    logic.endGame()
Exemple #44
0
def EXIT(args=[], kwa=None):
    """Exit the Command Console"""

    logic.endGame()
Exemple #45
0
def end():
    if gl.numero == gl.nombre_shot_total:
        gl.endGame()
Exemple #46
0
    def error(self, message, is_fatal):
        print(message)

        if is_fatal:
            logic.endGame()
Exemple #47
0
 def log_traceback(err):
     raise err
     print(err)
     logic.endGame()
Exemple #48
0
	def exit(self):
		logic.endGame()
Exemple #49
0
def init(cont):
    """run once"""
    ob = cont.owner
    objects = logic.getCurrentScene().objects

    dummy_a_rgb   = objects.get('Dummy.A.RGB')
    dummy_a_depth = objects.get('Dummy.A.Depth')
    dummy_b_rgb   = objects.get('Dummy.B.RGB')
    dummy_b_depth = objects.get('Dummy.B.Depth')

    kinect_a = objects.get('Kinect.A')
    kinect_a_matrix = kinect_a.worldTransform if kinect_a else Matrix()

    kinect_b = objects.get('Kinect.B')
    kinect_b_matrix = kinect_b.worldTransform if kinect_b else Matrix()

    if not (dummy_a_rgb and dummy_a_depth):
        print("Scene is missing dummy objects")
        logic.endGame()

    # initialize
    width=640
    height=480

    #data = 'RUN_AND_WAVE'
    #data = 'WAVING'
    #data = 'RUNNING'
    #data = 'WEBGL'
    #data = 'KINECT'
    #data = 'KINECT_CALIBRATION-1'
    #data = 'KINECT_CALIBRATION-2.1'
    #data = 'KINECT_CALIBRATION-2.2'
    data = 'STOOL'

    if data == 'RUN_AND_WAVE':
        logic.cloud_a = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/running-rgb/")
        logic.cloud_a.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 110, True)
        basedir = logic.expandPath("//../data/running-depth/")
        logic.cloud_a.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 110, False)

        logic.cloud_b = PointCloud(width, height, kinect_b_matrix)
        basedir = logic.expandPath("//../data/waving-rgb/")
        logic.cloud_b.addTextureImage(dummy_b_rgb, basedir, 'B.RGB', 91, True)
        basedir = logic.expandPath("//../data/waving-depth/")
        logic.cloud_b.addTextureImage(dummy_b_depth, basedir, 'B.Depth', 91, False)

    elif data == 'RUNNING':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/running-rgb/")
        logic.cloud.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 110, True)
        basedir = logic.expandPath("//../data/running-depth/")
        logic.cloud.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 110, False)

    elif data == 'WAVING':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/waving-rgb/")
        logic.cloud.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 91, True)
        basedir = logic.expandPath("//../data/waving-depth/")
        logic.cloud.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 91, False)

    elif data == 'WEBGL':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/webgl/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'kinect.webm', 'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'kinect.webm', 'A.Depth', False)

    elif data == 'KINECT':
        logic.cloud = PointCloud(width, height, kinect_a_matrix)
        basedir = logic.expandPath("//../data/kinect/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'rgb.mov', 'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'depth.mov', 'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-1':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath("//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'kinect2-calibration-1.mov', 'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'kinect2-calibration-1.mov', 'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-2.1':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath("//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'kinect2-calibration-2.1.mov', 'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'kinect2-calibration-2.1.mov', 'A.Depth', False)

    elif data == 'KINECT_CALIBRATION-2.2':
        logic.cloud = PointCloud(508, 442, kinect_a_matrix)
        basedir = logic.expandPath("//../data/kinect-calibration/kinect-calibration-2/")
        logic.cloud.addTextureVideo(dummy_a_rgb, basedir + 'kinect2-calibration-2.2.mov', 'A.RGB', True)
        logic.cloud.addTextureVideo(dummy_a_depth, basedir + 'kinect2-calibration-2.2.mov', 'A.Depth', False)

    elif data == 'STOOL':
        logic.cloud_a = PointCloud(256, 212, kinect_a_matrix, near=0.0, far=8.0)
        basedir = logic.expandPath("//../data/stool-rgb/")
        logic.cloud_a.addTextureImage(dummy_a_rgb, basedir, 'A.RGB', 50, True)
        basedir = logic.expandPath("//../data/stool-depth/")
        logic.cloud_a.addTextureImage(dummy_a_depth, basedir, 'A.Depth', 50, False)