Changeset 9820 in orxonox.OLD for branches/new_class_id/src/lib/graphics/resource_shader.cc
- Timestamp:
- Sep 25, 2006, 12:25:00 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.