Commit 39f9b8fa authored by cutealien's avatar cutealien

Fix: Collada reader/writer now uses wrap_p for third texture wrap value...

Fix: Collada reader/writer now uses wrap_p for third texture wrap value instead of invalid wrap_r (thx @Yoran for bugreport).
Seems that Irrlicht uses u,v,w, OpenGL uses s,t,r and Collada uses s,t,p
Files written by older Irrlicht can still be read (aka reader still supports wrap_r)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5297 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 3c57e017
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- Fix: Collada writer now uses wrap_p for third texture wrap value instead of invalid wrap_w (thx @Yoran for bugreport)
- Several getter functions in IAttributes made const (thx @Erik Schultheis for the patch) - Several getter functions in IAttributes made const (thx @Erik Schultheis for the patch)
- Fix: CTriangleSelector no longer ignores meshbuffer transformations from skinned meshes (thx @AlexAzazel for report and test-model). - Fix: CTriangleSelector no longer ignores meshbuffer transformations from skinned meshes (thx @AlexAzazel for report and test-model).
- Randomizer now returns range 0..randMax as documented and no longer 1..randMax as it did before. randMax got reduced by 1. - Randomizer now returns range 0..randMax as documented and no longer 1..randMax as it did before. randMax got reduced by 1.
......
...@@ -108,7 +108,8 @@ namespace ...@@ -108,7 +108,8 @@ namespace
const core::stringc dataName = "data"; const core::stringc dataName = "data";
const core::stringc wrapsName = "wrap_s"; const core::stringc wrapsName = "wrap_s";
const core::stringc wraptName = "wrap_t"; const core::stringc wraptName = "wrap_t";
const core::stringc wraprName = "wrap_r"; const core::stringc wraprName = "wrap_r"; // for downward compatibility to bug in old Irrlicht collada writer. Not standard but we wrote that accidentally up to Irrlicht 1.8, so we should still be able to load those files
const core::stringc wrappName = "wrap_p";
const core::stringc minfilterName = "minfilter"; const core::stringc minfilterName = "minfilter";
const core::stringc magfilterName = "magfilter"; const core::stringc magfilterName = "magfilter";
const core::stringc mipfilterName = "mipfilter"; const core::stringc mipfilterName = "mipfilter";
...@@ -1571,9 +1572,16 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect * ...@@ -1571,9 +1572,16 @@ void CColladaFileLoader::readEffect(io::IXMLReaderUTF8* reader, SColladaEffect *
if ( idx >= 0 ) if ( idx >= 0 )
twv = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx)); twv = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx));
video::E_TEXTURE_CLAMP twr = video::ETC_REPEAT; video::E_TEXTURE_CLAMP twr = video::ETC_REPEAT;
idx = effect->Parameters->findAttribute(wrappName.c_str());
if ( idx >= 0 )
twr = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx));
else
{
// for downward compatibility with older Irrlicht collada writer
idx = effect->Parameters->findAttribute(wraprName.c_str()); idx = effect->Parameters->findAttribute(wraprName.c_str());
if ( idx >= 0 ) if ( idx >= 0 )
twr = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx)); twr = (video::E_TEXTURE_CLAMP)(effect->Parameters->getAttributeAsInt(idx));
}
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i) for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
{ {
......
...@@ -1381,10 +1381,10 @@ void CColladaMeshWriter::writeMaterialEffect(const irr::core::stringw& materialf ...@@ -1381,10 +1381,10 @@ void CColladaMeshWriter::writeMaterialEffect(const irr::core::stringw& materialf
Writer->writeClosingTag(L"wrap_t"); Writer->writeClosingTag(L"wrap_t");
Writer->writeLineBreak(); Writer->writeLineBreak();
// <wrap_r>WRAP</wrap_r> // <wrap_p>WRAP</wrap_p>
Writer->writeElement(L"wrap_r", false); Writer->writeElement(L"wrap_p", false);
Writer->writeText(toString((video::E_TEXTURE_CLAMP)layer.TextureWrapW).c_str()); Writer->writeText(toString((video::E_TEXTURE_CLAMP)layer.TextureWrapW).c_str());
Writer->writeClosingTag(L"wrap_r"); Writer->writeClosingTag(L"wrap_p");
Writer->writeLineBreak(); Writer->writeLineBreak();
// <minfilter>LINEAR_MIPMAP_LINEAR</minfilter> // <minfilter>LINEAR_MIPMAP_LINEAR</minfilter>
......
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