Commit 009a6bfc authored by cutealien's avatar cutealien

ColladaMeshWriter: switch y to (1-y) in UV's as Collada is right-handed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3870 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 1c495448
......@@ -713,6 +713,12 @@ irr::core::stringw CColladaMeshWriter::toString(const irr::core::vector3df& vec)
return str;
}
irr::core::stringw CColladaMeshWriter::uvToString(const irr::core::vector2df& vec) const
{
// change handedness
return toString( core::vector2df(vec.X, 1.f-vec.Y) );
}
irr::core::stringw CColladaMeshWriter::toString(const irr::core::vector2df& vec) const
{
c8 tmpbuf[255];
......@@ -1255,7 +1261,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringw& meshname, s
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
for (u32 j=0; j<vertexCount; ++j)
{
Writer->writeText(toString(vtx[j].TCoords).c_str());
Writer->writeText(uvToString(vtx[j].TCoords).c_str());
Writer->writeLineBreak();
}
}
......@@ -1265,7 +1271,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringw& meshname, s
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (u32 j=0; j<vertexCount; ++j)
{
Writer->writeText(toString(vtx[j].TCoords).c_str());
Writer->writeText(uvToString(vtx[j].TCoords).c_str());
Writer->writeLineBreak();
}
}
......@@ -1275,7 +1281,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringw& meshname, s
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
for (u32 j=0; j<vertexCount; ++j)
{
Writer->writeText(toString(vtx[j].TCoords).c_str());
Writer->writeText(uvToString(vtx[j].TCoords).c_str());
Writer->writeLineBreak();
}
}
......
......@@ -81,6 +81,7 @@ protected:
bool hasSecondTextureCoordinates(video::E_VERTEX_TYPE type) const;
inline irr::core::stringw toString(const irr::core::vector3df& vec) const;
inline irr::core::stringw uvToString(const irr::core::vector2df& vec) const;
inline irr::core::stringw toString(const irr::core::vector2df& vec) const;
inline irr::core::stringw toString(const irr::video::SColorf& colorf, bool writeAlpha=true) const;
inline irr::core::stringw toString(const irr::video::ECOLOR_FORMAT format) const;
......
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