You need to sign in or sign up before continuing.
Commit 94e8a3e3 authored by hybrid's avatar hybrid

Start with texture support implementation.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1202 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e5dc2bf3
...@@ -92,6 +92,7 @@ namespace scene ...@@ -92,6 +92,7 @@ namespace scene
const core::stringc paramTagName = "param"; const core::stringc paramTagName = "param";
const core::stringc initFromName = "init_from"; const core::stringc initFromName = "init_from";
const core::stringc textureNodeName = "texture";
const core::stringc doubleSidedName = "double_sided"; const core::stringc doubleSidedName = "double_sided";
const core::stringc profileCOMMONSectionName = "profile_COMMON"; const core::stringc profileCOMMONSectionName = "profile_COMMON";
...@@ -168,7 +169,6 @@ namespace scene ...@@ -168,7 +169,6 @@ namespace scene
} }
scene::IMesh* Mesh; scene::IMesh* Mesh;
core::map<u32, video::SMaterial*> MaterialMapping;
//! creates an instance of this prefab //! creates an instance of this prefab
virtual scene::ISceneNode* addInstance(scene::ISceneNode* parent, virtual scene::ISceneNode* addInstance(scene::ISceneNode* parent,
...@@ -1301,6 +1301,18 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect * ...@@ -1301,6 +1301,18 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect *
transparency = colorf; transparency = colorf;
} }
else else
if (reader->getNodeType() == io::EXN_ELEMENT &&
textureNodeName == reader->getNodeName())
{
const core::stringc tname = reader->getAttributeValue("texture");
for (u32 i=0; i<Images.size(); ++i)
if ((tname == Images[i].Id) && Images[i].Filename.size())
{
effect->Mat.setTexture(0, Driver->getTexture(Images[i].Filename.c_str()));
break;
}
}
else
if (reader->getNodeType() == io::EXN_ELEMENT) if (reader->getNodeType() == io::EXN_ELEMENT)
skipSection(reader, false); skipSection(reader, false);
else else
...@@ -1412,6 +1424,7 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect * ...@@ -1412,6 +1424,7 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect *
} }
} }
const SColladaMaterial * CColladaFileLoader::findMaterial(const core::stringc & materialName) const SColladaMaterial * CColladaFileLoader::findMaterial(const core::stringc & materialName)
{ {
// do a quick lookup in the materials // do a quick lookup in the materials
...@@ -1438,6 +1451,7 @@ const SColladaMaterial * CColladaFileLoader::findMaterial(const core::stringc & ...@@ -1438,6 +1451,7 @@ const SColladaMaterial * CColladaFileLoader::findMaterial(const core::stringc &
return &Materials[mat]; return &Materials[mat];
} }
void CColladaFileLoader::readBindMaterialSection(io::IXMLReaderUTF8* reader, const core::stringc & id) void CColladaFileLoader::readBindMaterialSection(io::IXMLReaderUTF8* reader, const core::stringc & id)
{ {
#ifdef COLLADA_READER_DEBUG #ifdef COLLADA_READER_DEBUG
......
...@@ -133,7 +133,7 @@ struct SColladaEffect ...@@ -133,7 +133,7 @@ struct SColladaEffect
}; };
struct SNumberArray // for stroring float and int arrays struct SNumberArray // for storing float and int arrays
{ {
core::stringc Name; core::stringc Name;
core::array<f32> Data; core::array<f32> Data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment