00001
00002
00003
00004
00005 #ifndef RC_TRANSFORMABLE_H
00006 #define RC_TRANSFORMABLE_H
00007
00035 class Transformable : public Node {
00036 friend class SceneGraph;
00037 friend class World;
00038 friend class Camera;
00039 friend class Geometry;
00040
00041
00042
00043 protected:
00044 Transformable(
00045 const char *nname,
00046 NodeType_t ntype
00047 );
00048
00049 ~Transformable();
00050
00051 public:
00052
00053 void reset();
00054
00055
00056
00057 void translate(
00058 f32 x,
00059 f32 y,
00060 f32 z
00061 );
00062
00063 void translate(
00064 vec3f v
00065 );
00066
00067 void scale(
00068 f32 x,
00069 f32 y,
00070 f32 z
00071 );
00072
00073 void scale(
00074 vec3f v
00075 );
00076
00077 void scale(
00078 f32 uniform
00079 );
00080
00081
00082
00083 void rotate(
00084 f32 angle,
00085 f32 x,
00086 f32 y,
00087 f32 z
00088 );
00089
00090 void rotate(
00091 f32 angle,
00092 vec3f v
00093 );
00094
00095 void rotateX(
00096 f32 angle
00097 );
00098
00099 void rotateY(
00100 f32 angle
00101 );
00102
00103 void rotateZ(
00104 f32 angle
00105 );
00106
00107
00108
00109 void setTranslate(
00110 f32 x,
00111 f32 y,
00112 f32 z
00113 );
00114
00115 void setTranslate(
00116 vec3f v
00117 );
00118
00119 void setScale(
00120 f32 x,
00121 f32 y,
00122 f32 z
00123 );
00124
00125 void setScale(
00126 vec3f v
00127 );
00128
00129 void setScale(
00130 f32 uniform
00131 );
00132
00133
00134
00135 void setRotate(
00136 f32 angle,
00137 f32 x,
00138 f32 y,
00139 f32 z
00140 );
00141
00142 void setRotate(
00143 f32 angle,
00144 vec3f v
00145 );
00146
00147
00148
00149
00150
00151 void setRotateX(
00152 f32 angle
00153 );
00154
00155 void setRotateY(
00156 f32 angle
00157 );
00158
00159 void setRotateZ(
00160 f32 angle
00161 );
00162
00163
00164
00165 mat3f getRotation();
00166 vec3f getTranslation();
00167 vec3f getScale();
00168
00169 mat4f getTranslationMatrix();
00170 mat4f getRotationMatrix();
00171 mat4f getScaleMatrix();
00172
00173 mat4f getTranslationMatrixInverse();
00174 mat4f getRotationMatrixInverse();
00175 mat4f getScaleMatrixInverse();
00176
00177 mat4f getTranslationRotationMatrix();
00178
00179 mat4f getLocalMatrix();
00180 mat4f getLocalMatrixInverse();
00181
00182 mat4f getWorldMatrix();
00183 mat4f getWorldMatrixInverse();
00184
00185 mat3f getWorldNormalMatrix();
00186
00187 vec3f getLocalFront();
00188 vec3f getLocalUp();
00189 vec3f getLocalRight();
00190
00191 vec3f getWorldFront();
00192 vec3f getWorldUp();
00193 vec3f getWorldRight();
00194
00205 void lookAt(
00206 vec3f front_vec,
00207 vec3f up_vec
00208 );
00209
00210 void lookAt(
00211 vec3f front_vec
00212 );
00213
00220 vec3f getWorldPosition(
00221 vec3f pos
00222 );
00223
00228 vec3f getWorldPosition();
00229
00230 bool isTransformable() { return true; }
00231
00232 void setFreeze(
00233 bool do_freeze
00234 );
00235
00236 static void registerCommands();
00237
00238
00239
00240 protected:
00241
00242 void detached();
00243
00244 void logTransformableInfo();
00245
00246 private:
00247
00248 #if 0
00249 void update(
00250 mat4f *parent_world,
00251 bool parent_moved
00252 );
00253 #endif
00254
00255
00256
00257
00258
00259 public:
00260
00261 Group *axis;
00262
00263 protected:
00264 mat3f R;
00265 vec3f T;
00266 vec3f S;
00267
00268 mat4f worldMatrix;
00269 mat4f worldMatrixInverse;
00270
00271 i32 transformTime;
00272
00273 i32 parentWorldTime;
00274 i32 worldTime;
00275
00276 i32 worldInvTime;
00277 i32 parentWorldInvTime;
00278
00279 bool frozen;
00280
00281
00282 };
00283
00284
00285 #endif
00286