Changeset 9831 in orxonox.OLD for branches/new_class_id/src/lib/graphics/importer/resource_obj.cc
- Timestamp:
- Sep 26, 2006, 3:18:28 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/importer/resource_obj.cc
r9830 r9831 1 1 2 #include "resource_ texture.h"2 #include "resource_obj.h" 3 3 #include "substring.h" 4 4 #include "multi_type.h" … … 6 6 7 7 8 Resource Texture::ResourceTexture(const std::string& imageName, GLenum target)9 : NewResource(&Resource Texture::type)8 ResourceOBJ::ResourceOBJ(const std::string& imageName, float scaling) 9 : NewResource(&ResourceOBJ::type) 10 10 { 11 Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + "TEST");11 Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + MultiType(scaling).getString()); 12 12 13 13 if (ptr) 14 14 { 15 PRINTF(5)("FOUN T TEXTURE: %s\n", imageName.c_str());16 this->acquireData(static_cast<Resource Texture::TextureResourcePointer*>(ptr)->ptr());15 PRINTF(5)("FOUND OBJ: %s\n", imageName.c_str()); 16 this->acquireData(static_cast<ResourceOBJ::OBJResourcePointer*>(ptr)->ptr()); 17 17 } 18 18 else 19 19 { 20 PRINTF(5)("NOT FOUN T TEXTURE: %s\n", imageName.c_str());20 PRINTF(5)("NOT FOUND OBJ: %s\n", imageName.c_str()); 21 21 std::string fileName = this->NewResource::locateFile(imageName); 22 this-> Texture::loadImage(fileName, target);23 this->NewResource::addResource(new Resource Texture::TextureResourcePointer(imageName + ',' + "TEST", Resources::KeepLevel(0), this->Texture::dataPointer()));22 this->acquireData(OBJModel(fileName, scaling).dataPointer()); 23 this->NewResource::addResource(new ResourceOBJ::OBJResourcePointer(imageName + ',' + MultiType(scaling).getString(), Resources::KeepLevel(0), this->StaticModel::dataPointer())); 24 24 } 25 25 } 26 26 27 Resource Texture ResourceTexture::createFromString(const std::string& loadString)27 ResourceOBJ ResourceOBJ::createFromString(const std::string& loadString) 28 28 { 29 29 SubString loadValues(loadString, ','); 30 30 std::string imageName; 31 GLenum target = GL_TEXTURE_2D;31 float scaling = 1.0f; 32 32 if (loadValues.size() > 0) 33 33 imageName = loadValues[0]; 34 34 if (loadValues.size() > 1) 35 target = (GLenum)MultiType(loadValues[2]).getInt();35 scaling = (GLenum)MultiType(loadValues[2]).getFloat(); 36 36 37 return Resource Texture(imageName, target);37 return ResourceOBJ(imageName, scaling); 38 38 } 39 39 40 40 41 41 42 Resources::tType<Resource Texture> ResourceTexture::type("Texture");42 Resources::tType<ResourceOBJ> ResourceOBJ::type("OBJ"); 43 43 44 44 … … 46 46 47 47 48 Resource Texture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data)48 ResourceOBJ::OBJResourcePointer::OBJResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const StaticModelData::Pointer& data) 49 49 : Resources::StorePointer(loadString, keepLevel) , pointer(data) 50 50 {}
Note: See TracChangeset
for help on using the changeset viewer.