Gathers all information and builds a Raw Instance to be sent to GPU
(&self)
| 36 | |
| 37 | /// Gathers all information and builds a Raw Instance to be sent to GPU |
| 38 | pub fn build(&self) -> InstanceRaw { |
| 39 | let position_matrix = Matrix4::IDENTITY * Matrix4::from_translation(self.position); |
| 40 | let rotation_matrix = Matrix4::from_quat( |
| 41 | Quaternion::from_rotation_x(self.rotation.x) |
| 42 | * Quaternion::from_rotation_y(self.rotation.y) |
| 43 | * Quaternion::from_rotation_z(self.rotation.z), |
| 44 | ); |
| 45 | let scale_matrix = Matrix4::IDENTITY * Matrix4::from_scale(self.scale); |
| 46 | InstanceRaw { |
| 47 | model: position_matrix * rotation_matrix * scale_matrix, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | /// Sets the position |
| 52 | pub fn set_position(&mut self, position: impl Into<Vector3>) { |
no outgoing calls
no test coverage detected