Chaned the OsgCameraGroup so that its scene handler list used ref_ptr<> for

robustly managing memory.
This commit is contained in:
Robert Osfield
2003-03-18 20:27:09 +00:00
parent b04edb70aa
commit 8ed643ca24
8 changed files with 14 additions and 146 deletions

View File

@@ -47,7 +47,7 @@ Ben Discoe <ben@vterrain.org>
- png plugin.
- fixes to OBJ plugin.
Maroc Jez <marco.jez@arsenal.it>
Marco Jez <marco.jez@arsenal.it>
- osgParticle
- IO support for osgText.

View File

@@ -1,360 +1,222 @@
# Microsoft Developer Studio Project File - Name="Example osgcluster" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Example osgcluster - 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 "osgcluster.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 "osgcluster.mak" CFG="Example osgcluster - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Example osgcluster - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Example osgcluster - 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 osgcluster - 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 "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# 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" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /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 /machine:I386
# ADD LINK32 wsock32.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgcluster.exe" /libpath:"../../../lib"
!ELSEIF "$(CFG)" == "Example osgcluster - 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 "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# 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 /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /YX /FD /c
# SUBTRACT CPP /Fr
# 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 wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgclusterd.exe" /pdbtype:sept /libpath:"../../../lib"
# SUBTRACT LINK32 /incremental:no
!ENDIF
# Begin Target
# Name "Example osgcluster - Win32 Release"
# Name "Example osgcluster - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\..\examples\osgcluster\broadcaster.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\examples\osgcluster\osgcluster.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\examples\osgcluster\receiver.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter ";h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\..\examples\osgcluster\broadcaster.h
# End Source File
# Begin Source File
SOURCE=..\..\..\examples\osgcluster\receiver.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter ""
# End Group
# End Target
# End Project

View File

@@ -355,10 +355,9 @@ int main( int argc, char **argv )
itr!=viewer.getSceneHandlerList().end();
++itr)
{
osgUtil::SceneView* sceneview = *itr;
// switch off small feature culling to prevent the light points from being culled.
osgUtil::SceneView* sceneview = itr->get();
sceneview->setCullingMode( sceneview->getCullingMode() & ~osg::CullStack::SMALL_FEATURE_CULLING);
//sceneview->setCullingMode( 0);
}
while( !viewer.done() )

View File

@@ -347,7 +347,7 @@ int main( int argc, char **argv )
if (manuallyCreateOccluders)
{
osgUtil::SceneView* sceneview = viewer.getSceneHandlerList()[0];
osgUtil::SceneView* sceneview = viewer.getSceneHandlerList()[0].get();
viewer.getEventHandlerList().push_front(new OccluderEventHandler(sceneview,rootnode));
}

View File

@@ -108,7 +108,7 @@ int main( int argc, char **argv )
itr!=viewer.getSceneHandlerList().end();
++itr)
{
osgUtil::SceneView* sceneview = *itr;
osgUtil::SceneView* sceneview = itr->get();
sceneview->setCullMask(0xffffffff);
sceneview->setCullMaskLeft(0x00000001);
sceneview->setCullMaskRight(0x00000002);

View File

@@ -86,6 +86,9 @@ int main( int argc, char **argv )
}
// wait for all cull and draw threads to complete before exit.
viewer.sync();
return 0;
}

View File

@@ -1,3 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
@@ -42,7 +43,7 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
virtual ~OsgCameraGroup() {}
typedef std::vector <osgProducer::OsgSceneHandler*> SceneHandlerList;
typedef std::vector < osg::ref_ptr<osgProducer::OsgSceneHandler> > SceneHandlerList;
SceneHandlerList& getSceneHandlerList() { return _shvec;}

View File

@@ -127,7 +127,10 @@ void OsgCameraGroup::setUpSceneViewsWithData()
else if (_scene_data.valid())
{
(*p)->setSceneData( _scene_data.get() );
}
else
{
(*p)->setSceneData( 0 );
}
(*p)->setFrameStamp( _frameStamp.get() );
@@ -135,7 +138,7 @@ void OsgCameraGroup::setUpSceneViewsWithData()
(*p)->setBackgroundColor( _background_color );
(*p)->setLODScale( _LODScale );
(*p)->setFusionDistance( _fusionDistanceMode, _fusionDistanceValue );
(*p)->getState()->reset();
}
}