Lighting
1

2018

1

Transformation Defines a struct ObjectProperty as follow: property type comment rotation vec3 The object's rotation in its object center. scale vec4 / vec3 The object's scale level in its object center. translation vec3 The object's relative position to the origin (absolute position). face vec3 Where the object look at. The code: struct ObjectProperty { vec3 rotation; vec4 scale; vec3 translation; vec3 face; }; Object Transformation Object Transformation Order: -> Rotate -> Scale -> Translate Rotate and scale around the center of the object, so that the order of these transformations will not influence the result. The transformation matrix is: struct ObjectProperty objProp; mat4 m4ModelMatrix = translate(objProp.translation) * scale(objProp.scale) * rotate(objProp.rotation); The transformation operations are: vec4 v4PosInModel = m4ModelMatrix * vertex.position; Where vertex.position is a vec4 object containing the position of the