Removed osgfbo and osgpbuffer examples
This commit is contained in:
220
ChangeLog
220
ChangeLog
@@ -1,3 +1,223 @@
|
||||
2006-08-11 10:13 robert
|
||||
|
||||
* NEWS.txt: Updated NEWS
|
||||
|
||||
2006-08-10 21:50 robert
|
||||
|
||||
* VisualStudio/reset-64bit-outdirs.pl: From Mike Wittman, perl
|
||||
script to assist W64 support.
|
||||
|
||||
2006-08-10 21:30 robert
|
||||
|
||||
* VisualStudio/: MUST_READ_ME.txt,
|
||||
applications/osgarchive/osgarchive.dsp,
|
||||
applications/osgconv/osgconv.dsp, applications/osgdem/osgdem.dsp,
|
||||
applications/osgversion/osgversion.dsp,
|
||||
applications/osgviewer/osgviewer.dsp,
|
||||
examples/osgGLUTkeyboardmouse/osgGLUTkeyboardmouse.dsp,
|
||||
examples/osgGLUTsimple/osgGLUTsimple.dsp,
|
||||
examples/osganimate/osganimate.dsp,
|
||||
examples/osgautotransform/osgautotransform.dsp,
|
||||
examples/osgbillboard/osgbillboard.dsp,
|
||||
examples/osgblendequation/osgblendequation.dsp,
|
||||
examples/osgbluemarble/osgbluemarble.dsp,
|
||||
examples/osgcallback/osgcallback.dsp,
|
||||
examples/osgcamera/osgcamera.dsp,
|
||||
examples/osgcameragroup/osgcameragroup.dsp,
|
||||
examples/osgcatch/osgcatch.dsp, examples/osgclip/osgclip.dsp,
|
||||
examples/osgcluster/osgcluster.dsp, examples/osgcopy/osgcopy.dsp,
|
||||
examples/osgcubemap/osgcubemap.dsp,
|
||||
examples/osgdelaunay/osgdelaunay.dsp,
|
||||
examples/osgdepthpartition/osgdepthpartition.dsp,
|
||||
examples/osgdepthshadow/osgdepthshadow.dsp,
|
||||
examples/osgdistortion/osgdistortion.dsp,
|
||||
examples/osgfbo/osgfbo.dsp, examples/osgforest/osgforest.dsp,
|
||||
examples/osgfxbrowser/osgfxbrowser.dsp,
|
||||
examples/osggeodemo/osggeodemo.dsp,
|
||||
examples/osggeometry/osggeometry.dsp,
|
||||
examples/osghangglide/osghangglide.dsp,
|
||||
examples/osghud/osghud.dsp, examples/osgimpostor/osgimpostor.dsp,
|
||||
examples/osgintrospection/example_osgintrospection.dsp,
|
||||
examples/osgkeyboard/osgkeyboard.dsp,
|
||||
examples/osgkeyboardmouse/osgkeyboardmouse.dsp,
|
||||
examples/osglauncher/osglauncher.dsp,
|
||||
examples/osglight/osglight.dsp,
|
||||
examples/osglightpoint/osglightpoint.dsp,
|
||||
examples/osglogicop/osglogicop.dsp, examples/osglogo/osglogo.dsp,
|
||||
examples/osgmotionblur/osgmotionblur.dsp,
|
||||
examples/osgmovie/osgmovie.dsp,
|
||||
examples/osgmultiplecameras/osgmultiplecameras.dsp,
|
||||
examples/osgmultitexture/osgmultitexture.dsp,
|
||||
examples/osgoccluder/osgoccluder.dsp,
|
||||
examples/osgpagedlod/osgpagedlod.dsp,
|
||||
examples/osgparametric/osgparametric.dsp,
|
||||
examples/osgparticle/osgparticledemo.dsp,
|
||||
examples/osgparticleeffects/osgparticleeffects.dsp,
|
||||
examples/osgpbuffer/osgpbuffer.dsp,
|
||||
examples/osgphotoalbum/osgphotoalbum.dsp,
|
||||
examples/osgpick/osgpick.dsp, examples/osgplanets/osgplanets.dsp,
|
||||
examples/osgpoints/osgpoints.dsp,
|
||||
examples/osgpointsprite/osgpointsprite.dsp,
|
||||
examples/osgprecipitation/osgprecipitation.dsp,
|
||||
examples/osgprerender/osgprerender.dsp,
|
||||
examples/osgprerendercubemap/osgprerendercubemap.dsp,
|
||||
examples/osgreflect/osgreflect.dsp,
|
||||
examples/osgscalarbar/osgscalarbar.dsp,
|
||||
examples/osgscribe/osgscribe.dsp,
|
||||
examples/osgsequence/osgsequence.dsp,
|
||||
examples/osgshaders/osgshaders.dsp,
|
||||
examples/osgshaderterrain/osgshaderterrain.dsp,
|
||||
examples/osgshadowtexture/osgshadowtexture.dsp,
|
||||
examples/osgshape/osgshape.dsp, examples/osgsimple/osgsimple.dsp,
|
||||
examples/osgsimplepager/osgsimplepager.dsp,
|
||||
examples/osgsimplifier/osgsimplifier.dsp,
|
||||
examples/osgsimulation/osgsimulation.dsp,
|
||||
examples/osgslice/osgslice.dsp,
|
||||
examples/osgspacewarp/osgspacewarp.dsp,
|
||||
examples/osgspheresegment/osgspheresegment.dsp,
|
||||
examples/osgspotlight/osgspotlight.dsp,
|
||||
examples/osgstereoimage/osgstereoimage.dsp,
|
||||
examples/osgteapot/osgteapot.dsp,
|
||||
examples/osgtesselate/osgtesselate.dsp,
|
||||
examples/osgtext/osgtextdemo.dsp,
|
||||
examples/osgtexture1D/osgtexture1D.dsp,
|
||||
examples/osgtexture2D/osgtexture2D.dsp,
|
||||
examples/osgtexture3D/osgtexture3D.dsp,
|
||||
examples/osgtexturerectangle/osgtexturerectangle.dsp,
|
||||
examples/osgunittests/osgunittests.dsp,
|
||||
examples/osgvertexprogram/osgvertexprogram.dsp,
|
||||
examples/osgvolume/osgvolume.dsp,
|
||||
examples/osgwindows/osgwindows.dsp, osg/osg.dsp, osgDB/osgDB.dsp,
|
||||
osgFX/osgFX.dsp, osgGA/osgGA.dsp,
|
||||
osgIntrospection/osgIntrospection.dsp,
|
||||
osgParticle/osgParticle.dsp, osgPlugins/3dc/3dc.dsp,
|
||||
osgPlugins/ESRIShape/ESRIShape.dsp,
|
||||
osgPlugins/OpenFlight/OpenFlight.dsp, osgPlugins/ac3d/ac3d.dsp,
|
||||
osgPlugins/bmp/bmp.dsp, osgPlugins/bsp/bsp.dsp,
|
||||
osgPlugins/dds/dds.dsp, osgPlugins/directx/directx.dsp,
|
||||
osgPlugins/dw/dw.dsp, osgPlugins/dxf/dxf.dsp,
|
||||
osgPlugins/flt/flt.dsp, osgPlugins/freetype/freetype.dsp,
|
||||
osgPlugins/gdal/gdal.dsp, osgPlugins/geo/geo.dsp,
|
||||
osgPlugins/gif/gif.dsp, osgPlugins/hdr/hdr.dsp,
|
||||
osgPlugins/ive/ive.dsp, osgPlugins/jp2/jp2.dsp,
|
||||
osgPlugins/jpeg/jpeg.dsp, osgPlugins/lib3ds/lib3ds.dsp,
|
||||
osgPlugins/logo/logo.dsp, osgPlugins/lwo/lwo.dsp,
|
||||
osgPlugins/lws/lws.dsp, osgPlugins/md2/md2.dsp,
|
||||
osgPlugins/net/net.dsp, osgPlugins/normals/normals.dsp,
|
||||
osgPlugins/obj/obj.dsp, osgPlugins/osg/dot_osg.dsp,
|
||||
osgPlugins/osgFX/dot_osgFX.dsp,
|
||||
osgPlugins/osgParticle/dot_osgParticle.dsp,
|
||||
osgPlugins/osgSim/dot_osgSim.dsp,
|
||||
osgPlugins/osgText/dot_osgText.dsp, osgPlugins/osga/osga.dsp,
|
||||
osgPlugins/osgtgz/osgtgz.dsp, osgPlugins/pfb/pfb.dsp,
|
||||
osgPlugins/pic/pic.dsp, osgPlugins/png/png.dsp,
|
||||
osgPlugins/pnm/pnm.dsp, osgPlugins/rgb/rgb.dsp,
|
||||
osgPlugins/rot/rot.dsp, osgPlugins/scale/scale.dsp,
|
||||
osgPlugins/stl/stl.dsp, osgPlugins/tga/tga.dsp,
|
||||
osgPlugins/tgz/tgz.dsp, osgPlugins/tiff/tiff.dsp,
|
||||
osgPlugins/trans/trans.dsp, osgPlugins/txp/txp.dsp,
|
||||
osgPlugins/zip/zip.dsp, osgProducer/osgProducer.dsp,
|
||||
osgSim/osgSim.dsp, osgTerrain/osgTerrain.dsp,
|
||||
osgText/osgText.dsp, osgUtil/osgUtil.dsp,
|
||||
osgWrappers/osg/wrapper_osg.dsp,
|
||||
osgWrappers/osgDB/wrapper_osgDB.dsp,
|
||||
osgWrappers/osgFX/wrapper_osgFX.dsp,
|
||||
osgWrappers/osgGA/wrapper_osgGA.dsp,
|
||||
osgWrappers/osgParticle/wrapper_osgParticle.dsp,
|
||||
osgWrappers/osgProducer/wrapper_osgProducer.dsp,
|
||||
osgWrappers/osgSim/wrapper_osgSim.dsp,
|
||||
osgWrappers/osgTerrain/wrapper_osgTerrain.dsp,
|
||||
osgWrappers/osgText/wrapper_osgText.dsp,
|
||||
osgWrappers/osgUtil/wrapper_osgUtil.dsp: From Mike Wittman,
|
||||
support for VS 64bit build
|
||||
|
||||
2006-08-10 16:53 robert
|
||||
|
||||
* src/osgProducer/OsgCameraGroup.cpp: Moved all platform specific
|
||||
processor out of osgProducer and into OpenThreads
|
||||
|
||||
2006-08-10 14:12 robert
|
||||
|
||||
* src/osgPlugins/pfb/ConvertFromPerformer.cpp: From Laurens
|
||||
Voerman, " osgPlugins\pfb\ConvertFromPerformer.cpp
|
||||
|
||||
Added support for PFSTATE_ALPHAFUNC
|
||||
PFSTATE_ALPHAREF Improved handling of PFTR_NO_OCCLUDE
|
||||
|
||||
I have tested this with WIN32 performer 3.1 and 3.2.2 and linux
|
||||
OpenGL Performer 3.1.1"
|
||||
|
||||
------------------------------------------------
|
||||
|
||||
2006-08-10 13:13 robert
|
||||
|
||||
* examples/osgtext/osgtext.cpp: From Martijn Kragtwijk, added
|
||||
example text for showing osgText::Text::CharacterSizeMode in
|
||||
action.
|
||||
|
||||
2006-08-10 12:08 robert
|
||||
|
||||
* src/osgPlugins/pnm/ReaderWriterPNM.cpp: Added write ppn support,
|
||||
use -O ascii to select ascii ppn output, otherwise binary is
|
||||
chosen.
|
||||
|
||||
Fixed crash when erroneous pnm files were read.
|
||||
|
||||
Added -O flip option.
|
||||
|
||||
2006-08-10 09:45 robert
|
||||
|
||||
* ChangeLog, include/osg/Math: From Daniel Larimer, "Apple updated
|
||||
their developer tools again and broke the __isnanf and __isnand
|
||||
methods... replacing them with a call to isnan(v) seems to work
|
||||
on both Xcode 2.3 and 2.4"
|
||||
|
||||
2006-08-10 07:43 robert
|
||||
|
||||
* include/osgUtil/Optimizer: Addd a setNodeMaskOverride(0xffffffff)
|
||||
to cope with models that are hiding subgraphs that still need to
|
||||
be accounted for when optimizer.
|
||||
|
||||
2006-08-10 07:20 robert
|
||||
|
||||
* src/osgText/Text.cpp: Commented out the _textBB contribution of
|
||||
outline/backdrops to fix bounding box problem.
|
||||
|
||||
2006-08-09 14:02 robert
|
||||
|
||||
* include/osg/UByte4, VisualStudio/LANGEXT.DAT,
|
||||
VisualStudio/highlight70.reg, VisualStudio/highlight71.reg,
|
||||
VisualStudio/highlight80.reg,
|
||||
Xcode/OpenSceneGraph/OpenSceneGraph.xcode/project.pbxproj,
|
||||
Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj,
|
||||
Xcode/XcodeTemplates/OSG Application/osgApp_Prefix.pch: Removed
|
||||
referecens to the deprecate UByte4
|
||||
|
||||
2006-08-09 13:56 robert
|
||||
|
||||
* src/osgWrappers/osg/ValueTypeCandidates.txt: Added Vec4ub and
|
||||
removed UByte4
|
||||
|
||||
2006-08-09 11:09 robert
|
||||
|
||||
* src/osgPlugins/OpenFlight/: GeometryRecords.cpp,
|
||||
VertexRecords.cpp: Added nan dectecion and error reporting
|
||||
|
||||
2006-08-08 17:08 robert
|
||||
|
||||
* src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp: Added
|
||||
TESSELATE_GEOMETRY to Optimizer pass to fix z fighting issues.
|
||||
|
||||
2006-08-08 15:57 robert
|
||||
|
||||
* src/osgProducer/OsgCameraGroup.cpp: Added extra defined(CPU_SET)
|
||||
to try and get round RH8 compile problems.
|
||||
|
||||
2006-08-08 12:59 robert
|
||||
|
||||
* src/osgPlugins/OpenFlight/PaletteRecords.cpp: Fixed backColor
|
||||
implementation for LightPointAppearancePalette.
|
||||
|
||||
2006-08-08 12:27 robert
|
||||
|
||||
* include/osgProducer/OsgCameraGroup,
|
||||
|
||||
@@ -207,7 +207,6 @@ ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
osgdepthshadow \
|
||||
osgdepthpartition \
|
||||
osgdistortion \
|
||||
osgfbo \
|
||||
osgforest \
|
||||
osgfxbrowser \
|
||||
osggeodemo \
|
||||
@@ -231,7 +230,6 @@ ifeq ($(PRODUCER_INSTALLED),yes)
|
||||
osgparametric \
|
||||
osgparticle \
|
||||
osgparticleeffects \
|
||||
osgpbuffer \
|
||||
osgpick \
|
||||
osgplanets \
|
||||
osgpoints \
|
||||
|
||||
@@ -801,33 +801,6 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgfbo"=.\examples\osgfbo\osgfbo.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
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgfxbrowser"=.\examples\osgfxbrowser\osgfxbrowser.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@@ -1473,33 +1446,6 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgpbuffer"=.\examples\osgpbuffer\osgpbuffer.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
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgphotoalbum"=.\examples\osgphotoalbum\osgphotoalbum.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="Example osgfbo" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Example osgfbo - 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 "osgfbo.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 "osgfbo.mak" CFG="Example osgfbo - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Example osgfbo - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "Example osgfbo - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Example osgfbo - 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 ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /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 "_CONSOLE" /D "_MBCS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c
|
||||
# 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 opengl32.lib glu32.lib OpenThreadsWin32.lib /nologo /subsystem:console /debug /machine:I386 /out:"$(OutDir)/osgfbo.exe" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Example osgfbo - 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 ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /FR /YX /FD /Zm200 /c
|
||||
# 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 opengl32.lib glu32.lib OpenThreadsWin32d.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"$(OutDir)/osgfbod.exe" /pdbtype:sept /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
# SUBTRACT LINK32 /incremental:no
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Example osgfbo - Win32 Release"
|
||||
# Name "Example osgfbo - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\examples\osgfbo\osgfbo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\icons\osg_icon.rc
|
||||
# End Source File
|
||||
# End Target
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Project
|
||||
@@ -1,105 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="Example osgpbuffer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Example osgpbuffer - 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 "osgpbuffer.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 "osgpbuffer.mak" CFG="Example osgpbuffer - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Example osgpbuffer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "Example osgpbuffer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Example osgpbuffer - 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 ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /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 "_CONSOLE" /D "_MBCS" /D "_CRT_SECURE_NO_DEPRECATE" /YX /FD /Zm200 /c
|
||||
# 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 Producer.lib OpenThreadsWin32.lib glu32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /out:"$(OutDir)/osgpbuffer.exe" /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Example osgpbuffer - 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 ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../../../include" /I "../../../../OpenThreads/include" /I "../../../../Producer/include" /I "../../../../3rdParty/include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /FR /YX /FD /Zm200 /c
|
||||
# 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 Producerd.lib OpenThreadsWin32d.lib glu32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"$(OutDir)/osgpbufferd.exe" /pdbtype:sept /libpath:"../../../lib/$(PlatformName)" /libpath:"../../../../OpenThreads/lib/$(PlatformName)" /libpath:"../../../../Producer/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib/$(PlatformName)" /libpath:"../../../../3rdParty/lib"
|
||||
# SUBTRACT LINK32 /incremental:no
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Example osgpbuffer - Win32 Release"
|
||||
# Name "Example osgpbuffer - Win32 Debug"
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\examples\osgpbuffer\osgpbuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\icons\osg_icon.rc
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,18 +0,0 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
osgfbo.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
INSTFILES = \
|
||||
$(CXXFILES)\
|
||||
GNUmakefile.inst=GNUmakefile
|
||||
|
||||
EXEC = osgfbo
|
||||
|
||||
INC += $(X_INC)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
FBOExtensions.cpp\
|
||||
FramebufferObject.cpp\
|
||||
Renderbuffer.cpp\
|
||||
FramebufferAttachment.cpp\
|
||||
osgfbo.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
EXEC = osgfbo
|
||||
|
||||
INC += $(X_INC)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
@@ -1,141 +0,0 @@
|
||||
#include <osg/GL>
|
||||
#include <osg/Group>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Viewport>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <osg/FrameBufferObject>
|
||||
|
||||
// This function builds a textured quad
|
||||
osg::Node *build_quad(osg::Texture2D *tex)
|
||||
{
|
||||
osg::Geometry *geo = new osg::Geometry;
|
||||
osg::Vec3Array *vx = new osg::Vec3Array;
|
||||
vx->push_back(osg::Vec3(-10, 0, -10));
|
||||
vx->push_back(osg::Vec3(10, 0, -10));
|
||||
vx->push_back(osg::Vec3(10, 0, 10));
|
||||
vx->push_back(osg::Vec3(-10, 0, 10));
|
||||
geo->setVertexArray(vx);
|
||||
osg::Vec3Array *nx = new osg::Vec3Array;
|
||||
nx->push_back(osg::Vec3(0, -1, 0));
|
||||
geo->setNormalArray(nx);
|
||||
geo->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
osg::Vec2Array *tx = new osg::Vec2Array;
|
||||
tx->push_back(osg::Vec2(0, 0));
|
||||
tx->push_back(osg::Vec2(1, 0));
|
||||
tx->push_back(osg::Vec2(1, 1));
|
||||
tx->push_back(osg::Vec2(0, 1));
|
||||
geo->setTexCoordArray(0, tx);
|
||||
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4));
|
||||
geo->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex);
|
||||
|
||||
osg::Geode *geode = new osg::Geode;
|
||||
geode->addDrawable(geo);
|
||||
return geode;
|
||||
}
|
||||
|
||||
void build_world(osg::Group *root)
|
||||
{
|
||||
int width = 2048;
|
||||
int height = 2048;
|
||||
|
||||
// create and configure the texture that we're going
|
||||
// to use as target for render-to-texture
|
||||
osg::ref_ptr<osg::Texture2D> tex = new osg::Texture2D;
|
||||
tex->setTextureSize(width, height);
|
||||
tex->setInternalFormat(GL_RGBA);
|
||||
tex->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
|
||||
tex->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||
|
||||
// create and configure a framebuffer object.
|
||||
// We attach the texture to the first color buffer,
|
||||
// and we attach a simple offscreen image (RenderBuffer)
|
||||
// to the depth buffer in order to allow depth operations
|
||||
osg::ref_ptr<osg::FrameBufferObject> fbo = new osg::FrameBufferObject();
|
||||
fbo->setAttachment(GL_COLOR_ATTACHMENT0_EXT, osg::FrameBufferAttachment(tex.get()));
|
||||
fbo->setAttachment(GL_DEPTH_ATTACHMENT_EXT, osg::FrameBufferAttachment(new osg::RenderBuffer(width, height, GL_DEPTH_COMPONENT24)));
|
||||
|
||||
osg::ref_ptr<osg::Node> subgraph = osgDB::readNodeFile("cow.osg");
|
||||
if (!subgraph) return;
|
||||
|
||||
const osg::BoundingSphere& bs = subgraph->getBound();
|
||||
if (!bs.valid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::CameraNode> camera = new osg::CameraNode;
|
||||
camera->setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
|
||||
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
camera->setViewport(0, 0, width, height);
|
||||
|
||||
// set the camera to render before the main camera.
|
||||
camera->setRenderOrder(osg::CameraNode::PRE_RENDER);
|
||||
|
||||
float znear = 1.0f*bs.radius();
|
||||
float zfar = 3.0f*bs.radius();
|
||||
|
||||
// 2:1 aspect ratio as per flag geomtry below.
|
||||
float proj_top = 0.5f*znear;
|
||||
float proj_right = 0.5f*znear;
|
||||
|
||||
znear *= 0.9f;
|
||||
zfar *= 1.1f;
|
||||
|
||||
// set up projection.
|
||||
camera->setProjectionMatrixAsFrustum(-proj_right,proj_right,-proj_top,proj_top,znear,zfar);
|
||||
|
||||
// set view
|
||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||
camera->setViewMatrixAsLookAt(bs.center()+osg::Vec3(0.0f,2.0f,0.0f)*bs.radius(),bs.center(),osg::Vec3(0.0f,0.0f,1.0f));
|
||||
|
||||
// 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::COLOR_BUFFER,tex.get());
|
||||
|
||||
// attach the subgraph
|
||||
camera->addChild(subgraph.get());
|
||||
|
||||
|
||||
// attach the camera to the main scene graph.
|
||||
root->addChild(camera.get());
|
||||
|
||||
|
||||
// now create a simple quad that will be rendered
|
||||
// in the main framebuffers. The quad's texture
|
||||
// will be the content of the FBO's color buffer
|
||||
root->addChild(build_quad(tex.get()));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||
build_world(root.get());
|
||||
|
||||
osgProducer::Viewer viewer;
|
||||
viewer.setUpViewer();
|
||||
viewer.setSceneData(root.get());
|
||||
viewer.realize();
|
||||
|
||||
while (!viewer.done())
|
||||
{
|
||||
viewer.sync();
|
||||
viewer.update();
|
||||
viewer.frame();
|
||||
}
|
||||
|
||||
viewer.sync();
|
||||
viewer.cleanup_frame();
|
||||
viewer.sync();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
osgpbuffer.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
INSTFILES = \
|
||||
$(CXXFILES)\
|
||||
GNUmakefile.inst=GNUmakefile
|
||||
|
||||
EXEC = osgpbuffer
|
||||
|
||||
INC += $(X_INC)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
osgpbuffer.cpp\
|
||||
|
||||
LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
|
||||
|
||||
EXEC = osgpbuffer
|
||||
|
||||
INC += $(X_INC)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
@@ -1,475 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* freely and without restriction, both in commericial and non commericial applications,
|
||||
* as long as this copyright notice is maintained.
|
||||
*
|
||||
* This application 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.
|
||||
*/
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osgProducer/Viewer>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
|
||||
#include <Producer/CameraConfig>
|
||||
|
||||
class PBufferTexture2D : public osg::Texture2D
|
||||
{
|
||||
public:
|
||||
PBufferTexture2D( Producer::RenderSurface *pbuffer ):
|
||||
_pbuffer(pbuffer) {}
|
||||
|
||||
virtual void apply(osg::State& state) const
|
||||
{
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
TextureObject* textureObject = getTextureObject(contextID);
|
||||
if( textureObject == 0 )
|
||||
{
|
||||
GLuint format =
|
||||
_pbuffer->getRenderToTextureMode() == Producer::RenderSurface::RenderToRGBTexture ? GL_RGB:
|
||||
_pbuffer->getRenderToTextureMode() == Producer::RenderSurface::RenderToRGBATexture ? GL_RGBA : 0 ;
|
||||
unsigned int width = _pbuffer->getWindowWidth();
|
||||
unsigned int height = _pbuffer->getWindowHeight();
|
||||
|
||||
_textureObjectBuffer[contextID] = textureObject =
|
||||
generateTextureObject( contextID, GL_TEXTURE_2D, 1, format, width, height, 1, 0 );
|
||||
|
||||
textureObject->bind();
|
||||
applyTexParameters( GL_TEXTURE_2D, state);
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0,
|
||||
format, width, height, 0, format, GL_UNSIGNED_BYTE, 0 );
|
||||
textureObject->setAllocated(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
textureObject->bind();
|
||||
|
||||
static unsigned int frameNum = 0;
|
||||
|
||||
_pbuffer->bindPBufferToTexture( Producer::RenderSurface::FrontBuffer );
|
||||
|
||||
++frameNum;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Producer::ref_ptr<Producer::RenderSurface> _pbuffer;
|
||||
};
|
||||
|
||||
|
||||
class MyGeometryCallback :
|
||||
public osg::Drawable::UpdateCallback,
|
||||
public osg::Drawable::AttributeFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
MyGeometryCallback(const osg::Vec3& o,
|
||||
const osg::Vec3& x,const osg::Vec3& y,const osg::Vec3& z,
|
||||
double period,double xphase,double amplitude):
|
||||
_firstCall(true),
|
||||
_startTime(0.0),
|
||||
_time(0.0),
|
||||
_period(period),
|
||||
_xphase(xphase),
|
||||
_amplitude(amplitude),
|
||||
_origin(o),
|
||||
_xAxis(x),
|
||||
_yAxis(y),
|
||||
_zAxis(z) {}
|
||||
|
||||
virtual void update(osg::NodeVisitor* nv,osg::Drawable* drawable)
|
||||
{
|
||||
const osg::FrameStamp* fs = nv->getFrameStamp();
|
||||
double referenceTime = fs->getReferenceTime();
|
||||
if (_firstCall)
|
||||
{
|
||||
_firstCall = false;
|
||||
_startTime = referenceTime;
|
||||
}
|
||||
|
||||
_time = referenceTime-_startTime;
|
||||
|
||||
drawable->accept(*this);
|
||||
drawable->dirtyBound();
|
||||
|
||||
osg::Geometry* geometry = dynamic_cast<osg::Geometry*>(drawable);
|
||||
if (geometry)
|
||||
{
|
||||
osgUtil::SmoothingVisitor::smooth(*geometry);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
virtual void apply(osg::Drawable::AttributeType type,unsigned int count,osg::Vec3* begin)
|
||||
{
|
||||
if (type == osg::Drawable::VERTICES)
|
||||
{
|
||||
const float TwoPI=2.0f*osg::PI;
|
||||
const float phase = -_time/_period;
|
||||
|
||||
osg::Vec3* end = begin+count;
|
||||
for (osg::Vec3* itr=begin;itr<end;++itr)
|
||||
{
|
||||
osg::Vec3 dv(*itr-_origin);
|
||||
osg::Vec3 local(dv*_xAxis,dv*_yAxis,dv*_zAxis);
|
||||
|
||||
local.z() = local.x()*_amplitude*
|
||||
sinf(TwoPI*(phase+local.x()*_xphase));
|
||||
|
||||
(*itr) = _origin +
|
||||
_xAxis*local.x()+
|
||||
_yAxis*local.y()+
|
||||
_zAxis*local.z();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _firstCall;
|
||||
|
||||
double _startTime;
|
||||
double _time;
|
||||
|
||||
double _period;
|
||||
double _xphase;
|
||||
float _amplitude;
|
||||
|
||||
osg::Vec3 _origin;
|
||||
osg::Vec3 _xAxis;
|
||||
osg::Vec3 _yAxis;
|
||||
osg::Vec3 _zAxis;
|
||||
|
||||
};
|
||||
|
||||
osg::Node* createTexturedFlag(unsigned int width, unsigned int height, Producer::RenderSurface *pbuffer)
|
||||
{
|
||||
// create the quad to visualize.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
polyGeom->setSupportsDisplayList(false);
|
||||
|
||||
osg::Vec3 origin(0.0f,0.0f,0.0f);
|
||||
osg::Vec3 xAxis(1.0f,0.0f,0.0f);
|
||||
osg::Vec3 yAxis(0.0f,0.0f,1.0f);
|
||||
osg::Vec3 zAxis(0.0f,-1.0f,0.0f);
|
||||
float flag_height = 100.0f;
|
||||
float flag_width = 200.0f;
|
||||
int noSteps = 20;
|
||||
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array;
|
||||
osg::Vec3 bottom = origin;
|
||||
osg::Vec3 top = origin; top.z()+= flag_height;
|
||||
osg::Vec3 dv = xAxis*(flag_width/((float)(noSteps-1)));
|
||||
|
||||
osg::Vec2Array* texcoords = new osg::Vec2Array;
|
||||
osg::Vec2 bottom_texcoord(0.0f,0.0f);
|
||||
osg::Vec2 top_texcoord(0.0f,1.0f);
|
||||
osg::Vec2 dv_texcoord(1.0f/(float)(noSteps-1),0.0f);
|
||||
|
||||
for(int i=0;i<noSteps;++i)
|
||||
{
|
||||
vertices->push_back(top);
|
||||
vertices->push_back(bottom);
|
||||
top+=dv;
|
||||
bottom+=dv;
|
||||
|
||||
texcoords->push_back(top_texcoord);
|
||||
texcoords->push_back(bottom_texcoord);
|
||||
top_texcoord+=dv_texcoord;
|
||||
bottom_texcoord+=dv_texcoord;
|
||||
}
|
||||
|
||||
|
||||
// pass the created vertex array to the points geometry object.
|
||||
polyGeom->setVertexArray(vertices);
|
||||
|
||||
polyGeom->setTexCoordArray(0,texcoords);
|
||||
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||
polyGeom->setColorArray(colors);
|
||||
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
|
||||
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,vertices->size()));
|
||||
|
||||
// new we need to add the texture to the Drawable, we do so by creating a
|
||||
// StateSet to contain the Texture StateAttribute.
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
|
||||
// Dynamic texture filled with data from pbuffer.
|
||||
osg::Texture2D* texture = new PBufferTexture2D(pbuffer);
|
||||
texture->setInternalFormat(GL_RGB);
|
||||
texture->setTextureSize(width,height);
|
||||
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
|
||||
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
|
||||
texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP);
|
||||
texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP);
|
||||
stateset->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
|
||||
|
||||
polyGeom->setStateSet(stateset);
|
||||
|
||||
polyGeom->setUpdateCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/flag_width,0.2f));
|
||||
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
geode->addDrawable(polyGeom);
|
||||
|
||||
osg::Group* parent = new osg::Group;
|
||||
parent->addChild(geode);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Node> buildSceneGraphAndSetCameraViews(osg::Node *loadedModel,
|
||||
Producer::Camera *pbufferCamera,
|
||||
Producer::Camera *mainCamera)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
|
||||
osg::ref_ptr<osg::MatrixTransform> loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel);
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osg::AnimationPathCallback(
|
||||
loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc.get());
|
||||
|
||||
loadedModelTransform->setNodeMask( 0x1 );
|
||||
group->addChild( loadedModelTransform.get() );
|
||||
osg::ref_ptr<osg::Node> texturedFlag = createTexturedFlag( 1024, 512, pbufferCamera->getRenderSurface() );
|
||||
|
||||
texturedFlag->setNodeMask( 0x2 );
|
||||
group->addChild( texturedFlag.get());
|
||||
|
||||
osg::BoundingSphere bs = loadedModel->getBound();
|
||||
pbufferCamera->setLensFrustum( -0.5, 0.5, -0.25, 0.25, 1.0, 1000.0 );
|
||||
pbufferCamera->setViewByLookat(
|
||||
bs.center()[0], bs.center()[1] - bs.radius() * 3, bs.center()[2],
|
||||
bs.center()[0], bs.center()[1], bs.center()[2],
|
||||
0, 0, 1 );
|
||||
|
||||
mainCamera->getRenderSurface()->setReadDrawable( pbufferCamera->getRenderSurface());
|
||||
|
||||
return group.get();
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> buildSceneGraph(osg::Node *loadedModel, Producer::RenderSurface *pbuffer )
|
||||
{
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
|
||||
osg::ref_ptr<osg::MatrixTransform> loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel);
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osg::AnimationPathCallback(
|
||||
loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc.get());
|
||||
|
||||
// Set the loaded model to render only in the PBuffer camera
|
||||
loadedModelTransform->setNodeMask( 0x1 );
|
||||
group->addChild( loadedModelTransform.get() );
|
||||
osg::ref_ptr<osg::Node> texturedFlag = createTexturedFlag( 1024, 512, pbuffer );
|
||||
|
||||
// Set the textured flag to render only in the Main camera
|
||||
loadedModelTransform->setNodeMask( 0x1 );
|
||||
texturedFlag->setNodeMask( 0x2 );
|
||||
group->addChild( texturedFlag.get());
|
||||
|
||||
return group.get();
|
||||
}
|
||||
|
||||
Producer::ref_ptr<Producer::CameraConfig> buildCameraConfig( osg::Node &loadedModel )
|
||||
{
|
||||
// Set up the PBuffer camera
|
||||
Producer::ref_ptr<Producer::Camera> pbufferCamera = new Producer::Camera;
|
||||
pbufferCamera->getRenderSurface()->setWindowRectangle( 0, 0, 1024, 512 );
|
||||
pbufferCamera->getRenderSurface()->setDrawableType( Producer::RenderSurface::DrawableType_PBuffer );
|
||||
pbufferCamera->getRenderSurface()->setRenderToTextureMode(Producer::RenderSurface::RenderToRGBATexture);
|
||||
|
||||
// We will manually set the PBuffer camera's Lens and View,
|
||||
// so do not share with the rest of the Camera config.
|
||||
pbufferCamera->setShareLens(false);
|
||||
pbufferCamera->setShareView(false);
|
||||
|
||||
// Set the Lens and View for the Pbuffer camera according to the loaded model's size
|
||||
osg::BoundingSphere bs = loadedModel.getBound();
|
||||
pbufferCamera->setLensFrustum( -0.5, 0.5, -0.25, 0.25, 1.0, 1000.0 );
|
||||
pbufferCamera->setViewByLookat(
|
||||
bs.center()[0], bs.center()[1] - bs.radius() * 3, bs.center()[2],
|
||||
bs.center()[0], bs.center()[1], bs.center()[2],
|
||||
0, 0, 1 );
|
||||
|
||||
// Set up the main camera
|
||||
Producer::ref_ptr<Producer::Camera> mainCamera = new Producer::Camera;
|
||||
mainCamera->getRenderSurface()->setWindowRectangle( 0, 0, 800, 600 );
|
||||
|
||||
// Create the Camera config
|
||||
Producer::ref_ptr<Producer::CameraConfig> cfg = new Producer::CameraConfig;
|
||||
|
||||
// Cameras added in "alphabetical" order
|
||||
cfg->addCamera("A_PBufferCamera", pbufferCamera.get());
|
||||
cfg->addCamera("B_MainCamera", mainCamera.get());
|
||||
|
||||
// Set up the input area
|
||||
Producer::ref_ptr<Producer::InputArea> inputArea = new Producer::InputArea;
|
||||
inputArea->addRenderSurface( mainCamera->getRenderSurface());
|
||||
cfg->setInputArea( inputArea.get() );
|
||||
|
||||
|
||||
// Set the main Camera's read drawable to be the pbufferCamera's drawable
|
||||
mainCamera->getRenderSurface()->setReadDrawable( pbufferCamera->getRenderSurface());
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// set up the usage document, in case we need to print out how to use this program.
|
||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" example shows how to set up a Producer pbuffer for render to texture effects.");
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environment variables available");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--help-keys","Display keyboard & mouse bindings available");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--help-all","Display all command line, env vars and keyboard & mouse bindings");
|
||||
|
||||
/// Load models from command line and build scene graph
|
||||
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
||||
|
||||
// read the scene from the list of file specified commandline args.
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
if (!loadedModel)
|
||||
{
|
||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create the camera config. We use the loaded model to set the Lens and View on the PBuffer camera
|
||||
Producer::ref_ptr<Producer::CameraConfig> cameraConfig = buildCameraConfig( *(loadedModel.get()) );
|
||||
|
||||
// We need to build the rest of the scene graph after the camera config has been created because we need
|
||||
// to pass it the PBuffer, which will be the texture for the textured flag
|
||||
Producer::RenderSurface *pbuffer = cameraConfig->getCamera(0)->getRenderSurface();
|
||||
osg::ref_ptr<osg::Node >root = buildSceneGraph(loadedModel.get(), pbuffer );
|
||||
|
||||
|
||||
// construct the viewer with the camera config.
|
||||
osgProducer::Viewer viewer(cameraConfig.get());
|
||||
|
||||
// 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());
|
||||
|
||||
// if user request help write it out to cout.
|
||||
bool helpAll = arguments.read("--help-all");
|
||||
unsigned int helpType = ((helpAll || arguments.read("-h") || arguments.read("--help"))? osg::ApplicationUsage::COMMAND_LINE_OPTION : 0 ) |
|
||||
((helpAll || arguments.read("--help-env"))? osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE : 0 ) |
|
||||
((helpAll || arguments.read("--help-keys"))? osg::ApplicationUsage::KEYBOARD_MOUSE_BINDING : 0 );
|
||||
if (helpType)
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||
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);
|
||||
}
|
||||
|
||||
osg::Timer_t end_tick = osg::Timer::instance()->tick();
|
||||
|
||||
std::cout << "Time to load = "<<osg::Timer::instance()->delta_s(start_tick,end_tick)<<std::endl;
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(root.get());
|
||||
|
||||
// pass the loaded scene graph to the viewer.
|
||||
viewer.setSceneData(root.get());
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer.realize();
|
||||
|
||||
// The loaded model is to be viewed in the pbuffer camera, but
|
||||
// the textured flag is viewed in the main camera. The nodes have
|
||||
// been given node masks, now set the traversal masks on the cameras.
|
||||
// Note that this must be done after viewer.realize().
|
||||
{
|
||||
osgProducer::Viewer::SceneHandlerList shl = viewer.getSceneHandlerList();
|
||||
osgProducer::Viewer::SceneHandlerList::iterator p;
|
||||
unsigned int n = 0;
|
||||
for( p = shl.begin(); p != shl.end(); p++ )
|
||||
{
|
||||
int inheritanceMask = (*p)->getSceneView()->getInheritanceMask();
|
||||
inheritanceMask &= ~(osg::CullSettings::CULL_MASK);
|
||||
(*p)->getSceneView()->setInheritanceMask( inheritanceMask );
|
||||
(*p)->getSceneView()->setCullMask( 1<<(n));
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
// printf( "PBuffer window: 0x%x\n", pbuffer->getWindow() );
|
||||
|
||||
viewer.getCamera(0)->setClearColor( 0.1f,0.9f,0.3f,1.0f );
|
||||
|
||||
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 before exit.
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user