81 lines
1.4 KiB
C
81 lines
1.4 KiB
C
|
#ifndef BLUECORE_MODEL_MANAGER_H
|
||
|
#define BLUECORE_MODEL_MANAGER_H
|
||
|
|
||
|
// system includes
|
||
|
#include <map>
|
||
|
#include <string>
|
||
|
|
||
|
// project includes
|
||
|
#include "Utilities/Referenced.h"
|
||
|
#include "Utilities/Named.h"
|
||
|
|
||
|
#include "TextureManager.h"
|
||
|
#include "ShaderManager.h"
|
||
|
#include "MeshManager.h"
|
||
|
|
||
|
// forward declaration
|
||
|
class TiXmlElement;
|
||
|
|
||
|
namespace BlueCore
|
||
|
{
|
||
|
|
||
|
class Model : public Referenced, public Named
|
||
|
{
|
||
|
|
||
|
public:
|
||
|
|
||
|
struct TextureUnit
|
||
|
{
|
||
|
std::string mName;
|
||
|
ref_ptr<Texture> mTexture;
|
||
|
};
|
||
|
|
||
|
struct RenderPassDefinition
|
||
|
{
|
||
|
bool Enabled;
|
||
|
std::vector<TextureUnit> Textures;
|
||
|
ShaderProgram Program;
|
||
|
bool Tangents;
|
||
|
float Shininess;
|
||
|
float Specular[4];
|
||
|
};
|
||
|
|
||
|
ref_ptr<Mesh> ModelMesh;
|
||
|
ref_ptr<Mesh> ShadowMesh;
|
||
|
RenderPassDefinition AmbientPass;
|
||
|
RenderPassDefinition LitPass;
|
||
|
RenderPassDefinition DefaultPass;
|
||
|
|
||
|
void render();
|
||
|
};
|
||
|
|
||
|
class ModelManager : public Referenced
|
||
|
{
|
||
|
|
||
|
private:
|
||
|
|
||
|
typedef std::map< std::string, weak_ptr<Model> > ModelContainer;
|
||
|
|
||
|
ModelContainer _Models;
|
||
|
weak_ptr<TextureManager> _TextureManager;
|
||
|
weak_ptr<ShaderManager> _ShaderManager;
|
||
|
weak_ptr<MeshManager> _MeshManager;
|
||
|
|
||
|
void parseRenderPassDefinition(Model::RenderPassDefinition &Definition,
|
||
|
const TiXmlElement* DefinitionElement);
|
||
|
|
||
|
void unload();
|
||
|
|
||
|
public:
|
||
|
|
||
|
ModelManager(TextureManager *texturemanager, ShaderManager* shadermanager,
|
||
|
MeshManager* meshmanager);
|
||
|
~ModelManager();
|
||
|
|
||
|
Model *loadModel(const std::string &name);
|
||
|
};
|
||
|
|
||
|
} // namespace BlueCore
|
||
|
|
||
|
#endif
|