Changeset 9820 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Sep 25, 2006, 12:25:00 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/Makefile.am
r9818 r9820 10 10 shader.cc \ 11 11 shader_data.cc \ 12 resource_shader.cc \ 12 13 \ 13 14 render2D/render_2d.cc \ … … 28 29 shader.h \ 29 30 shader_data.h \ 31 resource_shader.h \ 30 32 \ 31 33 render2D/render_2d.h \ -
branches/new_class_id/src/lib/graphics/resource_shader.cc
r9818 r9820 1 1 2 #include "resource_ texture.h"2 #include "resource_shader.h" 3 3 #include "debug.h" 4 4 5 5 6 Resource Texture::ResourceTexture(const std::string& imageName, GLenum target)7 : NewResource(&Resource Texture::type)6 ResourceShader::ResourceShader(const std::string& vertexShaderName, const std::string& fragmentShaderName) 7 : NewResource(&ResourceShader::type) 8 8 { 9 Resources::StorePointer* ptr = this->acquireResource( imageName + ',' + "TEST");9 Resources::StorePointer* ptr = this->acquireResource(vertexShaderName +'|'+fragmentShaderName); 10 10 11 11 if (ptr) 12 12 { 13 PRINTF(5)("FOUN T TEXTURE: %s\n", imageName.c_str());14 this->acquireData(static_cast<Resource Texture::TextureResourcePointer*>(ptr)->ptr());13 PRINTF(5)("FOUND SHADER: %s\n", vertexShaderName.c_str()); 14 this->acquireData(static_cast<ResourceShader::ShaderResourcePointer*>(ptr)->ptr()); 15 15 } 16 16 else 17 17 { 18 PRINTF(5)("NOT FOUNT TEXTURE: %s\n", imageName.c_str()); 19 std::string fileName = this->NewResource::locateFile(imageName); 20 this->Texture::loadImage(fileName, target); 21 this->NewResource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", Resources::KeepLevel(0), this->Texture::dataPointer())); 18 PRINTF(5)("NOT FOUND SHADER: %s\n", vertexShaderName.c_str()); 19 std::string vertexFileName = this->NewResource::locateFile(vertexShaderName); 20 std::string fragmentFileName; 21 if (!fragmentShaderName.empty()) 22 fragmentFileName = this->NewResource::locateFile(fragmentShaderName); 23 24 this->Shader::load(vertexFileName, fragmentFileName); 25 this->NewResource::addResource(new ResourceShader::ShaderResourcePointer(vertexShaderName+'|'+fragmentShaderName, Resources::KeepLevel(0), this->Shader::dataPointer())); 22 26 } 23 27 } 24 28 25 29 26 Resources::Type Resource Texture::type("Texture");30 Resources::Type ResourceShader::type("Shader"); 27 31 28 32 … … 30 34 31 35 32 Resource Texture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data)36 ResourceShader::ShaderResourcePointer::ShaderResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const ShaderData::Pointer& data) 33 37 : Resources::StorePointer(loadString, keepLevel) , pointer(data) 34 38 {} 35 36 -
branches/new_class_id/src/lib/graphics/resource_shader.h
r9818 r9820 1 1 /*! 2 * @file resource_ texture.h3 * @brief Contains the Resource Texture class, that handles the Resource-specific loading part of the Texture.2 * @file resource_shader.h 3 * @brief Contains the ResourceShader class, that handles the Resource-specific loading part of the Shader. 4 4 * 5 5 */ 6 6 7 #ifndef _RESOURCE_ TEXTURE_H8 #define _RESOURCE_ TEXTURE_H7 #ifndef _RESOURCE_SHADER_H 8 #define _RESOURCE_SHADER_H 9 9 10 10 #include "util/loading/resource.h" 11 #include " texture.h"11 #include "shader.h" 12 12 13 13 14 class Resource Texture : public Texture, public Resources::NewResource14 class ResourceShader : public Shader, public Resources::NewResource 15 15 { 16 16 public: 17 Resource Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);17 ResourceShader(const std::string& vertexShaderName, const std::string& fragmentShaderName); 18 18 19 19 20 20 private: 21 class TextureResourcePointer : public Resources::StorePointer21 class ShaderResourcePointer : public Resources::StorePointer 22 22 { 23 23 public: 24 TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data);25 inline const TextureData::Pointer& ptr() const { return pointer; }24 ShaderResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const ShaderData::Pointer& data); 25 inline const ShaderData::Pointer& ptr() const { return pointer; } 26 26 private: 27 TextureData::Pointer pointer;27 ShaderData::Pointer pointer; 28 28 }; 29 29 … … 33 33 34 34 35 #endif /* _RESOURCE_ TEXTURE_H */35 #endif /* _RESOURCE_SHADER_H */ -
branches/new_class_id/src/world_entities/environments/mapped_water.cc
r9818 r9820 164 164 { 165 165 // load shader files 166 shader = Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag"); 166 shader = Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", 167 ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag"); 167 168 168 169 this->shader.activateShader();
Note: See TracChangeset
for help on using the changeset viewer.