|
From: <br...@us...> - 2008-09-17 00:58:44
|
Revision: 3639
http://openvrml.svn.sourceforge.net/openvrml/?rev=3639&view=rev
Author: braden
Date: 2008-09-17 00:58:54 +0000 (Wed, 17 Sep 2008)
Log Message:
-----------
Moved X3D Grouping node implementations into a convenience library.
Modified Paths:
--------------
trunk/ChangeLog
trunk/ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln
trunk/src/Makefile.am
trunk/src/libopenvrml/openvrml/x3d_grouping.cpp
Added Paths:
-----------
trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/
trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj
trunk/src/node/x3d-grouping/
trunk/src/node/x3d-grouping/static_group.cpp
trunk/src/node/x3d-grouping/static_group.h
Removed Paths:
-------------
trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj
trunk/src/node/x3d-grouping/static_group.cpp
trunk/src/node/x3d-grouping/static_group.h
Property Changed:
----------------
trunk/
trunk/src/node/x3d-core/metadata_double.cpp
trunk/src/node/x3d-core/metadata_double.h
trunk/src/node/x3d-core/metadata_float.cpp
trunk/src/node/x3d-core/metadata_float.h
trunk/src/node/x3d-core/metadata_integer.cpp
trunk/src/node/x3d-core/metadata_integer.h
trunk/src/node/x3d-core/metadata_set.cpp
trunk/src/node/x3d-core/metadata_set.h
trunk/src/node/x3d-core/metadata_string.cpp
trunk/src/node/x3d-core/metadata_string.h
trunk/src/node/x3d-networking/load_sensor.cpp
trunk/src/node/x3d-networking/load_sensor.h
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules:3622-3623,3632-3635
+ /branches/node-modules:3622-3623,3632-3635,3637-3638
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/ChangeLog 2008-09-17 00:58:54 UTC (rev 3639)
@@ -1,5 +1,20 @@
2008-09-16 Braden McDaniel <br...@en...>
+ Moved X3D Grouping node implementations into a convenience
+ library.
+
+ * ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln: Added
+ x3d-grouping static library project.
+ * ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj
+ * src/Makefile.am: Added convenience library
+ node/x3d-grouping/libx3d-grouping.la.
+ * src/libopenvrml/openvrml/x3d_grouping.cpp: Moved node
+ implementations to separate files.
+ * src/node/x3d-grouping/static_group.cpp
+ * src/node/x3d-grouping/static_group.h
+
+2008-09-16 Braden McDaniel <br...@en...>
+
Moved X3D Networking node implementations into a convenience
library.
Modified: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln
===================================================================
--- trunk/ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln 2008-09-17 00:58:54 UTC (rev 3639)
@@ -5,6 +5,7 @@
{78133A10-3ADF-474C-B32A-74124A976482} = {78133A10-3ADF-474C-B32A-74124A976482}
{430B1A48-8E64-43DF-8CC4-AD09C41BA735} = {430B1A48-8E64-43DF-8CC4-AD09C41BA735}
{5ED398C0-0529-40D5-AB2C-C7EF0769002B} = {5ED398C0-0529-40D5-AB2C-C7EF0769002B}
+ {1D32E4EB-6613-4270-8295-7113712BC6C5} = {1D32E4EB-6613-4270-8295-7113712BC6C5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvrml-gl", "openvrml-gl\openvrml-gl.vcproj", "{141F90C2-6630-4D7A-834F-D5D57C6CFC24}"
@@ -45,6 +46,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x3d-networking", "x3d-networking\x3d-networking.vcproj", "{430B1A48-8E64-43DF-8CC4-AD09C41BA735}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x3d-grouping", "x3d-grouping\x3d-grouping.vcproj", "{1D32E4EB-6613-4270-8295-7113712BC6C5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -91,6 +94,10 @@
{430B1A48-8E64-43DF-8CC4-AD09C41BA735}.Debug|Win32.Build.0 = Debug|Win32
{430B1A48-8E64-43DF-8CC4-AD09C41BA735}.Release|Win32.ActiveCfg = Release|Win32
{430B1A48-8E64-43DF-8CC4-AD09C41BA735}.Release|Win32.Build.0 = Release|Win32
+ {1D32E4EB-6613-4270-8295-7113712BC6C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1D32E4EB-6613-4270-8295-7113712BC6C5}.Debug|Win32.Build.0 = Debug|Win32
+ {1D32E4EB-6613-4270-8295-7113712BC6C5}.Release|Win32.ActiveCfg = Release|Win32
+ {1D32E4EB-6613-4270-8295-7113712BC6C5}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Property changes on: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping
___________________________________________________________________
Added: svn:ignore
+ Debug
Release
x3d-grouping.vcproj.*.user
Deleted: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj
===================================================================
--- branches/node-modules/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj 2008-09-17 00:58:54 UTC (rev 3639)
@@ -1,179 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="x3d-grouping"
- ProjectGUID="{1D32E4EB-6613-4270-8295-7113712BC6C5}"
- RootNamespace="x3dgrouping"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\openvrml;..\..\..\..\..\src\libopenvrml"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPENVRML_BUILD_DLL"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4226;4250;4251;4275;4290;4355;4661;4800"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="..\openvrml;..\..\..\..\..\src\libopenvrml"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPENVRML_BUILD_DLL"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- DisableSpecificWarnings="4226;4250;4251;4275;4290;4355;4661;4800"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\..\..\src\node\x3d-grouping\static_group.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\..\..\src\node\x3d-grouping\static_group.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
Copied: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj (from rev 3638, branches/node-modules/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj)
===================================================================
--- trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj (rev 0)
+++ trunk/ide-projects/Windows/VisualC9_0/OpenVRML/x3d-grouping/x3d-grouping.vcproj 2008-09-17 00:58:54 UTC (rev 3639)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="x3d-grouping"
+ ProjectGUID="{1D32E4EB-6613-4270-8295-7113712BC6C5}"
+ RootNamespace="x3dgrouping"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\openvrml;..\..\..\..\..\src\libopenvrml"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPENVRML_BUILD_DLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4226;4250;4251;4275;4290;4355;4661;4800"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\openvrml;..\..\..\..\..\src\libopenvrml"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPENVRML_BUILD_DLL"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4226;4250;4251;4275;4290;4355;4661;4800"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\..\..\src\node\x3d-grouping\static_group.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\..\..\src\node\x3d-grouping\static_group.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/src/Makefile.am 2008-09-17 00:58:54 UTC (rev 3639)
@@ -6,7 +6,8 @@
noinst_LTLIBRARIES = \
node/vrml97/libvrml97.la \
node/x3d-core/libx3d-core.la \
- node/x3d-networking/libx3d-networking.la
+ node/x3d-networking/libx3d-networking.la \
+ node/x3d-grouping/libx3d-grouping.la
if ENABLE_GL_RENDERER
lib_LTLIBRARIES += libopenvrml-gl/libopenvrml-gl.la
endif
@@ -141,6 +142,7 @@
node/vrml97/libvrml97.la \
node/x3d-core/libx3d-core.la \
node/x3d-networking/libx3d-networking.la \
+ node/x3d-grouping/libx3d-grouping.la \
-lboost_thread$(BOOST_LIB_SUFFIX) \
-lboost_filesystem$(BOOST_LIB_SUFFIX) \
-lltdl
@@ -345,6 +347,15 @@
node/x3d-networking/load_sensor.cpp \
node/x3d-networking/load_sensor.h
+node_x3d_grouping_libx3d_grouping_la_CPPFLAGS = \
+ -I$(top_builddir)/src/libopenvrml \
+ -I$(top_srcdir)/src/libopenvrml
+node_x3d_grouping_libx3d_grouping_la_CXXFLAGS = \
+ $(PTHREAD_CFLAGS)
+node_x3d_grouping_libx3d_grouping_la_SOURCES = \
+ node/x3d-grouping/static_group.cpp \
+ node/x3d-grouping/static_group.h
+
libopenvrml_gl_libopenvrml_gl_la_CPPFLAGS = \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml \
Modified: trunk/src/libopenvrml/openvrml/x3d_grouping.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/x3d_grouping.cpp 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/src/libopenvrml/openvrml/x3d_grouping.cpp 2008-09-17 00:58:54 UTC (rev 3639)
@@ -2,7 +2,7 @@
//
// OpenVRML
//
-// Copyright 2006, 2007 Braden McDaniel
+// Copyright 2006, 2007, 2008 Braden McDaniel
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
@@ -18,390 +18,20 @@
// along with this library; if not, see <http://www.gnu.org/licenses/>.
//
+# include "x3d_grouping.h"
+# include "browser.h"
+# include <x3d-grouping/static_group.h>
+
# ifdef HAVE_CONFIG_H
# include <config.h>
# endif
-# include <boost/array.hpp>
-# include <private.h>
-# include "browser.h"
-# include "node_impl_util.h"
-# include "x3d_grouping.h"
-
-using namespace openvrml;
-using namespace openvrml::node_impl_util;
-using namespace std;
-
-namespace {
-
- /**
- * @brief Class object for StaticGroup nodes.
- */
- class OPENVRML_LOCAL static_group_metatype : public node_metatype {
- public:
- static const char * const id;
-
- explicit static_group_metatype(openvrml::browser & browser);
- virtual ~static_group_metatype() OPENVRML_NOTHROW;
-
- private:
- virtual const boost::shared_ptr<node_type>
- do_create_type(const std::string & id,
- const node_interface_set & interfaces) const
- OPENVRML_THROW2(unsupported_interface, std::bad_alloc);
- };
-}
-
void register_grouping_node_metatypes(openvrml::browser & b)
{
using boost::shared_ptr;
using openvrml::node_metatype;
+ using namespace openvrml_node_x3d_grouping;
b.add_node_metatype(static_group_metatype::id,
shared_ptr<node_metatype>(
new static_group_metatype(b)));
}
-
-namespace {
- using namespace openvrml_;
-
- class OPENVRML_LOCAL static_group_node :
- public abstract_node<static_group_node>,
- public grouping_node {
-
- friend class static_group_metatype;
-
- mfnode children_;
- sfvec3f bbox_center_;
- sfvec3f bbox_size_;
-
- viewer::object_t viewerObject;
-
- bounding_sphere bsphere;
-
- public:
-
- static_group_node(const node_type & type,
- const boost::shared_ptr<openvrml::scope> & scope);
- virtual ~static_group_node() OPENVRML_NOTHROW;
-
-
- virtual bool modified() const;
-
- protected:
- virtual void do_render_child(openvrml::viewer & viewer,
- rendering_context context);
- virtual const openvrml::bounding_volume &
- do_bounding_volume() const;
- virtual const std::vector<boost::intrusive_ptr<node> >
- do_children() const OPENVRML_THROW1(std::bad_alloc);
-
- virtual void recalc_bsphere();
- void render_nocull(openvrml::viewer & viewer,
- rendering_context context);
- };
-
- /**
- * @brief @c node_metatype identifier.
- */
- const char * const static_group_metatype::id =
- "urn:X-openvrml:node:StaticGroup";
-
- /**
- * @brief Construct.
- *
- * @param browser the browser associated with this static_group_metatype.
- */
- static_group_metatype::static_group_metatype(openvrml::browser & browser):
- node_metatype(static_group_metatype::id, browser)
- {}
-
- /**
- * @brief Destroy.
- */
- static_group_metatype::~static_group_metatype() OPENVRML_NOTHROW
- {}
-
- /**
- * @brief Create a node_type.
- *
- * @param id the name for the new node_type.
- * @param interfaces the interfaces for the new node_type.
- *
- * @return a node_type_ptr to a node_type capable of creating StaticGroup nodes.
- *
- * @exception unsupported_interface if @p interfaces includes an interface
- * not supported by static_group_metatype.
- * @exception std::bad_alloc if memory allocation fails.
- */
- const boost::shared_ptr<openvrml::node_type>
- static_group_metatype::do_create_type(const std::string & id,
- const node_interface_set & interfaces) const
- OPENVRML_THROW2(unsupported_interface, std::bad_alloc)
- {
- typedef boost::array<node_interface, 4> supported_interfaces_t;
- static const supported_interfaces_t supported_interfaces = {
- node_interface(node_interface::exposedfield_id,
- field_value::sfnode_id,
- "metadata"),
- node_interface(node_interface::field_id,
- field_value::mfnode_id,
- "children"),
- node_interface(node_interface::field_id,
- field_value::sfvec3f_id,
- "bboxCenter"),
- node_interface(node_interface::field_id,
- field_value::sfvec3f_id,
- "bboxSize")
- };
- typedef node_type_impl<static_group_node> node_type_t;
-
- const boost::shared_ptr<node_type> type(new node_type_t(*this, id));
- node_type_t & the_node_type = static_cast<node_type_t &>(*type);
-
- for (node_interface_set::const_iterator interface_(interfaces.begin());
- interface_ != interfaces.end();
- ++interface_) {
- supported_interfaces_t::const_iterator supported_interface =
- supported_interfaces.begin() - 1;
- if (*interface_ == *++supported_interface) {
- the_node_type.add_exposedfield(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::metadata);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::children_);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::bbox_center_);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::bbox_size_);
- } else {
- throw unsupported_interface(*interface_);
- }
- }
- return type;
- }
-
- /**
- * @class static_group_node
- *
- * @brief Represents StaticGroup node instances.
- */
-
- /**
- * @var static_group_node::static_group_metatype
- *
- * @brief Class object for StaticGroup nodes.
- */
-
- /**
- * @var static_group_node::children_
- *
- * @brief children field
- */
-
- /**
- * @var static_group_node::bbox_center_
- *
- * @brief bbox_center field
- */
-
- /**
- * @var static_group_node::bbox_size_
- *
- * @brief bbox_size field
- */
-
- /**
- * @brief Get the children in the scene graph.
- *
- * @return the child nodes in the scene graph.
- *
- * @exception std::bad_alloc if memory allocation fails.
- */
- const std::vector<boost::intrusive_ptr<node> >
- static_group_node::do_children() const OPENVRML_THROW1(std::bad_alloc)
- {
- return this->children_.value();
- }
-
- /**
- * @brief Determine whether the node has been modified.
- *
- * @return @c true if the node or one of its children has been modified,
- * @c false otherwise.
- */
- bool static_group_node::modified() const
- {
- if (this->node::modified()) { return true; }
- for (size_t i = 0; i < this->children_.mfnode::value().size(); ++i) {
- if (this->children_.mfnode::value()[i]->modified()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @brief Render the node.
- *
- * Render each of the children.
- *
- * @param viewer a Viewer.
- * @param context a rendering context.
- */
- void
- static_group_node::
- do_render_child(openvrml::viewer & viewer, rendering_context context)
- {
- if (context.cull_flag != bounding_volume::inside) {
- using boost::polymorphic_downcast;
- const bounding_sphere & bs =
- *polymorphic_downcast<const bounding_sphere *>(
- &this->bounding_volume());
- bounding_sphere bv_copy(bs);
- bv_copy.transform(context.matrix());
- bounding_volume::intersection r =
- viewer.intersect_view_volume(bv_copy);
- if (context.draw_bounding_spheres) {
- viewer.draw_bounding_sphere(bs, r);
- }
- if (r == bounding_volume::outside) { return; }
- if (r == bounding_volume::inside) {
- context.cull_flag = bounding_volume::inside;
- }
- }
- this->render_nocull(viewer, context);
- }
-
- /**
- * because children will already have done the culling, we don't need
- * to repeat it here.
- */
- void
- static_group_node::render_nocull(openvrml::viewer & viewer,
- rendering_context context)
- {
- using std::vector;
-
- if (this->viewerObject && this->modified()) {
- viewer.remove_object(this->viewerObject);
- this->viewerObject = 0;
- }
-
- if (this->viewerObject) {
- viewer.insert_reference(this->viewerObject);
- } else if (!this->children_.mfnode::value().empty()) {
- vector<boost::intrusive_ptr<node> >::size_type i;
- vector<boost::intrusive_ptr<node> >::size_type n =
- this->children_.mfnode::value().size();
- size_t nSensors = 0;
-
- this->viewerObject = viewer.begin_object(this->id().c_str());
-
- // Draw nodes that impact their siblings (DirectionalLights,
- // TouchSensors, any others? ...)
- for (i = 0; i < n; ++i) {
- child_node * const child =
- node_cast<child_node *>(
- this->children_.mfnode::value()[i].get());
- if (child) {
- if (node_cast<light_node *>(child)
- && !(node_cast<scoped_light_node *>(child))) {
- child->render_child(viewer, context);
- } else if (
- node_cast<pointing_device_sensor_node *>(child)) {
- if (++nSensors == 1) {
- viewer.set_sensitive(this);
- }
- }
- }
- }
-
- // Do the rest of the children (except the scene-level lights)
- for (i = 0; i<n; ++i) {
- child_node * const child =
- node_cast<child_node *>(
- this->children_.mfnode::value()[i].get());
- if (child && !(node_cast<light_node *>(child))) {
- child->render_child(viewer, context);
- }
- }
-
- // Turn off sensitivity
- if (nSensors > 0) { viewer.set_sensitive(0); }
-
- viewer.end_object();
- }
-
- this->node::modified(false);
- }
-
- /**
- * @brief Get the bounding volume.
- *
- * @return the bounding volume associated with the node.
- */
- const openvrml::bounding_volume &
- static_group_node::do_bounding_volume() const
- {
- if (this->bounding_volume_dirty()) {
- const_cast<static_group_node *>(this)
- ->recalc_bsphere();
- }
- return this->bsphere;
- }
-
- /**
- * @fn void grouping_node_base<Derived>::recalc_bsphere()
- *
- * @brief Recalculate the bounding volume.
- */
- void static_group_node::recalc_bsphere()
- {
- this->bsphere = bounding_sphere();
- for (size_t i = 0; i < this->children_.value().size(); ++i) {
- const boost::intrusive_ptr<node> & node = this->children_.value()[i];
- bounded_volume_node * bounded_volume =
- node_cast<bounded_volume_node *>(node.get());
- if (bounded_volume) {
- const openvrml::bounding_volume & ci_bv =
- bounded_volume->bounding_volume();
- this->bsphere.extend(ci_bv);
- }
- }
- this->bounding_volume_dirty(false);
- }
-
- /**
- * @brief Construct.
- *
- * @param type the node_type associated with this node.
- * @param scope the scope to which the node belongs.
- */
- static_group_node::
- static_group_node(const node_type & type,
- const boost::shared_ptr<openvrml::scope> & scope):
- node(type, scope),
- bounded_volume_node(type, scope),
- child_node(type, scope),
- abstract_node<self_t>(type, scope),
- grouping_node(type, scope),
- bbox_size_(make_vec3f(-1.0f, -1.0f, -1.0f)),
- viewerObject(0)
- {}
-
- /**
- * @brief Destroy.
- */
- static_group_node::~static_group_node() OPENVRML_NOTHROW
- {}
-}
Property changes on: trunk/src/node/x3d-core/metadata_double.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_double.cpp:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_double.cpp:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_double.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_double.h:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_double.h:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_float.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_float.cpp:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_float.cpp:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_float.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_float.h:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_float.h:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_integer.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_integer.cpp:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_integer.cpp:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_integer.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_integer.h:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_integer.h:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_set.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_set.cpp:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_set.cpp:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_set.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_set.h:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_set.h:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_string.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_string.cpp:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_string.cpp:3632-3635,3637-3638
Property changes on: trunk/src/node/x3d-core/metadata_string.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/node-modules/src/node/x3d-core/metadata_string.h:3632-3635
+ /branches/node-modules/src/node/x3d-core/metadata_string.h:3632-3635,3637-3638
Deleted: trunk/src/node/x3d-grouping/static_group.cpp
===================================================================
--- branches/node-modules/src/node/x3d-grouping/static_group.cpp 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/src/node/x3d-grouping/static_group.cpp 2008-09-17 00:58:54 UTC (rev 3639)
@@ -1,378 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML
-//
-// Copyright 2006, 2007, 2008 Braden McDaniel
-//
-// This library is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// 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 GNU Lesser General Public
-// License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# include "static_group.h"
-# include <openvrml/node_impl_util.h>
-# include <boost/array.hpp>
-
-# ifdef HAVE_CONFIG_H
-# include <config.h>
-# endif
-
-using namespace openvrml;
-using namespace openvrml::node_impl_util;
-using namespace std;
-
-namespace {
-
- /**
- * @brief Represents StaticGroup node instances.
- */
- class OPENVRML_LOCAL static_group_node :
- public abstract_node<static_group_node>,
- public grouping_node {
-
- friend class openvrml_node_x3d_grouping::static_group_metatype;
-
- mfnode children_;
- sfvec3f bbox_center_;
- sfvec3f bbox_size_;
-
- viewer::object_t viewerObject;
-
- bounding_sphere bsphere;
-
- public:
-
- static_group_node(const node_type & type,
- const boost::shared_ptr<openvrml::scope> & scope);
- virtual ~static_group_node() OPENVRML_NOTHROW;
-
-
- virtual bool modified() const;
-
- protected:
- virtual void do_render_child(openvrml::viewer & viewer,
- rendering_context context);
- virtual const openvrml::bounding_volume &
- do_bounding_volume() const;
- virtual const std::vector<boost::intrusive_ptr<node> >
- do_children() const OPENVRML_THROW1(std::bad_alloc);
-
- virtual void recalc_bsphere();
- void render_nocull(openvrml::viewer & viewer,
- rendering_context context);
- };
-
-
- /**
- * @var static_group_node::static_group_metatype
- *
- * @brief Class object for StaticGroup nodes.
- */
-
- /**
- * @var static_group_node::children_
- *
- * @brief children field
- */
-
- /**
- * @var static_group_node::bbox_center_
- *
- * @brief bbox_center field
- */
-
- /**
- * @var static_group_node::bbox_size_
- *
- * @brief bbox_size field
- */
-
- /**
- * @brief Get the children in the scene graph.
- *
- * @return the child nodes in the scene graph.
- *
- * @exception std::bad_alloc if memory allocation fails.
- */
- const std::vector<boost::intrusive_ptr<node> >
- static_group_node::do_children() const OPENVRML_THROW1(std::bad_alloc)
- {
- return this->children_.value();
- }
-
- /**
- * @brief Determine whether the node has been modified.
- *
- * @return @c true if the node or one of its children has been modified,
- * @c false otherwise.
- */
- bool static_group_node::modified() const
- {
- if (this->node::modified()) { return true; }
- for (size_t i = 0; i < this->children_.mfnode::value().size(); ++i) {
- if (this->children_.mfnode::value()[i]->modified()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @brief Render the node.
- *
- * Render each of the children.
- *
- * @param viewer a Viewer.
- * @param context a rendering context.
- */
- void
- static_group_node::
- do_render_child(openvrml::viewer & viewer, rendering_context context)
- {
- if (context.cull_flag != bounding_volume::inside) {
- using boost::polymorphic_downcast;
- const bounding_sphere & bs =
- *polymorphic_downcast<const bounding_sphere *>(
- &this->bounding_volume());
- bounding_sphere bv_copy(bs);
- bv_copy.transform(context.matrix());
- bounding_volume::intersection r =
- viewer.intersect_view_volume(bv_copy);
- if (context.draw_bounding_spheres) {
- viewer.draw_bounding_sphere(bs, r);
- }
- if (r == bounding_volume::outside) { return; }
- if (r == bounding_volume::inside) {
- context.cull_flag = bounding_volume::inside;
- }
- }
- this->render_nocull(viewer, context);
- }
-
- /**
- * because children will already have done the culling, we don't need
- * to repeat it here.
- */
- void
- static_group_node::render_nocull(openvrml::viewer & viewer,
- rendering_context context)
- {
- using std::vector;
-
- if (this->viewerObject && this->modified()) {
- viewer.remove_object(this->viewerObject);
- this->viewerObject = 0;
- }
-
- if (this->viewerObject) {
- viewer.insert_reference(this->viewerObject);
- } else if (!this->children_.mfnode::value().empty()) {
- vector<boost::intrusive_ptr<node> >::size_type i;
- vector<boost::intrusive_ptr<node> >::size_type n =
- this->children_.mfnode::value().size();
- size_t nSensors = 0;
-
- this->viewerObject = viewer.begin_object(this->id().c_str());
-
- // Draw nodes that impact their siblings (DirectionalLights,
- // TouchSensors, any others? ...)
- for (i = 0; i < n; ++i) {
- child_node * const child =
- node_cast<child_node *>(
- this->children_.mfnode::value()[i].get());
- if (child) {
- if (node_cast<light_node *>(child)
- && !(node_cast<scoped_light_node *>(child))) {
- child->render_child(viewer, context);
- } else if (
- node_cast<pointing_device_sensor_node *>(child)) {
- if (++nSensors == 1) {
- viewer.set_sensitive(this);
- }
- }
- }
- }
-
- // Do the rest of the children (except the scene-level lights)
- for (i = 0; i<n; ++i) {
- child_node * const child =
- node_cast<child_node *>(
- this->children_.mfnode::value()[i].get());
- if (child && !(node_cast<light_node *>(child))) {
- child->render_child(viewer, context);
- }
- }
-
- // Turn off sensitivity
- if (nSensors > 0) { viewer.set_sensitive(0); }
-
- viewer.end_object();
- }
-
- this->node::modified(false);
- }
-
- /**
- * @brief Get the bounding volume.
- *
- * @return the bounding volume associated with the node.
- */
- const openvrml::bounding_volume &
- static_group_node::do_bounding_volume() const
- {
- if (this->bounding_volume_dirty()) {
- const_cast<static_group_node *>(this)
- ->recalc_bsphere();
- }
- return this->bsphere;
- }
-
- /**
- * @fn void grouping_node_base<Derived>::recalc_bsphere()
- *
- * @brief Recalculate the bounding volume.
- */
- void static_group_node::recalc_bsphere()
- {
- this->bsphere = bounding_sphere();
- for (size_t i = 0; i < this->children_.value().size(); ++i) {
- const boost::intrusive_ptr<node> & node =
- this->children_.value()[i];
- bounded_volume_node * bounded_volume =
- node_cast<bounded_volume_node *>(node.get());
- if (bounded_volume) {
- const openvrml::bounding_volume & ci_bv =
- bounded_volume->bounding_volume();
- this->bsphere.extend(ci_bv);
- }
- }
- this->bounding_volume_dirty(false);
- }
-
- /**
- * @brief Construct.
- *
- * @param type the node_type associated with this node.
- * @param scope the scope to which the node belongs.
- */
- static_group_node::
- static_group_node(const node_type & type,
- const boost::shared_ptr<openvrml::scope> & scope):
- node(type, scope),
- bounded_volume_node(type, scope),
- child_node(type, scope),
- abstract_node<self_t>(type, scope),
- grouping_node(type, scope),
- bbox_size_(make_vec3f(-1.0f, -1.0f, -1.0f)),
- viewerObject(0)
- {}
-
- /**
- * @brief Destroy.
- */
- static_group_node::~static_group_node() OPENVRML_NOTHROW
- {}
-}
-
-
-/**
- * @brief @c node_metatype identifier.
- */
-const char * const openvrml_node_x3d_grouping::static_group_metatype::id =
- "urn:X-openvrml:node:StaticGroup";
-
-/**
- * @brief Construct.
- *
- * @param browser the browser associated with this static_group_metatype.
- */
-openvrml_node_x3d_grouping::static_group_metatype::
-static_group_metatype(openvrml::browser & browser):
- node_metatype(static_group_metatype::id, browser)
-{}
-
-/**
- * @brief Destroy.
- */
-openvrml_node_x3d_grouping::static_group_metatype::~static_group_metatype()
- OPENVRML_NOTHROW
-{}
-
-/**
- * @brief Create a node_type.
- *
- * @param id the name for the new node_type.
- * @param interfaces the interfaces for the new node_type.
- *
- * @return a node_type_ptr to a node_type capable of creating StaticGroup nodes.
- *
- * @exception unsupported_interface if @p interfaces includes an interface
- * not supported by static_group_metatype.
- * @exception std::bad_alloc if memory allocation fails.
- */
-const boost::shared_ptr<openvrml::node_type>
-openvrml_node_x3d_grouping::static_group_metatype::
-do_create_type(const std::string & id,
- const node_interface_set & interfaces) const
- OPENVRML_THROW2(unsupported_interface, std::bad_alloc)
-{
- typedef boost::array<node_interface, 4> supported_interfaces_t;
- static const supported_interfaces_t supported_interfaces = {
- node_interface(node_interface::exposedfield_id,
- field_value::sfnode_id,
- "metadata"),
- node_interface(node_interface::field_id,
- field_value::mfnode_id,
- "children"),
- node_interface(node_interface::field_id,
- field_value::sfvec3f_id,
- "bboxCenter"),
- node_interface(node_interface::field_id,
- field_value::sfvec3f_id,
- "bboxSize")
- };
- typedef node_type_impl<static_group_node> node_type_t;
-
- const boost::shared_ptr<node_type> type(new node_type_t(*this, id));
- node_type_t & the_node_type = static_cast<node_type_t &>(*type);
-
- for (node_interface_set::const_iterator interface_(interfaces.begin());
- interface_ != interfaces.end();
- ++interface_) {
- supported_interfaces_t::const_iterator supported_interface =
- supported_interfaces.begin() - 1;
- if (*interface_ == *++supported_interface) {
- the_node_type.add_exposedfield(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::metadata);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::children_);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::bbox_center_);
- } else if (*interface_ == *++supported_interface) {
- the_node_type.add_field(
- supported_interface->field_type,
- supported_interface->id,
- &static_group_node::bbox_size_);
- } else {
- throw unsupported_interface(*interface_);
- }
- }
- return type;
-}
Copied: trunk/src/node/x3d-grouping/static_group.cpp (from rev 3638, branches/node-modules/src/node/x3d-grouping/static_group.cpp)
===================================================================
--- trunk/src/node/x3d-grouping/static_group.cpp (rev 0)
+++ trunk/src/node/x3d-grouping/static_group.cpp 2008-09-17 00:58:54 UTC (rev 3639)
@@ -0,0 +1,378 @@
+// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML
+//
+// Copyright 2006, 2007, 2008 Braden McDaniel
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or (at your
+// option) any later version.
+//
+// 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 GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# include "static_group.h"
+# include <openvrml/node_impl_util.h>
+# include <boost/array.hpp>
+
+# ifdef HAVE_CONFIG_H
+# include <config.h>
+# endif
+
+using namespace openvrml;
+using namespace openvrml::node_impl_util;
+using namespace std;
+
+namespace {
+
+ /**
+ * @brief Represents StaticGroup node instances.
+ */
+ class OPENVRML_LOCAL static_group_node :
+ public abstract_node<static_group_node>,
+ public grouping_node {
+
+ friend class openvrml_node_x3d_grouping::static_group_metatype;
+
+ mfnode children_;
+ sfvec3f bbox_center_;
+ sfvec3f bbox_size_;
+
+ viewer::object_t viewerObject;
+
+ bounding_sphere bsphere;
+
+ public:
+
+ static_group_node(const node_type & type,
+ const boost::shared_ptr<openvrml::scope> & scope);
+ virtual ~static_group_node() OPENVRML_NOTHROW;
+
+
+ virtual bool modified() const;
+
+ protected:
+ virtual void do_render_child(openvrml::viewer & viewer,
+ rendering_context context);
+ virtual const openvrml::bounding_volume &
+ do_bounding_volume() const;
+ virtual const std::vector<boost::intrusive_ptr<node> >
+ do_children() const OPENVRML_THROW1(std::bad_alloc);
+
+ virtual void recalc_bsphere();
+ void render_nocull(openvrml::viewer & viewer,
+ rendering_context context);
+ };
+
+
+ /**
+ * @var static_group_node::static_group_metatype
+ *
+ * @brief Class object for StaticGroup nodes.
+ */
+
+ /**
+ * @var static_group_node::children_
+ *
+ * @brief children field
+ */
+
+ /**
+ * @var static_group_node::bbox_center_
+ *
+ * @brief bbox_center field
+ */
+
+ /**
+ * @var static_group_node::bbox_size_
+ *
+ * @brief bbox_size field
+ */
+
+ /**
+ * @brief Get the children in the scene graph.
+ *
+ * @return the child nodes in the scene graph.
+ *
+ * @exception std::bad_alloc if memory allocation fails.
+ */
+ const std::vector<boost::intrusive_ptr<node> >
+ static_group_node::do_children() const OPENVRML_THROW1(std::bad_alloc)
+ {
+ return this->children_.value();
+ }
+
+ /**
+ * @brief Determine whether the node has been modified.
+ *
+ * @return @c true if the node or one of its children has been modified,
+ * @c false otherwise.
+ */
+ bool static_group_node::modified() const
+ {
+ if (this->node::modified()) { return true; }
+ for (size_t i = 0; i < this->children_.mfnode::value().size(); ++i) {
+ if (this->children_.mfnode::value()[i]->modified()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @brief Render the node.
+ *
+ * Render each of the children.
+ *
+ * @param viewer a Viewer.
+ * @param context a rendering context.
+ */
+ void
+ static_group_node::
+ do_render_child(openvrml::viewer & viewer, rendering_context context)
+ {
+ if (context.cull_flag != bounding_volume::inside) {
+ using boost::polymorphic_downcast;
+ const bounding_sphere & bs =
+ *polymorphic_downcast<const bounding_sphere *>(
+ &this->bounding_volume());
+ bounding_sphere bv_copy(bs);
+ bv_copy.transform(context.matrix());
+ bounding_volume::intersection r =
+ viewer.intersect_view_volume(bv_copy);
+ if (context.draw_bounding_spheres) {
+ viewer.draw_bounding_sphere(bs, r);
+ }
+ if (r == bounding_volume::outside) { return; }
+ if (r == bounding_volume::inside) {
+ context.cull_flag = bounding_volume::inside;
+ }
+ }
+ this->render_nocull(viewer, context);
+ }
+
+ /**
+ * because children will already have done the culling, we don't need
+ * to repeat it here.
+ */
+ void
+ static_group_node::render_nocull(openvrml::viewer & viewer,
+ rendering_context context)
+ {
+ using std::vector;
+
+ if (this->viewerObject && this->modified()) {
+ viewer.remove_object(this->viewerObject);
+ this->viewerObject = 0;
+ }
+
+ if (this->viewerObject) {
+ viewer.insert_reference(this->viewerObject);
+ } else if (!this->children_.mfnode::value().empty()) {
+ vector<boost::intrusive_ptr<node> >::size_type i;
+ vector<boost::intrusive_ptr<node> >::size_type n =
+ this->children_.mfnode::value().size();
+ size_t nSensors = 0;
+
+ this->viewerObject = viewer.begin_object(this->id().c_str());
+
+ // Draw nodes that impact their siblings (DirectionalLights,
+ // TouchSensors, any others? ...)
+ for (i = 0; i < n; ++i) {
+ child_node * const child =
+ node_cast<child_node *>(
+ this->children_.mfnode::value()[i].get());
+ if (child) {
+ if (node_cast<light_node *>(child)
+ && !(node_cast<scoped_light_node *>(child))) {
+ child->render_child(viewer, context);
+ } else if (
+ node_cast<pointing_device_sensor_node *>(child)) {
+ if (++nSensors == 1) {
+ viewer.set_sensitive(this);
+ }
+ }
+ }
+ }
+
+ // Do the rest of the children (except the scene-level lights)
+ for (i = 0; i<n; ++i) {
+ child_node * const child =
+ node_cast<child_node *>(
+ this->children_.mfnode::value()[i].get());
+ if (child && !(node_cast<light_node *>(child))) {
+ child->render_child(viewer, context);
+ }
+ }
+
+ // Turn off sensitivity
+ if (nSensors > 0) { viewer.set_sensitive(0); }
+
+ viewer.end_object();
+ }
+
+ this->node::modified(false);
+ }
+
+ /**
+ * @brief Get the bounding volume.
+ *
+ * @return the bounding volume associated with the node.
+ */
+ const openvrml::bounding_volume &
+ static_group_node::do_bounding_volume() const
+ {
+ if (this->bounding_volume_dirty()) {
+ const_cast<static_group_node *>(this)
+ ->recalc_bsphere();
+ }
+ return this->bsphere;
+ }
+
+ /**
+ * @fn void grouping_node_base<Derived>::recalc_bsphere()
+ *
+ * @brief Recalculate the bounding volume.
+ */
+ void static_group_node::recalc_bsphere()
+ {
+ this->bsphere = bounding_sphere();
+ for (size_t i = 0; i < this->children_.value().size(); ++i) {
+ const boost::intrusive_ptr<node> & node =
+ this->children_.value()[i];
+ bounded_volume_node * bounded_volume =
+ node_cast<bounded_volume_node *>(node.get());
+ if (bounded_volume) {
+ const openvrml::bounding_volume & ci_bv =
+ bounded_volume->bounding_volume();
+ this->bsphere.extend(ci_bv);
+ }
+ }
+ this->bounding_volume_dirty(false);
+ }
+
+ /**
+ * @brief Construct.
+ *
+ * @param type the node_type associated with this node.
+ * @param scope the scope to which the node belongs.
+ */
+ static_group_node::
+ static_group_node(const node_type & type,
+ const boost::shared_ptr<openvrml::scope> & scope):
+ node(type, scope),
+ bounded_volume_node(type, scope),
+ child_node(type, scope),
+ abstract_node<self_t>(type, scope),
+ grouping_node(type, scope),
+ bbox_size_(make_vec3f(-1.0f, -1.0f, -1.0f)),
+ viewerObject(0)
+ {}
+
+ /**
+ * @brief Destroy.
+ */
+ static_group_node::~static_group_node() OPENVRML_NOTHROW
+ {}
+}
+
+
+/**
+ * @brief @c node_metatype identifier.
+ */
+const char * const openvrml_node_x3d_grouping::static_group_metatype::id =
+ "urn:X-openvrml:node:StaticGroup";
+
+/**
+ * @brief Construct.
+ *
+ * @param browser the browser associated with this static_group_metatype.
+ */
+openvrml_node_x3d_grouping::static_group_metatype::
+static_group_metatype(openvrml::browser & browser):
+ node_metatype(static_group_metatype::id, browser)
+{}
+
+/**
+ * @brief Destroy.
+ */
+openvrml_node_x3d_grouping::static_group_metatype::~static_group_metatype()
+ OPENVRML_NOTHROW
+{}
+
+/**
+ * @brief Create a node_type.
+ *
+ * @param id the name for the new node_type.
+ * @param interfaces the interfaces for the new node_type.
+ *
+ * @return a node_type_ptr to a node_type capable of creating StaticGroup nodes.
+ *
+ * @exception unsupported_interface if @p interfaces includes an interface
+ * not supported by static_group_metatype.
+ * @exception std::bad_alloc if memory allocation fails.
+ */
+const boost::shared_ptr<openvrml::node_type>
+openvrml_node_x3d_grouping::static_group_metatype::
+do_create_type(const std::string & id,
+ const node_interface_set & interfaces) const
+ OPENVRML_THROW2(unsupported_interface, std::bad_alloc)
+{
+ typedef boost::array<node_interface, 4> supported_interfaces_t;
+ static const supported_interfaces_t supported_interfaces = {
+ node_interface(node_interface::exposedfield_id,
+ field_value::sfnode_id,
+ "metadata"),
+ node_interface(node_interface::field_id,
+ field_value::mfnode_id,
+ "children"),
+ node_interface(node_interface::field_id,
+ field_value::sfvec3f_id,
+ "bboxCenter"),
+ node_interface(node_interface::field_id,
+ field_value::sfvec3f_id,
+ "bboxSize")
+ };
+ typedef node_type_impl<static_group_node> node_type_t;
+
+ const boost::shared_ptr<node_type> type(new node_type_t(*this, id));
+ node_type_t & the_node_type = static_cast<node_type_t &>(*type);
+
+ for (node_interface_set::const_iterator interface_(interfaces.begin());
+ interface_ != interfaces.end();
+ ++interface_) {
+ supported_interfaces_t::const_iterator supported_interface =
+ supported_interfaces.begin() - 1;
+ if (*interface_ == *++supported_interface) {
+ the_node_type.add_exposedfield(
+ supported_interface->field_type,
+ supported_interface->id,
+ &static_group_node::metadata);
+ } else if (*interface_ == *++supported_interface) {
+ the_node_type.add_field(
+ supported_interface->field_type,
+ supported_interface->id,
+ &static_group_node::children_);
+ } else if (*interface_ == *++supported_interface) {
+ the_node_type.add_field(
+ supported_interface->field_type,
+ supported_interface->id,
+ &static_group_node::bbox_center_);
+ } else if (*interface_ == *++supported_interface) {
+ the_node_type.add_field(
+ supported_interface->field_type,
+ supported_interface->id,
+ &static_group_node::bbox_size_);
+ } else {
+ throw unsupported_interface(*interface_);
+ }
+ }
+ return type;
+}
Deleted: trunk/src/node/x3d-grouping/static_group.h
===================================================================
--- branches/node-modules/src/node/x3d-grouping/static_group.h 2008-09-17 00:45:22 UTC (rev 3638)
+++ trunk/src/node/x3d-grouping/static_group.h 2008-09-17 00:58:54 UTC (rev 3639)
@@ -1,47 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML
-//
-// Copyright 2006, 2007, 2008 Braden McDaniel
-//
-// This library is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// 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 GNU Lesser General Public
-// License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_NODE_X3D_GROUPING_STATIC_GROUP_H
-# define OPENVRML_NODE_X3D_GROUPING_STATIC_GROUP_H
-
-# include <openvrml/node.h>
-
-namespace openvrml_node_x3d_grouping {
-
- /**
- * @brief Class object for StaticGroup nodes.
- */
- class OPENVRML_LOCAL static_group_metatype :
- public openvrml::node_metatype {
- public:
- static const char * const id;
-
- explicit static_group_metatype(openvrml::browser & browser);
- virtual ~static_group_metatype() OPENVRML_NOTHROW;
-
- private:
- virtual const boost::shared_ptr<openvrml::node_type>
- do_create_type(const std::string & id,
- const openvrml::node_interface_set & interfaces) const
- OPENVRML_THROW2(openvrml::unsupported_interface, std::bad_alloc);
- };
-}
-
-# endif // ifndef OPENVRML_NODE_X3D_GROUPING_STATIC_GROUP_H
Copied: trunk/src/node/x3d-grouping/static_group.h (from rev 3638, branches/node-modules/src/node/x3d-grouping/static_group.h)
===================================================================
--- trunk/src/node/x3d-grouping/static_group.h ...
[truncated message content] |