vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
model.h
Go to the documentation of this file.
1 #ifndef modelH
2 #define modelH 1
3 
4 #include <vrecko/Ability.h>
6 #include <vrecko/World.h>
7 #include <vector>
8 #include <string>
9 #include <osgCal/CoreModel>
10 #include <osgCal/Model>
11 #include "awHelper.h"
12 
13 using namespace vrecko;
14 
15 namespace ArtificialWorld
16 {
18  enum ModelType
19  {
27  };
28 
30  enum ModelFlags
31  {
32  NONE = 1,
35  };
36 
38  class Model
39  {
40  public:
41 
43  osg::ref_ptr<EnvironmentObject> Geometry;
44 
45  Model(void);
46  virtual ~Model(void){};
47 
49  void SetModelFlags(ModelFlags flags){ modelFlags = flags; };
51  void SetMinVisibleDistance(unsigned long minDist){ hasMinDistance = true; minVisibleDistance = minDist; };
53  void SetMaxVisibleDistance(unsigned long maxDist){ hasMaxDistance = true; maxVisibleDistance = maxDist; };
55  void SetPosition(osg::Vec3 pos){ position = pos; };
57  void SetRotation(osg::Quat rot){ rotation = rot; };
59  void SetScale(osg::Vec3 sc){ scale = sc; };
61  void SetFileName(string fname){ fileName = fname; };
63  void SetFileName(char* fname){ fileName.assign(fname); };
65  void SetModelType(ModelType mtype){ modelType = mtype; };
66 
68  ModelFlags GetModelFlags(void){ return modelFlags; };
70  unsigned long GetMaxVisibleDistance(void){ return maxVisibleDistance; };
72  unsigned long GetMinVisibleDistance(void){ return minVisibleDistance; };
74  osg::Vec3 GetPosition(void){ return position; };
76  osg::Quat GetRotation(void){ return rotation; };
78  osg::Vec3 GetScale(void){ return scale; };
80  string GetFileName(void){ return fileName; }
82  ModelType GetModelType(void){ return modelType; };
83 
85  bool HasMinVisibleDistance(void){ return hasMinDistance; };
87  bool HasMaxVisibleDistance(void){ return hasMaxDistance; };
89  bool HasPositionSet(void){ return hasPositionSet; };
90 
91  protected:
93  ModelFlags modelFlags;
95  unsigned long maxVisibleDistance;
97  unsigned long minVisibleDistance;
99  osg::Vec3 position;
101  osg::Quat rotation;
103  osg::Vec3 scale;
105  string fileName;
114 
115  };
116 
118  class AnimatedModel : public Model{
119  public:
121  animationIndex = 0;
122  };
123 
125  void SetAnimationIndex(int index){ animationIndex = index; };
127  int GetAnimationIndex(void){ return animationIndex; };
128 
129  private:
131  int animationIndex;
132  };
133 }
134 
135 #endif
136