Esempio n. 1
0
    def _h3dSetupScene(self):
        h3dres = self._h3dres

        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        h3d.setNodeTransform(self._env, 0, -20, 0, 0, 0, 0, 20, 20, 20)

        self._knight = h3d.addNodes(h3d.RootNode, h3dres.knight)
        h3d.setNodeTransform(self._knight, 0, 0, 0, 0, 180, 0, 0.1, 0.1, 0.1)
        h3d.setupModelAnimStage(self._knight, 0, h3dres.knightAnim1, 0, '', False)
        h3d.setupModelAnimStage(self._knight, 1, h3dres.knightAnim2, 0, '', False)

        # Attach particle system to hand joint
        h3d.findNodes(self._knight, 'Bip01_R_Hand', h3d.NodeTypes.Joint)
        hand = h3d.getNodeFindResult(0)
        self._particleSystem = h3d.addNodes(hand, h3dres.particleSys)
        h3d.setNodeTransform(self._particleSystem, 0, 40, 0, 90, 0, 0, 1, 1, 1)

        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', 0, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 0, 15, 10, -60, 0, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 30)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.01)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 1.0)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.8)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.7)

        # Customize post processing effects
        mat = h3d.findResource(h3d.ResTypes.Material, 'pipelines/postHDR.material.xml')
        # hdrParams: exposure, brightpass threshold, brightpass offset (see shader for description)
        h3d.setMaterialUniform(mat, 'hdrExposure', 2.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightThres', 0.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightOffset', 0.08, 0.0, 0.0, 0.0)
Esempio n. 2
0
 def __init__(self, parent, a):
     # Add character to scene and apply animation
     self.node = h3d.addNodes(h3d.RootNode, parent.character)
     h3d.setupModelAnimStage(self.node, 0, parent.characterWalk, 0, "", False)
     # print "create 1"
     # Characters start in a circle formation
     self.px = sin(a * 6.28) * 10.0
     self.pz = cos(a * 6.28) * 10.0
     self.chooseDestination()
     h3d.setNodeTransform(self.node, self.px, 0.02, self.pz, 0, 0, 0, 1, 1, 1)
Esempio n. 3
0
 def __init__(self, parent, a):
     # Add character to scene and apply animation
     self.node = h3d.addNodes(h3d.RootNode, parent.character)
     h3d.setupModelAnimStage(self.node, 0, parent.characterWalk, 0, "",
                             False)
     # print "create 1"
     # Characters start in a circle formation
     self.px = sin(a * 6.28) * 10.0
     self.pz = cos(a * 6.28) * 10.0
     self.chooseDestination()
     h3d.setNodeTransform(self.node, self.px, 0.02, self.pz, 0, 0, 0, 1, 1,
                          1)
Esempio n. 4
0
    def setup_scene(self):
        h3dres = self._h3dres

        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        #h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.23, 0.23, 0.23)
        h3d.setNodeTransform(self._env, 0, -20, 0, 0, 0, 0, 20, 20, 20)
        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 90, 0, 0, 50, 50, 50)

        self._knight = h3d.addNodes(h3d.RootNode, h3dres.knight)
        h3d.setNodeTransform(self._knight, 0, 0, 0, 0, 180, 0, 0.1, 0.1, 0.1)
        h3d.setupModelAnimStage(self._knight, 0, h3dres.knightAnim1, 0, '',
                                False)
        h3d.setupModelAnimStage(self._knight, 1, h3dres.knightAnim2, 0, '',
                                False)

        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat,
                                       'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 0, 15, 10, -60, 0, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 30)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.01)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 1.0)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.8)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.7)

        # Customize post processing effects
        mat = h3d.findResource(h3d.ResTypes.Material,
                               'pipelines/postHDR.material.xml')
        # hdrParams: exposure, brightpass threshold, brightpass offset (see shader for description)
        h3d.setMaterialUniform(mat, 'hdrExposure', 2.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightThres', 0.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightOffset', 0.08, 0.0, 0.0, 0.0)

        # Attach particle system to hand joint
        self.set_particlesys(h3dres.particleSys2)
        self.add_camera("MainCamera", self.__rmode_dict[3][1])
        h3d.setNodeTransform(self.camera, -25, 14, 9, -30, -60, 5, 1, 1, 1)