- did some code refactoring, wanted to load some textures threaded but bailed out due to opengl's hideous problems related to multi-threads

This commit is contained in:
Mark Vejvoda
2011-03-22 02:02:54 +00:00
parent cb96d86a62
commit f7fdafbff4
9 changed files with 367 additions and 172 deletions

View File

@@ -15,13 +15,23 @@
#include <vector>
#include <string>
#include "util.h"
#include "texture.h"
#include "leak_dumper.h"
using namespace std;
using namespace Shared::Util;
using namespace Shared::Graphics;
namespace Shared { namespace PlatformCommon {
//
// This interface describes the methods a callback object must implement
//
class FileCRCPreCacheThreadCallbackInterface {
public:
virtual vector<Texture2D *> processTech(string techName) = 0;
};
// =====================================================
// class FileCRCPreCacheThread
// =====================================================
@@ -31,13 +41,22 @@ class FileCRCPreCacheThread : public BaseThread
protected:
vector<string> techDataPaths;
vector<string> workerThreadTechPaths;
FileCRCPreCacheThreadCallbackInterface *processTechCB;
Mutex mutexPendingTextureList;
vector<Texture2D *> pendingTextureList;
void addPendingTexture(Texture2D *texture);
void addPendingTextureList(vector<Texture2D *> textureList);
public:
FileCRCPreCacheThread();
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths);
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths,FileCRCPreCacheThreadCallbackInterface *processTechCB);
virtual void execute();
void setTechDataPaths(vector<string> value) { this->techDataPaths = value; }
void setWorkerThreadTechPaths(vector<string> value) { this->workerThreadTechPaths = value; }
void setFileCRCPreCacheThreadCallbackInterface(FileCRCPreCacheThreadCallbackInterface *value) { processTechCB = value; }
vector<Texture2D *> getPendingTextureList(int maxTexturesToGet);
};
// =====================================================