Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain/src/lib/graphics/importer/static_model.h

Last change on this file was 10141, checked in by bensch, 18 years ago

orxonox/trunk: ported the static_model to std::vectort.
Took me 90 minutes, and i hope everything is still working as it did before :)

File size: 2.5 KB
Line 
1/*!
2 * @file static_model.h
3 * @brief Contains the Model Class that handles Static 3D-Models rendered with glList's
4 */
5
6#ifndef _STATIC_MODEL_H
7#define _STATIC_MODEL_H
8
9#include "model.h"
10
11#include "material.h"
12#include <vector>
13#include "static_model_data.h"
14
15/////////////
16/// MODEL ///
17/////////////
18//! Class that handles static 3D-Models.
19/**
20 * it can also read them in and display them.
21 * All the objects are rendered with glLists
22 */
23class StaticModel : public Model
24{
25  ObjectListDeclaration(StaticModel);
26public:
27  StaticModel(const std::string& modelName = "");
28  StaticModel(const StaticModel& staticModel);
29  virtual ~StaticModel();
30
31  StaticModel& operator=(const StaticModel& model);
32
33  virtual void draw() const { data->draw(); };
34  void draw(int groupNumber) const { data->draw(groupNumber); };
35  void draw(const std::string& groupName) const { data->draw(groupName); };
36
37  void rebuild() { data->rebuild(); };
38
39  Material* addMaterial(const Material& material) { return data->addMaterial(material); };
40  Material* addMaterial(const std::string& materialName) { return data->addMaterial(materialName); };
41
42  bool addGroup(const std::string& groupString) { return data->addGroup(groupString); };
43
44  bool addVertex(const std::string& vertexString) { return data->addVertex(vertexString); };
45  bool addVertex(float x, float y, float z) { return data->addVertex(x, y, z); };
46
47  bool addFace(const std::string& faceString) { return data->addFace(faceString); };
48  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
49
50  bool addVertexNormal(const std::string& normalString) { return this->data->addVertexNormal(normalString); };
51  bool addVertexNormal(float x, float y, float z) { return this->data->addVertexNormal(x,y,z); };
52
53  bool addVertexTexture(const std::string& vTextureString) { return this->data->addVertexTexture(vTextureString); };
54  bool addVertexTexture(float u, float v) { return this->data->addVertexTexture(u, v); };
55
56  bool setMaterial(const std::string& mtlString) { return data->setMaterial(mtlString); };
57  bool setMaterial(Material* mtl) { return data->setMaterial(mtl);};
58
59  void finalize();
60
61  void acquireData(const StaticModelData::Pointer& data);
62  const StaticModelData::Pointer& dataPointer() const { return this->data; };
63
64  inline void setScaleFactor(float scaleFactor) { this->data->setScaleFactor(scaleFactor); };
65  float getScaleFactor() const { return data->getScaleFactor(); }
66
67protected:
68  void cubeModel();
69
70private:
71  void updateBase();
72private:
73  StaticModelData::Pointer         data;
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.