⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transparencydemo.py

📁 赫赫大名的 OGRE 游戏引擎
💻 PY
字号:
import localogre as ogre
import sampleframework

class TransparencyApplication(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 )

        planeEntity = self.sceneManager.createEntity( 'Plane', ogre.SceneManager.PrefabType.PT_PLANE )
        planeEntity.setMaterialName( 'Examples/BumpyMetal' )

        knotEntity = self.sceneManager.createEntity( 'Knot', 'knot.mesh' )
        knotEntity.setMaterialName( 'Examples/TransparentTest' )

        rootNode = self.sceneManager.getRootSceneNode()
        rootNode.attachObject( planeEntity )
        rootNode.attachObject( knotEntity )

        for index in xrange(0,10):
            node = self.sceneManager.createSceneNode()
            nodePos = ogre.Vector3()
            nodePos.x = ogre.Math.SymmetricRandom() * 500.0
            nodePos.y = ogre.Math.SymmetricRandom() * 500.0
            nodePos.z = ogre.Math.SymmetricRandom() * 500.0
            node.setPosition( nodePos )
            rootNode.addChild( node )
            knotEntityClone = knotEntity.clone( 'Knot%d' % index  )
            node.attachObject( knotEntityClone )

if __name__ == '__main__':
    application = TransparencyApplication()
    application.go()
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -