- Timestamp:
- Sep 25, 2006, 11:28:28 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/importer/material.cc
r9785 r9823 99 99 100 100 const Material* Material::selectedMaterial = NULL; 101 102 103 /// TODO FIX THIS104 // Material& Material::operator=(const Material& m)105 // {106 // this->setIllum(m.illumModel);107 // this->setDiffuse(m.diffuse[0],m.diffuse[1],m.diffuse[2]);108 // this->setAmbient(m.ambient[0],m.ambient[1],m.ambient[2]);109 // this->setSpecular(m.specular[0],m.specular[1],m.specular[2]);110 // this->setShininess(m.shininess);111 // this->setTransparency(m.transparency);112 //113 // if (this->diffuseTexture != NULL)114 // ResourceManager::getInstance()->unload(this->diffuseTexture);115 // if (m.diffuseTexture != NULL)116 // this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);117 // this->ambientTexture = NULL; /// FIXME118 // this->specularTexture = NULL; /// FIXME119 //120 // this->setName(m.getName());121 // }122 123 124 101 125 102 /** … … 296 273 //ResourceManager::getInstance()->addImageDir(pathName); 297 274 } 298 299 // MAPPING //300 301 275 302 276 /** -
branches/new_class_id/src/lib/graphics/importer/material.h
r9718 r9823 29 29 virtual ~Material (); 30 30 31 Material& operator=(const Material& material); 32 31 33 void loadParams(const TiXmlElement* root); 32 33 Material& operator=(const Material& material);34 34 35 35 bool select () const; -
branches/new_class_id/src/lib/graphics/importer/resource_texture.cc
r9793 r9823 1 1 2 2 #include "resource_texture.h" 3 #include "substring.h" 4 #include "multi_type.h" 3 5 #include "debug.h" 4 6 … … 23 25 } 24 26 27 ResourceTexture ResourceTexture::createFromString(const std::string& loadString) 28 { 29 SubString loadValues(loadString, ','); 30 std::string imageName; 31 GLenum target = GL_TEXTURE_2D; 32 if (loadValues.size() > 0) 33 imageName = loadValues[0]; 34 if (loadValues.size() > 1) 35 target = (GLenum)MultiType(loadValues[2]).getInt(); 25 36 26 Resources::Type ResourceTexture::type("Texture"); 37 return ResourceTexture(imageName, target); 38 } 39 40 41 42 Resources::tType<ResourceTexture> ResourceTexture::type("Texture"); 27 43 28 44 -
branches/new_class_id/src/lib/graphics/importer/resource_texture.h
r9800 r9823 16 16 public: 17 17 ResourceTexture(const std::string& imageName, GLenum target = GL_TEXTURE_2D); 18 18 static ResourceTexture createFromString(const std::string& loadString); 19 19 20 20 private: … … 24 24 TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data); 25 25 inline const TextureData::Pointer& ptr() const { return pointer; } 26 26 private: 27 27 TextureData::Pointer pointer; 28 28 }; 29 29 30 30 private: 31 static Resources:: Typetype;31 static Resources::tType<ResourceTexture> type; 32 32 }; 33 33 -
branches/new_class_id/src/lib/graphics/resource_shader.cc
r9820 r9823 2 2 #include "resource_shader.h" 3 3 #include "debug.h" 4 4 #include "substring.h" 5 5 6 6 ResourceShader::ResourceShader(const std::string& vertexShaderName, const std::string& fragmentShaderName) 7 7 : NewResource(&ResourceShader::type) 8 8 { 9 Resources::StorePointer* ptr = this->acquireResource(vertexShaderName +' |'+fragmentShaderName);9 Resources::StorePointer* ptr = this->acquireResource(vertexShaderName +','+fragmentShaderName); 10 10 11 11 if (ptr) … … 23 23 24 24 this->Shader::load(vertexFileName, fragmentFileName); 25 this->NewResource::addResource(new ResourceShader::ShaderResourcePointer(vertexShaderName+' |'+fragmentShaderName, Resources::KeepLevel(0), this->Shader::dataPointer()));25 this->NewResource::addResource(new ResourceShader::ShaderResourcePointer(vertexShaderName+','+fragmentShaderName, Resources::KeepLevel(0), this->Shader::dataPointer())); 26 26 } 27 27 } 28 28 29 ResourceShader ResourceShader::createFromString(const std::string& loadString) 30 { 31 std::string vertexShaderName; 32 std::string fragmentShaderName; 29 33 30 Resources::Type ResourceShader::type("Shader"); 34 SubString shaderNames(loadString, ','); 35 if (shaderNames.size() > 0) 36 vertexShaderName = shaderNames[0]; 37 if (shaderNames.size() > 1) 38 fragmentShaderName = shaderNames[1]; 31 39 40 return ResourceShader(vertexShaderName, fragmentShaderName); 41 } 32 42 33 34 43 Resources::tType<ResourceShader> ResourceShader::type("Shader"); 35 44 36 45 ResourceShader::ShaderResourcePointer::ShaderResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const ShaderData::Pointer& data) -
branches/new_class_id/src/lib/graphics/resource_shader.h
r9820 r9823 16 16 public: 17 17 ResourceShader(const std::string& vertexShaderName, const std::string& fragmentShaderName); 18 18 static ResourceShader createFromString(const std::string& loadString); 19 19 20 20 private: … … 29 29 30 30 private: 31 static Resources:: Typetype;31 static Resources::tType<ResourceShader> type; 32 32 }; 33 33 -
branches/new_class_id/src/lib/sound/resource_sound_buffer.cc
r9811 r9823 9 9 10 10 ResourceSoundBuffer::ResourceSoundBuffer(const std::string& soundName) 11 : SoundBuffer(), NewResource(&ResourceSoundBuffer::type)11 : SoundBuffer(), NewResource(&ResourceSoundBuffer::type) 12 12 { 13 13 this->registerObject(this, ResourceSoundBuffer::_objectList); … … 30 30 31 31 32 Resources:: TypeResourceSoundBuffer::type("SoundBuffer");32 Resources::tType<ResourceSoundBuffer> ResourceSoundBuffer::type("SoundBuffer"); 33 33 34 34 ResourceSoundBuffer::SoundBufferResourcePointer::SoundBufferResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const SoundBufferData::Pointer& data) 35 35 : Resources::StorePointer(loadString, keepLevel) , pointer(data) 36 {} 37 } 36 {}} -
branches/new_class_id/src/lib/sound/resource_sound_buffer.h
r9811 r9823 18 18 public: 19 19 ResourceSoundBuffer(const std::string& soundName); 20 static ResourceSoundBuffer createFromString(const std::string& loadString) { return ResourceSoundBuffer(loadString); }; 20 21 21 22 private: … … 30 31 31 32 private: 32 static Resources:: Typetype;33 static Resources::tType<ResourceSoundBuffer> type; 33 34 }; 34 35 } -
branches/new_class_id/src/lib/util/filesys/directory.cc
r9785 r9823 215 215 File operator+(const Directory& dir, const File& file) 216 216 { 217 return File(dir.name() + '/'+ file.name());218 } 217 return File(dir.name() + Directory::delimiter + file.name()); 218 } -
branches/new_class_id/src/lib/util/filesys/directory.h
r9785 r9823 65 65 const std::string& operator[](unsigned int fileNumber) const { return this->_fileNames[fileNumber]; }; 66 66 /** @returns a formated string containing the FileName, prepended with the directory-Name */ 67 std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + "/"+ _fileNames[fileNumber]; };67 std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + Directory::delimiter + _fileNames[fileNumber]; }; 68 68 /** @returns a File pointing to the File @param fileNumber the fileNumber (must not bigger than fileCount()) */ 69 69 File getFile(unsigned int fileNumber) const { return File(fileNameInDir(fileNumber)); }; -
branches/new_class_id/src/lib/util/loading/resource.h
r9801 r9823 61 61 public: 62 62 Type(const std::string& typeName); 63 ~Type();63 virtual ~Type(); 64 64 /** @returns true if the names match @param resourceName the Name to compare. @brief compare the Type with a Name */ 65 65 bool operator==(const std::string& resourceName) const { return this->_typeName == resourceName; }; … … 82 82 const std::vector<Resources::StorePointer*>& storedResources() const { return _storedResources; }; 83 83 84 virtual void createFromString(const std::string& loadString) = 0; 85 84 86 void setID(int id); 85 87 void addResource(Resources::StorePointer* resource); … … 95 97 96 98 std::vector<Resources::StorePointer*> _storedResources; //!< An array of all the stored Resources. 99 }; 100 101 template<class T> class tType : public Type 102 { 103 public: 104 tType(const std::string& typeName) : Type(typeName) {}; 105 virtual void createFromString(const std::string& loadString) { T::createFromString(loadString); } 97 106 }; 98 107 -
branches/new_class_id/src/story_entities/game_world.cc
r9816 r9823 694 694 * removes the loadscreen, and changes over to the game 695 695 */ 696 void GameWorld::releaseLoadScreen 696 void GameWorld::releaseLoadScreen() 697 697 { 698 698 PRINTF(3)("GameWorld::releaseLoadScreen - start\n"); -
branches/new_class_id/src/world_entities/environments/water.cc
r9716 r9823 23 23 #include "material.h" 24 24 25 #include "util/loading/resource_manager.h" 26 #include "shader.h" 25 #include "resource_shader.h" 27 26 28 27 #include "skybox.h" … … 56 55 57 56 this->rebuildGrid(); 58 this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, "shaders/water.frag");57 this->waterShader = ResourceShader("shaders/water.vert", "shaders/water.frag"); 59 58 60 59 // To test the Wave equation -
branches/new_class_id/src/world_entities/environments/water.h
r9715 r9823 13 13 #include "world_entity.h" 14 14 #include "material.h" 15 15 #include "shader.h" 16 16 17 17 /* FORWARD DECLARATION */ 18 18 class Grid; 19 class Shader;20 19 21 20 //! A Class to handle a WaterEffects … … 52 51 53 52 Material waterMaterial; 54 Shader *waterShader;53 Shader waterShader; 55 54 56 55 float height; //!< The hight of the Water -
branches/new_class_id/src/world_entities/skybox.cc
r9727 r9823 27 27 #include "network_game_manager.h" 28 28 #include "converter.h" 29 #include " util/loading/resource_manager.h"29 #include "resource_texture.h" 30 30 31 31 #include "debug.h" … … 113 113 if (this->material[i]) 114 114 delete this->material[i]; 115 if (this->cubeTexture[i])116 ResourceManager::getInstance()->unload(this->cubeTexture[i]);117 115 } 118 116 } … … 175 173 const std::string& posZ, const std::string& posX, const std::string& negX) 176 174 { 177 this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(negX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);178 this->cubeTexture[1] = (Texture*)ResourceManager::getInstance()->load(posX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);179 180 this->cubeTexture[2] = (Texture*)ResourceManager::getInstance()->load(negY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);181 this->cubeTexture[3] = (Texture*)ResourceManager::getInstance()->load(posY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);182 183 this->cubeTexture[4] = (Texture*)ResourceManager::getInstance()->load(negZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);184 this->cubeTexture[5] = (Texture*)ResourceManager::getInstance()->load(posZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);175 this->cubeTexture[0] = ResourceTexture(negX, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT); 176 this->cubeTexture[1] = ResourceTexture(posX, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT); 177 178 this->cubeTexture[2] = ResourceTexture(negY, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT); 179 this->cubeTexture[3] = ResourceTexture(posY, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT); 180 181 this->cubeTexture[4] = ResourceTexture(negZ, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT); 182 this->cubeTexture[5] = ResourceTexture(posZ, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT); 185 183 } 186 184 -
branches/new_class_id/src/world_entities/skybox.h
r9715 r9823 65 65 66 66 Material* material[6]; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back 67 Texture *cubeTexture[6]; //!< Textures for the CubeMap.67 Texture cubeTexture[6]; //!< Textures for the CubeMap. 68 68 69 69 float size; //!< Size of the SkyBox. This should match the frustum maximum range.
Note: See TracChangeset
for help on using the changeset viewer.