Commit 7afcfbd1 authored by cutealien's avatar cutealien

Calculating values for orthonormal camera on Collada export. Note that I have...

Calculating values for orthonormal camera on Collada export. Note that I have found no tool yet which can load them, so I have no test so far (CColladaFileLoader also ignores existence of orthographic cameras so far). But the old export was definitely wrong while the new solution should at least work in theory. 

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4409 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e0952a9c
--------------------------
Changes in 1.9 (not yet released)
- Collada exporter calculates values for orthographic camera now on export
- Collada exporter now exports the camera up-vector correctly.
- Add IColladaMeshWriter::findGeometryNameForNode
- Add getters IGUIButton::isDrawBorderEnabled and IGUIButton::isDrawBackgroundEnabled
......
......@@ -661,14 +661,20 @@ void CColladaMeshWriter::writeNodeCameras(irr::scene::ISceneNode * node)
Writer->writeElement(L"orthographic", false);
Writer->writeLineBreak();
// TODO: Those values are not affected by the matrix set for the ortographic projection.
// We do not have those values so far in Irrlicht for orthogonal cameras.
// writeNode(L"xmag", core::stringw("1.0").c_str()); // TODO: do we need xmag, ymag?
// writeNode(L"ymag", core::stringw("1.0").c_str());
writeNode(L"aspect_ratio", core::stringw(cameraNode->getAspectRatio()).c_str());
writeNode(L"znear", core::stringw(cameraNode->getNearValue()).c_str());
writeNode(L"zfar", core::stringw(cameraNode->getFarValue()).c_str());
irr::core::matrix4 projMat( cameraNode->getProjectionMatrix() );
irr::f32 xmag = 2.f/projMat[0];
irr::f32 ymag = 2.f/projMat[5];
// Note that Irrlicht camera does not update near/far when setting the projection matrix,
// so we have to calculate that here (at least currently - maybe camera code will be updated at some time).
irr::f32 nearMinusFar = -1.f/projMat[10];
irr::f32 zNear = projMat[14]*nearMinusFar;
irr::f32 zFar = 1.f/projMat[10] + zNear;
writeNode(L"xmag", core::stringw(xmag).c_str());
writeNode(L"ymag", core::stringw(ymag).c_str());
writeNode(L"znear", core::stringw(zNear).c_str());
writeNode(L"zfar", core::stringw(zFar).c_str());
Writer->writeClosingTag(L"orthographic");
Writer->writeLineBreak();
......
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