From 9962550fda7dc23fe6d08fb69287f6821671903a Mon Sep 17 00:00:00 2001 From: dixx Date: Sun, 6 Jul 2014 10:11:20 +0200 Subject: [PATCH] add comfortable object configuration --- ObjectConfiguration.cpp | 24 ++++++++ ObjectConfiguration.h | 46 +++++++++++++++ ObjectConfigurationContext.hpp | 101 +++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 ObjectConfiguration.cpp create mode 100644 ObjectConfiguration.h create mode 100644 ObjectConfigurationContext.hpp diff --git a/ObjectConfiguration.cpp b/ObjectConfiguration.cpp new file mode 100644 index 00000000..efb28530 --- /dev/null +++ b/ObjectConfiguration.cpp @@ -0,0 +1,24 @@ +#include "ObjectConfiguration.h" + + + +ObjectConfiguration::ObjectConfiguration() +{ + object = new ObjectConfigurationContextForObject; + node = new ObjectConfigurationContextForNode; + mesh = new ObjectConfigurationContextForMesh; + materials = new ObjectConfigurationContextForMaterials; + files = new ObjectConfigurationContextForFiles; +} + + + +ObjectConfiguration::~ObjectConfiguration() +{ + // Niemals droppen, wenn Objekt nicht durch "create" erzeugt wurde! + delete files; + delete materials; + delete mesh; + delete node; + delete object; +} diff --git a/ObjectConfiguration.h b/ObjectConfiguration.h new file mode 100644 index 00000000..2f6a997f --- /dev/null +++ b/ObjectConfiguration.h @@ -0,0 +1,46 @@ +/*! \file ObjectConfiguration.h + * \brief Informationen zur Erstellung eines 3D-Objektes. + */ + +#ifndef _OBJECTCONFIGURATION_HEADER +#define _OBJECTCONFIGURATION_HEADER + +#include +#include "ObjectConfigurationContext.hpp" + +using namespace irr; + +/*! \class ObjectConfiguration ObjectConfiguration.h "ObjectConfiguration.h" + * \brief Informationen zur Erstellung eines 3D-Objektes. + * \note Instanzierung: `ObjectConfiguration* myObjectConfiguration = new ObjectConfiguration();` + * \n Benutzen: `myObjectConfiguration->node->name;` + */ +class ObjectConfiguration +{ + +public: + + ObjectConfigurationContextForObject* object; + ObjectConfigurationContextForNode* node; + ObjectConfigurationContextForMesh* mesh; + ObjectConfigurationContextForMaterials* materials; + ObjectConfigurationContextForFiles* files; + + /*! \brief Konstruktor. + * \param - + * \return Zeiger auf das instanzierte Klassenobjekt + */ + ObjectConfiguration(); + + /*! \brief Destruktor + */ + ~ObjectConfiguration(); + +private: + + ObjectConfiguration( const ObjectConfiguration& ); + ObjectConfiguration& operator=( const ObjectConfiguration& ); + +}; + +#endif diff --git a/ObjectConfigurationContext.hpp b/ObjectConfigurationContext.hpp new file mode 100644 index 00000000..eb414203 --- /dev/null +++ b/ObjectConfigurationContext.hpp @@ -0,0 +1,101 @@ +/*! \file ObjectConfigurationContext.h + * \brief Untergruppen für ein Konfigurationsobjekt. + */ + +#ifndef _OBJECTCONFIGURATIONCONTEXT_HEADER +#define _OBJECTCONFIGURATIONCONTEXT_HEADER + +#include +#include "Constants.h" + +using namespace irr; + +/*! \class ObjectConfigurationContextForObject ObjectConfigurationContextForObject.h "ObjectConfigurationContextForObject.h" + * \brief High-Level-Informationen über das zu erstellende 3D-Object. + */ +class ObjectConfigurationContextForObject +{ + +public: + + enum ObjectType { + DEKORATION, + GESCHOSS, + WETTER, + HINDERNIS, + INTERAKTIV, + INVENTAR, + LEBEWESEN, + LEICHE, + BEGEHBAR, + MAUSPFEILREAKTIV + }; // TODO auslagern nach Constants.h und ersetzen aller Vorkommen von `core::stringc type` + + ObjectType type; + + ObjectConfigurationContextForObject() : type(DEKORATION) {} + +}; + +/*! \class ObjectConfigurationContextForNode ObjectConfigurationContextForNode.h "ObjectConfigurationContextForNode.h" + * \brief Informationen über den zu erstellenden Szenenknoten. + */ +class ObjectConfigurationContextForNode +{ + +public: + + core::stringc name; + + ObjectConfigurationContextForNode() : name("") {} + +}; + +/*! \class ObjectConfigurationContextForMesh ObjectConfigurationContextForMesh.h "ObjectConfigurationContextForMesh.h" + * \brief Informationen über das zu erstellende Mesh. + */ +class ObjectConfigurationContextForMesh +{ + +public: + + core::vector3df position, offset, scale, rotation; + + ObjectConfigurationContextForMesh() + : position(VEC_3DF_NULL), offset(VEC_3DF_NULL), scale(core::vector3df( 1.0f )), rotation(VEC_3DF_NULL) + {} + +}; + +/*! \class ObjectConfigurationContextForMaterials ObjectConfigurationContextForMaterials.h "ObjectConfigurationContextForMaterials.h" + * \brief Informationen über die Materialien des zu erstellenden 3D-Objects. + */ +class ObjectConfigurationContextForMaterials +{ + +public: + + core::array isTransparent, isBackFaceCulled; + + ObjectConfigurationContextForMaterials() { + isTransparent.clear(); + isBackFaceCulled.clear(); + } + +}; + +/*! \class ObjectConfigurationContextForFiles ObjectConfigurationContextForFiles.h "ObjectConfigurationContextForFiles.h" + * \brief Dateipfade des 3D-Objects. + */ +class ObjectConfigurationContextForFiles +{ + +public: + + io::path mesh; + + ObjectConfigurationContextForFiles() : mesh("") {} + +}; + +#endif