00001 #ifndef MESHRENDERER_H_INCLUDED
00002 #define MESHRENDERER_H_INCLUDED
00003
00004 #include "Renderable.h"
00005 #include "CGLA/Vec3f.h"
00006 #include "TriMesh.h"
00007
00008 enum BasicShapeEnum;
00009
00010 class Material;
00011
00012 using namespace CGLA;
00013 class GameObject;
00014
00015 class MeshRenderer:public Renderable{
00016 public :
00017 static const RTTI TYPE;
00018 virtual const RTTI& getType() const{ return TYPE; }
00019
00020 protected:
00021 int nbOfVertices;
00022 Vec3f *vertices;
00023 Vec3f *normals;
00024 TR3D::TriMesh* mesh;
00025 bool _castShadow;
00026 bool _receiveShadow;
00027
00028 public:
00029 MeshRenderer();
00030 MeshRenderer(BasicShapeEnum shape);
00031 ~MeshRenderer();
00032 virtual void render() const;
00033 void setMaterial(Material*);
00034 Material* getMaterial();
00035 void setMesh(TR3D::TriMesh * Mesh);
00036 TR3D::TriMesh* getMesh();
00037
00038 bool castShadow()const;
00039 bool receiveShadow()const;
00040 void setCastShadow(bool cast);
00041 void setReceiveShadow(bool receive);
00042
00043 private:
00044
00045 friend class boost::serialization::access;
00046 template<class Archive>
00047 void serialize(Archive& ar, const unsigned int version){
00048
00049 ar & boost::serialization::base_object<Renderable>(*this);
00050 ar & material;
00051 ar & mesh;
00052 ar & _castShadow;
00053 ar & _receiveShadow;
00054 }
00055
00056 };
00057
00058 #endif // MESHRENDERER_H_INCLUDED