From 183f0f0b905715f0d89b38174fdfd44641c1a79c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 12 Aug 2009 12:03:18 +0000 Subject: src/model filenames cleanup, parse .map texture coordinates, early loading of material textures --- src/model/parts.h | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 src/model/parts.h (limited to 'src/model/parts.h') diff --git a/src/model/parts.h b/src/model/parts.h new file mode 100644 index 0000000..8593147 --- /dev/null +++ b/src/model/parts.h @@ -0,0 +1,259 @@ +/* + model/classes.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_MODEL_PARTS_H__ +#define __INCLUDED_MODEL_PARTS_H__ + +#include "math/axis.h" +#include "math/color.h" +#include "math/vector3f.h" + +namespace model +{ + + +/** + * @brief + * 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 Light ------------------------------------------------ */ + +/// an exterior light +class Light +{ +public: + Light(); + + Light(const math::Vector3f & location, const math::Color & color, bool strobe=false); + + ~Light(); + + inline const math::Vector3f & location() const + { + return light_location; + } + + inline const math::Color & color() const + { + return light_color; + }; + + /// 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 + { + return light_entity; + } + + /// size of the light, default is 1.0f + inline float radius() const + { + return light_radius; + } + + /// strobe time offset, in seconds + inline float offset() const + { + return light_offset; + } + + /// frequency in strobes per second + inline float frequency() const + { + return light_frequency; + } + + /// 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 + { + return light_flare; + } + + /// render texture number + inline size_t texture() const + { + return render_texture; + } + + math::Vector3f light_location; + math::Color light_color; + bool light_strobe; + bool light_entity; + float light_radius; + float light_frequency; + float light_offset; + float light_time; + + unsigned int light_flare; + + size_t render_texture; +}; + +/* ---- class Flare ------------------------------------------------ */ + +/// a flare is a directional light +class Flare : public Light +{ +public: + Flare(); + ~Flare(); + + 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; + } + + math::Axis flare_axis; + bool flare_engine; + Cull flare_cull; +}; + +/* ---- class Particles -------------------------------------------- */ + +/// a particle system +class Particles +{ +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; + } + + inline const std::string & script() const + { + return particles_script; + } + + inline const bool entity() const + { + return particles_entity; + } + + inline const bool engine() const + { + return particles_engine; + } + + inline const float radius() const + { + return particles_radius; + } + + inline const Cull cull() const + { + return particles_cull; + } + + std::string particles_script; + math::Vector3f particles_location; + math::Axis particles_axis; + + bool particles_entity; + bool particles_engine; + + float particles_radius; + Cull particles_cull; +}; + +/* ---- class Dock ------------------------------------------------- */ + +/// a docking location +class Dock +{ +public: + Dock(); + ~Dock(); + + /// location of the dock + inline const math::Vector3f & location() const + { + return dock_location; + } + + /// trigger distance default is 0.01f + inline float radius() const + { + return dock_radius; + } + + + math::Vector3f dock_location; + float dock_radius; +}; + +/* ---- class SubModel --------------------------------------------- */ + +/// a submodel +class SubModel +{ +public: + SubModel(); + ~SubModel(); + + inline const std::string &name() const { return submodel_name; } + + inline const float scale() const { return submodel_scale; } + + inline const math::Vector3f &location() const { return submodel_location; } + + inline math::Axis &axis() { return submodel_axis; } + + inline void set_scale(const float scale) { submodel_scale = scale; } + + inline void set_name(const std::string &name) { submodel_name.assign(name); } + + inline void set_location(const math::Vector3f &location) { submodel_location.assign(location); } + + inline void set_axis(const math::Axis &axis) { submodel_axis.assign(axis); } + +private: + std::string submodel_name; + float submodel_scale; + math::Vector3f submodel_location; + math::Axis submodel_axis; +}; + +} + +#endif // __INCLUDED_MODEL_PARTS_H__ + -- cgit v1.2.3