Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/mapfile.cc3
-rw-r--r--src/model/tags.cc4
-rw-r--r--src/model/tags.h379
3 files changed, 271 insertions, 115 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index a516649..3df2659 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1588,6 +1588,7 @@ Model * MapFile::load(std::string const &name)
tag_light->set_strobe(spawnflag_isset(u, 1));
tag_light->set_entity(spawnflag_isset(u, 2));
tag_light->set_engine(spawnflag_isset(u, 4));
+ tag_light->set_entity_second(spawnflag_isset(u, 8));
continue;
} else if (mapfile.got_key_float("light", r)) {
@@ -1644,6 +1645,7 @@ Model * MapFile::load(std::string const &name)
tag_flare->set_strobe(spawnflag_isset(u, 1));
tag_flare->set_entity(spawnflag_isset(u, 2));
tag_flare->set_engine(spawnflag_isset(u, 4));
+ tag_flare->set_entity_second(spawnflag_isset(u, 8));
} else if (mapfile.got_key_float("light", r)) {
tag_flare->set_radius(r * SCALE);
@@ -1713,6 +1715,7 @@ Model * MapFile::load(std::string const &name)
} else if (mapfile.got_key_int("spawnflags", u)) {
tag_particles->set_entity(spawnflag_isset(u, 2));
tag_particles->set_engine(spawnflag_isset(u, 4));
+ tag_particles->set_entity_second(spawnflag_isset(u, 8));
} else if (mapfile.got_key_float("scale", s)) {
tag_particles->set_scale(s);
diff --git a/src/model/tags.cc b/src/model/tags.cc
index 75580e5..76f18ce 100644
--- a/src/model/tags.cc
+++ b/src/model/tags.cc
@@ -31,6 +31,7 @@ Light::Light() :
light_color(1.0f, 1.0f, 1.0f)
{
light_entity = false;
+ light_entity_second = false;
light_engine = false;
light_strobe = false;
light_has_color = false;
@@ -50,6 +51,7 @@ Light::Light(const Light& other) :
light_color(other.color())
{
light_entity = other.entity();
+ light_entity_second = other.entity_second();
light_engine = other.engine();
light_strobe = other.strobe();
light_has_color = other.has_color();
@@ -95,6 +97,7 @@ Particles::Particles() :
particles_script()
{
particles_entity = false;
+ particles_entity_second = false;
particles_engine = false;
particles_has_color = false;
particles_scale = 1.0f;
@@ -107,6 +110,7 @@ Particles::Particles(const Particles & other) :
particles_script(other.script())
{
particles_entity = other.entity();
+ particles_entity_second = other.entity_second();
particles_engine = other.engine();
particles_scale = other.scale();
particles_cull = other.cull();
diff --git a/src/model/tags.h b/src/model/tags.h
index ff95954..200c977 100644
--- a/src/model/tags.h
+++ b/src/model/tags.h
@@ -1,5 +1,5 @@
/*
- model/classes.h
+ model/tags.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
@@ -22,7 +22,7 @@ namespace model
* culling parameter values
* Culling is a paremeter used by flares and particles to indicate
* with side of the polygons should be culled during rendering
- */
+ * */
enum Cull { CullNone = 0, CullBack = 1, CullFront = 2 };
/* ---- class Tag -------------------------------------------------- */
@@ -31,47 +31,50 @@ enum Cull { CullNone = 0, CullBack = 1, CullFront = 2 };
* @brief a location tag
* A location tag provides an anchor point for model extenions
* like lights, flares and sounds.
- */
+ * */
class Tag
{
public:
/**
* @brief default constructor
- */
+ * */
Tag();
/**
* @brief copy constructor
- */
+ * */
Tag(const Tag& other);
/**
* @brief default destructor
- */
+ * */
~Tag();
/* ---- inspectors ----------------------------------------- */
/**
* @brief location of this part within the parent model
- */
- inline const math::Vector3f& location() const {
+ * */
+ inline const math::Vector3f& location() const
+ {
return tag_location;
}
/* ---- mutators ------------------------------------------- */
/**
* @brief set the location within the parent model
- */
- inline void set_location(const math::Vector3f& location) {
+ * */
+ inline void set_location(const math::Vector3f& location)
+ {
tag_location.assign(location);
}
/**
* @brief set the location within the parent model
- */
- inline void set_location(const float x, const float y, const float z) {
+ * */
+ inline void set_location(const float x, const float y, const float z)
+ {
tag_location.assign(x, y, z);
}
@@ -79,8 +82,9 @@ public:
/**
* @brief mutable reference to the location of this part within the parent model
- */
- inline math::Vector3f& get_location() {
+ * */
+ inline math::Vector3f& get_location()
+ {
return tag_location;
}
@@ -99,73 +103,115 @@ class Light : public Tag
public:
/**
* @brief default constructor
- */
+ * */
Light();
/**
* @brief copy constructor
- */
+ * */
Light(const Light& other);
/**
* @brief destructor
- */
+ * */
~Light();
/* ---- inspectors ----------------------------------------- */
- /// light color
- inline const math::Color& color() const {
+ /**
+ * @brief light color
+ * */
+ inline const math::Color& color() const
+ {
return light_color;
}
- /// true if the color was set
- inline bool has_color() const {
+ /**
+ * @brief true if the color was set
+ * */
+ inline bool has_color() const
+ {
return light_has_color;
}
- /// true if this is a strobe light
- inline bool strobe() const {
+ /**
+ * @brief true if this is a strobe light
+ * */
+ inline bool strobe() const
+ {
return light_strobe;
}
- /// true if this light has entity color
- inline bool entity() const {
+ /**
+ * @brief true if this light has entity primary color
+ * */
+ inline bool entity() const
+ {
return light_entity;
}
+
+ /**
+ * @brief true if this light has entity secondary color
+ * */
+ inline bool entity_second() const
+ {
+ return light_entity_second;
+ }
- /// true if this light has engine activation
- inline bool engine() const {
+ /**
+ * @brief true if this light has engine activation
+ * The light's intensity will vary depedning on entity thrust,
+ * */
+ inline bool engine() const
+ {
return light_engine;
}
- /// size of the light, default is 1.0f
- inline float radius() const {
+ /**
+ * @brief size of the light, default is 1.0f
+ * */
+ inline float radius() const
+ {
return light_radius;
}
- /// strobe time offset, in seconds
- inline float offset() const {
+ /**
+ * @brief strobe time offset, in seconds
+ * */
+ inline float offset() const
+ {
return light_offset;
}
- /// strobe frequency in strobes per second, default is 1.0f
- inline float frequency() const {
+ /**
+ * @brief strobe frequency in strobes per second, default is 1.0f
+ * */
+ inline float frequency() const
+ {
return light_frequency;
}
- /// fraction a strobe light will be on, default is 0.5f
- inline float time() const {
+ /**
+ * @brief fraction a strobe light will be on, default is 0.5f
+ * */
+ inline float time() const
+ {
return light_time;
}
- /// flare texture number
- inline unsigned int flare() const {
+ /**
+ * @brief flare texture number
+ * */
+ inline unsigned int flare() const
+ {
return light_flare;
}
- /// render texture id
- inline size_t texture() const {
+ /**
+ * @brief render texture id
+ * */
+ inline size_t texture() const
+ {
return light_texture;
}
/* ---- mutators ------------------------------------------- */
@@ -188,58 +234,74 @@ public:
}
/**
- * @brief set entity color on or off
- */
- inline void set_entity(const bool entity) {
+ * @brief set entity prinary color on or off
+ * */
+ inline void set_entity(const bool entity)
+ {
light_entity = entity;
}
+
+ /**
+ * @brief set entity secondary color on or off
+ * */
+ inline void set_entity_second(const bool entity_second)
+ {
+ light_entity_second = entity_second;
+ }
/**
* @brief set engine activation on or off
- */
- inline void set_engine(const bool engine) {
+ * */
+ inline void set_engine(const bool engine)
+ {
light_engine = engine;
}
/**
* @brief set the light radius
- */
- inline void set_radius(const float radius) {
+ * */
+ inline void set_radius(const float radius)
+ {
light_radius = radius;
}
/**
* @brief set the light strobe frequency, in strobes per second
- */
- inline void set_frequency(const float frequency) {
+ * */
+ inline void set_frequency(const float frequency)
+ {
light_frequency = frequency;
}
/**
* @brief set the light on time, from 0.0 (always off) to 1.0 (always on)
- */
- inline void set_time(const float time) {
+ * */
+ inline void set_time(const float time)
+ {
light_time = time;
}
/**
* @brief set the light strobe time offset, in seconds
- */
- inline void set_offset(const float offset) {
+ * */
+ inline void set_offset(const float offset)
+ {
light_offset = offset;
}
/**
* @brief set the flare texture number
- */
- inline void set_flare(unsigned int flare) {
+ * */
+ inline void set_flare(unsigned int flare)
+ {
light_flare = flare;
}
/**
* @brief set the render texture id
- */
- inline void set_texture(size_t texture) {
+ * */
+ inline void set_texture(size_t texture)
+ {
light_texture = texture;
}
@@ -247,6 +309,7 @@ private:
bool light_strobe;
bool light_engine;
bool light_entity;
+ bool light_entity_second;
unsigned int light_flare;
@@ -280,17 +343,20 @@ public:
/* ---- inspectors ----------------------------------------- */
- inline const math::Axis &axis() const {
+ inline const math::Axis &axis() const
+ {
return flare_axis;
}
- inline Cull cull() const {
+ inline Cull cull() const
+ {
return flare_cull;
}
/* ---- mutators ------------------------------------------- */
- inline void set_cull(const Cull cull) {
+ inline void set_cull(const Cull cull)
+ {
flare_cull = cull;
}
@@ -298,8 +364,9 @@ public:
/**
* @brief mutable reference to the axis
- */
- inline math::Axis& get_axis() {
+ * */
+ inline math::Axis& get_axis()
+ {
return flare_axis;
}
@@ -310,91 +377,129 @@ private:
/* ---- class Particles -------------------------------------------- */
-/// a particle system
+/**
+ * @brief a particle system
+ * */
class Particles : public Tag
{
public:
/**
* @brief default constructor
- */
+ * */
Particles();
/**
* @brief copy constructor
- */
+ * */
Particles(const Particles & other);
/**
* @brief destructor
- */
+ * */
~Particles();
+
+ /* ---- inspectors ----------------------------------------- */
- inline const math::Axis &axis() const {
+ inline const math::Axis &axis() const
+ {
return particles_axis;
}
/**
* @brief name of the script to load
- */
- inline const std::string& script() const {
+ * */
+ inline const std::string& script() const
+ {
return particles_script;
}
- inline bool entity() const {
+ /**
+ * @brief if true, the particle system has entity primary color
+ * */
+ inline bool entity() const
+ {
return particles_entity;
}
+
+ /**
+ * @brief if true, the particle system has entity secondary color
+ * */
+ inline bool entity_second() const
+ {
+ return particles_entity_second;
+ }
- inline bool engine() const {
+ inline bool engine() const
+ {
return particles_engine;
}
- inline const math::Color & color() const {
+ inline const math::Color & color() const
+ {
return particles_color;
}
- /// true if the color was set
- inline bool has_color() const {
+ /**
+ * @brief true if the color was set
+ * */
+ inline bool has_color() const
+ {
return particles_has_color;
}
-
- inline float scale() const {
+ inline float scale() const
+ {
return particles_scale;
}
- inline Cull cull() const {
+ inline Cull cull() const
+ {
return particles_cull;
}
/* ---- mutators ------------------------------------------- */
/**
- * @brief set entity color on or off
+ * @brief set entity primary color on or off
*/
- inline void set_entity(const bool entity) {
+ inline void set_entity(const bool entity)
+ {
particles_entity = entity;
}
+
+ /**
+ * @brief set entity secondary color on or off
+ */
+ inline void set_entity_second(const bool entity_second)
+ {
+ particles_entity_second = entity_second;
+ }
/**
* @brief set engine activation on or off
*/
- inline void set_engine(const bool engine) {
+ inline void set_engine(const bool engine)
+ {
particles_engine = engine;
}
- inline void set_cull(const Cull cull) {
+ inline void set_cull(const Cull cull)
+ {
particles_cull = cull;
}
- inline void set_script(const std::string& script) {
+ inline void set_script(const std::string& script)
+ {
particles_script.assign(script);
}
- inline void set_scale(const float scale) {
+ inline void set_scale(const float scale)
+ {
particles_scale = scale;
}
- inline void set_color(const math::Color &color) {
+ inline void set_color(const math::Color &color)
+ {
particles_color.assign(color);
particles_has_color = true;
}
@@ -404,12 +509,14 @@ public:
/**
* @brief mutable reference to the axis
*/
- inline math::Axis& get_axis() {
+ inline math::Axis& get_axis()
+ {
return particles_axis;
}
private:
bool particles_entity;
+ bool particles_entity_second;
bool particles_engine;
bool particles_has_color;
@@ -430,35 +537,49 @@ class Dock : public Tag
public:
/**
* @brief default constructor
- */
+ * */
Dock();
/**
* @brief copy constructor
- */
+ * */
Dock(const Dock& other);
/**
* @brief destructor
- */
+ * */
~Dock();
+
+ /* ---- inspectors ----------------------------------------- */
- inline const math::Axis &axis() const {
- return dock_axis;
+ /**
+ * @brief dock radius, default is 0.01f
+ * */
+ inline float radius() const
+ {
+ return dock_radius;
}
- /// dock radius, default is 0.01f
- inline float radius() const {
- return dock_radius;
+ inline const math::Axis &axis() const
+ {
+ return dock_axis;
}
+
+ /* ---- mutators ------------------------------------------- */
- /// set dock radius
- inline void set_radius(const float radius) {
+ /**
+ * @brief set dock radius
+ * */
+ inline void set_radius(const float radius)
+ {
dock_radius = radius;
}
- /// set dock axis
- inline void set_axis(const math::Axis& axis) {
+ /**
+ * @brief set dock axis
+ * */
+ inline void set_axis(const math::Axis& axis)
+ {
dock_axis.assign(axis);
}
@@ -466,7 +587,7 @@ public:
/**
* @brief mutable reference to the axis
- */
+ * */
inline math::Axis& get_axis() {
return dock_axis;
}
@@ -489,13 +610,24 @@ public:
Sound(const Sound& other);
~Sound();
+
+ /* ---- inspectors ----------------------------------------- */
- /// name of the sound sample
- inline const std::string& name() const {
+ /**
+ * @brief name of the sound sample
+ * */
+ inline const std::string& name() const
+ {
return sound_name;
}
+
+ /* ---- mutators ------------------------------------------- */
- inline void set_name(const std::string& name) {
+ /**
+ * @brief set the name name of the sound sample
+ * */
+ inline void set_name(const std::string& name)
+ {
sound_name.assign(name);
}
private:
@@ -515,19 +647,25 @@ public:
SubModel(const SubModel& other);
~SubModel();
+
+ /* ---- inspectors ----------------------------------------- */
- inline const std::string& name() const {
+ inline const std::string& name() const
+ {
return submodel_name;
}
- inline const math::Axis& axis() const {
+ inline const math::Axis& axis() const
+ {
return submodel_axis;
}
- inline float scale() const {
+ inline float scale() const
+ {
return submodel_scale;
}
-
+
+ /* ---- mutators ------------------------------------------- */
inline void set_scale(const float scale) {
submodel_scale = scale;
@@ -566,35 +704,46 @@ class Weapon : public Tag
public:
/**
* @brief default constructor
- */
+ * */
Weapon();
/**
* @brief copy constructor
- */
+ * */
Weapon(const Weapon& other);
/**
* @brief destructor
- */
+ * */
~Weapon();
+
+ /* ---- inspectors ----------------------------------------- */
inline const math::Axis &axis() const {
return weapon_axis;
}
- /// weapon slot radius, default is 0.01f
- inline float radius() const {
+ /**
+ * @brief weapon slot radius, default is 0.01f
+ * */
+ inline float radius() const
+ {
return weapon_radius;
}
- /// set weapon slot radius
- inline void set_radius(const float radius) {
+ /**
+ * @brief set weapon slot radius
+ * */
+ inline void set_radius(const float radius)
+ {
weapon_radius = radius;
}
- /// set weapon slot axis
- inline void set_axis(const math::Axis& axis) {
+ /**
+ * @brief set weapon slot axis
+ * */
+ inline void set_axis(const math::Axis& axis)
+ {
weapon_axis.assign(axis);
}
@@ -602,7 +751,7 @@ public:
/**
* @brief mutable reference to the axis
- */
+ * */
inline math::Axis& get_axis() {
return weapon_axis;
}
@@ -615,5 +764,5 @@ private:
}
-#endif // __INCLUDED_MODEL_PARTS_H__
+#endif // __INCLUDED_MODEL_TAGS_H__