Commit 9171ea99 authored by cutealien's avatar cutealien

Better support for Collada texture-wrapping on loading.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4103 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b7609b07
......@@ -1541,7 +1541,22 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect *
effect->Mat.MaterialType = irr::video::EMT_TRANSPARENT_VERTEX_ALPHA;
effect->Mat.ZWriteEnable = false;
}
effect->Mat.setFlag(video::EMF_TEXTURE_WRAP, !effect->Parameters->getAttributeAsBool("wrap_s"));
video::E_TEXTURE_CLAMP twu = video::ETC_REPEAT;
s32 idx = effect->Parameters->findAttribute(wrapsName.c_str());
if ( idx >= 0 )
twu = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx));
video::E_TEXTURE_CLAMP twv = video::ETC_REPEAT;
idx = effect->Parameters->findAttribute(wraptName.c_str());
if ( idx >= 0 )
twv = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx));
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
{
effect->Mat.TextureLayer[i].TextureWrapU = twu;
effect->Mat.TextureLayer[i].TextureWrapV = twv;
}
effect->Mat.setFlag(video::EMF_BILINEAR_FILTER, effect->Parameters->getAttributeAsBool("bilinear"));
effect->Mat.setFlag(video::EMF_TRILINEAR_FILTER, effect->Parameters->getAttributeAsBool("trilinear"));
effect->Mat.setFlag(video::EMF_ANISOTROPIC_FILTER, effect->Parameters->getAttributeAsBool("anisotropic"));
......@@ -2860,7 +2875,15 @@ void CColladaFileLoader::readParameter(io::IXMLReaderUTF8* reader, io::IAttribut
reader->read();
const core::stringc val = reader->getNodeData();
if (val == "WRAP")
parameters->addBool("wrap_s", true);
parameters->addInt(wrapsName.c_str(), (int)video::ETC_REPEAT);
else if ( val== "MIRROR")
parameters->addInt(wrapsName.c_str(), (int)video::ETC_MIRROR);
else if ( val== "CLAMP")
parameters->addInt(wrapsName.c_str(), (int)video::ETC_CLAMP_TO_EDGE);
else if ( val== "BORDER")
parameters->addInt(wrapsName.c_str(), (int)video::ETC_CLAMP_TO_BORDER);
else if ( val== "NONE")
parameters->addInt(wrapsName.c_str(), (int)video::ETC_CLAMP_TO_BORDER);
}
else
if (wraptName == reader->getNodeName())
......@@ -2868,7 +2891,15 @@ void CColladaFileLoader::readParameter(io::IXMLReaderUTF8* reader, io::IAttribut
reader->read();
const core::stringc val = reader->getNodeData();
if (val == "WRAP")
parameters->addBool("wrap_t", true);
parameters->addInt(wraptName.c_str(), (int)video::ETC_REPEAT);
else if ( val== "MIRROR")
parameters->addInt(wraptName.c_str(), (int)video::ETC_MIRROR);
else if ( val== "CLAMP")
parameters->addInt(wraptName.c_str(), (int)video::ETC_CLAMP_TO_EDGE);
else if ( val== "BORDER")
parameters->addInt(wraptName.c_str(), (int)video::ETC_CLAMP_TO_BORDER);
else if ( val== "NONE")
parameters->addInt(wraptName.c_str(), (int)video::ETC_CLAMP_TO_BORDER);
}
else
if (minfilterName == reader->getNodeName())
......
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