コード例 #1
0
ファイル: sceneView.py プロジェクト: josejuansanchez/horus
    def _renderObject(self, obj, brightness=0):
        glPushMatrix()
        glTranslate(obj.getPosition()[0],
                    obj.getPosition()[1],
                    obj.getSize()[2] / 2)

        if self.tempMatrix is not None and obj == self._selectedObj:
            glMultMatrixf(openglHelpers.convert3x3MatrixTo4x4(self.tempMatrix))

        offset = obj.getDrawOffset()
        glTranslate(-offset[0], -offset[1], -offset[2] - obj.getSize()[2] / 2)

        glMultMatrixf(openglHelpers.convert3x3MatrixTo4x4(obj.getMatrix()))

        if obj.isPointCloud():
            if obj._mesh is not None:
                if obj._mesh.vbo is not None:
                    obj._mesh.vbo.release()
                obj._mesh.vbo = openglHelpers.GLVBO(
                    GL_POINTS, obj._mesh.vertexes, colorArray=obj._mesh.colors)
                obj._mesh.vbo.render()
        else:
            if obj._mesh is not None:
                if obj._mesh.vbo is not None:
                    obj._mesh.vbo.release()
                obj._mesh.vbo = openglHelpers.GLVBO(GL_TRIANGLES,
                                                    obj._mesh.vertexes,
                                                    obj._mesh.normal)
                if brightness != 0:
                    glColor4fv(
                        map(lambda idx: idx * brightness, self._objColor))
                obj._mesh.vbo.render()
        glPopMatrix()
コード例 #2
0
ファイル: sceneView.py プロジェクト: Claude59/horus
	def _renderObject(self, obj, brightness = 0):
		glPushMatrix()
		glTranslate(obj.getPosition()[0], obj.getPosition()[1], obj.getSize()[2] / 2)

		if self.tempMatrix is not None:
			glMultMatrixf(openglHelpers.convert3x3MatrixTo4x4(self.tempMatrix))

		offset = obj.getDrawOffset()
		glTranslate(-offset[0], -offset[1], -offset[2] - obj.getSize()[2] / 2)

		glMultMatrixf(openglHelpers.convert3x3MatrixTo4x4(obj.getMatrix()))

		if obj.isPointCloud():
			if obj._mesh is not None:
				if obj._mesh.vbo is None or obj._mesh.vertexCount > obj._mesh.vbo._size:
					if obj._mesh.vbo is not None:
						obj._mesh.vbo.release()
					obj._mesh.vbo = openglHelpers.GLVBO(GL_POINTS, obj._mesh.vertexes[:obj._mesh.vertexCount], colorArray=obj._mesh.colors[:obj._mesh.vertexCount])
				obj._mesh.vbo.render()
		else:
			if obj._mesh is not None:
				if obj._mesh.vbo is None:
					obj._mesh.vbo = openglHelpers.GLVBO(GL_TRIANGLES, obj._mesh.vertexes[:obj._mesh.vertexCount], obj._mesh.normal[:obj._mesh.vertexCount])
				if brightness != 0:
					glColor4fv(map(lambda idx: idx * brightness, self._objColor))
				obj._mesh.vbo.render()
		glPopMatrix()