Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-02-23 20:30:57 +0000
committerStijn Buys <ingar@osirion.org>2010-02-23 20:30:57 +0000
commit83757353860fa447c36d4078602efea36d7da94e (patch)
treed1d72ae7714bce8efb250c03a68f080bb4396415 /src/model
parentfe229598d7437a85988eb9255cd0f6bdb6e07cb7 (diff)
renamed model::Parts to model::Tags
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Makefile.am8
-rw-r--r--src/model/model.h3
-rw-r--r--src/model/tags.cc (renamed from src/model/parts.cc)35
-rw-r--r--src/model/tags.h (renamed from src/model/parts.h)79
4 files changed, 88 insertions, 37 deletions
diff --git a/src/model/Makefile.am b/src/model/Makefile.am
index fe398a2..6a44471 100644
--- a/src/model/Makefile.am
+++ b/src/model/Makefile.am
@@ -1,12 +1,12 @@
METASOURCES = AUTO
-libmodel_la_SOURCES = asefile.cc parts.cc fragment.cc mapfile.cc material.cc \
- model.cc face.cc primitives.cc quad.cc triangle.cc vertexarray.cc
+libmodel_la_SOURCES = asefile.cc fragment.cc mapfile.cc material.cc \
+ model.cc face.cc primitives.cc quad.cc tags.cc triangle.cc vertexarray.cc
libmodel_la_LDFLAGS = -avoid-version -no-undefined -lm
noinst_LTLIBRARIES = libmodel.la
-noinst_HEADERS = asefile.h parts.h fragment.h mapfile.h material.h model.h face.h \
- primitives.h quad.h triangle.h vertexarray.h
+noinst_HEADERS = asefile.h fragment.h mapfile.h material.h model.h face.h \
+ primitives.h quad.h tags.h triangle.h vertexarray.h
INCLUDES = -I$(top_srcdir)/src
diff --git a/src/model/model.h b/src/model/model.h
index 30714d4..c8f60f1 100644
--- a/src/model/model.h
+++ b/src/model/model.h
@@ -12,7 +12,8 @@
#include <map>
#include "math/mathlib.h"
-#include "model/parts.h"
+
+#include "model/tags.h"
#include "model/fragment.h"
/// classes representing 3D geometry
diff --git a/src/model/parts.cc b/src/model/tags.cc
index e71ad16..baf70a4 100644
--- a/src/model/parts.cc
+++ b/src/model/tags.cc
@@ -1,10 +1,10 @@
/*
- model/classes.cc
+ model/tags.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
-#include "model/parts.h"
+#include "model/tags.h"
namespace model
{
@@ -12,7 +12,7 @@ namespace model
/* ---- class Light ------------------------------------------------ */
Light::Light() :
- Part(),
+ Tag(),
light_color(1.0f, 1.0f, 1.0f)
{
light_entity = false;
@@ -29,7 +29,7 @@ Light::Light() :
light_texture = 0;
}
-Light::Light(const Light& other) : Part(other),
+Light::Light(const Light& other) : Tag(other),
light_color(other.color())
{
light_entity = other.entity();
@@ -65,7 +65,7 @@ Flare::~Flare()
/* ---- class Particles -------------------------------------------- */
-Particles::Particles() : Part()
+Particles::Particles() : Tag()
{
particles_entity = false;
particles_engine = false;
@@ -74,7 +74,7 @@ Particles::Particles() : Part()
}
Particles::Particles(const math::Vector3f& location) :
- Part(location)
+ Tag(location)
{
}
@@ -84,12 +84,12 @@ Particles::~Particles()
/* ---- class Dock ------------------------------------------------- */
-Dock::Dock() : Part()
+Dock::Dock() : Tag()
{
dock_radius = 0.01f;
}
-Dock::Dock(const Dock& other) : Part(other)
+Dock::Dock(const Dock& other) : Tag(other)
{
dock_radius = other.radius();
}
@@ -98,14 +98,29 @@ Dock::~Dock()
{
}
+/* ---- class Sound ------------------------------------------------- */
+
+Sound::Sound() : Tag()
+{
+}
+
+Sound::Sound(const Sound& other) : Tag(other),
+ sound_name(other.name())
+{
+}
+
+Sound::~Sound()
+{
+}
+
/* ---- class SubModel---------------------------------------------- */
-SubModel::SubModel() : Part()
+SubModel::SubModel() : Tag()
{
submodel_scale = 1.0f;
}
-SubModel::SubModel(const SubModel& other) : Part(other),
+SubModel::SubModel(const SubModel& other) : Tag(other),
submodel_name(other.name()),
submodel_axis(other.axis())
{
diff --git a/src/model/parts.h b/src/model/tags.h
index 4df4672..0c97910 100644
--- a/src/model/parts.h
+++ b/src/model/tags.h
@@ -4,8 +4,8 @@
the terms of the GNU General Public License version 2
*/
-#ifndef __INCLUDED_MODEL_PARTS_H__
-#define __INCLUDED_MODEL_PARTS_H__
+#ifndef __INCLUDED_MODEL_TAGS_H__
+#define __INCLUDED_MODEL_TAGS_H__
#include "math/axis.h"
#include "math/color.h"
@@ -17,7 +17,6 @@ namespace model
/* ---- globals ---------------------------------------------------- */
// FIXME this should end up in material.h
-
/**
* @brief
* culling parameter values
@@ -26,31 +25,34 @@ namespace model
*/
enum Cull { CullNone = 0, CullBack = 1, CullFront = 2 };
-/* ---- class Part ------------------------------------------------- */
+/* ---- class Tag -------------------------------------------------- */
/**
- * @brief a special part of a model
+ * @brief a location tag
+ * A location tag provides an anchor point for model extenions
+ * like lights, flares and sounds.
*/
-class Part
+
+class Tag
{
public:
/**
* @brief default constructor
*/
- inline Part() : part_location() {
+ inline Tag() : tag_location() {
}
/**
* @brief copy constructor
*/
- inline Part(const Part& other) : part_location(other.location()) {
+ inline Tag(const Tag& other) : tag_location(other.location()) {
}
/**
* @brief constructor with location
* @param location location of this part within the parent model
*/
- inline Part(const math::Vector3f& location) : part_location(location) {
+ inline Tag(const math::Vector3f& location) : tag_location(location) {
}
/* ---- inspectors ----------------------------------------- */
@@ -59,7 +61,7 @@ public:
* @brief location of this part within the parent model
*/
inline const math::Vector3f& location() const {
- return part_location;
+ return tag_location;
}
/* ---- mutators ------------------------------------------- */
@@ -67,14 +69,14 @@ public:
* @brief set the location within the parent model
*/
inline void set_location(const math::Vector3f& location) {
- part_location.assign(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) {
- part_location.assign(x, y, z);
+ tag_location.assign(x, y, z);
}
/* ---- actors --------------------------------------------- */
@@ -83,17 +85,20 @@ public:
* @brief mutable reference to the location of this part within the parent model
*/
inline math::Vector3f& get_location() {
- return part_location;
+ return tag_location;
}
private:
- math::Vector3f part_location;
+ math::Vector3f tag_location;
};
/* ---- class Light ------------------------------------------------ */
-/// an exterior light
-class Light : public Part
+/**
+ * @brief an exterior light
+ * a tag used to attach exterior lights
+ */
+class Light : public Tag
{
public:
/**
@@ -253,7 +258,9 @@ private:
/* ---- class Flare ------------------------------------------------ */
-/// a flare is a directional light
+/**
+ * @brief a directional light
+ */
class Flare : public Light
{
public:
@@ -299,7 +306,7 @@ private:
/* ---- class Particles -------------------------------------------- */
/// a particle system
-class Particles : public Part
+class Particles : public Tag
{
public:
Particles();
@@ -383,8 +390,8 @@ private:
/* ---- class Dock ------------------------------------------------- */
-/// a docking location
-class Dock : public Part
+/// a docking location tag
+class Dock : public Tag
{
public:
Dock();
@@ -410,10 +417,38 @@ private:
float dock_radius;
};
+/* ---- class Sound ------------------------------------------------ */
+
+/**
+ * @brief a sound location tag
+ */
+class Sound : public Tag
+{
+public:
+ Sound();
+
+ Sound(const Sound& other);
+
+ ~Sound();
+
+ /// name of the sound sample
+ inline const std::string& name() const {
+ return sound_name;
+ }
+
+ inline void set_name(const std::string& name) {
+ sound_name.assign(name);
+ }
+private:
+ std::string sound_name;
+};
+
/* ---- class SubModel --------------------------------------------- */
-/// a submodel
-class SubModel : public Part
+/**
+ * @brief a submodel tag
+ */
+class SubModel : public Tag
{
public:
SubModel();