Skip to content

Commit

Permalink
add comfortable object configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dixx committed Jul 6, 2014
1 parent 620dbc6 commit 9962550
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ObjectConfiguration.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
46 changes: 46 additions & 0 deletions ObjectConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*! \file ObjectConfiguration.h
* \brief Informationen zur Erstellung eines 3D-Objektes.
*/

#ifndef _OBJECTCONFIGURATION_HEADER
#define _OBJECTCONFIGURATION_HEADER

#include <irrlicht.h>
#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
101 changes: 101 additions & 0 deletions ObjectConfigurationContext.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*! \file ObjectConfigurationContext.h
* \brief Untergruppen für ein Konfigurationsobjekt.
*/

#ifndef _OBJECTCONFIGURATIONCONTEXT_HEADER
#define _OBJECTCONFIGURATIONCONTEXT_HEADER

#include <irrlicht.h>
#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("<noname>") {}

};

/*! \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<bool> 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

1 comment on commit 9962550

@dixx
Copy link
Owner Author

@dixx dixx commented on 9962550 Jul 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

belongs to #35

Please sign in to comment.