SYNOPSIS

#include <Inventor/annex/FXViz/nodes/SoShadowDirectionalLight.h>

Inherits SoDirectionalLight.

Public Member Functions

virtual SoType getTypeId (void) const

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. SoShadowDirectionalLight (void)

virtual void GLRender (SoGLRenderAction *action)

Static Public Member Functions

static SoType getClassTypeId (void)

static void initClass (void)

Public Attributes

SoSFNode shadowMapScene

SoSFFloat maxShadowDistance

SoSFVec3f bboxCenter

SoSFVec3f bboxSize

Protected Member Functions

virtual const SoFieldData * getFieldData (void) const

virtual ~SoShadowDirectionalLight ()

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)

Additional Inherited Members

Detailed Description

The SoShadowDirectionalLight class is a node for setting up a directional light which casts shadows.

Directional lights usually affect everything, but since it's not always feasible to use one shadow map for the entire scene graph. This node has some extra features to work around this.

It calculates the intersection between the current view volume and either the scene bounding box, or the bounding box provided in this node. The shadows are only calculated for this volume. This means that you'll get more detailed shadows as you zoom in on items in the scene graph.

In addition, you can set the maximum distance from the camera which will be shaded with shadows. Think of this a new far plane for the camera which only affects shadows.

As with SoShadowSpotLight, it's possible to optimize further by setting your own shadow caster scene graph in the shadowMapScene field.

The example scene graph below demonstrates how you can use this node to create shadows on a large number of objects, and still get decent precision when zooming in. To further reduce the volume covered by the shadowmap, you can set maxShadowDistance to some number > 0. This is the distance from the camera where shadows will be visible.

DirectionalLight {
   direction 0 0 -1
   intensity 0.2
}

ShadowGroup {
  quality 1 # to get per pixel lighting
  precision 1

  ShadowDirectionalLight {
    direction 1 1 -1
    intensity 0.8
    # enable this to reduce the shadow view distance
    # maxShadowDistance 200
  }

  # 900 cubes spaced out over a fairly large area
  Array {
    origin CENTER
    numElements1 30
    numElements2 30
    numElements3 1
    separation1 20 0 0
    separation2 0 20 0
    separation3 0 0 0

    Material { diffuseColor 1 0 0 specularColor 1 1 1 }
    Cube { width 4 height 4 depth 4 }
  }

  # a chess board
  Coordinate3 { point [ -400 -400 -3, 400 -400 -3, 400 400 -3, -400 400 -3 ] }
  Material { specularColor 1 1 1 shininess 0.9 }
  Complexity { textureQuality 0.1 }
  Texture2 { image 2 2 3 0xffffff 0x225588 0x225588 0xffffff }
  Texture2Transform { scaleFactor 20 20 }
  FaceSet { numVertices 4 }
}

Since:

Coin 3.0

Constructor & Destructor Documentation

SoShadowDirectionalLight::SoShadowDirectionalLight (void)

Constructor.

SoShadowDirectionalLight::~SoShadowDirectionalLight ()\fC [protected]\fP, \fC [virtual]\fP

Destructor.

Member Function Documentation

\fBSoType\fP SoShadowDirectionalLight::getTypeId (void) const\fC [virtual]\fP

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. Usage example:

void foo(SoNode * node)
{
  if (node->getTypeId() == SoFile::getClassTypeId()) {
    SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type
  }
}

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Reimplemented from SoDirectionalLight.

const \fBSoFieldData\fP * SoShadowDirectionalLight::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoDirectionalLight.

void SoShadowDirectionalLight::GLRender (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP

Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method.

Reimplemented from SoDirectionalLight.

Author

Generated automatically by Doxygen for Coin from the source code.