Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/graphics/importer/static_model.h @ 9831

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

added resource_obj for new resource managed obj-loader

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);
26  public:
27  StaticModel(const std::string& modelName = "");
28  virtual ~StaticModel();
29
30  StaticModel& operator=(const StaticModel& model) { this->data = model.data; return *this; };
31
32  virtual void draw() const { data->draw(); };
33  void draw(int groupNumber) const { data->draw(groupNumber); };
34  void draw(const std::string& groupName) const { data->draw(groupName); };
35
36  void rebuild() { data->rebuild(); };
37
38  Material* addMaterial(Material* material) { return data->addMaterial(material); };
39  Material* addMaterial(const std::string& materialName) { return data->addMaterial(materialName); };
40
41  bool addGroup(const std::string& groupString) { return data->addGroup(groupString); };
42
43  bool addVertex(const std::string& vertexString) { return data->addVertex(vertexString); };
44  bool addVertex(float x, float y, float z) { return data->addVertex(x, y, z); };
45
46  bool addFace(const std::string& faceString) { return data->addFace(faceString); };
47  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
48
49  bool addVertexNormal(const std::string& normalString) { return this->data->addVertexNormal(normalString); };
50  bool addVertexNormal(float x, float y, float z) { return this->data->addVertexNormal(x,y,z); };
51
52  bool addVertexTexture(const std::string& vTextureString) { return this->data->addVertexTexture(vTextureString); };
53  bool addVertexTexture(float u, float v) { return this->data->addVertexTexture(u, v); };
54
55  bool setMaterial(const std::string& mtlString) { return data->setMaterial(mtlString); };
56  bool setMaterial(Material* mtl) { return data->setMaterial(mtl);};
57
58  void finalize();
59
60  void acquireData(const StaticModelData::Pointer& data) { this->data = data; };
61  const StaticModelData::Pointer& dataPointer() const { return this->data; };
62
63  inline void setScaleFactor(float scaleFactor) { this->data->setScaleFactor(scaleFactor); };
64  float getScaleFactor() const { return data->getScaleFactor(); }
65
66 protected:
67  void cubeModel();
68
69 private:
70   StaticModelData::Pointer         data;
71};
72
73#endif
Note: See TracBrowser for help on using the repository browser.