def addAvatar(filename, parent=viz.WORLD, scene=viz.MainScene, flags=0, **kw): """vizfx: Add an avatar to the scene""" model = VizAvatar( viz._ipcSend(viz._VIZ_ADDAVATAR, viz._sceneID(scene), int(parent), filename, flags, 0.0, 0.0, 0.0), **kw) if model: if model.getAsyncStatus() == viz.ASYNC_LOADING: vizact.onAsyncLoad(model, vizfx._modelAsyncLoad, viz.EFFECTGEN_DEFAULT, vizfx.getComposer(vizfx.DEFAULT_COMPOSER)) else: model.generateEffects(viz.EFFECTGEN_DEFAULT, vizfx.getComposer(vizfx.DEFAULT_COMPOSER)) return model
def copy(self, **kw): avCopy = viz.VizAvatar.copy(self, **kw) # copy position and orientation avCopy.setMatrix(self.getMatrix()) # start walk animation avCopy.state(1) avCopy.isVisible = 1 avCopy.hasArrived = 0 avCopy.isInHouse = 0 # copy id avCopy.setAvID(self.getAvID()) # add field where path will be stored in avCopy.path = None # copy ctx avCopy.setCtx(self.getCtx()) # copy position #avCopy.setPosition( self.getPosition() ) # activate vizfx effects avCopy.generateEffects(viz.EFFECTGEN_DEFAULT, vizfx.getComposer(vizfx.DEFAULT_COMPOSER)) return avCopy
# Set the near and far clipping distances. viz.clip(.1,100000) ocean = vizfx.addChild(ART_DIRECTORY + './art/environment/OceanFloor.osgb') # Change properties to enable the god ray. water = ocean.getChild('Water') water.disable(viz.DEPTH_WRITE) water.drawOrder(101) # Create and apply global fog effect. # fog = vizfx.addFogEffect( colorRamp=viz.addTexture(ART_DIRECTORY + './art/texture/FogRamp.tif'), height=1, density=(.09)) fog = vizfx.addFogEffect( colorRamp=viz.addTexture(globals_oa.MODEL_DIRECTORY + 'FogRamp.tif'), height=1, density=(.09)) vizfx.getComposer().addEffect(fog) bgcolor = [0.15*1.2, 0.67*1.2, 0.95*1.2] viz.clearcolor(bgcolor) # Enable fog on main scene. # viz.MainScene.enable(viz.FOG, op=viz.OP_ROOT) # Add sun light. lightSun = vizfx.addPointLight() lightSun.constantAttenuation(0) lightSun.linearAttenuation(0) lightSun.quadraticAttenuation(.3) lightSun.setPosition([0.123,0.84911,-1.929]) lightSun.color( viz.WHITE ) lightSun.specular( viz.WHITE ) lightSun.ambient( viz.BLACK )
def affect(self, model): ''' sets effect for node ''' model.generateEffects(viz.EFFECTGEN_DEFAULT, vizfx.getComposer()) model.apply(self._effect) self._affected_models.append(model)
def initFog(): fog = vizfx.addFogEffect(colorRamp=viz.addTexture(MODEL_DIR + 'FogRamp.tif'), height=1, density=(.01)) vizfx.getComposer().addEffect(fog) # Enable fog on main scene. viz.MainScene.enable(viz.FOG, op=viz.OP_ROOT)
lab = vizfx.addChild('resource/modern_lobby.osgb') lab.enable(viz.LIGHTING) # これをすると部屋が暗くなる(ライトが有効になる?) # マウスの設定 viz.mouse.setTrap(True) #アプリ内でしか動けなくなる viz.mouse.setCursor(True) # カーソルが見えるかどうか viz.mouse.setOverride(viz.ON) # 鳩のロゴ pigion_proj = vizfx.addProjector(texture=viz.addTexture('resource/pigion.jpg'), pos=(-8, 3.5, 3.0), euler=(-90, 0, 0), blend=vizfx.BLEND_AVERAGE) vizfx.getComposer().addEffect(pigion_proj.getEffect()) # 鳩のロゴと同じ場所にtexquad pigion = viz.addTexQuad(size=4.5, pos=(-8, 3.5, 3.0), alpha=0) # 鳩のロゴ用のセンサー pigion_sensor = vizproximity.Sensor(vizproximity.CircleArea(4), source=pigion) manager.addSensor(pigion_sensor) # 鳩の説明 pigon_board = viz.addTexQuad(pos=[-8, 3.5, 3.0]) pigon_texture = viz.addTexture('resource/pigon_descrption.JPG') pigon_board.texture(pigon_texture) pigon_board.billboard(viz.BILLBOARD_YAXIS) pigon_board.visible(False) # プロジェクターの表示