So I made a small change in IShadowVolumeSceneNode/CShadowVolumeSceneNode files, a setEnabled function, to enable or disable the rendering of a shadow.
Tested with latest SVN, but it should work with Irr 1.4/1.4.1 too.
IShadowVolumeSceneNode.h
Code: Select all
AFTER
virtual void setMeshToRenderFrom(const IMesh* mesh) = 0;
ADD
virtual void setEnabled(bool enabled) = 0;
Code: Select all
AFTER
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const { return ESNT_SHADOW_VOLUME; }
ADD
//! enable or disable shadow
virtual void setEnabled(bool enabled);
AFTER
bool* FaceData; // used for zfail method, if face is front facing
bool UseZFailMethod;
ADD
bool Enabled;
CShadowVolumeSceneNode.cpp
Code: Select all
AFTER
setAutomaticCulling(scene::EAC_OFF);
ADD
Enabled = true;
AFTER
void CShadowVolumeSceneNode::render()
{
ADD
if (!Enabled)
return;
BEFORE !!
} // end namespace scene
} // end namespace irr
ADD
//! enable or disable shadow
void CShadowVolumeSceneNode::setEnabled(bool enabled)
{
Enabled = enabled;
}
Compile, and rulez !
Shadow is enabled by default.
To use it, it's very easy :
IShadowVolumeSceneNode* myShadow = node->addShadowVolumeSceneNode();
myShadow->setEnabled(true); to enable shadow
myShadow->setEnabled(false); to disable shadow
[/b]