Пример #1
0
	def _h3dEngineOptions(self):
		# engine options
		h3d.setOption(h3d.Options.LoadTextures, 1)
		h3d.setOption(h3d.Options.TexCompression, 0)
		h3d.setOption(h3d.Options.FastAnimation, 0)
		h3d.setOption(h3d.Options.MaxAnisotropy, 4)
		h3d.setOption(h3d.Options.ShadowMapSize, 2048)
Пример #2
0
    def _mainloopUpdate(self, dt):
        app.App._mainloopUpdate(self, dt)

        for w in self._windows:
            h3d.setNodeTransform(w.camera, self._x, self._y, self._z, self._rx, self._ry, 0, 1, 1, 1)
            h3d.setOption(h3d.Options.DebugViewMode, float(self._debugViewMode))
            h3d.setOption(h3d.Options.WireframeMode, float(self._wireframeMode))

            key = pyglet.window.key
            curVel = self._velocity * dt
            if w.keyboard[key.LSHIFT]:
                curVel *= 10
            if w.keyboard[key.W]:
                self._x -= sin(radians(self._ry)) * cos(-radians(self._rx)) * curVel
                self._y -= sin(-radians(self._rx)) * curVel
                self._z -= cos(radians(self._ry)) * cos(-radians(self._rx)) * curVel
            if w.keyboard[key.S]:
                self._x += sin(radians(self._ry)) * cos(-radians(self._rx)) * curVel
                self._y += sin(-radians(self._rx)) * curVel
                self._z += cos(radians(self._ry)) * cos(-radians(self._rx)) * curVel
            if w.keyboard[key.A]:
                self._x += sin(radians(self._ry - 90)) * curVel
                self._z += cos(radians(self._ry - 90)) * curVel
            if w.keyboard[key.D]:
                self._x += sin(radians(self._ry + 90)) * curVel
                self._z += cos(radians(self._ry + 90)) * curVel
            break # we use only exactly ONE window
Пример #3
0
    def _mainloopUpdate(self, dt):
        app.App._mainloopUpdate(self, dt)

        for w in self._windows:
            h3d.setNodeTransform(w.camera, self._x, self._y, self._z, self._rx, self._ry, 0, 1, 1, 1)

            if self._debugViewMode:
                h3d.setOption(h3d.Options.DebugViewMode, 1.0)
            else:
                h3d.setOption(h3d.Options.DebugViewMode, 0.0)

            if self._wireframeMode:
                h3d.setOption(h3d.Options.WireframeMode, 1.0)
            else:
                h3d.setOption(h3d.Options.WireframeMode, 0.0)

            key = pyglet.window.key
            curVel = self._velocity * dt
            if w.keyboard[key.LSHIFT]:
                curVel *= 5
            if w.keyboard[key.W]:
                self._x -= sin(radians(self._ry)) * cos(-radians(self._rx)) * curVel
                self._y -= sin(-radians(self._rx)) * curVel
                self._z -= cos(radians(self._ry)) * cos(-radians(self._rx)) * curVel
            if w.keyboard[key.S]:
                self._x += sin(radians(self._ry)) * cos(-radians(self._rx)) * curVel
                self._y += sin(-radians(self._rx)) * curVel
                self._z += cos(radians(self._ry)) * cos(-radians(self._rx)) * curVel
            if w.keyboard[key.A]:
                self._x += sin(radians(self._ry - 90)) * curVel
                self._z += cos(radians(self._ry - 90)) * curVel
            if w.keyboard[key.D]:
                self._x += sin(radians(self._ry + 90)) * curVel
                self._z += cos(radians(self._ry + 90)) * curVel
            if w.keyboard[key._1]:
                self._weight += 2 * dt
                if self._weight > 1.0:
                    self._weight = 1.0
            if w.keyboard[key._2]:
                self._weight -= 2 * dt
                if self._weight < 0.0:
                    self._weight = 0.0

            break # we use only exactly ONE window

        if not self._freeze:
            self._animTime += dt

            h3d.setModelAnimParams(self._knight, 0, self._animTime * 24.0, self._weight)
            h3d.setModelAnimParams(self._knight, 1, self._animTime * 24.0, 1.0 - self._weight)

            count = h3d.findNodes(self._particleSystem, '', h3d.NodeTypes.Emitter)
            for i in range(count):
                h3d.advanceEmitterTime(h3d.getNodeFindResult(i), dt)
Пример #4
0
def set_engine_options() :
    h3d.setOption(h3d.Options.LoadTextures, 1)
    h3d.setOption(h3d.Options.TexCompression, 0)
    h3d.setOption(h3d.Options.FastAnimation, 0)
    h3d.setOption(h3d.Options.MaxAnisotropy, 4)
    h3d.setOption(h3d.Options.ShadowMapSize, 2048)
Пример #5
0
def set_engine_options():
    h3d.setOption(h3d.Options.LoadTextures, 1)
    h3d.setOption(h3d.Options.TexCompression, 0)
    h3d.setOption(h3d.Options.FastAnimation, 0)
    h3d.setOption(h3d.Options.MaxAnisotropy, 4)
    h3d.setOption(h3d.Options.ShadowMapSize, 2048)