Commit 3cf4e010 authored by Nadro's avatar Nadro

- Fixed shadows issue in example no. 8.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4317 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 0942a6d3
...@@ -255,7 +255,7 @@ int main() ...@@ -255,7 +255,7 @@ int main()
anode->setAnimationSpeed(15); anode->setAnimationSpeed(15);
// add shadow // add shadow
anode->addShadowVolumeSceneNode(); anode->addShadowVolumeSceneNode(0, -1, true, 400.0f); // workaround for infinity matrix problem
smgr->setShadowColor(video::SColor(150,0,0,0)); smgr->setShadowColor(video::SColor(150,0,0,0));
// make the model a little bit bigger and normalize its normals // make the model a little bit bigger and normalize its normals
......
...@@ -90,6 +90,7 @@ void CShadowVolumeSceneNode::createShadowVolume(const core::vector3df& light, bo ...@@ -90,6 +90,7 @@ void CShadowVolumeSceneNode::createShadowVolume(const core::vector3df& light, bo
#define IRR_USE_ADJACENCY #define IRR_USE_ADJACENCY
#define IRR_USE_REVERSE_EXTRUDED
u32 CShadowVolumeSceneNode::createEdgesAndCaps(const core::vector3df& light, u32 CShadowVolumeSceneNode::createEdgesAndCaps(const core::vector3df& light,
SShadowVolume* svp) SShadowVolume* svp)
...@@ -104,7 +105,12 @@ u32 CShadowVolumeSceneNode::createEdgesAndCaps(const core::vector3df& light, ...@@ -104,7 +105,12 @@ u32 CShadowVolumeSceneNode::createEdgesAndCaps(const core::vector3df& light,
const core::vector3df v1 = Vertices[Indices[3*i+1]]; const core::vector3df v1 = Vertices[Indices[3*i+1]];
const core::vector3df v2 = Vertices[Indices[3*i+2]]; const core::vector3df v2 = Vertices[Indices[3*i+2]];
#ifdef IRR_USE_REVERSE_EXTRUDED
FaceData[i]=core::triangle3df(v0,v1,v2).isFrontFacing(light); FaceData[i]=core::triangle3df(v0,v1,v2).isFrontFacing(light);
#else
FaceData[i]=core::triangle3df(v2,v1,v0).isFrontFacing(light);
#endif
if (UseZFailMethod && FaceData[i]) if (UseZFailMethod && FaceData[i])
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -284,7 +290,7 @@ void CShadowVolumeSceneNode::render() ...@@ -284,7 +290,7 @@ void CShadowVolumeSceneNode::render()
if (!ShadowVolumesUsed || !driver) if (!ShadowVolumesUsed || !driver)
return; return;
if (UseZFailMethod && SceneManager->getActiveCamera()) /*if (UseZFailMethod && SceneManager->getActiveCamera())
{ {
core::matrix4 mat(core::matrix4::EM4CONST_NOTHING); core::matrix4 mat(core::matrix4::EM4CONST_NOTHING);
...@@ -295,7 +301,7 @@ void CShadowVolumeSceneNode::render() ...@@ -295,7 +301,7 @@ void CShadowVolumeSceneNode::render()
core::ROUNDING_ERROR_f32); core::ROUNDING_ERROR_f32);
driver->setTransform(video::ETS_PROJECTION, mat); driver->setTransform(video::ETS_PROJECTION, mat);
} }*/
driver->setTransform(video::ETS_WORLD, Parent->getAbsoluteTransformation()); driver->setTransform(video::ETS_WORLD, Parent->getAbsoluteTransformation());
......
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