First cut at class interfaces and stubs for implementations for the new osgShadow NodeKit
This commit is contained in:
parent
d445995432
commit
5163c4a762
@ -20,6 +20,7 @@ SRC_DIRS = \
|
||||
osgParticle \
|
||||
osgText \
|
||||
osgFX \
|
||||
osgShadow \
|
||||
osgSim
|
||||
|
||||
ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
@ -200,15 +201,14 @@ ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
osgbillboard \
|
||||
osgblendequation \
|
||||
osgcallback \
|
||||
osgcatch \
|
||||
osgcamera \
|
||||
osgcameragroup \
|
||||
osgcatch \
|
||||
osgclip \
|
||||
osgcluster \
|
||||
osgcopy \
|
||||
osgcubemap \
|
||||
osgdelaunay \
|
||||
osgdepthshadow \
|
||||
osgdepthpartition \
|
||||
osgdistortion \
|
||||
osgforest \
|
||||
@ -227,8 +227,8 @@ ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
osglogo \
|
||||
osgmotionblur \
|
||||
osgmovie \
|
||||
osgmultitexture \
|
||||
osgmultiplecameras \
|
||||
osgmultitexture \
|
||||
osgoccluder \
|
||||
osgpagedlod \
|
||||
osgparametric \
|
||||
@ -247,7 +247,9 @@ ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
osgsequence \
|
||||
osgshaders \
|
||||
osgshaderterrain \
|
||||
osgshadow \
|
||||
osgshadowtexture \
|
||||
osgdepthshadow \
|
||||
osgshape \
|
||||
osgsimple \
|
||||
osgsimplepager \
|
||||
|
@ -99,6 +99,24 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Core osgShadow"=.\osgShadow\osgShadow.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osg
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgUtil
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Core osgParticle"=.\osgParticle\osgParticle.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@ -1842,6 +1860,36 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgshadow"=.\examples\osgshadow\osgshadow.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osg
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgDB
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgGA
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgProducer
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgUtil
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgShadow
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgslice"=.\examples\osgslice\osgslice.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
226
VisualStudio/osgShadow/osgShadow.dsp
Normal file
226
VisualStudio/osgShadow/osgShadow.dsp
Normal file
@ -0,0 +1,226 @@
|
||||
# Microsoft Developer Studio Project File - Name="Core osgShadow" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=Core osgShadow - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "osgShadow.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "osgShadow.mak" CFG="Core osgShadow - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Core osgShadow - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Core osgShadow - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Core osgShadow - Win32 Release Static" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Core osgShadow - Win32 Debug Static" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Core osgShadow - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "../../lib"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../bin/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../include" /I "../../../OpenThreads/include" /I "../../../Producer/include" /I "../../../3rdParty/include" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "osgShadow_LIBRARY" /D "WIN32" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 OpenThreadsWin32.lib opengl32.lib glu32.lib /nologo /dll /debug /machine:I386 /opt:ref /opt:icf /out:"$(OutDir)/osgShadow.dll" /implib:"../../lib/$(PlatformName)/osgShadow.lib" /libpath:"../../lib/$(PlatformName)" /libpath:"../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../Producer/lib/$(PlatformName)" /libpath:"../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../3rdParty/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Core osgShadow - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "../../lib"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../bin/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /vmg /GR /GX /Zi /Od /I "../../include" /I "../../../OpenThreads/include" /I "../../../Producer/include" /I "../../../3rdParty/include" /D "osgShadow_LIBRARY" /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /GZ /Zm200 /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 OpenThreadsWin32d.lib opengl32.lib glu32.lib /nologo /dll /debug /machine:I386 /out:"$(OutDir)/osgShadowd.dll" /pdbtype:sept /implib:"../../lib/$(PlatformName)/osgShadowd.lib" /libpath:"../../lib/$(PlatformName)" /libpath:"../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../Producer/lib/$(PlatformName)" /libpath:"../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../3rdParty/lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "Core osgShadow - Win32 Release Static"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "../../lib"
|
||||
# PROP BASE Intermediate_Dir "Release_Static"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../lib/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)_Static"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "OSG_LIBRARY_STATIC" "OT_LIBRARY_STATIC" "PR_LIBRARY_STATIC" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../include" /I "../../../OpenThreads/include" /I "../../../Producer/include" /I "../../../3rdParty/include" /D "NDEBUG" /D "_MBCS" /D "OSG_LIBRARY_STATIC" /D "OT_LIBRARY_STATIC" /D "PR_LIBRARY_STATIC" /D "WIN32" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nodefaultlib /nologo /out:"$(OutDir)/osgShadow_s.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Core osgShadow - Win32 Debug Static"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "../../lib"
|
||||
# PROP BASE Intermediate_Dir "Debug_Static"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../lib/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)_Static"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "OSG_LIBRARY_STATIC" "OT_LIBRARY_STATIC" "PR_LIBRARY_STATIC" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /vmg /GR /GX /Z7 /Od /I "../../include" /I "../../../OpenThreads/include" /I "../../../Producer/include" /I "../../../3rdParty/include" /D "OSG_LIBRARY_STATIC" /D "OT_LIBRARY_STATIC" /D "PR_LIBRARY_STATIC" /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /GZ /Zm200 /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nodefaultlib /nologo /out:"$(OutDir)/osgShadowd_s.lib"
|
||||
# SUBTRACT LIB32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Core osgShadow - Win32 Release"
|
||||
# Name "Core osgShadow - Win32 Debug"
|
||||
# Name "Core osgShadow - Win32 Release Static"
|
||||
# Name "Core osgShadow - Win32 Debug Static"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ShadowedScene.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ShadowTechnique.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ShadowTexture.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ShadowMap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ShadowVolume.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\ParallelSplitShadowMap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osgShadow\Version.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter ";h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\Export
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ShadowedScene
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ShadowTechnique
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ShadowTexture
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ShadowMap
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ShadowVolume
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\ParallelSplitShadowMap
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osgShadow\Version
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
137
VisualStudio/osgWrappers/osgShadow/wrapper_osgShadow.dsp
Normal file
137
VisualStudio/osgWrappers/osgShadow/wrapper_osgShadow.dsp
Normal file
@ -0,0 +1,137 @@
|
||||
# Microsoft Developer Studio Project File - Name="osgWrapper osgShadow" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=osgWrapper osgShadow - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wrapper_osgShadow.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wrapper_osgShadow.mak" CFG="osgWrapper osgShadow - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "osgWrapper osgShadow - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "osgWrapper osgShadow - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "osgWrapper osgShadow - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../../bin/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 opengl32.lib OpenThreadsWin32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBC" /opt:ref /opt:icf /out:"$(OutDir)/osgwrapper_osgShadow.dll" /implib:"../../../lib/$(PlatformName)/osgwrapper_osgShadow.lib" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ELSEIF "$(CFG)" == "osgWrapper osgShadow - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../../bin/$(PlatformName)"
|
||||
# PROP Intermediate_Dir "$(PlatformName)/$(ConfigurationName)"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /vmg /GR /GX /Zi /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 opengl32.lib OpenThreadsWin32d.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OutDir)/osgwrapper_osgShadowd.dll" /pdbtype:sept /implib:"../../../lib/$(PlatformName)/osgwrapper_osgShadowd.lib" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "osgWrapper osgShadow - Win32 Release"
|
||||
# Name "osgWrapper osgShadow - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\Export.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ParallelSplitShadowMap.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ShadowMap.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ShadowTechnique.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ShadowTexture.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ShadowVolume.cpp
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
SOURCE=..\..\..\src\osgWrappers\osgShadow\ShadowedScene.cpp
|
||||
# End Source File
|
||||
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
17
examples/osgshadow/GNUmakefile
Normal file
17
examples/osgshadow/GNUmakefile
Normal file
@ -0,0 +1,17 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
osgshadow.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgShadow -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
INSTFILES = \
|
||||
$(CXXFILES)\
|
||||
GNUmakefile.inst=GNUmakefile
|
||||
|
||||
EXEC = osgshadow
|
||||
|
||||
INC += $(X_INC)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
14
examples/osgshadow/GNUmakefile.inst
Normal file
14
examples/osgshadow/GNUmakefile.inst
Normal file
@ -0,0 +1,14 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
osgshadow.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgShadow -losgText -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
EXEC = osgshadow
|
||||
|
||||
INC += $(PRODUCER_INCLUDE_DIR) $(X_INC)
|
||||
LDFLAGS += $(PRODUCER_LIB_DIR)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
506
examples/osgshadow/osgshadow.cpp
Normal file
506
examples/osgshadow/osgshadow.cpp
Normal file
@ -0,0 +1,506 @@
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
#include <osg/Projection>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/TexGen>
|
||||
#include <osg/Geode>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Light>
|
||||
#include <osg/LightSource>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/Material>
|
||||
#include <osg/TexEnvCombine>
|
||||
#include <osg/TexEnv>
|
||||
|
||||
#include <osg/CameraNode>
|
||||
#include <osg/TexGenNode>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
class LightTransformCallback: public osg::NodeCallback
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
LightTransformCallback(float angular_velocity, float height, float radius):
|
||||
_angular_velocity(angular_velocity),
|
||||
_height(height),
|
||||
_radius(radius),
|
||||
_previous_traversal_number(-1),
|
||||
_previous_time(-1.0f),
|
||||
_angle(0)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(Node* node, NodeVisitor* nv);
|
||||
|
||||
protected:
|
||||
|
||||
float _angular_velocity;
|
||||
float _height;
|
||||
float _radius;
|
||||
int _previous_traversal_number;
|
||||
double _previous_time;
|
||||
float _angle;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
LightTransformCallback::operator()(Node* node, NodeVisitor* nv)
|
||||
{
|
||||
MatrixTransform* transform = dynamic_cast<MatrixTransform*>(node);
|
||||
if (nv && transform)
|
||||
{
|
||||
const FrameStamp* fs = nv->getFrameStamp();
|
||||
if (!fs) return; // not frame stamp, no handle on the time so can't move.
|
||||
|
||||
double new_time = fs->getReferenceTime();
|
||||
if (nv->getTraversalNumber() != _previous_traversal_number)
|
||||
{
|
||||
_angle += _angular_velocity * (new_time - _previous_time);
|
||||
|
||||
Matrix matrix = Matrix::rotate(atan(_height / _radius), -X_AXIS) *
|
||||
Matrix::rotate(PI_2, Y_AXIS) *
|
||||
Matrix::translate(Vec3(_radius, 0, 0)) *
|
||||
Matrix::rotate(_angle, Y_AXIS) *
|
||||
Matrix::translate(Vec3(0, _height, 0));
|
||||
|
||||
// update the specified transform
|
||||
transform->setMatrix(matrix);
|
||||
|
||||
_previous_traversal_number = nv->getTraversalNumber();
|
||||
}
|
||||
|
||||
_previous_time = new_time;
|
||||
}
|
||||
|
||||
// must call any nested node callbacks and continue subgraph traversal.
|
||||
traverse(node,nv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
ref_ptr<MatrixTransform> _create_lights()
|
||||
{
|
||||
ref_ptr<MatrixTransform> transform_0 = new MatrixTransform;
|
||||
|
||||
// create a spot light.
|
||||
ref_ptr<Light> light_0 = new Light;
|
||||
light_0->setLightNum(0);
|
||||
light_0->setPosition(Vec4(0, 0, 0, 1.0f));
|
||||
light_0->setAmbient(Vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
light_0->setDiffuse(Vec4(1.0f, 0.8f, 0.8f, 1.0f));
|
||||
light_0->setSpotCutoff(60.0f);
|
||||
light_0->setSpotExponent(2.0f);
|
||||
|
||||
ref_ptr<LightSource> light_source_0 = new LightSource;
|
||||
light_source_0->setLight(light_0.get());
|
||||
light_source_0->setLocalStateSetModes(StateAttribute::ON);
|
||||
transform_0->setUpdateCallback(new LightTransformCallback(inDegrees(90.0f), 8, 5));
|
||||
transform_0->addChild(light_source_0.get());
|
||||
|
||||
ref_ptr<Geode> geode = new Geode;
|
||||
|
||||
ref_ptr<ShapeDrawable> shape;
|
||||
ref_ptr<TessellationHints> hints = new TessellationHints;
|
||||
hints->setDetailRatio(0.3f);
|
||||
shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 0.0f), 0.15f), hints.get());
|
||||
shape->setColor(Vec4(1.0f, 0.5f, 0.5f, 1.0f));
|
||||
geode->addDrawable(shape.get());
|
||||
shape = new ShapeDrawable(new Cylinder(Vec3(0.0f, 0.0f, -0.4f), 0.05f, 0.8f), hints.get());
|
||||
shape->setColor(Vec4(1.0f, 0.5f, 0.5f, 1.0f));
|
||||
geode->addDrawable(shape.get());
|
||||
|
||||
|
||||
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, StateAttribute::OFF);
|
||||
transform_0->addChild(geode.get());
|
||||
|
||||
return transform_0;
|
||||
}
|
||||
|
||||
ref_ptr<Group> _create_scene()
|
||||
{
|
||||
ref_ptr<Group> scene = new Group;
|
||||
ref_ptr<Geode> geode_1 = new Geode;
|
||||
scene->addChild(geode_1.get());
|
||||
|
||||
ref_ptr<Geode> geode_2 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_2 = new MatrixTransform;
|
||||
transform_2->addChild(geode_2.get());
|
||||
transform_2->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
|
||||
scene->addChild(transform_2.get());
|
||||
|
||||
ref_ptr<Geode> geode_3 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_3 = new MatrixTransform;
|
||||
transform_3->addChild(geode_3.get());
|
||||
transform_3->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
|
||||
scene->addChild(transform_3.get());
|
||||
|
||||
const float radius = 0.8f;
|
||||
const float height = 1.0f;
|
||||
ref_ptr<TessellationHints> hints = new TessellationHints;
|
||||
hints->setDetailRatio(2.0f);
|
||||
ref_ptr<ShapeDrawable> shape;
|
||||
|
||||
shape = new ShapeDrawable(new Box(Vec3(0.0f, -2.0f, 0.0f), 10, 0.1f, 10), hints.get());
|
||||
shape->setColor(Vec4(0.5f, 0.5f, 0.7f, 1.0f));
|
||||
geode_1->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 0.0f), radius * 2), hints.get());
|
||||
shape->setColor(Vec4(0.8f, 0.8f, 0.8f, 1.0f));
|
||||
geode_1->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Sphere(Vec3(-3.0f, 0.0f, 0.0f), radius), hints.get());
|
||||
shape->setColor(Vec4(0.6f, 0.8f, 0.8f, 1.0f));
|
||||
geode_2->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Box(Vec3(3.0f, 0.0f, 0.0f), 2 * radius), hints.get());
|
||||
shape->setColor(Vec4(0.4f, 0.9f, 0.3f, 1.0f));
|
||||
geode_2->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Cone(Vec3(0.0f, 0.0f, -3.0f), radius, height), hints.get());
|
||||
shape->setColor(Vec4(0.2f, 0.5f, 0.7f, 1.0f));
|
||||
geode_2->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Cylinder(Vec3(0.0f, 0.0f, 3.0f), radius, height), hints.get());
|
||||
shape->setColor(Vec4(1.0f, 0.3f, 0.3f, 1.0f));
|
||||
geode_2->addDrawable(shape.get());
|
||||
|
||||
shape = new ShapeDrawable(new Box(Vec3(0.0f, 3.0f, 0.0f), 2, 0.1f, 2), hints.get());
|
||||
shape->setColor(Vec4(0.8f, 0.8f, 0.4f, 1.0f));
|
||||
geode_3->addDrawable(shape.get());
|
||||
|
||||
// material
|
||||
ref_ptr<Material> matirial = new Material;
|
||||
matirial->setColorMode(Material::DIFFUSE);
|
||||
matirial->setAmbient(Material::FRONT_AND_BACK, Vec4(0, 0, 0, 1));
|
||||
matirial->setSpecular(Material::FRONT_AND_BACK, Vec4(1, 1, 1, 1));
|
||||
matirial->setShininess(Material::FRONT_AND_BACK, 64.0f);
|
||||
scene->getOrCreateStateSet()->setAttributeAndModes(matirial.get(), StateAttribute::ON);
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
||||
class UpdateCameraAndTexGenCallback : public osg::NodeCallback
|
||||
{
|
||||
public:
|
||||
|
||||
UpdateCameraAndTexGenCallback(osg::MatrixTransform* light_transform, osg::CameraNode* cameraNode, osg::TexGenNode* texgenNode):
|
||||
_light_transform(light_transform),
|
||||
_cameraNode(cameraNode),
|
||||
_texgenNode(texgenNode)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
// first update subgraph to make sure objects are all moved into postion
|
||||
traverse(node,nv);
|
||||
|
||||
// now compute the camera's view and projection matrix to point at the shadower (the camera's children)
|
||||
osg::BoundingSphere bs;
|
||||
for(unsigned int i=0; i<_cameraNode->getNumChildren(); ++i)
|
||||
{
|
||||
bs.expandBy(_cameraNode->getChild(i)->getBound());
|
||||
}
|
||||
|
||||
if (!bs.valid())
|
||||
{
|
||||
osg::notify(osg::WARN) << "bb invalid"<<_cameraNode.get()<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
osg::Vec3 position = _light_transform->getMatrix().getTrans();
|
||||
|
||||
float centerDistance = (position-bs.center()).length();
|
||||
|
||||
float znear = centerDistance-bs.radius();
|
||||
float zfar = centerDistance+bs.radius();
|
||||
float zNearRatio = 0.001f;
|
||||
if (znear<zfar*zNearRatio) znear = zfar*zNearRatio;
|
||||
|
||||
#if 0
|
||||
// hack to illustrate the precision problems of excessive gap between near far range.
|
||||
znear = 0.00001*zfar;
|
||||
#endif
|
||||
float top = (bs.radius()/centerDistance)*znear;
|
||||
float right = top;
|
||||
|
||||
_cameraNode->setReferenceFrame(osg::CameraNode::ABSOLUTE_RF);
|
||||
_cameraNode->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar);
|
||||
_cameraNode->setViewMatrixAsLookAt(position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f));
|
||||
|
||||
// compute the matrix which takes a vertex from local coords into tex coords
|
||||
// will use this later to specify osg::TexGen..
|
||||
osg::Matrix MVPT = _cameraNode->getViewMatrix() *
|
||||
_cameraNode->getProjectionMatrix() *
|
||||
osg::Matrix::translate(1.0,1.0,1.0) *
|
||||
osg::Matrix::scale(0.5f,0.5f,0.5f);
|
||||
|
||||
_texgenNode->getTexGen()->setMode(osg::TexGen::EYE_LINEAR);
|
||||
_texgenNode->getTexGen()->setPlanesFromMatrix(MVPT);
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~UpdateCameraAndTexGenCallback() {}
|
||||
|
||||
osg::ref_ptr<osg::MatrixTransform> _light_transform;
|
||||
osg::ref_ptr<osg::CameraNode> _cameraNode;
|
||||
osg::ref_ptr<osg::TexGenNode> _texgenNode;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// fragment shader
|
||||
//
|
||||
char fragmentShaderSource_noBaseTexture[] =
|
||||
"uniform sampler2DShadow shadowTexture; \n"
|
||||
"uniform vec2 ambientBias; \n"
|
||||
"\n"
|
||||
"void main(void) \n"
|
||||
"{ \n"
|
||||
" gl_FragColor = gl_Color * (ambientBias.x + shadow2DProj( shadowTexture, gl_TexCoord[0] ) * ambientBias.y); \n"
|
||||
"}\n";
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// fragment shader
|
||||
//
|
||||
char fragmentShaderSource_withBaseTexture[] =
|
||||
"uniform sampler2D baseTexture; \n"
|
||||
"uniform sampler2DShadow shadowTexture; \n"
|
||||
"uniform vec2 ambientBias; \n"
|
||||
"\n"
|
||||
"void main(void) \n"
|
||||
"{ \n"
|
||||
" vec4 color = gl_Color * texture2D( baseTexture, gl_TexCoord[0].xy ); \n"
|
||||
" gl_FragColor = color * (ambientBias.x + shadow2DProj( shadowTexture, gl_TexCoord[1] ) * ambientBias.y); \n"
|
||||
"}\n";
|
||||
|
||||
|
||||
osg::Group* createShadowedScene(osg::Node* shadowed,osg::MatrixTransform* light_transform, unsigned int unit)
|
||||
{
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
unsigned int tex_width = 1024;
|
||||
unsigned int tex_height = 1024;
|
||||
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setTextureSize(tex_width, tex_height);
|
||||
|
||||
texture->setInternalFormat(GL_DEPTH_COMPONENT);
|
||||
texture->setShadowComparison(true);
|
||||
texture->setShadowTextureMode(Texture::LUMINANCE);
|
||||
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
|
||||
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
|
||||
|
||||
// set up the render to texture camera.
|
||||
{
|
||||
|
||||
// create the camera
|
||||
osg::CameraNode* camera = new osg::CameraNode;
|
||||
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||
camera->setComputeNearFarMode(osg::CameraNode::DO_NOT_COMPUTE_NEAR_FAR);
|
||||
|
||||
// set viewport
|
||||
camera->setViewport(0,0,tex_width,tex_height);
|
||||
|
||||
osg::StateSet* _local_stateset = camera->getOrCreateStateSet();
|
||||
|
||||
_local_stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
|
||||
|
||||
float factor = 0.0f;
|
||||
float units = 1.0f;
|
||||
|
||||
ref_ptr<PolygonOffset> polygon_offset = new PolygonOffset;
|
||||
polygon_offset->setFactor(factor);
|
||||
polygon_offset->setUnits(units);
|
||||
_local_stateset->setAttribute(polygon_offset.get(), StateAttribute::ON | StateAttribute::OVERRIDE);
|
||||
_local_stateset->setMode(GL_POLYGON_OFFSET_FILL, StateAttribute::ON | StateAttribute::OVERRIDE);
|
||||
|
||||
ref_ptr<CullFace> cull_face = new CullFace;
|
||||
cull_face->setMode(CullFace::FRONT);
|
||||
_local_stateset->setAttribute(cull_face.get(), StateAttribute::ON | StateAttribute::OVERRIDE);
|
||||
_local_stateset->setMode(GL_CULL_FACE, StateAttribute::ON | StateAttribute::OVERRIDE);
|
||||
|
||||
|
||||
// set the camera to render before the main camera.
|
||||
camera->setRenderOrder(osg::CameraNode::PRE_RENDER);
|
||||
|
||||
// tell the camera to use OpenGL frame buffer object where supported.
|
||||
camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT);
|
||||
|
||||
// attach the texture and use it as the color buffer.
|
||||
camera->attach(osg::CameraNode::DEPTH_BUFFER, texture);
|
||||
|
||||
// add subgraph to render
|
||||
camera->addChild(shadowed);
|
||||
|
||||
group->addChild(camera);
|
||||
|
||||
// create the texgen node to project the tex coords onto the subgraph
|
||||
osg::TexGenNode* texgenNode = new osg::TexGenNode;
|
||||
texgenNode->setTextureUnit(unit);
|
||||
group->addChild(texgenNode);
|
||||
|
||||
// set an update callback to keep moving the camera and tex gen in the right direction.
|
||||
group->setUpdateCallback(new UpdateCameraAndTexGenCallback(light_transform, camera, texgenNode));
|
||||
}
|
||||
|
||||
|
||||
// set the shadowed subgraph so that it uses the texture and tex gen settings.
|
||||
{
|
||||
osg::Group* shadowedGroup = new osg::Group;
|
||||
shadowedGroup->addChild(shadowed);
|
||||
group->addChild(shadowedGroup);
|
||||
|
||||
osg::StateSet* stateset = shadowedGroup->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(unit,texture,osg::StateAttribute::ON);
|
||||
stateset->setTextureMode(unit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON);
|
||||
stateset->setTextureMode(unit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON);
|
||||
stateset->setTextureMode(unit,GL_TEXTURE_GEN_R,osg::StateAttribute::ON);
|
||||
|
||||
stateset->setTextureMode(unit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON);
|
||||
|
||||
osg::Program* program = new osg::Program;
|
||||
stateset->setAttribute(program);
|
||||
|
||||
if (unit==0)
|
||||
{
|
||||
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_noBaseTexture);
|
||||
program->addShader(fragment_shader);
|
||||
|
||||
osg::Uniform* shadowTextureSampler = new osg::Uniform("shadowTexture",(int)unit);
|
||||
stateset->addUniform(shadowTextureSampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_withBaseTexture);
|
||||
program->addShader(fragment_shader);
|
||||
|
||||
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
|
||||
stateset->addUniform(baseTextureSampler);
|
||||
|
||||
osg::Uniform* shadowTextureSampler = new osg::Uniform("shadowTexture",(int)unit);
|
||||
stateset->addUniform(shadowTextureSampler);
|
||||
}
|
||||
|
||||
osg::Uniform* ambientBias = new osg::Uniform("ambientBias",osg::Vec2(0.3f,1.2f));
|
||||
stateset->addUniform(ambientBias);
|
||||
|
||||
}
|
||||
|
||||
// add the shadower and shadowed.
|
||||
group->addChild(light_transform);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
ArgumentParser arguments(&argc, argv);
|
||||
|
||||
// set up the usage document, in case we need to print out how to use this program.
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " is the example which demonstrates using of GL_ARB_shadow extension implemented in osg::Texture class");
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName());
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--with-base-texture", "Adde base texture to shadowed model.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--no-base-texture", "Adde base texture to shadowed model.");
|
||||
|
||||
// construct the viewer.
|
||||
osgProducer::Viewer viewer(arguments);
|
||||
|
||||
// set up the value with sensible default event handlers.
|
||||
viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);
|
||||
|
||||
// get details on keyboard and mouse bindings used by the viewer.
|
||||
viewer.getUsage(*arguments. getApplicationUsage());
|
||||
|
||||
bool withBaseTexture = true;
|
||||
while(arguments.read("--with-base-texture")) { withBaseTexture = true; }
|
||||
while(arguments.read("--no-base-texture")) { withBaseTexture = false; }
|
||||
|
||||
// if user request help write it out to cout.
|
||||
if (arguments.read("-h") || arguments.read("--help"))
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ref_ptr<MatrixTransform> scene = new MatrixTransform;
|
||||
scene->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(125.0),1.0,0.0,0.0));
|
||||
|
||||
ref_ptr<Group> shadowed_scene = _create_scene();
|
||||
if (!shadowed_scene.valid()) return 1;
|
||||
|
||||
ref_ptr<MatrixTransform> light_transform = _create_lights();
|
||||
if (!light_transform.valid()) return 1;
|
||||
|
||||
ref_ptr<Group> shadowedScene;
|
||||
|
||||
|
||||
if (withBaseTexture)
|
||||
{
|
||||
shadowed_scene->getOrCreateStateSet()->setTextureAttributeAndModes( 0, new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")), osg::StateAttribute::ON);
|
||||
shadowedScene = createShadowedScene(shadowed_scene.get(),light_transform.get(),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
shadowedScene = createShadowedScene(shadowed_scene.get(),light_transform.get(),0);
|
||||
}
|
||||
|
||||
scene->addChild(shadowedScene.get());
|
||||
|
||||
viewer.setSceneData(scene.get());
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer.realize();
|
||||
|
||||
while (!viewer.done())
|
||||
{
|
||||
// wait for all cull and draw threads to complete.
|
||||
viewer.sync();
|
||||
|
||||
// update the scene by traversing it with the the update visitor which will
|
||||
// call all node update callbacks and animations.
|
||||
viewer.update();
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
viewer.frame();
|
||||
}
|
||||
|
||||
// wait for all cull and draw threads to complete.
|
||||
viewer.sync();
|
||||
|
||||
// run a clean up frame to delete all OpenGL objects.
|
||||
viewer.cleanup_frame();
|
||||
|
||||
// wait for all the clean up frame to complete.
|
||||
viewer.sync();
|
||||
|
||||
return 0;
|
||||
}
|
47
include/osgShadow/Export
Normal file
47
include/osgShadow/Export
Normal 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
|
41
include/osgShadow/ParallelSplitShadowMap
Normal file
41
include/osgShadow/ParallelSplitShadowMap
Normal 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
|
41
include/osgShadow/ShadowMap
Normal file
41
include/osgShadow/ShadowMap
Normal 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
|
47
include/osgShadow/ShadowTechnique
Normal file
47
include/osgShadow/ShadowTechnique
Normal 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
|
41
include/osgShadow/ShadowTexture
Normal file
41
include/osgShadow/ShadowTexture
Normal 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
|
41
include/osgShadow/ShadowVolume
Normal file
41
include/osgShadow/ShadowVolume
Normal 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
|
62
include/osgShadow/ShadowedScene
Normal file
62
include/osgShadow/ShadowedScene
Normal 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
46
include/osgShadow/Version
Normal 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
|
21
src/osgShadow/GNUmakefile
Normal file
21
src/osgShadow/GNUmakefile
Normal file
@ -0,0 +1,21 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
|
||||
CXXFILES = \
|
||||
ShadowedScene.cpp\
|
||||
ShadowTechnique.cpp\
|
||||
ShadowMap.cpp\
|
||||
ShadowTexture.cpp\
|
||||
ShadowVolume.cpp\
|
||||
ParallelSplitShadowMap.cpp\
|
||||
Version.cpp\
|
||||
|
||||
DEF += -DOSGTEXT_LIBRARY
|
||||
|
||||
LIBS += -losgDB -losg $(GL_LIBS) $(OTHER_LIBS)
|
||||
|
||||
TARGET_BASENAME = osgText
|
||||
LIB = $(LIB_PREFIX)$(TARGET_BASENAME).$(LIB_EXT)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
27
src/osgShadow/ParallelSplitShadowMap.cpp
Normal file
27
src/osgShadow/ParallelSplitShadowMap.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osgShadow/ParallelSplitShadowMap>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osgShadow;
|
||||
|
||||
ParallelSplitShadowMap::ParallelSplitShadowMap()
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: osgShadow::ParallelSplitShadowMap technique not implemented yet."<<std::endl;
|
||||
}
|
||||
|
||||
ParallelSplitShadowMap::ParallelSplitShadowMap(const ParallelSplitShadowMap& copy, const osg::CopyOp& copyop):
|
||||
ShadowTechnique(copy,copyop)
|
||||
{
|
||||
}
|
27
src/osgShadow/ShadowMap.cpp
Normal file
27
src/osgShadow/ShadowMap.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osgShadow/ShadowMap>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osgShadow;
|
||||
|
||||
ShadowMap::ShadowMap()
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: osgShadow::ShadowMap technique not implemented yet."<<std::endl;
|
||||
}
|
||||
|
||||
ShadowMap::ShadowMap(const ShadowMap& copy, const osg::CopyOp& copyop):
|
||||
ShadowTechnique(copy,copyop)
|
||||
{
|
||||
}
|
25
src/osgShadow/ShadowTechnique.cpp
Normal file
25
src/osgShadow/ShadowTechnique.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osgShadow/ShadowTechnique>
|
||||
|
||||
using namespace osgShadow;
|
||||
|
||||
ShadowTechnique::ShadowTechnique()
|
||||
{
|
||||
}
|
||||
|
||||
ShadowTechnique::ShadowTechnique(const ShadowTechnique& copy, const osg::CopyOp& copyop):
|
||||
osg::Object(copy,copyop)
|
||||
{
|
||||
}
|
27
src/osgShadow/ShadowTexture.cpp
Normal file
27
src/osgShadow/ShadowTexture.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osgShadow/ShadowTexture>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osgShadow;
|
||||
|
||||
ShadowTexture::ShadowTexture()
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: osgShadow::ShadowTexture technique not implemented yet."<<std::endl;
|
||||
}
|
||||
|
||||
ShadowTexture::ShadowTexture(const ShadowTexture& copy, const osg::CopyOp& copyop):
|
||||
ShadowTechnique(copy,copyop)
|
||||
{
|
||||
}
|
27
src/osgShadow/ShadowVolume.cpp
Normal file
27
src/osgShadow/ShadowVolume.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osgShadow/ShadowVolume>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osgShadow;
|
||||
|
||||
ShadowVolume::ShadowVolume()
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: osgShadow::ShadowVolume technique not implemented yet."<<std::endl;
|
||||
}
|
||||
|
||||
ShadowVolume::ShadowVolume(const ShadowVolume& copy, const osg::CopyOp& copyop):
|
||||
ShadowTechnique(copy,copyop)
|
||||
{
|
||||
}
|
58
src/osgShadow/ShadowedScene.cpp
Normal file
58
src/osgShadow/ShadowedScene.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*-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.
|
||||
*/
|
||||
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgUtil/CullVisitor>
|
||||
#include <osgShadow/ShadowedScene>
|
||||
|
||||
using namespace osgShadow;
|
||||
using namespace osg;
|
||||
|
||||
ShadowedScene::ShadowedScene()
|
||||
{
|
||||
setNumChildrenRequiringUpdateTraversal(1);
|
||||
}
|
||||
|
||||
ShadowedScene::ShadowedScene(const ShadowedScene& copy, const osg::CopyOp& copyop):
|
||||
osg::Group(copy,copyop)
|
||||
{
|
||||
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
|
||||
}
|
||||
|
||||
void ShadowedScene::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
|
||||
{
|
||||
Group::traverse(nv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR)
|
||||
{
|
||||
Group::traverse(nv);
|
||||
return;
|
||||
}
|
||||
|
||||
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);
|
||||
if (!cv)
|
||||
{
|
||||
Group::traverse(nv);
|
||||
return;
|
||||
}
|
||||
|
||||
Group::traverse(nv);
|
||||
}
|
12
src/osgShadow/Version.cpp
Normal file
12
src/osgShadow/Version.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgShadow/Version>
|
||||
|
||||
const char* osgShadowGetVersion()
|
||||
{
|
||||
return "1.2";
|
||||
}
|
||||
|
||||
|
||||
const char* osgShaodowGetLibraryName()
|
||||
{
|
||||
return "OpenSceneGraph Shadow Library";
|
||||
}
|
35
src/osgWrappers/osgShadow/ParallelSplitShadowMap.cpp
Normal file
35
src/osgWrappers/osgShadow/ParallelSplitShadowMap.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Object>
|
||||
#include <osgShadow/ParallelSplitShadowMap>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgShadow::ParallelSplitShadowMap)
|
||||
I_BaseType(osgShadow::ShadowTechnique);
|
||||
I_Constructor0();
|
||||
I_ConstructorWithDefaults2(IN, const osgShadow::ParallelSplitShadowMap &, es, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY);
|
||||
I_Method0(osg::Object *, cloneType);
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop);
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj);
|
||||
I_Method0(const char *, libraryName);
|
||||
I_Method0(const char *, className);
|
||||
END_REFLECTOR
|
||||
|
35
src/osgWrappers/osgShadow/ShadowTechnique.cpp
Normal file
35
src/osgWrappers/osgShadow/ShadowTechnique.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Object>
|
||||
#include <osgShadow/ShadowTechnique>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgShadow::ShadowTechnique)
|
||||
I_BaseType(osg::Object);
|
||||
I_Constructor0();
|
||||
I_ConstructorWithDefaults2(IN, const osgShadow::ShadowTechnique &, es, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY);
|
||||
I_Method0(osg::Object *, cloneType);
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop);
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj);
|
||||
I_Method0(const char *, libraryName);
|
||||
I_Method0(const char *, className);
|
||||
END_REFLECTOR
|
||||
|
35
src/osgWrappers/osgShadow/ShadowVolume.cpp
Normal file
35
src/osgWrappers/osgShadow/ShadowVolume.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Object>
|
||||
#include <osgShadow/ShadowVolume>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgShadow::ShadowVolume)
|
||||
I_BaseType(osgShadow::ShadowTechnique);
|
||||
I_Constructor0();
|
||||
I_ConstructorWithDefaults2(IN, const osgShadow::ShadowVolume &, es, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY);
|
||||
I_Method0(osg::Object *, cloneType);
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop);
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj);
|
||||
I_Method0(const char *, libraryName);
|
||||
I_Method0(const char *, className);
|
||||
END_REFLECTOR
|
||||
|
49
src/osgWrappers/osgShadow/ShadowedScene.cpp
Normal file
49
src/osgWrappers/osgShadow/ShadowedScene.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Object>
|
||||
#include <osgShadow/ShadowTechnique>
|
||||
#include <osgShadow/ShadowedScene>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgShadow::ShadowedScene)
|
||||
I_BaseType(osg::Group);
|
||||
I_Constructor0();
|
||||
I_ConstructorWithDefaults2(IN, const osgShadow::ShadowedScene &, es, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY);
|
||||
I_Method0(osg::Object *, cloneType);
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop);
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj);
|
||||
I_Method0(const char *, className);
|
||||
I_Method0(const char *, libraryName);
|
||||
I_Method1(void, accept, IN, osg::NodeVisitor &, nv);
|
||||
I_Method1(void, traverse, IN, osg::NodeVisitor &, nv);
|
||||
I_Method1(void, setRecievesShadowTraversalMask, IN, unsigned int, mask);
|
||||
I_Method0(unsigned int, getRecievesShadowTraversalMask);
|
||||
I_Method1(void, setCastsShadowTraversalMask, IN, unsigned int, mask);
|
||||
I_Method0(unsigned int, getCastsShadowTraversalMask);
|
||||
I_Method1(void, setShadowTechnique, IN, osgShadow::ShadowTechnique *, technique);
|
||||
I_Method0(osgShadow::ShadowTechnique *, getShadowTechnique);
|
||||
I_Method0(const osgShadow::ShadowTechnique *, getShadowTechnique);
|
||||
I_Property(unsigned int, CastsShadowTraversalMask);
|
||||
I_Property(unsigned int, RecievesShadowTraversalMask);
|
||||
I_Property(osgShadow::ShadowTechnique *, ShadowTechnique);
|
||||
END_REFLECTOR
|
||||
|
Loading…
Reference in New Issue
Block a user