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

@@ -0,0 +1,20 @@
// ==============================================================
// This file is part of Glest Shared Library (www.glest.org)
//
// Copyright (C) 2001-2008 Martiño Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
#include "model_gl.h"
namespace Shared{ namespace Graphics{ namespace Gl{
ModelGl::ModelGl(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) {
load(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
}
}}}//end namespace

View File

@@ -40,8 +40,8 @@ ModelManager::~ModelManager(){
end();
}
Model *ModelManager::newModel(){
Model *model= GraphicsInterface::getInstance().getFactory()->newModel();
Model *ModelManager::newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader){
Model *model= GraphicsInterface::getInstance().getFactory()->newModel(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
model->setTextureManager(textureManager);
models.push_back(model);
return model;

View File

@@ -121,55 +121,60 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
// prepare command to be executed
// our program need to be passed after the -e parameter
#if __APPLE_CC__
snprintf(buf, 8096,"xcrun atos -v -o %s %p",PlatformExceptionHandler::application_binary.c_str(),address);
fprintf(stderr,"> %s\n",buf);
#else
snprintf(buf, 8096,"addr2line -C -e %s -f -i %p",PlatformExceptionHandler::application_binary.c_str(),address);
#endif
FILE* f = popen (buf, "r");
if (f == NULL) {
perror (buf);
return 0;
}
#if __APPLE_CC__
//### TODO Will: still working this out
int len = fread(buf,1,maxbufSize,f);
buf[len] = 0;
fprintf(stderr,"< %s",buf);
return -1;
#endif
for(;function != NULL && function[0] != '\0';) {
// get function name
char *ret = fgets (buf, maxbufSize, f);
if(ret == NULL) {
pclose(f);
return line;
}
//printf("Looking for [%s] Found [%s]\n",function,ret);
if(strstr(ret,function) != NULL) {
break;
}
// get file and line
ret = fgets (buf, maxbufSize, f);
if(ret == NULL) {
pclose(f);
return line;
}
if(function != NULL && function[0] != '\0') {
line = 0;
for(;function != NULL && function[0] != '\0';) {
// get function name
char *ret = fgets (buf, maxbufSize, f);
if(ret == NULL) {
pclose(f);
return line;
}
//printf("Looking for [%s] Found [%s]\n",function,ret);
if(strstr(ret,function) != NULL) {
break;
}
if(strlen(buf) > 0 && buf[0] != '?') {
//int l;
char *p = buf;
// file name is until ':'
while(*p != 0 && *p != ':') {
p++;
}
// get file and line
ret = fgets (buf, maxbufSize, f);
if(ret == NULL) {
pclose(f);
return line;
}
if(strlen(buf) > 0 && buf[0] != '?') {
//int l;
char *p = buf;
// file name is until ':'
while(*p != 0 && *p != ':') {
p++;
}
*p++ = 0;
// after file name follows line number
strcpy (file , buf);
sscanf (p,"%10d", &line);
}
else {
strcpy (file,"unknown");
line = 0;
}
}
}
*p++ = 0;
// after file name follows line number
strcpy (file , buf);
sscanf (p,"%10d", &line);
}
else {
strcpy (file,"unknown");
line = 0;
}
}
// get file and line
char *ret = fgets (buf, maxbufSize, f);