INNER CODE UNIT · Python
draw
mosra/magnum-examples · src/python/magnum-primitives-scenegraph.py:47
def draw(self, transformation_matrix: Matrix4, camera: scenegraph.Camera3D):
self._shader.light_positions = [
Vector4(camera.camera_matrix.transform_point((-3.0, 5.0, 10.0)), 0.0)
]
self._shader.light_colors = [Color3(1.0)]
self._shader.diffuse_color = self.color
self._shader.ambient_color = Color3.from_hsv(self.color.hue(), 1.0, 0.3)
self._shader.transformation_matrix = transformation_matrix
self._shader.normal_matrix = transformation_matrix.rotation_scaling()
self._shader.projection_matrix = camera.projection_matrix
self._shader.draw(self._mesh)
class PrimitivesSceneGraphExample(Application):
def __init__(self):
Application.__init__(self, self.Configuration(
title="Magnum Python Primitives + SceneGraph Example"
))