g4tools  5.4.0
Public Member Functions | Public Attributes | Protected Attributes | List of all members
tools::sg::matrix Class Reference
Inheritance diagram for tools::sg::matrix:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::matrix:
Collaboration graph
[legend]

Public Member Functions

virtual const desc_fieldsnode_desc_fields () const
 
virtual void render (render_action &a_action)
 
virtual void pick (pick_action &a_action)
 
virtual void bbox (bbox_action &a_action)
 
virtual void event (event_action &a_action)
 
virtual void get_matrix (get_matrix_action &a_action)
 
virtual void is_visible (visible_action &a_action)
 
 matrix ()
 
virtual ~matrix ()
 
 matrix (const matrix &a_from)
 
matrixoperator= (const matrix &a_from)
 
void set_identity ()
 
void set_translate (float a_x, float a_y, float a_z)
 
void set_translate (const vec3f &a_v)
 
void set_scale (float a_x, float a_y, float a_z)
 
void set_scale (float a_s)
 
void set_rotate (float a_x, float a_y, float a_z, float a_angle)
 
void set_rotate (const vec3f &a_v, float a_angle)
 
bool set_rotate (const vec3f &a_from, const vec3f &a_to)
 
void mul_mtx (const mat4f &a_m)
 
void mul_translate (float a_x, float a_y, float a_z)
 
void mul_translate (const vec3f &a_v)
 
void mul_scale (float a_x, float a_y, float a_z)
 
void mul_scale (float a_s)
 
void mul_rotate (float a_x, float a_y, float a_z, float a_angle)
 
void mul_rotate (const vec3f &a_v, float a_angle)
 
void mul_rotate (const vec4f &a_v)
 
void left_mul_rotate (float a_x, float a_y, float a_z, float a_angle)
 
void left_mul_scale (float a_x, float a_y, float a_z)
 
void left_mul_translate (float a_x, float a_y, float a_z)
 
void left_mul_translate (const vec3f &a_v)
 
bool mul_rotate (const vec3f &a_from, const vec3f &a_to)
 
- Public Member Functions inherited from tools::sg::node
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const =0
 
virtual nodecopy () const =0
 
virtual unsigned int cls_version () const
 
virtual void search (search_action &a_action)
 
virtual bool write (write_action &a_action)
 
virtual bool read (read_action &a_action)
 
virtual void protocol_one_fields (std::vector< field * > &a_fields) const
 
virtual bool draw_in_frame_buffer () const
 
virtual bool touched ()
 
virtual void reset_touched ()
 
 node ()
 
virtual ~node ()
 
void touch ()
 
fieldfield_from_desc (const field_desc &a_desc) const
 
void dump_field_descs (std::ostream &a_out) const
 
fieldfind_field_by_name (const std::string &a_name) const
 

Public Attributes

sf_mat4f mtx
 

Protected Attributes

float m_tmp [16]
 

Additional Inherited Members

- Protected Member Functions inherited from tools::sg::node
 node (const node &)
 
nodeoperator= (const node &)
 
void add_field (field *a_field)
 
bool write_fields (write_action &a_action)
 
bool read_fields (read_action &a_action)
 
field_desc::offset_t field_offset (const field *a_field) const
 
fieldfind_field (const field_desc &a_rdesc) const
 
void check_fields (std::ostream &a_out) const
 

Detailed Description

Definition at line 19 of file matrix.

Constructor & Destructor Documentation

◆ matrix() [1/2]

tools::sg::matrix::matrix ( )
inline

Definition at line 62 of file matrix.

62  :parent(),mtx(mat4f()) {
63 #ifdef TOOLS_MEM
64  mem::increment(s_class().c_str());
65 #endif
66  add_fields();
67  mtx.set_identity();
68  }

◆ ~matrix()

virtual tools::sg::matrix::~matrix ( )
inlinevirtual

Definition at line 69 of file matrix.

69  {
70 #ifdef TOOLS_MEM
71  mem::decrement(s_class().c_str());
72 #endif
73  }

◆ matrix() [2/2]

tools::sg::matrix::matrix ( const matrix a_from)
inline

Definition at line 75 of file matrix.

75  :parent(a_from),mtx(a_from.mtx) {
76 #ifdef TOOLS_MEM
77  mem::increment(s_class().c_str());
78 #endif
79  add_fields();
80  }

Member Function Documentation

◆ bbox()

virtual void tools::sg::matrix::bbox ( bbox_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 45 of file matrix.

45  {
46  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
47  a_action.state().m_model = a_action.model_matrix();
48  }

◆ event()

virtual void tools::sg::matrix::event ( event_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 49 of file matrix.

49  {
50  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
51  a_action.state().m_model = a_action.model_matrix();
52  }

◆ get_matrix()

virtual void tools::sg::matrix::get_matrix ( get_matrix_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 53 of file matrix.

53  {
54  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
55  a_action.state().m_model = a_action.model_matrix();
56  }

◆ is_visible()

virtual void tools::sg::matrix::is_visible ( visible_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 57 of file matrix.

57  {
58  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
59  a_action.state().m_model = a_action.model_matrix();
60  }

◆ left_mul_rotate()

void tools::sg::matrix::left_mul_rotate ( float  a_x,
float  a_y,
float  a_z,
float  a_angle 
)
inline

Definition at line 112 of file matrix.

112 {mtx.left_mul_rotate(a_x,a_y,a_z,a_angle);}

◆ left_mul_scale()

void tools::sg::matrix::left_mul_scale ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 114 of file matrix.

114 {mtx.left_mul_scale(a_x,a_y,a_z);}

◆ left_mul_translate() [1/2]

void tools::sg::matrix::left_mul_translate ( const vec3f a_v)
inline

Definition at line 118 of file matrix.

118 {mtx.left_mul_translate(a_v);}

◆ left_mul_translate() [2/2]

void tools::sg::matrix::left_mul_translate ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 116 of file matrix.

116 {mtx.left_mul_translate(a_x,a_y,a_z);}

◆ mul_mtx()

void tools::sg::matrix::mul_mtx ( const mat4f a_m)
inline

Definition at line 100 of file matrix.

100 {mtx.mul_mtx(a_m,m_tmp);}

◆ mul_rotate() [1/4]

bool tools::sg::matrix::mul_rotate ( const vec3f a_from,
const vec3f a_to 
)
inline

Definition at line 120 of file matrix.

120 {return mtx.mul_rotate(a_from,a_to,m_tmp);}

◆ mul_rotate() [2/4]

void tools::sg::matrix::mul_rotate ( const vec3f a_v,
float  a_angle 
)
inline

Definition at line 109 of file matrix.

109 {mtx.mul_rotate(a_v,a_angle);}

◆ mul_rotate() [3/4]

void tools::sg::matrix::mul_rotate ( const vec4f a_v)
inline

Definition at line 110 of file matrix.

110 {mtx.mul_rotate(a_v.v0(),a_v.v1(),a_v.v2(),a_v.v3());}

◆ mul_rotate() [4/4]

void tools::sg::matrix::mul_rotate ( float  a_x,
float  a_y,
float  a_z,
float  a_angle 
)
inline

Definition at line 107 of file matrix.

107 {mtx.mul_rotate(a_x,a_y,a_z,a_angle);}

◆ mul_scale() [1/2]

void tools::sg::matrix::mul_scale ( float  a_s)
inline

Definition at line 105 of file matrix.

105 {mtx.mul_scale(a_s);}

◆ mul_scale() [2/2]

void tools::sg::matrix::mul_scale ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 104 of file matrix.

104 {mtx.mul_scale(a_x,a_y,a_z);}

◆ mul_translate() [1/2]

void tools::sg::matrix::mul_translate ( const vec3f a_v)
inline

Definition at line 103 of file matrix.

103 {mtx.mul_translate(a_v);}

◆ mul_translate() [2/2]

void tools::sg::matrix::mul_translate ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 102 of file matrix.

102 {mtx.mul_translate(a_x,a_y,a_z);}

◆ node_desc_fields()

virtual const desc_fields& tools::sg::matrix::node_desc_fields ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 24 of file matrix.

24  {
26  static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
28  );
29  return s_v;
30  }

◆ operator=()

matrix& tools::sg::matrix::operator= ( const matrix a_from)
inline

Definition at line 81 of file matrix.

81  {
82  parent::operator=(a_from);
83  mtx = a_from.mtx;
84  return *this;
85  }

◆ pick()

virtual void tools::sg::matrix::pick ( pick_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 41 of file matrix.

41  {
42  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
43  a_action.state().m_model = a_action.model_matrix();
44  }

◆ render()

virtual void tools::sg::matrix::render ( render_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 36 of file matrix.

36  {
37  a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
38  a_action.state().m_model = a_action.model_matrix();
39  a_action.load_model_matrix(a_action.model_matrix());
40  }

◆ set_identity()

void tools::sg::matrix::set_identity ( )
inline

Definition at line 88 of file matrix.

88 {mtx.set_identity();}

◆ set_rotate() [1/3]

bool tools::sg::matrix::set_rotate ( const vec3f a_from,
const vec3f a_to 
)
inline

Definition at line 98 of file matrix.

98 {return mtx.set_rotate(a_from,a_to,m_tmp);}

◆ set_rotate() [2/3]

void tools::sg::matrix::set_rotate ( const vec3f a_v,
float  a_angle 
)
inline

Definition at line 97 of file matrix.

97 {mtx.set_rotate(a_v,a_angle);}

◆ set_rotate() [3/3]

void tools::sg::matrix::set_rotate ( float  a_x,
float  a_y,
float  a_z,
float  a_angle 
)
inline

Definition at line 96 of file matrix.

96 {mtx.set_rotate(a_x,a_y,a_z,a_angle);}

◆ set_scale() [1/2]

void tools::sg::matrix::set_scale ( float  a_s)
inline

Definition at line 94 of file matrix.

94 {mtx.set_scale(a_s);}

◆ set_scale() [2/2]

void tools::sg::matrix::set_scale ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 93 of file matrix.

93 {mtx.set_scale(a_x,a_y,a_z);}

◆ set_translate() [1/2]

void tools::sg::matrix::set_translate ( const vec3f a_v)
inline

Definition at line 91 of file matrix.

91 {mtx.set_translate(a_v);}

◆ set_translate() [2/2]

void tools::sg::matrix::set_translate ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 90 of file matrix.

90 {mtx.set_translate(a_x,a_y,a_z);}

Member Data Documentation

◆ m_tmp

float tools::sg::matrix::m_tmp[16]
protected

Definition at line 122 of file matrix.

◆ mtx

sf_mat4f tools::sg::matrix::mtx

Definition at line 22 of file matrix.


The documentation for this class was generated from the following file:
tools::sg::sf_mat4f::left_mul_scale
void left_mul_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:103
tools::sg::sf_mat4f::left_mul_rotate
void left_mul_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:98
tools::sg::sf_mat4f::mul_scale
void mul_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:79
tools::sg::sf_mat4f::left_mul_translate
void left_mul_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:108
tools::sg::sf_mat4f::set_translate
void set_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:41
tools::sg::sf_mat4f::set_rotate
void set_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:57
tools::sg::matrix::m_tmp
float m_tmp[16]
Definition: matrix:122
tools::sg::sf_mat4f::mul_mtx
void mul_mtx(const mat4f &a_m, float a_tmp[])
Definition: sf_mat4f:66
tools::sg::sf_mat4f::mul_rotate
void mul_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:88
tools::sg::matrix::mtx
sf_mat4f mtx
Definition: matrix:22
tools::sg::matrix
Definition: matrix:19
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::sf_mat4f::set_scale
void set_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:49
tools::sg::sf_mat4f::mul_translate
void mul_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:71
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::sf_mat4f::set_identity
void set_identity()
Definition: sf_mat4f:37
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71