summaryrefslogtreecommitdiffstats
path: root/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'MatchBloxEngine/MatchBloxEngine/C_3DObject.h')
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_3DObject.h62
1 files changed, 49 insertions, 13 deletions
diff --git a/MatchBloxEngine/MatchBloxEngine/C_3DObject.h b/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
index 9f194cc..4027596 100644
--- a/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
+++ b/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
@@ -2,29 +2,65 @@
#define C_3DOBJECT_HEADER_FILE
+#include <fstream>
+#include <vector>
+
+#include "typedefs.h"
+
class C_3DObject
{
public:
- C_3DObject(char* f_strFileName);
+ C_3DObject();
+ C_3DObject(const char* f_strFileName,
+ char* f_strColorTexName,
+ MatProps_t f_Material);
+ C_3DObject(const char* f_strFileName,
+ GLuint f_uiTexturei,
+ MatProps_t f_Material);
+
~C_3DObject();
- inline void SetPos(double f_dX, double f_dY, double f_dZ) { m_d3Pos[0] = f_dX; m_d3Pos[1] = f_dY; m_d3Pos[2] = f_dZ; }
- inline void SetRot(double f_dX, double f_dY, double f_dZ) { m_d3Rot[0] = f_dX; m_d3Rot[1] = f_dY; m_d3Rot[2] = f_dZ; }
- inline void SetScale(double f_dX, double f_dY, double f_dZ) { m_d3Scale[0] = f_dX; m_d3Scale[1] = f_dY; m_d3Scale[2] = f_dZ; }
+ inline void SetPos(double f_dX, double f_dY, double f_dZ)
+ { m_Pos.x = f_dX; m_Pos.y = f_dY; m_Pos.z = f_dZ; }
+ inline void SetRot(double f_dX, double f_dY, double f_dZ)
+ { m_Rot.x = f_dX; m_Rot.y = f_dY; m_Rot.z = f_dZ; }
+ inline void SetScale(double f_dX, double f_dY, double f_dZ)
+ { m_Scale.x = f_dX; m_Scale.y = f_dY; m_Scale.z = f_dZ; }
+ inline void SetPos(const Vect3D_t &pos)
+ { m_Pos = pos; }
+ inline void SetRot(const Vect3D_t &rot)
+ { m_Rot = rot; }
+ inline void SetScale(const Vect3D_t &scale)
+ { m_Scale = scale; }
- inline double* GetPos() { return m_d3Pos; }
- inline double* GetRot() { return m_d3Rot; }
- inline double* GetScale() { return m_d3Scale; }
+ inline const Vect3D_t& GetPos() { return m_Pos; }
+ inline const Vect3D_t& GetRot() { return m_Rot; }
+ inline const Vect3D_t& GetScale() { return m_Scale; }
+ inline const BoundingBox_t& GetBoundingBox() { return m_BBox; }
+ inline bool Initialized() { return m_bDispListValid; }
- void TransRotateScale();
- virtual void Draw();
+ void TransRotateScale(); //applies the scaling, translation and rotation
+ //for this object
+ virtual void Render(); //renders the object using the current projection
+ //and modelview matrices
protected:
- double m_d3Pos[3],
- m_d3Rot[3],
- m_d3Scale[3];
+ Vect3D_t m_Pos,
+ m_Rot,
+ m_Scale;
+ BoundingBox_t m_BBox; //bounding box of the object
+ GLuint m_uiListIndex; //display list index
+ bool m_bDispListValid;
+ GLuint m_uiColorTex;
+ bool m_bOwnTexture;
+ MatProps_t m_Mat;
+ bool CreateObject(const char *f_pFilePath);
+ bool LoadGeometryData(const char *f_pFilePath, Geometry_t &f_Geom);
+ bool ParseVect3D(const char *f_pInbuffer, Vect3D_t &f_V3);
+ bool ParseTriangle(const char *f_pInbuffer, Triangle_t &f_triangle);
};
-#endif //C_3DOBJECT_HEADER_FILE \ No newline at end of file
+#endif //C_3DOBJECT_HEADER_FILE
+