Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/mapfile.cc7
-rw-r--r--src/model/mapfile.h5
-rw-r--r--src/model/material.h26
3 files changed, 35 insertions, 3 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index b0f5bea..2cbee2b 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -169,6 +169,7 @@ MapFile::~MapFile()
void MapFile::clear_materials()
{
+ // delete primitives for each material
for (Materials::iterator mit = map_materials.begin(); mit != map_materials.end(); mit++) {
// delete list of primitives
delete(*mit).second;
@@ -176,6 +177,12 @@ void MapFile::clear_materials()
map_materials.clear();
map_collisiontriangles.clear();
+
+ // delete origin vertices
+ for (std::vector<math::Vector3f *>::iterator ovit = class_origin_vertices.begin(); ovit != class_origin_vertices.end(); ovit++) {
+ delete (*ovit);
+ }
+ class_origin_vertices.clear();
}
bool MapFile::open(std::string const & mapname)
diff --git a/src/model/mapfile.h b/src/model/mapfile.h
index 011c01d..551943e 100644
--- a/src/model/mapfile.h
+++ b/src/model/mapfile.h
@@ -174,7 +174,6 @@ private:
/// list of planes for the current brush
std::vector<Face *> planes;
-
std::string classname_current;
std::string key_current;
std::string value_current;
@@ -203,6 +202,10 @@ private:
float class_distance;
bool class_engine;
+
+ /// list of vertices with the origin material within the current map class
+ std::vector<math::Vector3f *> class_origin_vertices;
+
Materials map_materials;
TriangleList map_collisiontriangles;
diff --git a/src/model/material.h b/src/model/material.h
index 9b54dcc..885831c 100644
--- a/src/model/material.h
+++ b/src/model/material.h
@@ -24,7 +24,7 @@ public:
typedef void(* LoaderFuncPtr)(Material *);
/// surface flags
- enum SurfaceFlags { None = 0, Primary = 1, Secondary = 2, Tertiary = 3, Bright = 4, Engine = 8, Environment = 16, Texture = 32, Ignore = 64, Clip = 128};
+ enum SurfaceFlags { None = 0, Primary = 1, Secondary = 2, Tertiary = 3, Bright = 4, Engine = 8, Environment = 16, Texture = 32, Ignore = 64, Clip = 128, Origin = 256};
/// type definition for the material registry
typedef std::map<std::string, Material *> Registry;
@@ -64,10 +64,32 @@ public:
return material_size;
}
+ /**
+ * @brief returns true if the material has the requested flag set
+ * */
+ inline bool flag_is_set(const SurfaceFlags surfaceflag) const {
+ return ((material_flags & surfaceflag) == surfaceflag);
+ }
+
+ /**
+ * @brief returns true if the material has the Ignore flag set
+ * @see flags()
+ * */
+ inline bool ignore_is_set() const {
+ return (flag_is_set(Ignore));
+ }
+
+ /**
+ * @brief returns true if the material has the Origin flag set
+ * @see flags()
+ * */
+ inline bool origin_is_set() const {
+ return (flag_is_set(Origin));
+ }
+
/* ---- mutators ------------------------------------------- */
void set_color(const math::Color &color);
-
/**
* @brief set the material texture name
*/