Start to abstract model

This commit is contained in:
Will
2013-12-05 16:17:41 +01:00
parent bf1c7df8bb
commit 6afadafa1e
22 changed files with 123 additions and 126 deletions

View File

@@ -33,7 +33,7 @@ public:
virtual TextRenderer3D *newTextRenderer3D() {return new TextRenderer3DGl();}
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
virtual Context *newContext() {return new ContextGl();}
virtual Model *newModel() {return new ModelGl();}
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) { return new ModelGl(path,deletePixMapAfterLoad,loadedFileList,sourceLoader); }
virtual Texture2D *newTexture2D() {return new Texture2DGl();}
virtual Font2D *newFont2D() {return new Font2DGl();}
virtual Font3D *newFont3D() {return new Font3DGl();}

View File

@@ -47,7 +47,7 @@ public:
//models
virtual ModelManager *newModelManager() {return new ModelManager();}
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
virtual Model *newModel() {return new ModelGl();}
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) { return new ModelGl(path,deletePixMapAfterLoad,loadedFileList,sourceLoader); }
//text
virtual FontManager *newFontManager() {return new FontManager();}

View File

@@ -22,6 +22,9 @@ namespace Shared{ namespace Graphics{ namespace Gl{
// =====================================================
class ModelGl: public Model{
friend class GraphicsFactoryGl;
protected:
ModelGl(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader);
public:
virtual void init(){}
virtual void end(){}

View File

@@ -13,6 +13,11 @@
#define _SHARED_GRAPHICS_GRAPHICSFACTORY_H_
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
using std::string;
#include "leak_dumper.h"
namespace Shared{ namespace Graphics{
@@ -64,7 +69,7 @@ public:
//models
virtual ModelManager *newModelManager() {return NULL;}
virtual ModelRenderer *newModelRenderer() {return NULL;}
virtual Model *newModel() {return NULL;}
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,std::vector<std::pair<string, string> > > *loadedFileList, string *sourceLoader) {return NULL;}
//text
virtual FontManager *newFontManager() {return NULL;}

View File

@@ -35,7 +35,7 @@ enum ResourceScope {
class RendererInterface {
public:
virtual Texture2D *newTexture2D(ResourceScope rs) = 0;
virtual Model *newModel(ResourceScope rs) = 0;
virtual Model *newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL) = 0;
virtual ~RendererInterface() {}
};

View File

@@ -221,9 +221,7 @@ public:
uint32 getVertexCount() const;
//io
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
void save(const string &path, string convertTextureToFormat,bool keepsmallest);
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string sourceLoader="");
void saveG3d(const string &path, string convertTextureToFormat,bool keepsmallest);
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
@@ -234,6 +232,11 @@ public:
void toEndian();
void fromEndian();
protected:
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string sourceLoader="");
private:
void buildInterpolationData() const;
void autoJoinMeshFrames();

View File

@@ -38,7 +38,7 @@ public:
ModelManager();
virtual ~ModelManager();
Model *newModel();
Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader);
void init();
void end();