holds transformation information
#include <frame.hpp>
Inherits renderstack::uniform_source.
Inherited by renderstack::camera.
Public Member Functions | |
frame () | |
void | translate_in_world (vec3 const &v) |
void | rotate_in_world (vec3 const &axis, float angle_radians) |
void | set_hpb_xyz (vec3 const &hpb, vec3 const &xyz) |
matrix & | local_to_world () |
matrix & | world_to_local () |
matrix const & | local_to_world () const |
matrix const & | world_to_local () const |
vec3 | position_in_world () |
bool | connect (uniform_bindings &bindings, enum logical_uniform uniform, int slot) |
Static Public Attributes | |
static class frame | identity |
Definition at line 37 of file frame.hpp.
renderstack::frame::frame | ( | ) |
Definition at line 35 of file frame.cpp.
00036 { 00037 m_local_to_world = matrix::identity(); 00038 m_world_to_local = matrix::identity(); 00039 }
void renderstack::frame::translate_in_world | ( | vec3 const & | v | ) |
void renderstack::frame::rotate_in_world | ( | vec3 const & | axis, | |
float | angle_radians | |||
) |
Definition at line 59 of file frame.cpp.
00060 { 00061 vec3 a = axis; 00062 float half_angle = 0.5f * angle; 00063 float half_angle_sin = sinf(half_angle); 00064 float half_angle_cos = cosf(half_angle); 00065 matrix local_to_world; 00066 00067 while(angle < 0) 00068 { 00069 angle += RS_TWO_PI; 00070 } 00071 00072 while(angle >= RS_TWO_PI) 00073 { 00074 angle -= RS_TWO_PI; 00075 } 00076 00077 quaternion q = quaternion(axis, half_angle_sin, half_angle_cos); 00078 m_local_to_world *= matrix(q); 00079 m_world_to_local = inverse(m_local_to_world); 00080 }
Definition at line 82 of file frame.cpp.
00086 { 00087 make_matrix_hpb_xyz( 00088 m_local_to_world, 00089 m_world_to_local, 00090 hpb_mod_2pi(hpb), 00091 translation 00092 ); 00093 }
matrix& renderstack::frame::local_to_world | ( | ) | [inline] |
matrix& renderstack::frame::world_to_local | ( | ) | [inline] |
matrix const& renderstack::frame::local_to_world | ( | ) | const [inline] |
matrix const& renderstack::frame::world_to_local | ( | ) | const [inline] |
vec3 renderstack::frame::position_in_world | ( | ) | [inline] |
bool renderstack::frame::connect | ( | uniform_bindings & | bindings, | |
enum logical_uniform | uniform, | |||
int | slot | |||
) | [virtual] |
Implements renderstack::uniform_source.
Reimplemented in renderstack::camera.
Definition at line 41 of file frame.cpp.
00042 { 00043 switch(uniform) 00044 { 00045 case logical_uniform_local_to_world: return bindings.add(uniform_type_matrix_4, slot, 1, &m_local_to_world.m[0][0]); 00046 case logical_uniform_world_to_local: return bindings.add(uniform_type_matrix_4, slot, 1, &m_world_to_local.m[0][0]); 00047 default: return false; 00048 } 00049 }
class frame renderstack::frame::identity [static] |