First cut at class interfaces and stubs for implementations for the new osgShadow NodeKit

This commit is contained in:
Robert Osfield
2006-10-06 14:16:11 +00:00
parent d445995432
commit 5163c4a762
27 changed files with 1697 additions and 3 deletions

47
include/osgShadow/Export Normal file
View File

@@ -0,0 +1,47 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_EXPORT_
#define OSGSHADOW_EXPORT_ 1
#if defined(_MSC_VER)
#pragma warning( disable : 4244 )
#pragma warning( disable : 4251 )
#pragma warning( disable : 4267 )
#pragma warning( disable : 4275 )
#pragma warning( disable : 4290 )
#pragma warning( disable : 4786 )
#pragma warning( disable : 4305 )
#pragma warning( disable : 4996 )
#endif
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__)
# if defined( OSG_LIBRARY_STATIC )
# define OSGSHADOW_EXPORT
# elif defined( OSGSHADOW_LIBRARY )
# define OSGSHADOW_EXPORT __declspec(dllexport)
# else
# define OSGSHADOW_EXPORT __declspec(dllimport)
# endif
#else
# define OSGSHADOW_EXPORT
#endif
/**
\namespace osgShadow
The osgShadow is a NodeKit library that extends the core scene graph to add support for a range of shadow techniques.
*/
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_PARALLELSPLITSHADOWMAP
#define OSGSHADOW_PARALLELSPLITSHADOWMAP 1
#include <osg/CameraNode>
#include <osgShadow/ShadowTechnique>
namespace osgShadow {
/** ShadowedTexture provides an implementation of shadow textures.*/
class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
{
public :
ParallelSplitShadowMap();
ParallelSplitShadowMap(const ParallelSplitShadowMap& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, ParallelSplitShadowMap);
protected :
virtual ~ParallelSplitShadowMap() {}
};
}
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SHADOWEDTEXTURE
#define OSGSHADOW_SHADOWEDTEXTURE 1
#include <osg/CameraNode>
#include <osgShadow/ShadowTechnique>
namespace osgShadow {
/** ShadowedTexture provides an implementation of shadow textures.*/
class OSGSHADOW_EXPORT ShadowMap : public ShadowTechnique
{
public :
ShadowMap();
ShadowMap(const ShadowMap& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, ShadowMap);
protected :
virtual ~ShadowMap() {}
};
}
#endif

View File

@@ -0,0 +1,47 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SHADOWEDTECHNIQUE
#define OSGSHADOW_SHADOWEDTECHNIQUE 1
#include <osg/buffered_value>
#include <osg/CameraNode>
#include <osg/Texture2D>
#include <osg/TexGenNode>
#include <osgShadow/Export>
namespace osgShadow {
// forward declare ShadowedScene
class ShadowedScene;
/** ShadowedScene provides a mechansim for decorating a scene that the needs to have shadows cast upon it.*/
class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object
{
public :
ShadowTechnique();
ShadowTechnique(const ShadowTechnique& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, ShadowTechnique);
protected :
virtual ~ShadowTechnique() {}
};
}
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SHADOWEDTEXTURE
#define OSGSHADOW_SHADOWEDTEXTURE 1
#include <osg/CameraNode>
#include <osgShadow/ShadowTechnique>
namespace osgShadow {
/** ShadowedTexture provides an implementation of shadow textures.*/
class OSGSHADOW_EXPORT ShadowTexture : public ShadowTechnique
{
public :
ShadowTexture();
ShadowTexture(const ShadowTexture& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, ShadowTexture);
protected :
virtual ~ShadowTexture() {}
};
}
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SHADOWVOLUME
#define OSGSHADOW_SHADOWVOLUME 1
#include <osg/CameraNode>
#include <osgShadow/ShadowTechnique>
namespace osgShadow {
/** ShadowedTexture provides an implementation of shadow textures.*/
class OSGSHADOW_EXPORT ShadowVolume : public ShadowTechnique
{
public :
ShadowVolume();
ShadowVolume(const ShadowVolume& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, ShadowVolume);
protected :
virtual ~ShadowVolume() {}
};
}
#endif

View File

@@ -0,0 +1,62 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SHADOWEDSCENE
#define OSGSHADOW_SHADOWEDSCENE 1
#include <osg/buffered_value>
#include <osg/CameraNode>
#include <osg/Texture2D>
#include <osg/TexGenNode>
#include <osgShadow/ShadowTechnique>
namespace osgShadow {
/** ShadowedScene provides a mechansim for decorating a scene that the needs to have shadows cast upon it.*/
class OSGSHADOW_EXPORT ShadowedScene : public osg::Group
{
public :
ShadowedScene();
ShadowedScene(const ShadowedScene& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osgShadow, ShadowedScene);
virtual void traverse(osg::NodeVisitor& nv);
void setRecievesShadowTraversalMask(unsigned int mask) { _recievesShadowTraversalMask = mask; }
unsigned int getRecievesShadowTraversalMask() const { return _recievesShadowTraversalMask; }
void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; }
unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; }
void setShadowTechnique(ShadowTechnique* technique);
ShadowTechnique* getShadowTechnique() { return _shadowTechnique.get(); }
const ShadowTechnique* getShadowTechnique() const { return _shadowTechnique.get(); }
protected :
virtual ~ShadowedScene() {}
unsigned int _recievesShadowTraversalMask;
unsigned int _castsShadowTraversalMask;
osg::ref_ptr<ShadowTechnique> _shadowTechnique;
};
}
#endif

46
include/osgShadow/Version Normal file
View File

@@ -0,0 +1,46 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_VERSION
#define OSGSHADOW_VERSION 1
#include <osgShadow/Export>
extern "C" {
/**
* osgShadowGetVersion() returns the library version number.
* Numbering convention : OpenSceneGraph-1.0 will return 1.0 from osgShadowGetVersion.
*
* This C function can be also used to check for the existence of the OpenSceneGraph
* library using autoconf and its m4 macro AC_CHECK_LIB.
*
* Here is the code to add to your configure.in:
\verbatim
#
# Check for the OpenSceneGraph (OSG) library
#
AC_CHECK_LIB(osg, osgShadowGetVersion, ,
[AC_MSG_ERROR(OpenSceneGraph library not found. See http://www.openscenegraph.org)],)
\endverbatim
*/
extern OSGSHADOW_EXPORT const char* osgShadowGetVersion();
/**
* osgShadowGetLibraryName() returns the library name in human friendly form.
*/
extern OSGSHADOW_EXPORT const char* osgShadowGetLibraryName();
}
#endif