00001 00002 00003 #ifndef SPRITE_H 00004 #define SPRITE_H 00005 00006 00007 #include "RenderableObject.h" 00008 #include "Vector3f.h" 00009 #include "Vector4f.h" 00010 00011 00012 namespace pge { 00013 00014 class Texture; 00015 00016 class Sprite : public IRenderableObject { 00017 00018 public: 00019 //************************************************************************ 00020 // 00021 // Constructor 00022 // 00023 //************************************************************************ 00025 Sprite(Vector3f topLeft, Vector3f topRight, Vector3f bottomRight, Vector3f bottomLeft); 00026 Sprite(Vector3f center, float size); 00027 00028 00029 //************************************************************************ 00030 // 00031 // Destructor 00032 // 00033 //************************************************************************ 00035 virtual ~Sprite(void); 00036 00037 00038 //************************************************************************ 00039 // 00040 // Functions 00041 // 00042 //************************************************************************ 00043 Vector3f getCenter(void); 00044 void setCenter(Vector3f center); 00045 void setSize(float size); 00046 void setTexture(Texture *texture); 00047 void setColor(Vector4f color); 00048 bool isBillboardEnabled(void); 00049 void setBillboardEnabled(bool enabled); 00050 00051 bool init(void); 00052 void render(void); 00053 void timer(unsigned int delay); 00054 00055 00056 protected: 00057 //************************************************************************ 00058 // 00059 // Variables 00060 // 00061 //************************************************************************ 00062 Vector3f m_topLeft; 00063 Vector3f m_topRight; 00064 Vector3f m_bottomLeft; 00065 Vector3f m_bottomRight; 00066 Vector3f m_center; 00067 00068 00069 private: 00070 //************************************************************************ 00071 // 00072 // Functions 00073 // 00074 //************************************************************************ 00075 00076 00077 //************************************************************************ 00078 // 00079 // Variables 00080 // 00081 //************************************************************************ 00082 bool m_forceBillboard; 00083 bool m_billboardEnabled; 00084 00085 float m_mat[16]; 00086 00087 float m_size; 00088 00089 Vector3f m_right; 00090 Vector3f m_up; 00091 00092 Vector4f m_color; 00093 00094 Texture *m_texture; 00095 00096 float m_texRepeatU; 00097 float m_texRepeatV; 00098 00099 }; 00100 }; 00101 00102 #endif