Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/parts.h')
-rw-r--r--src/model/parts.h183
1 files changed, 142 insertions, 41 deletions
diff --git a/src/model/parts.h b/src/model/parts.h
index 3e5e74f..78ad5e4 100644
--- a/src/model/parts.h
+++ b/src/model/parts.h
@@ -14,6 +14,9 @@
namespace model
{
+/* ---- globals ---------------------------------------------------- */
+
+// FIXME this should end up in material.h
/**
* @brief
@@ -23,23 +26,82 @@ namespace model
*/
enum Cull { CullNone=0, CullBack=1, CullFront=2 };
+/* ---- class Part ------------------------------------------------- */
+
+/**
+ * @brief a special part of a model
+ */
+class Part
+{
+public:
+ /**
+ * @brief default constructor
+ */
+ inline Part() : part_location()
+ {
+ }
+
+ /**
+ * @brief constructor with location
+ */
+ inline Part(const math::Vector3f &location) : part_location(location)
+ {
+ }
+
+ /* ---- inspectors ----------------------------------------- */
+
+ /**
+ * @brief location of this part within the parent model
+ */
+ inline const math::Vector3f &location() const
+ {
+ return part_location;
+ }
+
+ /* ---- mutators ------------------------------------------- */
+ /**
+ * @brief set the location within the parent model
+ */
+ inline void set_location(const math::Vector3f location) { part_location.assign(location); }
+
+ /**
+ * @brief set the location within the parent model
+ */
+ inline void set_location(const float x, const float y, const float z) { part_location.assign(x, y, z); }
+
+ /* ---- actors --------------------------------------------- */
+
+ /**
+ * @brief mutable reference to the location of this part within the parent model
+ */
+ inline math::Vector3f &get_location()
+ {
+ return part_location;
+ }
+
+private:
+ math::Vector3f part_location;
+};
+
/* ---- class Light ------------------------------------------------ */
/// an exterior light
-class Light
+class Light : public Part
{
public:
+ /**
+ * @brief default constructor
+ */
Light();
-
- Light(const math::Vector3f & location, const math::Color & color, bool strobe=false, bool engine=false);
-
+
+ /**
+ * @brief destructor
+ */
~Light();
- inline const math::Vector3f & location() const
- {
- return light_location;
- }
-
+ /* ---- inspectors ----------------------------------------- */
+
+ /// light color
inline const math::Color & color() const
{
return light_color;
@@ -56,6 +118,12 @@ public:
{
return light_entity;
}
+
+ /// true if this light has engine activation
+ inline const bool engine() const
+ {
+ return light_engine;
+ }
/// size of the light, default is 1.0f
inline float radius() const
@@ -86,32 +154,42 @@ public:
{
return light_flare;
}
-
- /// true if this light has engine activation
- inline const bool engine() const
- {
- return light_engine;
- }
/// render texture number
inline size_t texture() const
{
return render_texture;
}
-
- math::Vector3f light_location;
+ /* ---- mutators ------------------------------------------- */
+
+ /// set strobe on or off
+ inline void set_strobe(bool strobe) { light_strobe = strobe; }
+
+ /**
+ * @brief set entity color on or off
+ */
+ inline void set_entity(bool entity) { light_entity = entity; }
+
+ /**
+ * @brief set engine activation on or off
+ */
+ inline void set_engine(bool engine) { light_engine = engine; }
+
+
math::Color light_color;
- bool light_strobe;
- bool light_entity;
- bool light_engine;
float light_radius;
float light_frequency;
float light_offset;
float light_time;
-
+
unsigned int light_flare;
-
+
size_t render_texture;
+
+private:
+ bool light_strobe;
+ bool light_engine;
+ bool light_entity;
};
/* ---- class Flare ------------------------------------------------ */
@@ -121,46 +199,47 @@ class Flare : public Light
{
public:
Flare();
+
~Flare();
+ /* ---- inspectors ----------------------------------------- */
+
inline const math::Axis axis() const
{
return flare_axis;
}
- inline const bool engine() const
- {
- return flare_engine;
- }
-
inline const Cull cull() const
{
return flare_cull;
}
+ /* ---- mutators ------------------------------------------- */
+
+ inline void set_cull(const Cull cull) { flare_cull = cull; }
+
+ /* ---- actors --------------------------------------------- */
+
+ /**
+ * @brief mutable reference to the axis
+ */
+ inline math::Axis &get_axis() { return flare_axis; }
+
+private:
math::Axis flare_axis;
- bool flare_engine;
Cull flare_cull;
};
/* ---- class Particles -------------------------------------------- */
/// a particle system
-class Particles
+class Particles : public Part
{
public:
Particles();
-
Particles(const math::Vector3f & location);
~Particles();
- void set_radius(const float radius);
-
- inline const math::Vector3f & location() const
- {
- return particles_location;
- }
-
inline const math::Axis &axis() const
{
return particles_axis;
@@ -191,14 +270,36 @@ public:
return particles_cull;
}
+ /* ---- mutators ------------------------------------------- */
+
+ /**
+ * @brief set entity color on or off
+ */
+ inline void set_entity(const bool entity) { particles_entity = entity; }
+
+ /**
+ * @brief set engine activation on or off
+ */
+ inline void set_engine(const bool engine) { particles_engine = engine; }
+
+ inline void set_radius(const float radius) { particles_radius = radius; }
+
+ inline void set_cull(const Cull cull) { particles_cull = cull; }
+
+ /* ---- actors --------------------------------------------- */
+
+ /**
+ * @brief mutable reference to the axis
+ */
+ inline math::Axis &get_axis() { return particles_axis; }
+
std::string particles_script;
- math::Vector3f particles_location;
- math::Axis particles_axis;
+private:
+ math::Axis particles_axis;
+ float particles_radius;
bool particles_entity;
bool particles_engine;
-
- float particles_radius;
Cull particles_cull;
};