📄 texturefxdemo.py
字号:
import localogre as ogre
import sampleframework
class TextureFXApplication(sampleframework.Application):
def _createScene( self ):
sceneManager = self.sceneManager
camera = self.camera
sceneManager.setAmbientLight( ogre.ColourValue(0.5, 0.5, 0.5) )
light = sceneManager.createLight( 'MainLight' )
light.setPosition( 20, 80, 50 )
self._createScalingPlane()
self._createScrollingKnot()
self._createWateryPlane()
skyMaterial = sceneManager.createMaterial( 'SkyMat' )
skyMaterial.setLightingEnabled( False )
textureUnitState = skyMaterial.getTechnique(0).getPass(0).createTextureUnitState( 'clouds.jpg', 0 )
textureUnitState.setScrollAnimation( 0.15, 0 )
sceneManager.setSkyDome( True, 'SkyMat', -5.0, 2.0 )
def _createScalingPlane( self ):
entity = self.sceneManager.createEntity( 'Plane', ogre.SceneManager.PrefabType.PT_PLANE )
entity.setMaterialName( 'Examples/TextureEffect1' )
node = self.sceneManager.getRootSceneNode().createChildSceneNode( ogre.Vector3( -250,-40,-100),
ogre.Quaternion.IDENTITY )
node.attachObject( entity )
def _createScrollingKnot( self ):
entity = self.sceneManager.createEntity( 'Knot', 'knot.mesh' )
entity.setMaterialName( 'Examples/TextureEffect2' )
node = self.sceneManager.getRootSceneNode().createChildSceneNode( ogre.Vector3( 200,50,150),
ogre.Quaternion.IDENTITY )
node.attachObject( entity )
def _createWateryPlane( self ):
entity = self.sceneManager.createEntity( 'WaterPlane', ogre.SceneManager.PrefabType.PT_PLANE )
entity.setMaterialName( 'Examples/TextureEffect3' )
node = self.sceneManager.getRootSceneNode().attachObject( entity )
if __name__ == '__main__':
application = TextureFXApplication()
application.go()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -