2008-01-16 11:45:17 +00:00
|
|
|
#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"
|
2008-01-17 16:42:24 +00:00
|
|
|
#include "RenderQueue.h"
|
2008-01-16 11:45:17 +00:00
|
|
|
|
|
|
|
// forward declaration
|
|
|
|
class TiXmlElement;
|
|
|
|
|
|
|
|
namespace BlueCore
|
|
|
|
{
|
|
|
|
|
2008-01-17 16:42:24 +00:00
|
|
|
class Model : public Named, public RenderItem
|
2008-01-16 11:45:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2008-01-17 16:42:24 +00:00
|
|
|
void render(RenderDevice *) const;
|
2008-01-16 11:45:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|