def __init__(self, model, position, orientation, scale): self.model = model self.position = position self.orientation = orientation self.scale = scale self.transform = Matrix44.translation_vec3(position) * Matrix44.scale(scale) * orientation
def __init__(self, position, orientation, clipping_planes): self.position = position self.orientation = orientation self.clipping_planes = clipping_planes cameraTranlationMatrixInverse = Matrix44.translation_vec3(position).get_inverse_translation() cameraRotationInverse = orientation.get_inverse_rotation() self.matrix = cameraRotationInverse * cameraTranlationMatrixInverse
def renderScene(camera, instances): """ """ cameraTranlationMatrixInverse = Matrix44.translation_vec3(camera.position).get_inverse_translation() cameraRotationInverse = camera.orientation.get_inverse_rotation() cameraMatrix = cameraRotationInverse * cameraTranlationMatrixInverse for instance in instances: transform = cameraMatrix * instance.transform transformAndClip(camera.clipping_planes, instance, transform)
def renderScene(camera, instances): """ """ cameraTranlationMatrixInverse = Matrix44.translation_vec3(camera.position).get_inverse_translation() cameraRotationInverse = camera.orientation.get_inverse_rotation() cameraMatrix = cameraRotationInverse * cameraTranlationMatrixInverse for instance in instances: transform = cameraMatrix * instance.transform renderModel(instance.model, transform)