Added osgFX::MultiTextureControl node for managing blending between

different texture layers.
This commit is contained in:
Robert Osfield 2005-03-09 16:54:10 +00:00
parent 8dc1be6707
commit 6a103aa413
18 changed files with 593 additions and 333 deletions

View File

@ -227,6 +227,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name Core osgDB
End Project Dependency
Begin Project Dependency
Project_Dep_Name Core osgFX
End Project Dependency
}}}
###############################################################################
@ -2357,6 +2360,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name Core osgText
End Project Dependency
Begin Project Dependency
Project_Dep_Name Core osgFX
End Project Dependency
}}}
###############################################################################

View File

@ -111,6 +111,10 @@ SOURCE=..\..\src\osgFX\Effect.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\osgFX\MultiTextureControl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\osgFX\Registry.cpp
# End Source File
# Begin Source File
@ -155,6 +159,10 @@ SOURCE=..\..\include\osgFX\Export
# End Source File
# Begin Source File
SOURCE=..\..\include\osgFX\MultiTextureControl
# End Source File
# Begin Source File
SOURCE=..\..\include\osgFX\Registry
# End Source File
# Begin Source File

View File

@ -276,6 +276,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\MultiSwitch.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\MultiTextureControl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\Node.cpp
# End Source File
# Begin Source File
@ -580,6 +584,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\MultiSwitch.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\MultiTextureControl.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\Node.h
# End Source File
# Begin Source File

View File

@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=osgPlugin osgFX - Win32 Debug
CFG=osgPlugin osgFX - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@ -13,12 +13,12 @@ CFG=osgPlugin osgFX - Win32 Debug
!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 "dot_osgFX.mak" CFG="osgPlugin osgFX - Win32 Debug"
!MESSAGE NMAKE /f "dot_osgFX.mak" CFG="osgPlugin osgFX - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "osgPlugin osgFX - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "osgPlugin osgFX - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "osgPlugin osgFX - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
@ -29,130 +29,75 @@ CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "osgPlugin osgFX - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "../../../bin"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "../../../include" /I "../../../../OpenThreads/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DOT_OSGNV_EXPORTS" /D "_MBCS" /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DOT_OSGNV_EXPORTS" /D "_MBCS" /GZ /c
# ADD BASE MTL /nologo /win32
# ADD MTL /nologo /win32
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
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 osgd.lib osgDBd.lib /nologo /subsystem:windows /dll /pdb:"..\..\..\bin\dot_osgFXd.pdb" /debug /machine:IX86 /out:"..\..\..\bin\osgdb_osgFXd.dll" /implib:"../../../lib/osgdb_osgFXd.lib" /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 OpenThreadsWin32d.lib 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 /subsystem:windows /dll /pdb:"..\..\..\bin\dot_osgFXd.pdb" /debug /machine:IX86 /out:"..\..\..\bin\osgdb_osgFXd.dll" /implib:"../../../lib/osgdb_osgFXd.lib" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../../OpenThreads/lib/win32" /libpath:"../../../../Producer/lib" /libpath:"../../../../3rdParty/lib"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "osgPlugin osgFX - Win32 Release"
!IF "$(CFG)" == "osgPlugin osgFX - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../../../bin"
# 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"
# PROP Output_Dir "../../../lib"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /MD /W3 /GR /GX /Zi /O2 /I "../../../include" /I "../../../../OpenThreads/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DOT_OSGNV_EXPORTS" /D "_MBCS" /GF /c
# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DOT_OSGNV_EXPORTS" /D "_MBCS" /GF /c
# ADD BASE MTL /nologo /win32
# ADD MTL /nologo /win32
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
# 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" /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 osg.lib osgDB.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /out:"..\..\..\bin\osgdb_osgFX.dll" /implib:"../../../lib/osgdb_osgFX.lib" /pdbtype:sept /opt:ref /opt:icf
# ADD LINK32 OpenThreadsWin32.lib 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 /subsystem:windows /dll /debug /machine:IX86 /out:"..\..\..\bin\osgdb_osgFX.dll" /implib:"../../../lib/osgdb_osgFX.lib" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../../OpenThreads/lib/win32" /libpath:"../../../../Producer/lib" /libpath:"../../../../3rdParty/lib" /opt:ref /opt:icf
# 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 /machine:I386
# ADD LINK32 OpenThreadsWin32.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"LIBC" /out:"../../../bin/osgdb_osgFX.dll" /libpath:"../../../lib" /libpath:"../../../../OpenThreads/lib/win32" /libpath:"../../../../Producer/lib" /libpath:"../../../../3rdParty/lib"
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "osgPlugin osgFX - 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 "../../../lib"
# PROP Intermediate_Dir "Debug"
# 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 /vd0 /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" /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 OpenThreadsWin32d.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBC" /out:"../../../bin/osgdb_osgFXd.dll" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../../OpenThreads/lib/win32" /libpath:"../../../../Producer/lib" /libpath:"../../../../3rdParty/lib"
# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ENDIF
# Begin Target
# Name "osgPlugin osgFX - Win32 Debug"
# Name "osgPlugin osgFX - Win32 Release"
# Name "osgPlugin osgFX - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;def;odl;idl;hpj;bat;asm"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_AnisotropicLighting.cpp
DEP_CPP_IO_AN=\
"..\..\..\Include\osg\ArgumentParser"\
"..\..\..\Include\Osg\Array"\
"..\..\..\Include\Osg\BoundingBox"\
"..\..\..\Include\Osg\BoundingSphere"\
"..\..\..\include\osg\buffered_value"\
"..\..\..\Include\Osg\ConvexPlanarOccluder"\
"..\..\..\Include\Osg\ConvexPlanarPolygon"\
"..\..\..\Include\Osg\CopyOp"\
"..\..\..\include\osg\DisplaySettings"\
"..\..\..\Include\Osg\Drawable"\
"..\..\..\Include\Osg\Export"\
"..\..\..\include\osg\fast_back_stack"\
"..\..\..\include\osg\FrameStamp"\
"..\..\..\Include\Osg\Geode"\
"..\..\..\Include\Osg\Gl"\
"..\..\..\Include\Osg\Group"\
"..\..\..\Include\Osg\Image"\
"..\..\..\include\osg\Math"\
"..\..\..\Include\Osg\Matrix"\
"..\..\..\Include\Osg\Node"\
"..\..\..\include\osg\NodeCallback"\
"..\..\..\Include\Osg\NodeVisitor"\
"..\..\..\Include\Osg\Object"\
"..\..\..\Include\Osg\OccluderNode"\
"..\..\..\Include\Osg\Plane"\
"..\..\..\Include\Osg\Polytope"\
"..\..\..\Include\Osg\Quat"\
"..\..\..\include\osg\ref_ptr"\
"..\..\..\Include\Osg\Referenced"\
"..\..\..\Include\Osg\Shape"\
"..\..\..\Include\Osg\State"\
"..\..\..\Include\Osg\StateAttribute"\
"..\..\..\Include\Osg\StateSet"\
"..\..\..\Include\Osg\Texture"\
"..\..\..\Include\Osg\Texture2D"\
"..\..\..\include\osg\UByte4"\
"..\..\..\Include\Osg\Vec2"\
"..\..\..\Include\Osg\Vec3"\
"..\..\..\Include\Osg\Vec4"\
"..\..\..\include\osg\Viewport"\
"..\..\..\Include\osgDB\DotOsgWrapper"\
"..\..\..\Include\osgDB\DynamicLibrary"\
"..\..\..\Include\osgDB\Export"\
"..\..\..\Include\osgDB\Field"\
"..\..\..\Include\osgDB\FieldReader"\
"..\..\..\Include\osgDB\FieldReaderIterator"\
"..\..\..\Include\osgDB\Input"\
"..\..\..\Include\osgDB\Output"\
"..\..\..\include\osgDB\ReaderWriter"\
"..\..\..\Include\osgDB\Registry"\
"..\..\..\include\osgFX\AnisotropicLighting"\
"..\..\..\include\osgFX\Effect"\
"..\..\..\include\osgFX\Export"\
"..\..\..\include\osgFX\Technique"\
# End Source File
# Begin Source File
@ -161,246 +106,31 @@ SOURCE=..\..\..\src\osgPlugins\osgFX\IO_BumpMapping.cpp
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_Cartoon.cpp
DEP_CPP_IO_CA=\
"..\..\..\Include\osg\ArgumentParser"\
"..\..\..\Include\Osg\Array"\
"..\..\..\Include\Osg\BoundingBox"\
"..\..\..\Include\Osg\BoundingSphere"\
"..\..\..\include\osg\buffered_value"\
"..\..\..\Include\Osg\ConvexPlanarOccluder"\
"..\..\..\Include\Osg\ConvexPlanarPolygon"\
"..\..\..\Include\Osg\CopyOp"\
"..\..\..\include\osg\DisplaySettings"\
"..\..\..\Include\Osg\Drawable"\
"..\..\..\Include\Osg\Export"\
"..\..\..\include\osg\fast_back_stack"\
"..\..\..\include\osg\FrameStamp"\
"..\..\..\Include\Osg\Geode"\
"..\..\..\Include\Osg\Gl"\
"..\..\..\Include\Osg\Group"\
"..\..\..\Include\Osg\Image"\
"..\..\..\Include\Osg\LineWidth"\
"..\..\..\Include\Osg\Material"\
"..\..\..\include\osg\Math"\
"..\..\..\Include\Osg\Matrix"\
"..\..\..\Include\Osg\Node"\
"..\..\..\include\osg\NodeCallback"\
"..\..\..\Include\Osg\NodeVisitor"\
"..\..\..\Include\Osg\Object"\
"..\..\..\Include\Osg\OccluderNode"\
"..\..\..\Include\Osg\Plane"\
"..\..\..\Include\Osg\Polytope"\
"..\..\..\Include\Osg\Quat"\
"..\..\..\include\osg\ref_ptr"\
"..\..\..\Include\Osg\Referenced"\
"..\..\..\Include\Osg\Shape"\
"..\..\..\Include\Osg\State"\
"..\..\..\Include\Osg\StateAttribute"\
"..\..\..\Include\Osg\StateSet"\
"..\..\..\include\osg\UByte4"\
"..\..\..\Include\Osg\Vec2"\
"..\..\..\Include\Osg\Vec3"\
"..\..\..\Include\Osg\Vec4"\
"..\..\..\include\osg\Viewport"\
"..\..\..\Include\osgDB\DotOsgWrapper"\
"..\..\..\Include\osgDB\DynamicLibrary"\
"..\..\..\Include\osgDB\Export"\
"..\..\..\Include\osgDB\Field"\
"..\..\..\Include\osgDB\FieldReader"\
"..\..\..\Include\osgDB\FieldReaderIterator"\
"..\..\..\Include\osgDB\Input"\
"..\..\..\Include\osgDB\Output"\
"..\..\..\include\osgDB\ReaderWriter"\
"..\..\..\Include\osgDB\Registry"\
"..\..\..\include\osgFX\Cartoon"\
"..\..\..\include\osgFX\Effect"\
"..\..\..\include\osgFX\Export"\
"..\..\..\include\osgFX\Technique"\
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_Effect.cpp
DEP_CPP_IO_EF=\
"..\..\..\Include\osg\ArgumentParser"\
"..\..\..\Include\Osg\Array"\
"..\..\..\Include\Osg\BoundingBox"\
"..\..\..\Include\Osg\BoundingSphere"\
"..\..\..\include\osg\buffered_value"\
"..\..\..\Include\Osg\ConvexPlanarOccluder"\
"..\..\..\Include\Osg\ConvexPlanarPolygon"\
"..\..\..\Include\Osg\CopyOp"\
"..\..\..\include\osg\DisplaySettings"\
"..\..\..\Include\Osg\Drawable"\
"..\..\..\Include\Osg\Export"\
"..\..\..\include\osg\fast_back_stack"\
"..\..\..\include\osg\FrameStamp"\
"..\..\..\Include\Osg\Geode"\
"..\..\..\Include\Osg\Gl"\
"..\..\..\Include\Osg\Group"\
"..\..\..\Include\Osg\Image"\
"..\..\..\include\osg\Math"\
"..\..\..\Include\Osg\Matrix"\
"..\..\..\Include\Osg\Node"\
"..\..\..\include\osg\NodeCallback"\
"..\..\..\Include\Osg\NodeVisitor"\
"..\..\..\Include\Osg\Object"\
"..\..\..\Include\Osg\OccluderNode"\
"..\..\..\Include\Osg\Plane"\
"..\..\..\Include\Osg\Polytope"\
"..\..\..\Include\Osg\Quat"\
"..\..\..\include\osg\ref_ptr"\
"..\..\..\Include\Osg\Referenced"\
"..\..\..\Include\Osg\Shape"\
"..\..\..\Include\Osg\State"\
"..\..\..\Include\Osg\StateAttribute"\
"..\..\..\Include\Osg\StateSet"\
"..\..\..\include\osg\UByte4"\
"..\..\..\Include\Osg\Vec2"\
"..\..\..\Include\Osg\Vec3"\
"..\..\..\Include\Osg\Vec4"\
"..\..\..\include\osg\Viewport"\
"..\..\..\Include\osgDB\DotOsgWrapper"\
"..\..\..\Include\osgDB\DynamicLibrary"\
"..\..\..\Include\osgDB\Export"\
"..\..\..\Include\osgDB\Field"\
"..\..\..\Include\osgDB\FieldReader"\
"..\..\..\Include\osgDB\FieldReaderIterator"\
"..\..\..\Include\osgDB\Input"\
"..\..\..\Include\osgDB\Output"\
"..\..\..\include\osgDB\ReaderWriter"\
"..\..\..\Include\osgDB\Registry"\
"..\..\..\include\osgFX\Effect"\
"..\..\..\include\osgFX\Export"\
"..\..\..\include\osgFX\Technique"\
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_MultiTextureControl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_Scribe.cpp
DEP_CPP_IO_SC=\
"..\..\..\Include\osg\ArgumentParser"\
"..\..\..\Include\Osg\Array"\
"..\..\..\Include\Osg\BoundingBox"\
"..\..\..\Include\Osg\BoundingSphere"\
"..\..\..\include\osg\buffered_value"\
"..\..\..\Include\Osg\ConvexPlanarOccluder"\
"..\..\..\Include\Osg\ConvexPlanarPolygon"\
"..\..\..\Include\Osg\CopyOp"\
"..\..\..\include\osg\DisplaySettings"\
"..\..\..\Include\Osg\Drawable"\
"..\..\..\Include\Osg\Export"\
"..\..\..\include\osg\fast_back_stack"\
"..\..\..\include\osg\FrameStamp"\
"..\..\..\Include\Osg\Geode"\
"..\..\..\Include\Osg\Gl"\
"..\..\..\Include\Osg\Group"\
"..\..\..\Include\Osg\Image"\
"..\..\..\Include\Osg\LineWidth"\
"..\..\..\Include\Osg\Material"\
"..\..\..\include\osg\Math"\
"..\..\..\Include\Osg\Matrix"\
"..\..\..\Include\Osg\Node"\
"..\..\..\include\osg\NodeCallback"\
"..\..\..\Include\Osg\NodeVisitor"\
"..\..\..\Include\Osg\Object"\
"..\..\..\Include\Osg\OccluderNode"\
"..\..\..\Include\Osg\Plane"\
"..\..\..\Include\Osg\Polytope"\
"..\..\..\Include\Osg\Quat"\
"..\..\..\include\osg\ref_ptr"\
"..\..\..\Include\Osg\Referenced"\
"..\..\..\Include\Osg\Shape"\
"..\..\..\Include\Osg\State"\
"..\..\..\Include\Osg\StateAttribute"\
"..\..\..\Include\Osg\StateSet"\
"..\..\..\include\osg\UByte4"\
"..\..\..\Include\Osg\Vec2"\
"..\..\..\Include\Osg\Vec3"\
"..\..\..\Include\Osg\Vec4"\
"..\..\..\include\osg\Viewport"\
"..\..\..\Include\osgDB\DotOsgWrapper"\
"..\..\..\Include\osgDB\DynamicLibrary"\
"..\..\..\Include\osgDB\Export"\
"..\..\..\Include\osgDB\Field"\
"..\..\..\Include\osgDB\FieldReader"\
"..\..\..\Include\osgDB\FieldReaderIterator"\
"..\..\..\Include\osgDB\Input"\
"..\..\..\Include\osgDB\Output"\
"..\..\..\include\osgDB\ReaderWriter"\
"..\..\..\Include\osgDB\Registry"\
"..\..\..\include\osgFX\Effect"\
"..\..\..\include\osgFX\Export"\
"..\..\..\include\osgFX\Scribe"\
"..\..\..\include\osgFX\Technique"\
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\osgFX\IO_SpecularHighlights.cpp
DEP_CPP_IO_SP=\
"..\..\..\Include\osg\ArgumentParser"\
"..\..\..\Include\Osg\Array"\
"..\..\..\Include\Osg\BoundingBox"\
"..\..\..\Include\Osg\BoundingSphere"\
"..\..\..\include\osg\buffered_value"\
"..\..\..\Include\Osg\ConvexPlanarOccluder"\
"..\..\..\Include\Osg\ConvexPlanarPolygon"\
"..\..\..\Include\Osg\CopyOp"\
"..\..\..\include\osg\DisplaySettings"\
"..\..\..\Include\Osg\Drawable"\
"..\..\..\Include\Osg\Export"\
"..\..\..\include\osg\fast_back_stack"\
"..\..\..\include\osg\FrameStamp"\
"..\..\..\Include\Osg\Geode"\
"..\..\..\Include\Osg\Gl"\
"..\..\..\Include\Osg\Group"\
"..\..\..\Include\Osg\Image"\
"..\..\..\include\osg\Math"\
"..\..\..\Include\Osg\Matrix"\
"..\..\..\Include\Osg\Node"\
"..\..\..\include\osg\NodeCallback"\
"..\..\..\Include\Osg\NodeVisitor"\
"..\..\..\Include\Osg\Object"\
"..\..\..\Include\Osg\OccluderNode"\
"..\..\..\Include\Osg\Plane"\
"..\..\..\Include\Osg\Polytope"\
"..\..\..\Include\Osg\Quat"\
"..\..\..\include\osg\ref_ptr"\
"..\..\..\Include\Osg\Referenced"\
"..\..\..\Include\Osg\Shape"\
"..\..\..\Include\Osg\State"\
"..\..\..\Include\Osg\StateAttribute"\
"..\..\..\Include\Osg\StateSet"\
"..\..\..\include\osg\UByte4"\
"..\..\..\Include\Osg\Vec2"\
"..\..\..\Include\Osg\Vec3"\
"..\..\..\Include\Osg\Vec4"\
"..\..\..\include\osg\Viewport"\
"..\..\..\Include\osgDB\DotOsgWrapper"\
"..\..\..\Include\osgDB\DynamicLibrary"\
"..\..\..\Include\osgDB\Export"\
"..\..\..\Include\osgDB\Field"\
"..\..\..\Include\osgDB\FieldReader"\
"..\..\..\Include\osgDB\FieldReaderIterator"\
"..\..\..\Include\osgDB\Input"\
"..\..\..\Include\osgDB\Output"\
"..\..\..\include\osgDB\ReaderWriter"\
"..\..\..\Include\osgDB\Registry"\
"..\..\..\include\osgFX\Effect"\
"..\..\..\include\osgFX\Export"\
"..\..\..\include\osgFX\SpecularHighlights"\
"..\..\..\include\osgFX\Technique"\
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;inc"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -0,0 +1,53 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 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 OSGFX_MULTITEXTURECONTROL
#define OSGFX_MULTITEXTURECONTROL
#include <osg/Group>
#include <osgFX/Export>
namespace osgFX
{
/**
This node provides control over the which texture units are active and the
blending weighting between them.
*/
class OSGFX_EXPORT MultiTextureControl: public osg::Group {
public:
MultiTextureControl();
MultiTextureControl(const MultiTextureControl& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgFX, MultiTextureControl);
void setTextureWeight(unsigned int unit, float weight);
float getTextureWeight(unsigned int unit) const { return (unit<_textureWeightList.size()) ? _textureWeightList[unit] : 0.0f; }
unsigned int getNumTextureWeights() const { return _textureWeightList.size(); }
protected:
virtual ~MultiTextureControl() {}
MultiTextureControl& operator = (const MultiTextureControl&) { return *this; }
void updateStateSet();
typedef std::vector<float> TextureWeightList;
TextureWeightList _textureWeightList;
};
}
#endif

View File

@ -1026,6 +1026,11 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
bool getDecorateGeneratedSceneGraphWithCoordinateSystemNode() const { return _decorateWithCoordinateSystemNode; }
void setDecorateGeneratedSceneGraphWithMultiTextureControl(bool flag) { _decorateWithMultiTextureControl = flag; }
bool getDecorateGeneratedSceneGraphWithMultiTextureControl() const { return _decorateWithMultiTextureControl; }
unsigned int getNumOfTextureLevels() const { return _numTextureLevels; }
void setCommentString(const std::string& comment) { _comment = comment; }
const std::string& getCommentString() const { return _comment; }
@ -1064,6 +1069,8 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
// helper functions for handling optional archive
void _writeNodeFile(const osg::Node& node,const std::string& filename);
void _writeImageFile(const osg::Image& image,const std::string& filename);
protected:
@ -1079,6 +1086,7 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
void init();
osg::Node* decorateWithCoordinateSystemNode(osg::Node* subgraph);
osg::Node* decorateWithMultiTextureControl(osg::Node* subgraph);
osg::ref_ptr<CompositeSource> _sourceGraph;
@ -1114,10 +1122,13 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
TextureType _textureType;
float _maxAnisotropy;
MipMappingMode _mipMappingMode;
unsigned int _numTextureLevels;
bool _useLocalTileTransform;
bool _decorateWithCoordinateSystemNode;
bool _decorateWithMultiTextureControl;
std::string _comment;

View File

@ -6,6 +6,7 @@ CXXFILES =\
BumpMapping.cpp\
Cartoon.cpp\
Effect.cpp\
MultiTextureControl.cpp\
Registry.cpp\
Scribe.cpp\
SpecularHighlights.cpp\

View File

@ -0,0 +1,178 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 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/TexEnv>
#include <osg/TexEnvCombine>
#include <osgFX/MultiTextureControl>
using namespace osgFX;
MultiTextureControl::MultiTextureControl()
{
}
MultiTextureControl::MultiTextureControl(const MultiTextureControl& copy, const osg::CopyOp& copyop):
Group(copy,copyop),
_textureWeightList(copy._textureWeightList)
{
updateStateSet();
}
void MultiTextureControl::setTextureWeight(unsigned int unit, float weight)
{
if (unit >= _textureWeightList.size())
{
_textureWeightList.resize(unit+1,0.0f);
}
_textureWeightList[unit] = weight;
updateStateSet();
}
void MultiTextureControl::updateStateSet()
{
osg::StateSet* stateset = getOrCreateStateSet();
stateset->clear();
if (_textureWeightList.size()==1)
{
osg::TexEnv* texenv = new osg::TexEnv(osg::TexEnv::MODULATE);
stateset->setTextureAttribute(0, texenv);
}
if (_textureWeightList.size()==2)
{
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE0+0);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE0+1);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
float r = _textureWeightList[0]/(_textureWeightList[0]+_textureWeightList[1]);
texenv->setConstantColor(osg::Vec4(r,r,r,r));
stateset->setTextureAttribute(0, texenv);
}
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::MODULATE);
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
stateset->setTextureAttribute(1, texenv);
}
}
if (_textureWeightList.size()==3)
{
float b = (_textureWeightList[0]+_textureWeightList[1])/(_textureWeightList[0]+_textureWeightList[1]+_textureWeightList[2]);
float a = _textureWeightList[0]/(_textureWeightList[0]+_textureWeightList[1]);
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE0+0);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE0+1);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setConstantColor(osg::Vec4(a,a,a,a));
stateset->setTextureAttribute(0, texenv);
}
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE0+2);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setConstantColor(osg::Vec4(b,b,b,b));
stateset->setTextureAttribute(1, texenv);
}
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::MODULATE);
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
stateset->setTextureAttribute(2, texenv);
}
}
/*
bool firstActiveTextureUnit = true;
for(unsigned int unit = 0;
unit < _textureWeightList.size();
++unit)
{
float r = _textureWeightList[unit];
if (r==0.0f)
{
stateset->setTextureMode(unit, GL_TEXTURE_2D, osg::StateAttribute::OFF);
}
else
{
stateset->setTextureMode(unit, GL_TEXTURE_2D, osg::StateAttribute::ON);
if (firstActiveTextureUnit)
{
stateset->setTextureAttribute(unit, new osg::TexEnv);
firstActiveTextureUnit = false;
}
else
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setConstantColor(osg::Vec4(r,r,r,r));
stateset->setTextureAttribute(unit, texenv);
}
}
}
*/
}

View File

@ -61,6 +61,8 @@
#include "MultiSwitch.h"
#include "VisibilityGroup.h"
#include "MultiTextureControl.h"
#include "Geometry.h"
#include "ShapeDrawable.h"
#include "Shape.h"
@ -952,6 +954,10 @@ osg::Node* DataInputStream::readNode()
node = new osgSim::LightPointNode();
((ive::LightPointNode*)(node))->read(this);
}
else if(nodeTypeID== IVEMULTITEXTURECONTROL){
node = new osgFX::MultiTextureControl();
((ive::MultiTextureControl*)(node))->read(this);
}
else{
throw Exception("Unknown node identification in DataInputStream::readNode()");
}

View File

@ -63,6 +63,8 @@
#include "MultiSwitch.h"
#include "VisibilityGroup.h"
#include "MultiTextureControl.h"
#include "Geometry.h"
#include "ShapeDrawable.h"
@ -733,6 +735,9 @@ void DataOutputStream::writeNode(const osg::Node* node)
else if(dynamic_cast<const osgSim::LightPointNode*>(node)){
((ive::LightPointNode*)(node))->write(this);
}
else if(dynamic_cast<const osgFX::MultiTextureControl*>(node)){
((ive::MultiTextureControl*)(node))->write(this);
}
else
throw Exception("Unknown node in Group::write()");

View File

@ -47,6 +47,7 @@ CXXFILES =\
Material.cpp\
MatrixTransform.cpp\
MultiSwitch.cpp\
MultiTextureControl.cpp\
Node.cpp\
Object.cpp\
OccluderNode.cpp\
@ -77,7 +78,7 @@ CXXFILES =\
VertexProgram.cpp\
VisibilityGroup.cpp\
LIBS += -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS)
LIBS += -losgFX -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS)
TARGET_BASENAME = ive
include $(TOPDIR)/Make/cygwin_plugin_def

View File

@ -0,0 +1,70 @@
/**********************************************************************
*
* FILE: MultiTextureControl.cpp
*
* DESCRIPTION: Read/Write osg::MultiTextureControl in binary format to disk.
*
* CREATED BY: Auto generated by iveGenerate
* and later modified by Rune Schmidt Jensen.
*
* HISTORY: Created 24.3.2003
*
* Copyright 2003 VR-C
**********************************************************************/
#include "Exception.h"
#include "MultiTextureControl.h"
#include "Group.h"
using namespace ive;
void MultiTextureControl::write(DataOutputStream* out){
// Write MultiTextureControl's identification.
out->writeInt(IVEMULTITEXTURECONTROL);
// If the osg class is inherited by any other class we should also write this to file.
osg::Group* group = dynamic_cast<osg::Group*>(this);
if(group){
((ive::Group*)(group))->write(out);
}
else
throw Exception("MultiTextureControl::write(): Could not cast this osg::MultiTextureControl to an osg::Group.");
// Write MultiTextureControl's properties.
// Write rangelist
unsigned int size = getNumTextureWeights();
out->writeUInt(size);
for(unsigned int i=0;i<size;i++){
out->writeFloat(getTextureWeight(i));
}
}
void MultiTextureControl::read(DataInputStream* in){
// Peek on MultiTextureControl's identification.
int id = in->peekInt();
if(id == IVEMULTITEXTURECONTROL){
// Read MultiTextureControl's identification.
id = in->readInt();
// If the osg class is inherited by any other class we should also read this from file.
osg::Group* group = dynamic_cast<osg::Group*>(this);
if(group){
((ive::Group*)(group))->read(in);
}
else
throw Exception("MultiTextureControl::read(): Could not cast this osg::MultiTextureControl to an osg::Group.");
// Read MultiTextureControl's properties
// Read rangelist
unsigned int size = in->readUInt();
for(unsigned int i=0;i<size;i++)
{
float value = in->readFloat();
setTextureWeight(i, value);
}
}
else{
throw Exception("MultiTextureControl::read(): Expected MultiTextureControl identification.");
}
}

View File

@ -0,0 +1,15 @@
#ifndef IVE_MULTITEXTYRECONTROL
#define IVE_MULTITEXTYRECONTROL 1
#include <osgFX/MultiTextureControl>
#include "ReadWrite.h"
namespace ive{
class MultiTextureControl : public osgFX::MultiTextureControl, public ReadWrite {
public:
void write(DataOutputStream* out);
void read(DataInputStream* in);
};
}
#endif

View File

@ -96,8 +96,13 @@ namespace ive {
#define IVELIGHTPOINTNODE 0x00100007
#define IVEMULTISWITCH 0x00100008
#define IVEVISIBILITYGROUP 0x00100009
#define IVEDIRECTIONALSECTOR 0x0010000A
#define IVEVISIBILITYGROUP 0x00100009
#define IVEDIRECTIONALSECTOR 0x0010000A
// osgFX classes
#define IVEMULTITEXTURECONTROL 0x01000001
class ReadWrite{

View File

@ -5,6 +5,7 @@ CXXFILES =\
IO_AnisotropicLighting.cpp\
IO_BumpMapping.cpp\
IO_Cartoon.cpp\
IO_MultiTextureControl.cpp\
IO_Scribe.cpp\
IO_SpecularHighlights.cpp\
IO_Effect.cpp\

View File

@ -0,0 +1,79 @@
#include <osgFX/MultiTextureControl>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
bool MultiTextureControl_readLocalData(osg::Object &obj, osgDB::Input &fr);
bool MultiTextureControl_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
osgDB::RegisterDotOsgWrapperProxy MultiTextureControl_Proxy
(
new osgFX::MultiTextureControl,
"osgFX::MultiTextureControl",
"Object Node osgFX::MultiTextureControl Group",
MultiTextureControl_readLocalData,
MultiTextureControl_writeLocalData
);
bool MultiTextureControl_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgFX::MultiTextureControl &mtc = static_cast<osgFX::MultiTextureControl &>(obj);
bool iteratorAdvanced = false;
bool matchFirst = false;
if ((matchFirst=fr.matchSequence("TextureWeights {")) || fr.matchSequence("TextureWeights %i {"))
{
// set up coordinates.
int entry = fr[0].getNoNestedBrackets();
if (matchFirst)
{
fr += 2;
}
else
{
fr += 3;
}
float weight=0.0f;
unsigned int i=0;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
if (fr[0].getFloat(weight))
{
mtc.setTextureWeight(i,weight);
++fr;
++i;
}
else
{
++fr;
}
}
iteratorAdvanced = true;
++fr;
}
return iteratorAdvanced;
}
bool MultiTextureControl_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgFX::MultiTextureControl &mtc = static_cast<const osgFX::MultiTextureControl &>(obj);
fw.indent() << "TextureWeights "<<mtc.getNumTextureWeights()<<" {"<< std::endl;
fw.moveIn();
for(unsigned int i=0; i<mtc.getNumTextureWeights();++i)
{
fw.indent() << mtc.getTextureWeight(i)<<std::endl;
}
fw.moveOut();
fw.indent() << "}"<< std::endl;
return true;
}

View File

@ -31,6 +31,8 @@
#include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>
#include <osgFX/MultiTextureControl>
#include <osgTerrain/DataSet>
// GDAL includes
@ -2134,12 +2136,12 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
osg::StateSet* stateset = new osg::StateSet;
osg::Texture* baseTexture = 0;
for(layerNum=0;
layerNum<_imagery.size();
++layerNum)
{
ImageData& imageData = _imagery[layerNum];
if (!imageData._imagery.valid() || !imageData._imagery->_image.valid()) continue;
osg::Image* image = imageData._imagery->_image.get();
@ -2156,6 +2158,9 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
image->setFileName(imageName.c_str());
osg::Texture2D* texture = new osg::Texture2D;
if (baseTexture==0) baseTexture=texture;
texture->setImage(image);
texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
@ -2231,6 +2236,27 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
}
}
// now fill in any blank texture units.
bool fillInAllTextureUnits = true;
if (fillInAllTextureUnits && baseTexture)
{
for(layerNum=0;
layerNum<_dataSet->getNumOfTextureLevels();
++layerNum)
{
bool applyBaseTexture = false;
if (layerNum>=_imagery.size()) applyBaseTexture=true;
else
{
ImageData& imageData = _imagery[layerNum];
if (!imageData._imagery.valid() ||
!imageData._imagery->_image.valid()) applyBaseTexture=true;
}
if (applyBaseTexture)
stateset->setTextureAttributeAndModes(layerNum,baseTexture,osg::StateAttribute::ON);
}
}
return stateset;
}
@ -2549,17 +2575,29 @@ osg::Node* DataSet::DestinationTile::createPolygonal()
geometry->setColorArray(&color);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
for(unsigned int layerNum=0;
layerNum<_imagery.size();
++layerNum)
bool fillInAllTextureUnits = true;
if (fillInAllTextureUnits)
{
ImageData& imageData = _imagery[layerNum];
if (imageData._imagery.valid() && imageData._imagery->_image.valid())
for(unsigned int layerNum=0;
layerNum<_dataSet->getNumOfTextureLevels();
++layerNum)
{
geometry->setTexCoordArray(layerNum,&t);
}
}
else
{
for(unsigned int layerNum=0;
layerNum<_imagery.size();
++layerNum)
{
ImageData& imageData = _imagery[layerNum];
if (imageData._imagery.valid() && imageData._imagery->_image.valid())
{
geometry->setTexCoordArray(layerNum,&t);
}
}
}
osg::DrawElementsUShort& drawElements = *(new osg::DrawElementsUShort(GL_TRIANGLES,2*3*(numColumns-1)*(numRows-1)));
geometry->addPrimitiveSet(&drawElements);
@ -3328,6 +3366,9 @@ DataSet::DataSet()
_useLocalTileTransform = true;
_decorateWithCoordinateSystemNode = true;
_decorateWithMultiTextureControl = true;
_numTextureLevels = 1;
_writeNodeBeforeSimplification = false;
@ -3708,6 +3749,19 @@ void DataSet::computeDestinationGraphFromSources(unsigned int numLevels)
}
}
// compute the number of texture layers required.
unsigned int maxTextureUnit = 0;
for(CompositeSource::source_iterator sitr(_sourceGraph.get());sitr.valid();++sitr)
{
Source* source = sitr->get();
if (source)
{
if (maxTextureUnit<source->getLayer()) maxTextureUnit = source->getLayer();
}
}
_numTextureLevels = maxTextureUnit+1;
my_notify(osg::INFO)<<"extents = xMin()"<<extents.xMin()<<" "<<extents.xMax()<<std::endl;
my_notify(osg::INFO)<<" yMin()"<<extents.yMin()<<" "<<extents.yMax()<<std::endl;
@ -4045,6 +4099,10 @@ void DataSet::_writeRow(Row& row)
node = decorateWithCoordinateSystemNode(node.get());
}
if (_decorateWithMultiTextureControl)
{
node = decorateWithMultiTextureControl(node.get());
}
if (!_comment.empty())
{
@ -4108,6 +4166,26 @@ osg::Node* DataSet::decorateWithCoordinateSystemNode(osg::Node* subgraph)
return csn;
}
osg::Node* DataSet::decorateWithMultiTextureControl(osg::Node* subgraph)
{
// if only one layer exists don't need to decorate with MultiTextureControl
if (_numTextureLevels<=1) return subgraph;
// multiple layers active so use osgFX::MultiTextureControl to manage them
osgFX::MultiTextureControl* mtc = new osgFX::MultiTextureControl;
float r = 1.0f/(float)_numTextureLevels;
for(unsigned int i=0;i<_numTextureLevels;++i)
{
mtc->setTextureWeight(i,r);
}
// add the a subgraph.
mtc->addChild(subgraph);
return mtc;
}
void DataSet::_buildDestination(bool writeToDisk)
{
@ -4145,6 +4223,11 @@ void DataSet::_buildDestination(bool writeToDisk)
_rootNode = decorateWithCoordinateSystemNode(_rootNode.get());
}
if (_decorateWithMultiTextureControl)
{
_rootNode = decorateWithMultiTextureControl(_rootNode.get());
}
if (!_comment.empty())
{
_rootNode->addDescription(_comment);

View File

@ -12,7 +12,7 @@ DEF += -DOSGTERRAIN_LIBRARY
INC += $(GDAL_INCLUDES)
LIBS += -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(OTHER_LIBS)
LIBS += -losgFX -losgDB -losgUtil -losg $(GDAL_LIBS) $(GL_LIBS) $(OTHER_LIBS)
TARGET_BASENAME = osgTerrain
LIB = $(LIB_PREFIX)$(TARGET_BASENAME).$(LIB_EXT)