From: <br...@us...> - 2009-04-06 07:22:52
|
Revision: 3886 http://openvrml.svn.sourceforge.net/openvrml/?rev=3886&view=rev Author: braden Date: 2009-04-06 07:22:50 +0000 (Mon, 06 Apr 2009) Log Message: ----------- Resolve ambiguity regarding "value". Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/exposedfield.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-06 07:05:11 UTC (rev 3885) +++ trunk/ChangeLog 2009-04-06 07:22:50 UTC (rev 3886) @@ -1,5 +1,11 @@ -2009-04-05 Braden McDaniel <br...@en...> +2009-04-06 Braden McDaniel <br...@en...> + * src/libopenvrml/openvrml/exposedfield.h + (openvrml::exposedfield<FieldValue>): Resolve ambiguity regarding + "value". + +2009-04-06 Braden McDaniel <br...@en...> + * src/node/vrml97/background.cpp (update_texture(openvrml_node_vrml97::background_node &, openvrml::read_write_mutex &, const openvrml::mfstring &, Modified: trunk/src/libopenvrml/openvrml/exposedfield.h =================================================================== --- trunk/src/libopenvrml/openvrml/exposedfield.h 2009-04-06 07:05:11 UTC (rev 3885) +++ trunk/src/libopenvrml/openvrml/exposedfield.h 2009-04-06 07:22:50 UTC (rev 3886) @@ -34,6 +34,8 @@ public: virtual ~exposedfield() OPENVRML_NOTHROW; + using FieldValue::value; + protected: exposedfield(openvrml::node & node, const typename FieldValue::value_type & value = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 02:31:30
|
Revision: 3887 http://openvrml.svn.sourceforge.net/openvrml/?rev=3887&view=rev Author: braden Date: 2009-04-17 02:31:16 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Allow OpenVRML to be configured to use only nonthrowing exception specifications. Modified Paths: -------------- trunk/ChangeLog trunk/README trunk/configure-gcc-opt trunk/configure.ac trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml-config.h trunk/src/libopenvrml/openvrml-common.h trunk/src/libopenvrml/openvrml-config.h.in Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/ChangeLog 2009-04-17 02:31:16 UTC (rev 3887) @@ -1,3 +1,25 @@ +2009-04-16 Braden McDaniel <br...@en...> + + Allow OpenVRML to be configured to use only nonthrowing exception + specifications. + + * README: Added documentation for + "--enable-exception-specs=nothrow". + * configure.ac: Added "nothrow" argument to the + --enable-exception-specs option. + * ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml-config.h: + Define OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS and + OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS to 0; the Microsoft + compiler ignores exception specifications, so there's nothing to + do here. + * src/libopenvrml/openvrml-common.h: Distinguish between throwing + and "nothrow" exception specifications with the preprocessor + symbols OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS and + OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS. + * src/libopenvrml/openvrml-config.h.in: Define + OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS and + OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS. + 2009-04-06 Braden McDaniel <br...@en...> * src/libopenvrml/openvrml/exposedfield.h Modified: trunk/README =================================================================== --- trunk/README 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/README 2009-04-17 02:31:16 UTC (rev 3887) @@ -147,9 +147,19 @@ that modify what features are built and/or what packages OpenVRML depends on. - --disable-exception-specs - Disable use of C++ exception specifications. This is likely to - improve performance. Note that this changes the library ABI. + --enable-exception-specs[=yes,no,nothrow] + Modulate use of C++ exception specifications. By default, + OpenVRML uses exception specifications wherever the set of + exceptions thrown from a function can be constrained. This can + aid in debugging; but in general it is likely to degrade + performance. Exception specifications can be disabled altogether + (using an argument of "no" or the option + "--disable-exception-specs"); or, only empty (i.e., nonthrowing) + exception specifications can be enabled (using an argument of + "nothrow"). Some compilers may be able to use the nonthrowing + exception specification as an optimization hint. Note that + changing what exception specifications are applied changes the + library ABI. --enable-gecko-rpath Enable use of the Gecko runtime library directory -rpath flag. On Modified: trunk/configure-gcc-opt =================================================================== --- trunk/configure-gcc-opt 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/configure-gcc-opt 2009-04-17 02:31:16 UTC (rev 3887) @@ -1,3 +1,3 @@ #!/bin/bash -./$(dirname $0)/configure -C --prefix=$HOME --disable-static --disable-exception-specs --enable-gtk-doc CXX='g++ -pipe' CPPFLAGS='-I$HOME/include -DNDEBUG' CXXFLAGS='-Os -Wall -Wextra -Wno-missing-braces -Wno-unused-variable -fvisibility=hidden -fvisibility-inlines-hidden' LDFLAGS='-L$HOME/lib64 -L$HOME/lib' BOOST_LIB_SUFFIX=-mt JAVA_HOME=/usr/lib/jvm/jre "$*" +./$(dirname $0)/configure -C --prefix=$HOME --disable-static --enable-exception-specs=nothrow --enable-gtk-doc CXX='g++ -pipe' CPPFLAGS='-I$HOME/include -DNDEBUG' CXXFLAGS='-O3 -Wall -Wextra -Wno-missing-braces -Wno-unused-variable -fvisibility=hidden -fvisibility-inlines-hidden' LDFLAGS='-L$HOME/lib64 -L$HOME/lib' BOOST_LIB_SUFFIX=-mt JAVA_HOME=/usr/lib/jvm/jre "$*" Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/configure.ac 2009-04-17 02:31:16 UTC (rev 3887) @@ -240,14 +240,17 @@ # Use exception specifications? # AC_ARG_ENABLE([exception-specs], - [AC_HELP_STRING([--disable-exception-specs], - [disable use of C++ exception specifications])]) -if test X$enable_exceptions_specs = Xno; then - OPENVRML_ENABLE_EXCEPTION_SPECS=0 -else - OPENVRML_ENABLE_EXCEPTION_SPECS=1 -fi -AC_SUBST([OPENVRML_ENABLE_EXCEPTION_SPECS]) + [AC_HELP_STRING([--enable-exception-specs[[=yes,no,nothrow]]], + [modulate use of C++ exception specifications [default=yes]])]) +AS_IF([test X$enable_exception_specs = Xno], + [OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS=0 + OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS=0], + [OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS=1 + AS_IF([test X$enable_exception_specs = Xnothrow], + [OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS=0], + [OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS=1])]) +AC_SUBST([OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS]) +AC_SUBST([OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS]) # # Enable use of the Gecko -rpath flag Modified: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml-config.h =================================================================== --- trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml-config.h 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml-config.h 2009-04-17 02:31:16 UTC (rev 3887) @@ -2,7 +2,7 @@ // // OpenVRML // -// Copyright 2005 Braden McDaniel +// Copyright 2005, 2009 Braden McDaniel // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,6 +37,7 @@ # define OPENVRML_LOCAL -# define OPENVRML_ENABLE_EXCEPTION_SPECS 0 +# define OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS 0 +# define OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS 0 # endif // ifndef OPENVRML_CONFIG_H Modified: trunk/src/libopenvrml/openvrml-common.h =================================================================== --- trunk/src/libopenvrml/openvrml-common.h 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/src/libopenvrml/openvrml-common.h 2009-04-17 02:31:16 UTC (rev 3887) @@ -2,7 +2,7 @@ // // OpenVRML // -// Copyright 2005, 2006, 2007, 2008 Braden McDaniel +// Copyright 2005, 2006, 2007, 2008, 2009 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 @@ -35,15 +35,19 @@ # define PHOENIX_LIMIT 6 # endif -# if OPENVRML_ENABLE_EXCEPTION_SPECS +# if OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS # define OPENVRML_NOTHROW throw () +# else +# define OPENVRML_NOTHROW +# endif + +# if OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS # define OPENVRML_THROW1(ex_) throw (ex_) # define OPENVRML_THROW2(ex1_, ex2_) throw (ex1_, ex2_) # define OPENVRML_THROW3(ex1_, ex2_, ex3_) throw (ex1_, ex2_, ex3_) # define OPENVRML_THROW4(ex1_, ex2_, ex3_, ex4_) throw (ex1_, ex2_, ex3_, ex4_) # define OPENVRML_THROW5(ex1_, ex2_, ex3_, ex4_, ex5_) throw (ex1_, ex2_, ex3_, ex4_, ex5_) # else -# define OPENVRML_NOTHROW # define OPENVRML_THROW1(ex_) # define OPENVRML_THROW2(ex1_, ex2_) # define OPENVRML_THROW3(ex1_, ex2_, ex3_) Modified: trunk/src/libopenvrml/openvrml-config.h.in =================================================================== --- trunk/src/libopenvrml/openvrml-config.h.in 2009-04-06 07:22:50 UTC (rev 3886) +++ trunk/src/libopenvrml/openvrml-config.h.in 2009-04-17 02:31:16 UTC (rev 3887) @@ -2,7 +2,7 @@ // // OpenVRML // -// Copyright 2005, 2006, 2007 Braden McDaniel +// Copyright 2005, 2006, 2007, 2009 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 @@ -19,10 +19,11 @@ // # ifndef OPENVRML_CONFIG_H -# define OPENVRML_CONFIG_H +# define OPENVRML_CONFIG_H -# define OPENVRML_API @OPENVRML_API@ -# define OPENVRML_LOCAL @OPENVRML_LOCAL@ -# define OPENVRML_ENABLE_EXCEPTION_SPECS @OPENVRML_ENABLE_EXCEPTION_SPECS@ +# define OPENVRML_API @OPENVRML_API@ +# define OPENVRML_LOCAL @OPENVRML_LOCAL@ +# define OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS @OPENVRML_ENABLE_THROWING_EXCEPTION_SPECS@ +# define OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS @OPENVRML_ENABLE_NOTHROW_EXCEPTION_SPECS@ # endif // ifndef OPENVRML_CONFIG_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 04:59:13
|
Revision: 3888 http://openvrml.svn.sourceforge.net/openvrml/?rev=3888&view=rev Author: braden Date: 2009-04-17 04:59:03 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Updated to reflect that Script node Java support is now enabled by default. Modified Paths: -------------- trunk/ChangeLog trunk/README Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 02:31:16 UTC (rev 3887) +++ trunk/ChangeLog 2009-04-17 04:59:03 UTC (rev 3888) @@ -1,3 +1,8 @@ +2009-04-17 Braden McDaniel <br...@en...> + + * README: Updated to reflect that Script node Java support is now + enabled by default. + 2009-04-16 Braden McDaniel <br...@en...> Allow OpenVRML to be configured to use only nonthrowing exception Modified: trunk/README =================================================================== --- trunk/README 2009-04-17 02:31:16 UTC (rev 3887) +++ trunk/README 2009-04-17 04:59:03 UTC (rev 3888) @@ -186,8 +186,8 @@ Disable support for JavaScript in the Script node. By default, OpenVRML uses the Mozilla JavaScript library to execute JavaScript. - --enable-script-node-java - Enable support for Java in the Script node. "configure" searches + --disable-script-node-java + Disable support for Java in the Script node. "configure" searches for a Java Native Interface (JNI) implementation, which may be provided either by a Java Development Kit or the GNU Compiler for Java (gcj). If using a Java Development Kit, you will probably @@ -195,10 +195,6 @@ and LDFLAGS, respectively. See the file INSTALL for general information on using these variables. - NOTE: This option is not supported in this release of OpenVRML. - (Don't even bother trying; the code simply does not build.) Java - scripting support will reappear in a future release of OpenVRML. - --disable-gl-renderer Do not build the GL renderer. OpenVRML's GL renderer depends on OpenGL/Mesa. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 05:00:22
|
Revision: 3889 http://openvrml.svn.sourceforge.net/openvrml/?rev=3889&view=rev Author: braden Date: 2009-04-17 05:00:18 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/local/xml_reader.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 04:59:03 UTC (rev 3888) +++ trunk/ChangeLog 2009-04-17 05:00:18 UTC (rev 3889) @@ -1,5 +1,10 @@ 2009-04-17 Braden McDaniel <br...@en...> + * src/libopenvrml/openvrml/local/xml_reader.cpp: Whitespace + changes. + +2009-04-17 Braden McDaniel <br...@en...> + * README: Updated to reflect that Script node Java support is now enabled by default. Modified: trunk/src/libopenvrml/openvrml/local/xml_reader.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/xml_reader.cpp 2009-04-17 04:59:03 UTC (rev 3888) +++ trunk/src/libopenvrml/openvrml/local/xml_reader.cpp 2009-04-17 05:00:18 UTC (rev 3889) @@ -187,8 +187,8 @@ return (hr == S_OK) ? 1 : (hr == S_FALSE) - ? 0 - : -1; + ? 0 + : -1; # else return xmlTextReaderRead(this->reader); # endif @@ -273,8 +273,8 @@ return (hr == S_OK) ? 1 : (hr == S_FALSE) - ? 0 - : -1; + ? 0 + : -1; # else return xmlTextReaderMoveToFirstAttribute(this->reader); # endif @@ -294,8 +294,8 @@ return (hr == S_OK) ? 1 : (hr == S_FALSE) - ? 0 - : -1; + ? 0 + : -1; # else return xmlTextReaderMoveToNextAttribute(this->reader); # endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 05:03:04
|
Revision: 3890 http://openvrml.svn.sourceforge.net/openvrml/?rev=3890&view=rev Author: braden Date: 2009-04-17 05:03:01 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Quell unused variable warning. Modified Paths: -------------- trunk/ChangeLog trunk/src/mozilla-plugin/openvrml.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 05:00:18 UTC (rev 3889) +++ trunk/ChangeLog 2009-04-17 05:03:01 UTC (rev 3890) @@ -1,5 +1,11 @@ 2009-04-17 Braden McDaniel <br...@en...> + * src/mozilla-plugin/openvrml.cpp + (NPP_StreamAsFile(NPP, NPStream *, const char *)): Quell unused + variable warning. + +2009-04-17 Braden McDaniel <br...@en...> + * src/libopenvrml/openvrml/local/xml_reader.cpp: Whitespace changes. Modified: trunk/src/mozilla-plugin/openvrml.cpp =================================================================== --- trunk/src/mozilla-plugin/openvrml.cpp 2009-04-17 05:00:18 UTC (rev 3889) +++ trunk/src/mozilla-plugin/openvrml.cpp 2009-04-17 05:03:01 UTC (rev 3890) @@ -608,6 +608,7 @@ NPStream *, const char * /* fname */) { + boost::ignore_unused_variable_warning(instance); assert(instance); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 05:08:48
|
Revision: 3891 http://openvrml.svn.sourceforge.net/openvrml/?rev=3891&view=rev Author: braden Date: 2009-04-17 05:08:38 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Include <iostream> for std::cerr. Modified Paths: -------------- trunk/ChangeLog trunk/src/script/java.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 05:03:01 UTC (rev 3890) +++ trunk/ChangeLog 2009-04-17 05:08:38 UTC (rev 3891) @@ -1,5 +1,9 @@ 2009-04-17 Braden McDaniel <br...@en...> + * src/script/java.cpp: Include <iostream> for std::cerr. + +2009-04-17 Braden McDaniel <br...@en...> + * src/mozilla-plugin/openvrml.cpp (NPP_StreamAsFile(NPP, NPStream *, const char *)): Quell unused variable warning. Modified: trunk/src/script/java.cpp =================================================================== --- trunk/src/script/java.cpp 2009-04-17 05:03:01 UTC (rev 3890) +++ trunk/src/script/java.cpp 2009-04-17 05:08:38 UTC (rev 3891) @@ -88,6 +88,7 @@ # include <boost/multi_index/detail/scope_guard.hpp> # include <boost/scoped_array.hpp> # include <algorithm> +# include <iostream> # include <cstdio> # include <cstring> # include <sstream> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-17 05:17:35
|
Revision: 3892 http://openvrml.svn.sourceforge.net/openvrml/?rev=3892&view=rev Author: braden Date: 2009-04-17 05:17:31 +0000 (Fri, 17 Apr 2009) Log Message: ----------- Quell uninitialized variable warning. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/local/component.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 05:08:38 UTC (rev 3891) +++ trunk/ChangeLog 2009-04-17 05:17:31 UTC (rev 3892) @@ -1,5 +1,11 @@ 2009-04-17 Braden McDaniel <br...@en...> + * src/libopenvrml/openvrml/local/component.cpp + (openvrml::local::component::xml_reader::start_element(openvrml::local::xml_reader&)): + Quell uninitialized variable warning. + +2009-04-17 Braden McDaniel <br...@en...> + * src/script/java.cpp: Include <iostream> for std::cerr. 2009-04-17 Braden McDaniel <br...@en...> Modified: trunk/src/libopenvrml/openvrml/local/component.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/component.cpp 2009-04-17 05:08:38 UTC (rev 3891) +++ trunk/src/libopenvrml/openvrml/local/component.cpp 2009-04-17 05:17:31 UTC (rev 3892) @@ -120,7 +120,7 @@ case component::xml_reader::level: if (reader.local_name() == "requires") { string id; - size_t level; + size_t level = 0; move_to_attr_result = reader.move_to_first_attribute(); while (move_to_attr_result > 0) { using boost::lexical_cast; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-22 05:22:17
|
Revision: 3893 http://openvrml.svn.sourceforge.net/openvrml/?rev=3893&view=rev Author: braden Date: 2009-04-22 05:22:14 +0000 (Wed, 22 Apr 2009) Log Message: ----------- Apply the nonvirtual interface idiom to openvrml::node::modified. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/node.cpp trunk/src/libopenvrml/openvrml/node.h trunk/src/node/vrml97/abstract_indexed_set.h trunk/src/node/vrml97/appearance.cpp trunk/src/node/vrml97/cad_layer.cpp trunk/src/node/vrml97/collision.cpp trunk/src/node/vrml97/elevation_grid.cpp trunk/src/node/vrml97/grouping_node_base.h trunk/src/node/vrml97/indexed_face_set.cpp trunk/src/node/vrml97/lod.cpp trunk/src/node/vrml97/point_set.cpp trunk/src/node/vrml97/shape.cpp trunk/src/node/vrml97/switch.cpp trunk/src/node/vrml97/text.cpp trunk/src/node/x3d-cad-geometry/cad_face.cpp trunk/src/node/x3d-cad-geometry/indexed_quad_set.cpp trunk/src/node/x3d-geometry2d/arc2d.cpp trunk/src/node/x3d-geometry2d/arc_close2d.cpp trunk/src/node/x3d-geometry2d/circle2d.cpp trunk/src/node/x3d-geometry2d/disk2d.cpp trunk/src/node/x3d-geometry2d/polypoint2d.cpp trunk/src/node/x3d-geometry2d/rectangle2d.cpp trunk/src/node/x3d-geometry2d/triangle_set2d.cpp trunk/src/node/x3d-geospatial/geo_elevation_grid.cpp trunk/src/node/x3d-grouping/static_group.cpp trunk/src/node/x3d-nurbs/nurbs_curve.cpp trunk/src/node/x3d-nurbs/nurbs_patch_surface.cpp trunk/src/node/x3d-nurbs/nurbs_swept_surface.cpp trunk/src/node/x3d-nurbs/nurbs_swung_surface.cpp trunk/src/node/x3d-nurbs/nurbs_trimmed_surface.cpp trunk/src/node/x3d-rendering/indexed_triangle_fan_set.cpp trunk/src/node/x3d-rendering/indexed_triangle_set.cpp trunk/src/node/x3d-rendering/triangle_fan_set.cpp trunk/src/node/x3d-rendering/triangle_set.cpp trunk/src/node/x3d-rendering/triangle_strip_set.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/ChangeLog 2009-04-22 05:22:14 UTC (rev 3893) @@ -1,3 +1,87 @@ +2009-04-21 Braden McDaniel <br...@en...> + + Apply the nonvirtual interface idiom to openvrml::node::modified. + + * src/libopenvrml/openvrml/node.cpp + (openvrml::node::modified(bool)): Added exception specification + noting that boost::thread_resource_error can be thrown; call + do_modified. + (openvrml::node::do_modified() const): Added function; this base + class implementation always returns false. + * src/libopenvrml/openvrml/node.h + (openvrml::node): Made modified function nonvirtual; added private + virtual function do_modified. + * src/node/vrml97/abstract_indexed_set.h + (openvrml_node_vrml97::abstract_indexed_set<Derived>): Override + do_modified instead of modified. + * src/node/vrml97/appearance.cpp + (appearance): Override do_modified instead of modified. + * src/node/vrml97/cad_layer.cpp + (cad_layer): Override do_modified instead of modified. + * src/node/vrml97/collision.cpp + (collision): Override do_modified instead of modified. + * src/node/vrml97/elevation_grid.cpp + (elevation_grid): Override do_modified instead of modified. + * src/node/vrml97/grouping_node_base.h + (openvrml_node_vrml97::grouping_node_base<Derived>): Override + do_modified instead of modified. + * src/node/vrml97/indexed_face_set.cpp + (indexed_face_set): Override do_modified instead of modified. + * src/node/vrml97/lod.cpp + (lod): Override do_modified instead of modified. + * src/node/vrml97/point_set.cpp + (point_set): Override do_modified instead of modified. + * src/node/vrml97/shape.cpp + (shape): Override do_modified instead of modified. + * src/node/vrml97/switch.cpp + (switch): Override do_modified instead of modified. + * src/node/vrml97/text.cpp + (text): Override do_modified instead of modified. + * src/node/x3d-cad-geometry/cad_face.cpp + (cad_face): Override do_modified instead of modified. + * src/node/x3d-cad-geometry/indexed_quad_set.cpp + (indexed_quad_set): Override do_modified instead of modified. + * src/node/x3d-geometry2d/arc2d.cpp + (arc2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/arc_close2d.cpp + (arc_close2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/circle2d.cpp + (circle2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/disk2d.cpp + (disk2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/polypoint2d.cpp + (polypoint2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/rectangle2d.cpp + (rectangle2d): Removed unnecessary override of modified. + * src/node/x3d-geometry2d/triangle_set2d.cpp + (triangle_set2d): Removed unnecessary override of modified. + * src/node/x3d-geospatial/geo_elevation_grid.cpp + (geo_elevation_grid): Override do_modified instead of modified. + * src/node/x3d-grouping/static_group.cpp + (static_group): Override do_modified instead of modified. + * src/node/x3d-nurbs/nurbs_curve.cpp + (nurbs_curve): Override do_modified instead of modified. + * src/node/x3d-nurbs/nurbs_patch_surface.cpp + (nurbs_patch_surface): Override do_modified instead of modified. + * src/node/x3d-nurbs/nurbs_swept_surface.cpp + (nurbs_swept_surface): Override do_modified instead of modified. + * src/node/x3d-nurbs/nurbs_swung_surface.cpp + (nurbs_swung_surface): Override do_modified instead of modified. + * src/node/x3d-nurbs/nurbs_trimmed_surface.cpp + (nurbs_trimmed_surface): Override do_modified instead of modified. + * src/node/x3d-rendering/indexed_triangle_fan_set.cpp + (indexed_triangle_fan_set): Override do_modified instead of + modified. + * src/node/x3d-rendering/indexed_triangle_set.cpp + (indexed_triangle_set): Override do_modified instead of modified. + * src/node/x3d-rendering/triangle_fan_set.cpp + (indexed_triangle_fan_set): Override do_modified instead of + modified. + * src/node/x3d-rendering/triangle_set.cpp + (triangle_set): Override do_modified instead of modified. + * src/node/x3d-rendering/triangle_strip_set.cpp + (triangle_strip_set): Override do_modified instead of modified. + 2009-04-17 Braden McDaniel <br...@en...> * src/libopenvrml/openvrml/local/component.cpp Modified: trunk/src/libopenvrml/openvrml/node.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/node.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/libopenvrml/openvrml/node.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -2683,8 +2683,12 @@ * Indicates the node needs to be revisited for rendering. * * @param[in] value + * + * @exception boost::thread_resource_error if @c #modified_mutex_ cannot be + * locked. */ void openvrml::node::modified(const bool value) + OPENVRML_THROW1(boost::thread_resource_error) { read_write_mutex::scoped_write_lock lock(this->modified_mutex_); this->modified_ = value; @@ -2699,14 +2703,35 @@ * return @c true if any of their children have been modified. * * @return @c true if the @c node has been modified; @c false otherwise. + * + * @exception boost::thread_resource_error if @c #modified_mutex_ cannot be + * locked. */ bool openvrml::node::modified() const + OPENVRML_THROW1(boost::thread_resource_error) { read_write_mutex::scoped_read_lock lock(this->modified_mutex_); - return this->modified_; + return this->modified_ || this->do_modified(); } /** + * @brief Determine whether the @c node has been modified. + * + * The default implementation returns @c false. Subclasses that can have + * child @c node%s should override this method and return @c true if any of + * their children has been modified. + * + * @return @c false. + * + * @exception boost::thread_resource_error if a mutex cannot be locked. + */ +bool openvrml::node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) +{ + return false; +} + +/** * @brief Emit an event. * * @param[in,out] emitter an @c event_emitter. Modified: trunk/src/libopenvrml/openvrml/node.h =================================================================== --- trunk/src/libopenvrml/openvrml/node.h 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/libopenvrml/openvrml/node.h 2009-04-22 05:22:14 UTC (rev 3893) @@ -575,8 +575,8 @@ OPENVRML_THROW2(unsupported_interface, std::bad_cast); void shutdown(double timestamp) OPENVRML_NOTHROW; - virtual bool modified() const; - void modified(bool value); + bool modified() const OPENVRML_THROW1(boost::thread_resource_error); + void modified(bool value) OPENVRML_THROW1(boost::thread_resource_error); protected: static void emit_event(openvrml::event_emitter & emitter, @@ -606,6 +606,9 @@ OPENVRML_THROW1(unsupported_interface) = 0; virtual void do_shutdown(double timestamp) OPENVRML_NOTHROW; + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual script_node * to_script() OPENVRML_NOTHROW; virtual appearance_node * to_appearance() OPENVRML_NOTHROW; virtual bounded_volume_node * to_bounded_volume() OPENVRML_NOTHROW; Modified: trunk/src/node/vrml97/abstract_indexed_set.h =================================================================== --- trunk/src/node/vrml97/abstract_indexed_set.h 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/abstract_indexed_set.h 2009-04-22 05:22:14 UTC (rev 3893) @@ -78,14 +78,15 @@ public: virtual ~abstract_indexed_set_node() OPENVRML_NOTHROW = 0; - virtual bool modified() const; - virtual const openvrml::color_node * do_color() const OPENVRML_NOTHROW; protected: abstract_indexed_set_node( const openvrml::node_type & type, const boost::shared_ptr<openvrml::scope> & scope); + + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); }; /** @@ -266,14 +267,11 @@ * @c false otherwise. */ template <typename Derived> - bool abstract_indexed_set_node<Derived>::modified() const + bool abstract_indexed_set_node<Derived>::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - using openvrml::sfnode; - return this->node::modified() - || (this->color_.sfnode::value() - && this->color_.sfnode::value()->modified()) - || (this->coord_.sfnode::value() - && this->coord_.sfnode::value()->modified()); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()); } /** Modified: trunk/src/node/vrml97/appearance.cpp =================================================================== --- trunk/src/node/vrml97/appearance.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/appearance.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -48,9 +48,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~appearance_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + // // appearance_node implementation // @@ -125,15 +126,13 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool appearance_node::modified() const + bool appearance_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return (this->node::modified() - || (this->material_.sfnode::value() - && this->material_.sfnode::value()->modified()) - || (this->texture_.sfnode::value() - && this->texture_.sfnode::value()->modified()) - || (this->texture_transform_.sfnode::value() - && this->texture_transform_.sfnode::value()->modified())); + return (this->material_.value() && this->material_.value()->modified()) + || (this->texture_.value() && this->texture_.value()->modified()) + || (this->texture_transform_.value() + && this->texture_transform_.value()->modified()); } /** Modified: trunk/src/node/vrml97/cad_layer.cpp =================================================================== --- trunk/src/node/vrml97/cad_layer.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/cad_layer.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -61,9 +61,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~cad_layer_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_children_event_side_effect(const openvrml::mfnode & choice, double timestamp) @@ -232,16 +233,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool cad_layer_node::modified() const + bool cad_layer_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - if (this->node::modified()) { return true; } - - openvrml::mfnode::value_type::const_iterator iter = - current_children_.value().begin(); - for (; iter != current_children_.value().end(); ++iter) - { - if ((*iter)->modified()) - return true; + for (openvrml::mfnode::value_type::const_iterator child = + current_children_.value().begin(); + child != current_children_.value().end(); + ++child) { + if ((*child)->modified()) { return true; } } return false; } Modified: trunk/src/node/vrml97/collision.cpp =================================================================== --- trunk/src/node/vrml97/collision.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/collision.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -48,7 +48,9 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~collision_node() OPENVRML_NOTHROW; - virtual bool modified() const; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); }; @@ -119,7 +121,8 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool collision_node::modified() const + bool collision_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { return (this->proxy_.value() && this->proxy_.value()->modified()) || (this->openvrml_node_vrml97::grouping_node_base<collision_node>:: Modified: trunk/src/node/vrml97/elevation_grid.cpp =================================================================== --- trunk/src/node/vrml97/elevation_grid.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/elevation_grid.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -69,9 +69,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~elevation_grid_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, openvrml::rendering_context context); }; @@ -263,15 +264,13 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool elevation_grid_node::modified() const + bool elevation_grid_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->color_.sfnode::value() - && this->color_.sfnode::value()->modified()) - || (this->normal_.sfnode::value() - && this->normal_.sfnode::value()->modified()) - || (this->tex_coord_.sfnode::value() - && this->tex_coord_.sfnode::value()->modified()); + return (this->color_.value() && this->color_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/vrml97/grouping_node_base.h =================================================================== --- trunk/src/node/vrml97/grouping_node_base.h 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/grouping_node_base.h 2009-04-22 05:22:14 UTC (rev 3893) @@ -103,9 +103,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~grouping_node_base() OPENVRML_NOTHROW; - virtual bool modified() const; - protected: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_child(openvrml::viewer & viewer, openvrml::rendering_context context); virtual const openvrml::bounding_volume & @@ -448,19 +449,15 @@ /** * @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. + * @return @c true if one of the node's children has been modified, + * @c false otherwise. */ template <typename Derived> - bool grouping_node_base<Derived>::modified() const + bool grouping_node_base<Derived>::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - using namespace openvrml; - - 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; - } + for (size_t i = 0; i < this->children_.value().size(); ++i) { + if (this->children_.value()[i]->modified()) { return true; } } return false; } Modified: trunk/src/node/vrml97/indexed_face_set.cpp =================================================================== --- trunk/src/node/vrml97/indexed_face_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/indexed_face_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -84,9 +84,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~indexed_face_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual const openvrml::bounding_volume & do_bounding_volume() const; virtual void do_render_geometry(openvrml::viewer & viewer, openvrml::rendering_context context); @@ -318,17 +319,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool indexed_face_set_node::modified() const + bool indexed_face_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->color_.sfnode::value() - && this->color_.sfnode::value()->modified()) - || (this->coord_.sfnode::value() - && this->coord_.sfnode::value()->modified()) - || (this->normal_.sfnode::value() - && this->normal_.sfnode::value()->modified()) - || (this->tex_coord_.sfnode::value() - && this->tex_coord_.sfnode::value()->modified()); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/vrml97/lod.cpp =================================================================== --- trunk/src/node/vrml97/lod.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/lod.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -45,10 +45,11 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~lod_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: - virtual void do_render_child(openvrml::viewer & viewer, + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + + virtual void do_render_child(openvrml::viewer & viewer, openvrml::rendering_context context); virtual const std::vector<boost::intrusive_ptr<openvrml::node> > do_children() const OPENVRML_THROW1(std::bad_alloc); @@ -116,15 +117,12 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool lod_node::modified() const + bool lod_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - if (this->node::modified()) { return true; } - // This should really check which range is being rendered... - for (size_t i = 0; i < this->children_.mfnode::value().size(); ++i) { - if (this->children_.mfnode::value()[i]->modified()) { - return true; - } + for (size_t i = 0; i < this->children_.value().size(); ++i) { + if (this->children_.value()[i]->modified()) { return true; } } return false; } Modified: trunk/src/node/vrml97/point_set.cpp =================================================================== --- trunk/src/node/vrml97/point_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/point_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -47,9 +47,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~point_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual const openvrml::bounding_volume & do_bounding_volume() const; @@ -121,13 +122,11 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool point_set_node::modified() const + bool point_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->color_.sfnode::value() - && this->color_.sfnode::value()->modified()) - || (this->coord_.sfnode::value() - && this->coord_.sfnode::value()->modified()); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()); } /** Modified: trunk/src/node/vrml97/shape.cpp =================================================================== --- trunk/src/node/vrml97/shape.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/shape.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -47,9 +47,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~shape_node() OPENVRML_NOTHROW; - virtual bool modified() const; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); - private: virtual const openvrml::bounding_volume & do_bounding_volume() const; virtual void do_render_child(openvrml::viewer & viewer, @@ -110,13 +111,12 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool shape_node::modified() const + bool shape_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->geometry_.sfnode::value() - && this->geometry_.sfnode::value()->modified()) - || (this->appearance_.sfnode::value() - && this->appearance_.sfnode::value()->modified()); + return (this->geometry_.value() && this->geometry_.value()->modified()) + || (this->appearance_.value() + && this->appearance_.value()->modified()); } OPENVRML_LOCAL void set_unlit_material(openvrml::viewer & v) Modified: trunk/src/node/vrml97/switch.cpp =================================================================== --- trunk/src/node/vrml97/switch.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/switch.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -58,9 +58,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~switch_node() OPENVRML_NOTHROW; - virtual bool modified() const; - private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_children_event_side_effect(const openvrml::mfnode & choice, double timestamp) OPENVRML_THROW1(std::bad_alloc); @@ -238,17 +239,15 @@ /** * @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. + * @return @c true if one of the node's rendered children has been + * modified, @c false otherwise. */ - bool switch_node::modified() const + bool switch_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - if (this->node::modified()) { return true; } - - long w = this->which_choice_.sfint32::value(); - - return w >= 0 && size_t(w) < this->children_.mfnode::value().size() - && this->children_.mfnode::value()[w]->modified(); + const openvrml::int32 w = this->which_choice_.value(); + return w >= 0 && static_cast<size_t>(w) < this->children_.value().size() + && this->children_.value()[w]->modified(); } /** Modified: trunk/src/node/vrml97/text.cpp =================================================================== --- trunk/src/node/vrml97/text.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/vrml97/text.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -163,9 +163,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~text_node() OPENVRML_NOTHROW; - virtual bool modified() const; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); - private: virtual void do_render_geometry(openvrml::viewer & viewer, openvrml::rendering_context context); @@ -1093,11 +1094,11 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool text_node::modified() const + bool text_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->font_style_.sfnode::value() - && this->font_style_.sfnode::value()->modified()); + return this->font_style_.value() + && this->font_style_.value()->modified(); } /** Modified: trunk/src/node/x3d-cad-geometry/cad_face.cpp =================================================================== --- trunk/src/node/x3d-cad-geometry/cad_face.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-cad-geometry/cad_face.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -50,9 +50,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~cad_face_node() OPENVRML_NOTHROW; - virtual bool modified() const; + protected: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); - protected: 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); @@ -105,11 +106,10 @@ * @return @c true if the node or it child has been modified * @c false otherwise. */ - bool cad_face_node::modified() const + bool cad_face_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - if (this->node::modified()) { return true; } - if (shape_.sfnode::value().get() == NULL) { return false; } - return shape_.sfnode::value()->modified(); + return this->shape_.value() && this->shape_.value()->modified(); } /** Modified: trunk/src/node/x3d-cad-geometry/indexed_quad_set.cpp =================================================================== --- trunk/src/node/x3d-cad-geometry/indexed_quad_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-cad-geometry/indexed_quad_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -71,9 +71,11 @@ virtual ~indexed_quad_set_node() OPENVRML_NOTHROW; virtual const color_node * color() const OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual const openvrml::bounding_volume & do_bounding_volume() const; @@ -275,17 +277,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool indexed_quad_set_node::modified() const + bool indexed_quad_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified() - || (this->color_.sfnode::value() - && this->color_.sfnode::value()->modified()) - || (this->coord_.sfnode::value() - && this->coord_.sfnode::value()->modified()) - || (this->normal_.sfnode::value() - && this->normal_.sfnode::value()->modified()) - || (this->tex_coord_.sfnode::value() - && this->tex_coord_.sfnode::value()->modified()); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } } Modified: trunk/src/node/x3d-geometry2d/arc2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/arc2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/arc2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -49,7 +49,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~arc2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -97,17 +96,6 @@ /** - * @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 arc2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the @c node_type associated with this @c node. Modified: trunk/src/node/x3d-geometry2d/arc_close2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/arc_close2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/arc_close2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -53,7 +53,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~arc_close2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -111,19 +110,7 @@ const rendering_context /* context */) {} - /** - * @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 arc_close2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geometry2d/circle2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/circle2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/circle2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -47,7 +47,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~circle2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -80,19 +79,7 @@ const rendering_context /* context */) {} - /** - * @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 circle2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geometry2d/disk2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/disk2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/disk2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -49,7 +49,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~disk2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -95,17 +94,6 @@ {} /** - * @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 disk2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geometry2d/polypoint2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/polypoint2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/polypoint2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -49,7 +49,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~polypoint2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -83,19 +82,7 @@ const rendering_context /* context */) {} - /** - * @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 polypoint2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geometry2d/rectangle2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/rectangle2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/rectangle2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -50,7 +50,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~rectangle2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -90,19 +89,7 @@ const rendering_context /* context */) {} - /** - * @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 rectangle2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geometry2d/triangle_set2d.cpp =================================================================== --- trunk/src/node/x3d-geometry2d/triangle_set2d.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geometry2d/triangle_set2d.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -50,7 +50,6 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~triangle_set2d_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); @@ -90,19 +89,7 @@ const rendering_context /* context */) {} - /** - * @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 triangle_set2d_node::modified() const - { - return this->node::modified(); - } - - /** * @brief Construct. * * @param type the node_type associated with this node. Modified: trunk/src/node/x3d-geospatial/geo_elevation_grid.cpp =================================================================== --- trunk/src/node/x3d-geospatial/geo_elevation_grid.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-geospatial/geo_elevation_grid.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -79,9 +79,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~geo_elevation_grid_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -246,9 +249,11 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool geo_elevation_grid_node::modified() const + bool geo_elevation_grid_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return this->geo_origin_.value() + && this->geo_origin_.value()->modified(); } /** Modified: trunk/src/node/x3d-grouping/static_group.cpp =================================================================== --- trunk/src/node/x3d-grouping/static_group.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-grouping/static_group.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -54,10 +54,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~static_group_node() OPENVRML_NOTHROW; - - virtual bool modified() const; - protected: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_child(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & @@ -114,13 +114,11 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool static_group_node::modified() const + bool static_group_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - 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; - } + for (size_t i = 0; i < this->children_.value().size(); ++i) { + if (this->children_.value()[i]->modified()) { return true; } } return false; } Modified: trunk/src/node/x3d-nurbs/nurbs_curve.cpp =================================================================== --- trunk/src/node/x3d-nurbs/nurbs_curve.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-nurbs/nurbs_curve.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -54,8 +54,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~nurbs_curve_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -118,16 +120,17 @@ const rendering_context /* context */) {} - /** * @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 nurbs_curve_node::modified() const + bool nurbs_curve_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return this->control_point_.value() + && this->control_point_.value()->modified(); } /** Modified: trunk/src/node/x3d-nurbs/nurbs_patch_surface.cpp =================================================================== --- trunk/src/node/x3d-nurbs/nurbs_patch_surface.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-nurbs/nurbs_patch_surface.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -63,8 +63,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~nurbs_patch_surface_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -182,9 +184,13 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool nurbs_patch_surface_node::modified() const + bool nurbs_patch_surface_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->control_point_.value() + && this->control_point_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/x3d-nurbs/nurbs_swept_surface.cpp =================================================================== --- trunk/src/node/x3d-nurbs/nurbs_swept_surface.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-nurbs/nurbs_swept_surface.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -53,8 +53,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~nurbs_swept_surface_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -105,16 +107,19 @@ const rendering_context /* context */) {} - /** * @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 nurbs_swept_surface_node::modified() const + bool nurbs_swept_surface_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->cross_section_curve_.value() + && this->cross_section_curve_.value()->modified()) + || (this->trajectory_curve_.value() + && this->trajectory_curve_.value()->modified()); } /** Modified: trunk/src/node/x3d-nurbs/nurbs_swung_surface.cpp =================================================================== --- trunk/src/node/x3d-nurbs/nurbs_swung_surface.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-nurbs/nurbs_swung_surface.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -53,8 +53,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~nurbs_swung_surface_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -112,9 +114,13 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool nurbs_swung_surface_node::modified() const + bool nurbs_swung_surface_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->componentcurve_.value() + && this->componentcurve_.value()->modified()) + || (this->trajectory_curve_.value() + && this->trajectory_curve_.value()->modified()); } /** Modified: trunk/src/node/x3d-nurbs/nurbs_trimmed_surface.cpp =================================================================== --- trunk/src/node/x3d-nurbs/nurbs_trimmed_surface.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-nurbs/nurbs_trimmed_surface.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -89,8 +89,10 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~nurbs_trimmed_surface_node() OPENVRML_NOTHROW; - virtual bool modified() const; private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); }; @@ -261,16 +263,27 @@ const rendering_context /* context */) {} - /** * @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 nurbs_trimmed_surface_node::modified() const + bool nurbs_trimmed_surface_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + if ((this->control_point_.value() + && this->control_point_.value()->modified()) + || this->tex_coord_.value() && this->tex_coord_.value()->modified()) + { + return true; + } + + for (size_t i = 0; i < this->trimming_contour_.value().size(); ++i) { + if (this->trimming_contour_.value()[i]->modified()) { return true; } + } + + return false; } /** Modified: trunk/src/node/x3d-rendering/indexed_triangle_fan_set.cpp =================================================================== --- trunk/src/node/x3d-rendering/indexed_triangle_fan_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-rendering/indexed_triangle_fan_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -71,9 +71,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~indexed_triangle_fan_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & do_bounding_volume() const; @@ -237,9 +240,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool indexed_triangle_fan_set_node::modified() const + bool indexed_triangle_fan_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/x3d-rendering/indexed_triangle_set.cpp =================================================================== --- trunk/src/node/x3d-rendering/indexed_triangle_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-rendering/indexed_triangle_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -75,9 +75,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~indexed_triangle_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & @@ -235,9 +238,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool indexed_triangle_set_node::modified() const + bool indexed_triangle_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/x3d-rendering/triangle_fan_set.cpp =================================================================== --- trunk/src/node/x3d-rendering/triangle_fan_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-rendering/triangle_fan_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -60,9 +60,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~triangle_fan_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & @@ -195,9 +198,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool triangle_fan_set_node::modified() const + bool triangle_fan_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/x3d-rendering/triangle_set.cpp =================================================================== --- trunk/src/node/x3d-rendering/triangle_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-rendering/triangle_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -58,9 +58,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~triangle_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & @@ -187,9 +190,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool triangle_set_node::modified() const + bool triangle_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** Modified: trunk/src/node/x3d-rendering/triangle_strip_set.cpp =================================================================== --- trunk/src/node/x3d-rendering/triangle_strip_set.cpp 2009-04-17 05:17:31 UTC (rev 3892) +++ trunk/src/node/x3d-rendering/triangle_strip_set.cpp 2009-04-22 05:22:14 UTC (rev 3893) @@ -60,9 +60,12 @@ const boost::shared_ptr<openvrml::scope> & scope); virtual ~triangle_strip_set_node() OPENVRML_NOTHROW; - virtual bool modified() const; virtual const color_node * color() const OPENVRML_NOTHROW; + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + virtual void do_render_geometry(openvrml::viewer & viewer, rendering_context context); virtual const openvrml::bounding_volume & @@ -195,9 +198,14 @@ * @return @c true if the node or one of its children has been modified, * @c false otherwise. */ - bool triangle_strip_set_node::modified() const + bool triangle_strip_set_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) { - return this->node::modified(); + return (this->color_.value() && this->color_.value()->modified()) + || (this->coord_.value() && this->coord_.value()->modified()) + || (this->normal_.value() && this->normal_.value()->modified()) + || (this->tex_coord_.value() + && this->tex_coord_.value()->modified()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-27 05:27:36
|
Revision: 3894 http://openvrml.svn.sourceforge.net/openvrml/?rev=3894&view=rev Author: braden Date: 2009-04-27 05:27:33 +0000 (Mon, 27 Apr 2009) Log Message: ----------- Removed reference to GIF copyright; OpenVRML hasn't supported GIF for some years. Modified Paths: -------------- trunk/AUTHORS trunk/ChangeLog Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2009-04-22 05:22:14 UTC (rev 3893) +++ trunk/AUTHORS 2009-04-27 05:27:33 UTC (rev 3894) @@ -39,8 +39,3 @@ Christopher K. St. John <cs...@ac...> Steve Sycamore <syc...@in...> Lukas Vonblon <lvo...@fl...> - - - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-22 05:22:14 UTC (rev 3893) +++ trunk/ChangeLog 2009-04-27 05:27:33 UTC (rev 3894) @@ -1,3 +1,8 @@ +2009-04-27 Braden McDaniel <br...@en...> + + * AUTHORS: Removed reference to GIF copyright; OpenVRML hasn't + supported GIF for some years. + 2009-04-21 Braden McDaniel <br...@en...> Apply the nonvirtual interface idiom to openvrml::node::modified. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-27 05:31:12
|
Revision: 3895 http://openvrml.svn.sourceforge.net/openvrml/?rev=3895&view=rev Author: braden Date: 2009-04-27 05:31:07 +0000 (Mon, 27 Apr 2009) Log Message: ----------- openvrml::viewer::insert_texture no longer returns a value. Modified Paths: -------------- trunk/ChangeLog trunk/src/node/vrml97/image_texture.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-27 05:27:33 UTC (rev 3894) +++ trunk/ChangeLog 2009-04-27 05:31:07 UTC (rev 3895) @@ -1,5 +1,11 @@ 2009-04-27 Braden McDaniel <br...@en...> + * src/node/vrml97/image_texture.cpp + (image_texture_node::do_render_texture(openvrml::viewer & v)): + openvrml::viewer::insert_texture no longer returns a value. + +2009-04-27 Braden McDaniel <br...@en...> + * AUTHORS: Removed reference to GIF copyright; OpenVRML hasn't supported GIF for some years. Modified: trunk/src/node/vrml97/image_texture.cpp =================================================================== --- trunk/src/node/vrml97/image_texture.cpp 2009-04-27 05:27:33 UTC (rev 3894) +++ trunk/src/node/vrml97/image_texture.cpp 2009-04-27 05:31:07 UTC (rev 3895) @@ -230,7 +230,7 @@ void image_texture_node::do_render_texture(openvrml::viewer & v) { this->update_texture(); - return v.insert_texture(*this, true); + v.insert_texture(*this, true); } /** @@ -243,11 +243,10 @@ if (this->texture_needs_update) { using openvrml_node_vrml97::image_stream_listener; try { - if (!this->url_.mfstring::value().empty()) { + if (!this->url_.value().empty()) { using std::auto_ptr; auto_ptr<openvrml::resource_istream> in( - this->scene()->get_resource( - this->url_.mfstring::value())); + this->scene()->get_resource(this->url_.value())); auto_ptr<openvrml::stream_listener> listener( new image_stream_listener(in->url(), this->image_, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-27 14:48:48
|
Revision: 3896 http://openvrml.svn.sourceforge.net/openvrml/?rev=3896&view=rev Author: braden Date: 2009-04-27 14:48:40 +0000 (Mon, 27 Apr 2009) Log Message: ----------- Override do_modified for background_node; set the initial value of the url field for the subordinate image_texture_nodes. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/viewer.cpp trunk/src/libopenvrml/openvrml/viewer.h trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp trunk/src/libopenvrml-gl/openvrml/gl/viewer.h trunk/src/node/vrml97/background.cpp trunk/src/node/vrml97/background.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/ChangeLog 2009-04-27 14:48:40 UTC (rev 3896) @@ -1,5 +1,31 @@ 2009-04-27 Braden McDaniel <br...@en...> + Override do_modified for background_node; set the initial value of + the url field for the subordinate image_texture_nodes. + + * src/libopenvrml/openvrml/viewer.cpp: Changed insert_background + to take nonconst texture_nodes. + * src/libopenvrml/openvrml/viewer.h: Changed insert_background to + take nonconst texture_nodes. + * src/libopenvrml-gl/openvrml/gl/viewer.cpp: Changed + insert_background to take nonconst texture_nodes; always call + render_texture on the texture_nodes in order to trigger + downloading the image. + * src/libopenvrml-gl/openvrml/gl/viewer.h: Changed + insert_background to take nonconst texture_nodes. + * src/node/vrml97/background.cpp + (openvrml_node_vrml97::background_metatype::do_render(openvrml::viewer&) + const): Made static null_texture_nodes nonconst. + (openvrml_node_vrml97::background_node::do_initialize(double)): + Set the initial value for the "url" fields of the subordinate + image_texture_nodes. + (openvrml_node_vrml97::background_node::do_modified() const): + Check the modified flags of the subordinate image_texture_nodes. + * src/node/vrml97/background.h + (openvrml_node_vrml97::background_node): Override do_modified. + +2009-04-27 Braden McDaniel <br...@en...> + * src/node/vrml97/image_texture.cpp (image_texture_node::do_render_texture(openvrml::viewer & v)): openvrml::viewer::insert_texture no longer returns a value. Modified: trunk/src/libopenvrml/openvrml/viewer.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/viewer.cpp 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/libopenvrml/openvrml/viewer.cpp 2009-04-27 14:48:40 UTC (rev 3896) @@ -246,12 +246,12 @@ const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, - const texture_node & front, - const texture_node & back, - const texture_node & left, - const texture_node & right, - const texture_node & top, - const texture_node & bottom) + texture_node & front, + texture_node & back, + texture_node & left, + texture_node & right, + texture_node & top, + texture_node & bottom) { return this->do_insert_background(ground_angle, ground_color, sky_angle, sky_color, @@ -259,7 +259,7 @@ } /** - * @fn void openvrml::viewer::do_insert_background(const std::vector<float> & ground_angle, const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, const texture_node & front, const texture_node & back, const texture_node & left, const texture_node & right, const texture_node & top, const texture_node & bottom) + * @fn void openvrml::viewer::do_insert_background(const std::vector<float> & ground_angle, const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, texture_node & front, texture_node & back, texture_node & left, texture_node & right, texture_node & top, texture_node & bottom) * * @brief Insert a background into a display list. * Modified: trunk/src/libopenvrml/openvrml/viewer.h =================================================================== --- trunk/src/libopenvrml/openvrml/viewer.h 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/libopenvrml/openvrml/viewer.h 2009-04-27 14:48:40 UTC (rev 3896) @@ -74,12 +74,12 @@ const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, - const texture_node & front, - const texture_node & back, - const texture_node & left, - const texture_node & right, - const texture_node & top, - const texture_node & bottom); + texture_node & front, + texture_node & back, + texture_node & left, + texture_node & right, + texture_node & top, + texture_node & bottom); void insert_box(const geometry_node & n, const vec3f & size); void insert_cone(const geometry_node & n, @@ -220,12 +220,12 @@ const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, - const texture_node & front, - const texture_node & back, - const texture_node & left, - const texture_node & right, - const texture_node & top, - const texture_node & bottom) = 0; + texture_node & front, + texture_node & back, + texture_node & left, + texture_node & right, + texture_node & top, + texture_node & bottom) = 0; virtual void do_insert_box(const geometry_node & n, const vec3f & size) = 0; Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-27 14:48:40 UTC (rev 3896) @@ -1012,6 +1012,7 @@ const GLubyte * const error_str = gluErrorString(glerr); const GLubyte * end; for (end = error_str; *end; ++end) {} + boost::ignore_unused_variable_warning(s); OPENVRML_GL_PRINT_MESSAGE_("GL ERROR: " + s + " " + std::string(error_str, end)); } @@ -1172,13 +1173,14 @@ const std::vector<color> & groundColor, const std::vector<float> & skyAngle, const std::vector<color> & skyColor, - const texture_node & front, - const texture_node & back, - const texture_node & left, - const texture_node & right, - const texture_node & top, - const texture_node & bottom) + texture_node & front, + texture_node & back, + texture_node & left, + texture_node & right, + texture_node & top, + texture_node & bottom) { + std::cout << "do_insert_background" << std::endl; using std::vector; float r = 0.0, g = 0.0, b = 0.0, a = 1.0; @@ -1216,15 +1218,7 @@ glClear(mask); // Draw the background as big spheres centered at the view position - if (!this->select_mode - && (!skyAngle.empty() - || !groundAngle.empty() - || !front.image().array().empty() - || !back.image().array().empty() - || !left.image().array().empty() - || !right.image().array().empty() - || !top.image().array().empty() - || !bottom.image().array().empty())) { + if (!this->select_mode && (!skyAngle.empty() || !groundAngle.empty())) { glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); @@ -1331,10 +1325,8 @@ glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - static const bool retain = true; - + front.render_texture(*this); if (!front.image().array().empty()) { - this->insert_texture(front, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, -1); @@ -1346,8 +1338,8 @@ glVertex3f(-1, 1, -1); glEnd(); // GL_QUADS } + back.render_texture(*this); if (!back.image().array().empty()) { - this->insert_texture(back, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(1, -1, 1); @@ -1359,8 +1351,8 @@ glVertex3f(1, 1, 1); glEnd(); // GL_QUADS } + left.render_texture(*this); if (!left.image().array().empty()) { - this->insert_texture(left, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, 1); @@ -1372,8 +1364,8 @@ glVertex3f(-1, 1, 1); glEnd(); // GL_QUADS } + right.render_texture(*this); if (!right.image().array().empty()) { - this->insert_texture(right, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(1, -1, -1); @@ -1385,8 +1377,8 @@ glVertex3f(1, 1, -1); glEnd(); // GL_QUADS } + top.render_texture(*this); if (!top.image().array().empty()) { - this->insert_texture(top, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, 1, -1); @@ -1398,8 +1390,8 @@ glVertex3f(-1, 1, 1); glEnd(); // GL_QUADS } + bottom.render_texture(*this); if (!bottom.image().array().empty()) { - this->insert_texture(bottom, retain); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, 1); Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.h =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-27 14:48:40 UTC (rev 3896) @@ -205,12 +205,12 @@ const std::vector<color> & groundColor, const std::vector<float> & skyAngle, const std::vector<color> & skyColor, - const texture_node & front, - const texture_node & back, - const texture_node & left, - const texture_node & right, - const texture_node & top, - const texture_node & bottom); + texture_node & front, + texture_node & back, + texture_node & left, + texture_node & right, + texture_node & top, + texture_node & bottom); virtual void do_insert_box(const geometry_node & n, Modified: trunk/src/node/vrml97/background.cpp =================================================================== --- trunk/src/node/vrml97/background.cpp 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/node/vrml97/background.cpp 2009-04-27 14:48:40 UTC (rev 3896) @@ -21,7 +21,6 @@ // # include "background.h" -# include "image_stream_listener.h" # include <openvrml/browser.h> # include <openvrml/scene.h> # include <openvrml/scope.h> @@ -249,12 +248,12 @@ static const vector<color> ground_color; static const vector<float> sky_angle; static const vector<color> sky_color; - static const null_texture_node front(this->null_texture_node_type_); - static const null_texture_node back(this->null_texture_node_type_); - static const null_texture_node left(this->null_texture_node_type_); - static const null_texture_node right(this->null_texture_node_type_); - static const null_texture_node top(this->null_texture_node_type_); - static const null_texture_node bottom(this->null_texture_node_type_); + static null_texture_node front(this->null_texture_node_type_); + static null_texture_node back(this->null_texture_node_type_); + static null_texture_node left(this->null_texture_node_type_); + static null_texture_node right(this->null_texture_node_type_); + static null_texture_node top(this->null_texture_node_type_); + static null_texture_node bottom(this->null_texture_node_type_); v.insert_background(ground_angle, ground_color, sky_angle, sky_color, front, back, @@ -271,10 +270,10 @@ v.remove_object(background); } - v.insert_background(background.ground_angle_.mffloat::value(), - background.ground_color_.mfcolor::value(), - background.sky_angle_.mffloat::value(), - background.sky_color_.mfcolor::value(), + v.insert_background(background.ground_angle_.value(), + background.ground_color_.value(), + background.sky_angle_.value(), + background.sky_color_.value(), *background.front, *background.back, *background.left, @@ -755,14 +754,42 @@ node::emit_event(this->is_bound_emitter_, timestamp); } +namespace { + OPENVRML_LOCAL void set_url(openvrml::node & n, + const openvrml::mfstring & url, + const double timestamp) + OPENVRML_NOTHROW + { + using openvrml::mfstring; + using openvrml::mfstring_listener; + mfstring_listener & listener = n.event_listener<mfstring>("url"); + listener.process_event(url, timestamp); + } +} + /** * @brief Initialize. * * @param timestamp the current time. */ -void openvrml_node_vrml97::background_node::do_initialize(double) +void +openvrml_node_vrml97::background_node::do_initialize(const double timestamp) OPENVRML_NOTHROW { + set_url(*this->front, this->front_url_, timestamp); + set_url(*this->back, this->back_url_, timestamp); + set_url(*this->left, this->left_url_, timestamp); + set_url(*this->right, this->right_url_, timestamp); + set_url(*this->top, this->top_url_, timestamp); + set_url(*this->bottom, this->bottom_url_, timestamp); + + this->front->initialize(*this->scene(), timestamp); + this->back->initialize(*this->scene(), timestamp); + this->left->initialize(*this->scene(), timestamp); + this->right->initialize(*this->scene(), timestamp); + this->top->initialize(*this->scene(), timestamp); + this->bottom->initialize(*this->scene(), timestamp); + using boost::polymorphic_downcast; background_metatype & nodeClass = const_cast<background_metatype &>( @@ -791,6 +818,17 @@ if (node_metatype.is_first(*this)) { node_metatype.reset_first(); } } +bool openvrml_node_vrml97::background_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) +{ + return (this->front && this->front->modified()) + || (this->back && this->back->modified()) + || (this->left && this->left->modified()) + || (this->right && this->right->modified()) + || (this->top && this->top->modified()) + || (this->bottom && this->bottom->modified()); +} + namespace { const boost::shared_ptr<openvrml::scope> null_scope_ptr; Modified: trunk/src/node/vrml97/background.h =================================================================== --- trunk/src/node/vrml97/background.h 2009-04-27 05:31:07 UTC (rev 3895) +++ trunk/src/node/vrml97/background.h 2009-04-27 14:48:40 UTC (rev 3896) @@ -110,5 +110,7 @@ private: virtual void do_initialize(double timestamp) OPENVRML_NOTHROW; virtual void do_shutdown(double timestamp) OPENVRML_NOTHROW; + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-30 03:31:54
|
Revision: 3897 http://openvrml.svn.sourceforge.net/openvrml/?rev=3897&view=rev Author: braden Date: 2009-04-30 03:31:52 +0000 (Thu, 30 Apr 2009) Log Message: ----------- Removed erroneously committed debugging output. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-27 14:48:40 UTC (rev 3896) +++ trunk/ChangeLog 2009-04-30 03:31:52 UTC (rev 3897) @@ -1,3 +1,12 @@ +2009-04-29 Braden McDaniel <br...@en...> + + * src/libopenvrml-gl/openvrml/gl/viewer.cpp + (openvrml::gl::viewer::do_insert_background(const + std::vector<float> &, const std::vector<color> &, const + std::vector<float> &, const std::vector<color> &, texture_node &, + texture_node &, texture_node &, texture_node &, texture_node &, + texture_node &)): Removed erroneously committed debugging output. + 2009-04-27 Braden McDaniel <br...@en...> Override do_modified for background_node; set the initial value of Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-27 14:48:40 UTC (rev 3896) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-30 03:31:52 UTC (rev 3897) @@ -1180,7 +1180,6 @@ texture_node & top, texture_node & bottom) { - std::cout << "do_insert_background" << std::endl; using std::vector; float r = 0.0, g = 0.0, b = 0.0, a = 1.0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-04-30 07:20:13
|
Revision: 3898 http://openvrml.svn.sourceforge.net/openvrml/?rev=3898&view=rev Author: braden Date: 2009-04-30 07:20:11 +0000 (Thu, 30 Apr 2009) Log Message: ----------- Added abstract node type openvrml::background_node. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/local/externproto.cpp trunk/src/libopenvrml/openvrml/local/externproto.h trunk/src/libopenvrml/openvrml/local/proto.cpp trunk/src/libopenvrml/openvrml/node.cpp trunk/src/libopenvrml/openvrml/node.h trunk/src/libopenvrml/openvrml/viewer.cpp trunk/src/libopenvrml/openvrml/viewer.h trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp trunk/src/libopenvrml-gl/openvrml/gl/viewer.h trunk/src/node/vrml97/background.cpp trunk/src/node/vrml97/background.h trunk/src/node/x3d-environmental-effects/texture_background.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/ChangeLog 2009-04-30 07:20:11 UTC (rev 3898) @@ -1,3 +1,123 @@ +2009-04-30 Braden McDaniel <br...@en...> + + Added abstract node type openvrml::background_node. + + * src/libopenvrml/openvrml/local/externproto.cpp + (openvrml::local::externproto_node::to_background()): Added + implementation of openvrml::node::to_background. + * src/libopenvrml/openvrml/local/externproto.h + (openvrml::local::externproto): Override + openvrml::node::to_background. + * src/libopenvrml/openvrml/local/proto.cpp + (openvrml::local::proto): Override openvrml::node::to_background. + * src/libopenvrml/openvrml/node.cpp + (openvrml::node::to_background()): Added downcast function; + default implementation returns 0. + (openvrml::background_node::background_node(const node_type &, + const boost::shared_ptr<openvrml::scope> &)): Construct a + background_node. + (openvrml::background_node::~background_node()): Destroy a + background_node. + (openvrml::background_node::to_background()): Return this. + (openvrml::background_node::ground_angle() const): Delegate to + do_ground_angle. + (openvrml::background_node::ground_color() const): Delegate to + do_ground_color. + (openvrml::background_node::sky_angle() const): Delegate to + do_sky_angle. + (openvrml::background_node::sky_color() const): Delegate to + do_sky_color. + (openvrml::background_node::front() const): Delegate to do_front. + (openvrml::background_node::back() const): Delegate to do_back. + (openvrml::background_node::left() const): Delegate to do_left. + (openvrml::background_node::right() const): Delegate to do_right. + (openvrml::background_node::top() const): Delegate to do_top. + (openvrml::background_node::bottom() const): Delegate to + do_bottom. + * src/libopenvrml/openvrml/node.h + (openvrml::node): Added polymorphic "cast" function used by + node_cast. + (openvrml::node_cast<background_node *>(node *)): Specialize for + background_node. + (openvrml::background_node): Added background_node abstract node + type. + * src/libopenvrml/openvrml/viewer.cpp + (openvrml::viewer::insert_background(const background_node &)): + Just take a background_node. + * src/libopenvrml/openvrml/viewer.h + (openvrml::viewer): Changed insert_background and + do_insert_background just to take a background_node. + * src/libopenvrml-gl/openvrml/gl/viewer.cpp + (openvrml::gl::viewer::do_insert_background(const + background_node&)): Get data from the background_node. + * src/libopenvrml-gl/openvrml/gl/viewer.h + (openvrml::gl::viewer): Changed do_insert_background to take a + background_node. + * src/node/vrml97/background.cpp + (openvrml_node_vrml97::background_metatype::background_metatype(openvrml::browser&)): + Initialize the node_metatype and node_type for the default + background node. + (null_texture_node): Removed. + (openvrml_node_vrml97::background_metatype::do_render(openvrml::viewer&) + const): Use a background_node instance for the default background. + (openvrml_node_vrml97::background_node::background_node(const + openvrml::node_type &, const + boost::shared_ptr<openvrml::scope>&)): Don't bother to set up the + texture nodes for the default background. + (openvrml_node_vrml97::background_node::do_ground_angle() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_ground_color() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_sky_angle() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_sky_color() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_front() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_back() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_left() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_right() const): + Implement openvrml::background_node. + (openvrml_node_vrml97::background_node::do_top() const): Implement + openvrml::background_node. + (openvrml_node_vrml97::background_node::do_bottom() const): + Implement openvrml::background_node. + * src/node/vrml97/background.h + (openvrml_node_vrml97::background_metatype): Provide a + null_node_metatype and a null_node_type for the default + background. + (openvrml_node_vrml97::background_node): Inherit + openvrml::background_node; override openvrml::node::do_modified. + * src/node/x3d-environmental-effects/texture_background.cpp + (texture_background_node): Inherit openvrml::background_node. + (texture_background_node::texture_background_node(const + node_type&, const boost::shared_ptr<openvrml::scope> &)): + Initialize the base openvrml::background_node. + (texture_background_node::do_modified() const): Check the modified + states of the texture nodes. + (texture_background_node::do_ground_angle() const): Implement + openvrml::background_node. + (texture_background_node::do_ground_color() const): Implement + openvrml::background_node. + (texture_background_node::do_sky_angle() const): Implement + openvrml::background_node. + (texture_background_node::do_sky_color() const): Implement + openvrml::background_node. + (texture_background_node::do_front() const): Implement + openvrml::background_node. + (texture_background_node::do_back() const): Implement + openvrml::background_node. + (texture_background_node::do_left() const): Implement + openvrml::background_node. + (texture_background_node::do_right() const): Implement + openvrml::background_node. + (texture_background_node::do_top() const): Implement + openvrml::background_node. + (texture_background_node::do_bottom() const): Implement + openvrml::background_node. + 2009-04-29 Braden McDaniel <br...@en...> * src/libopenvrml-gl/openvrml/gl/viewer.cpp Modified: trunk/src/libopenvrml/openvrml/local/externproto.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/externproto.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/local/externproto.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -660,6 +660,18 @@ } /** + * @brief Cast to a @c background_node. + * + * @return a pointer to the first node in the implementation if that node + * is a @c background_node, or 0 otherwise. + */ +openvrml::background_node * +openvrml::local::externproto_node::to_background() OPENVRML_NOTHROW +{ + return node_cast<background_node *>(this->proto_node_.get()); +} + +/** * @brief Cast to a @c bounded_volume_node. * * @return a pointer to the first node in the implementation if that node Modified: trunk/src/libopenvrml/openvrml/local/externproto.h =================================================================== --- trunk/src/libopenvrml/openvrml/local/externproto.h 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/local/externproto.h 2009-04-30 07:20:11 UTC (rev 3898) @@ -243,6 +243,8 @@ virtual openvrml::script_node * to_script() OPENVRML_NOTHROW; virtual openvrml::appearance_node * to_appearance() OPENVRML_NOTHROW; + virtual openvrml::background_node * to_background() + OPENVRML_NOTHROW; virtual openvrml::bounded_volume_node * to_bounded_volume() OPENVRML_NOTHROW; virtual openvrml::child_node * to_child() OPENVRML_NOTHROW; Modified: trunk/src/libopenvrml/openvrml/local/proto.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/proto.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/local/proto.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -179,6 +179,8 @@ OPENVRML_NOTHROW; virtual openvrml::bounded_volume_node * to_bounded_volume() OPENVRML_NOTHROW; + virtual openvrml::background_node * to_background() + OPENVRML_NOTHROW; virtual openvrml::child_node * to_child() OPENVRML_NOTHROW; virtual openvrml::color_node * to_color() OPENVRML_NOTHROW; virtual openvrml::color_rgba_node * to_color_rgba() @@ -1465,6 +1467,21 @@ } /** + * @brief Cast to a @c background_node. + * + * @return a pointer to the first node in the implementation if that node + * is a @c background_node, or 0 otherwise. + */ +openvrml::background_node * +openvrml::local::proto_node::to_background() + OPENVRML_NOTHROW +{ + assert(!this->impl_nodes_.empty()); + assert(this->impl_nodes_[0]); + return node_cast<background_node *>(this->impl_nodes_[0].get()); +} + +/** * @brief Cast to a @c bounded_volume_node. * * @return a pointer to the first node in the implementation if that node Modified: trunk/src/libopenvrml/openvrml/node.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/node.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/node.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -2380,6 +2380,21 @@ /** * @internal * + * @brief Cast to a @c background_node. + * + * Default implementation returns 0. + * + * @return 0 + */ +openvrml::background_node * openvrml::node::to_background() + OPENVRML_NOTHROW +{ + return 0; +} + +/** + * @internal + * * @brief Cast to a @c bounded_volume_node. * * Default implementation returns 0. @@ -3641,6 +3656,255 @@ /** + * @class openvrml::background_node openvrml/node.h + * + * @brief Abstract base class for background nodes. + */ + +/** + * @brief Construct. + * + * @param[in] type the @c node_type associated with the node. + * @param[in] scope the scope the node belongs to. + */ +openvrml::background_node:: +background_node(const node_type & type, + const boost::shared_ptr<openvrml::scope> & scope) + OPENVRML_NOTHROW: + node(type, scope), + bounded_volume_node(type, scope), + child_node(type, scope) +{} + +/** + * @brief Destroy. + */ +openvrml::background_node::~background_node() OPENVRML_NOTHROW +{} + +/** + * @brief Cast to a @c background_node. + * + * @return a pointer to this @c background_node. + */ +openvrml::background_node * openvrml::background_node::to_background() + OPENVRML_NOTHROW +{ + return this; +} + +/** + * @brief Ground angles. + * + * This function delegates to @c #do_ground_angle. + * + * @return a vector of angles corresponding to ground colors. + */ +const std::vector<float> & +openvrml::background_node::ground_angle() const OPENVRML_NOTHROW +{ + return this->do_ground_angle(); +} + +/** + * @fn const std::vector<float> & openvrml::background_node::do_ground_angle() const + * + * @brief Ground angles. + * + * @return a vector of angles corresponding to ground colors. + */ + +/** + * @brief Ground colors. + * + * This function delegates to @c #do_ground_color. + * + * @return a vector of ground colors. + */ +const std::vector<openvrml::color> & +openvrml::background_node::ground_color() const OPENVRML_NOTHROW +{ + return this->do_ground_color(); +} + +/** + * @fn const std::vector<openvrml::color> & openvrml::background_node::do_ground_color() const + * + * @brief Ground colors. + * + * @return a vector of ground colors. + */ + +/** + * @brief Sky angles. + * + * This function delegates to @c #do_sky_angle. + * + * @return a vector of angles corresponding to sky colors. + */ +const std::vector<float> & +openvrml::background_node::sky_angle() const OPENVRML_NOTHROW +{ + return this->do_sky_angle(); +} + +/** + * @fn const std::vector<float> & openvrml::background_node::do_sky_angle() const + * + * @brief Sky angles. + * + * @return a vector of angles corresponding to sky colors. + */ + +/** + * @brief Sky colors. + * + * This function delegates to @c #do_sky_color. + * + * @return a vector of sky colors. + */ +const std::vector<openvrml::color> & +openvrml::background_node::sky_color() const OPENVRML_NOTHROW +{ + return this->do_sky_color(); +} + +/** + * @fn const std::vector<openvrml::color> & openvrml::background_node::do_sky_color() const + * + * @brief Sky colors. + * + * @return a vector of sky colors. + */ + +/** + * @brief Front texture. + * + * This function delegates to @c #do_front. + * + * @return the front texture. + */ +openvrml::texture_node * openvrml::background_node::front() const + OPENVRML_NOTHROW +{ + return this->do_front(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_front() const + * + * @brief Front texture. + * + * @return the front texture. + */ + +/** + * @brief Back texture. + * + * This function delegates to @c #do_back. + * + * @return the back texture. + */ +openvrml::texture_node * openvrml::background_node::back() const + OPENVRML_NOTHROW +{ + return this->do_back(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_back() const + * + * @brief Back texture. + * + * @return the back texture. + */ + +/** + * @brief Left texture. + * + * This function delegates to @c #do_left. + * + * @return the left texture. + */ +openvrml::texture_node * openvrml::background_node::left() const + OPENVRML_NOTHROW +{ + return this->do_left(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_left() const + * + * @brief Left texture. + * + * @return the left texture. + */ + +/** + * @brief Right texture. + * + * This function delegates to @c @do_right. + * + * @return the right texture. + */ +openvrml::texture_node * openvrml::background_node::right() const + OPENVRML_NOTHROW +{ + return this->do_right(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_right() const + * + * @brief Right texture. + * + * @return the right texture. + */ + +/** + * @brief Top texture. + * + * This function delegates to @c #do_top. + * + * @return the top texture. + */ +openvrml::texture_node * openvrml::background_node::top() const + OPENVRML_NOTHROW +{ + return this->do_top(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_top() const + * + * @brief Top texture. + * + * @return the top texture. + */ + +/** + * @brief Bottom texture. + * + * This function delegates to @c #do_bottom. + * + * @return the bottom texture. + */ +openvrml::texture_node * openvrml::background_node::bottom() const + OPENVRML_NOTHROW +{ + return this->do_bottom(); +} + +/** + * @fn openvrml::texture_node * openvrml::background_node::do_bottom() const + * + * @brief Bottom texture. + * + * @return the bottom texture. + */ + + +/** * @class openvrml::color_node openvrml/node.h * * @brief Abstract base class for color nodes. Modified: trunk/src/libopenvrml/openvrml/node.h =================================================================== --- trunk/src/libopenvrml/openvrml/node.h 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/node.h 2009-04-30 07:20:11 UTC (rev 3898) @@ -359,6 +359,7 @@ class bounding_volume; class script_node; class appearance_node; + class background_node; class bounded_volume_node; class child_node; class color_node; @@ -410,6 +411,8 @@ OPENVRML_NOTHROW; friend appearance_node * node_cast<appearance_node *>(node * n) OPENVRML_NOTHROW; + friend background_node * node_cast<background_node *>(node * n) + OPENVRML_NOTHROW; friend bounded_volume_node * node_cast<bounded_volume_node *>(node * n) OPENVRML_NOTHROW; friend child_node * node_cast<child_node *>(node * n) OPENVRML_NOTHROW; @@ -611,6 +614,7 @@ virtual script_node * to_script() OPENVRML_NOTHROW; virtual appearance_node * to_appearance() OPENVRML_NOTHROW; + virtual background_node * to_background() OPENVRML_NOTHROW; virtual bounded_volume_node * to_bounded_volume() OPENVRML_NOTHROW; virtual child_node * to_child() OPENVRML_NOTHROW; virtual color_node * to_color() OPENVRML_NOTHROW; @@ -727,6 +731,15 @@ } template <> + inline background_node * node_cast<background_node *>(node * n) + OPENVRML_NOTHROW + { + return n + ? n->to_background() + : 0; + } + + template <> inline bounded_volume_node * node_cast<bounded_volume_node *>(node * n) OPENVRML_NOTHROW { @@ -986,6 +999,46 @@ }; + class OPENVRML_API background_node : public virtual child_node { + public: + virtual ~background_node() OPENVRML_NOTHROW = 0; + + const std::vector<float> & ground_angle() const OPENVRML_NOTHROW; + const std::vector<color> & ground_color() const OPENVRML_NOTHROW; + const std::vector<float> & sky_angle() const OPENVRML_NOTHROW; + const std::vector<color> & sky_color() const OPENVRML_NOTHROW; + texture_node * front() const OPENVRML_NOTHROW; + texture_node * back() const OPENVRML_NOTHROW; + texture_node * left() const OPENVRML_NOTHROW; + texture_node * right() const OPENVRML_NOTHROW; + texture_node * top() const OPENVRML_NOTHROW; + texture_node * bottom() const OPENVRML_NOTHROW; + + protected: + background_node(const node_type & type, + const boost::shared_ptr<openvrml::scope> & scope) + OPENVRML_NOTHROW; + + private: + virtual background_node * to_background() OPENVRML_NOTHROW; + + virtual const std::vector<float> & do_ground_angle() const + OPENVRML_NOTHROW = 0; + virtual const std::vector<color> & do_ground_color() const + OPENVRML_NOTHROW = 0; + virtual const std::vector<float> & do_sky_angle() const + OPENVRML_NOTHROW = 0; + virtual const std::vector<color> & do_sky_color() const + OPENVRML_NOTHROW = 0; + virtual texture_node * do_front() const OPENVRML_NOTHROW = 0; + virtual texture_node * do_back() const OPENVRML_NOTHROW = 0; + virtual texture_node * do_left() const OPENVRML_NOTHROW = 0; + virtual texture_node * do_right() const OPENVRML_NOTHROW = 0; + virtual texture_node * do_top() const OPENVRML_NOTHROW = 0; + virtual texture_node * do_bottom() const OPENVRML_NOTHROW = 0; + }; + + class OPENVRML_API color_node : public virtual node { public: virtual ~color_node() OPENVRML_NOTHROW = 0; Modified: trunk/src/libopenvrml/openvrml/viewer.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/viewer.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/viewer.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -230,49 +230,19 @@ * * This function delegates to @c viewer::do_insert_background. * - * @param[in] ground_angle ground angles. - * @param[in] ground_color ground colors. - * @param[in] sky_angle sky angles. - * @param[in] sky_color sky colors. - * @param[in] front front texture. - * @param[in] back back texture. - * @param[in] left left texture. - * @param[in] right right texture. - * @param[in] top top texture. - * @param[in] bottom bottom texture. + * @param[in] n a @c background_node. */ -void -openvrml::viewer::insert_background(const std::vector<float> & ground_angle, - const std::vector<color> & ground_color, - const std::vector<float> & sky_angle, - const std::vector<color> & sky_color, - texture_node & front, - texture_node & back, - texture_node & left, - texture_node & right, - texture_node & top, - texture_node & bottom) +void openvrml::viewer::insert_background(const background_node & n) { - return this->do_insert_background(ground_angle, ground_color, - sky_angle, sky_color, - front, back, left, right, top, bottom); + return this->do_insert_background(n); } /** - * @fn void openvrml::viewer::do_insert_background(const std::vector<float> & ground_angle, const std::vector<color> & ground_color, const std::vector<float> & sky_angle, const std::vector<color> & sky_color, texture_node & front, texture_node & back, texture_node & left, texture_node & right, texture_node & top, texture_node & bottom) + * @fn void openvrml::viewer::do_insert_background(const background_node & n) * * @brief Insert a background into a display list. * - * @param[in] ground_angle ground angles. - * @param[in] ground_color ground colors. - * @param[in] sky_angle sky angles. - * @param[in] sky_color sky colors. - * @param[in] front front texture. - * @param[in] back back texture. - * @param[in] left left texture. - * @param[in] right right texture. - * @param[in] top top texture. - * @param[in] bottom bottom texture. + * @param[in] n a @c background_node. */ /** Modified: trunk/src/libopenvrml/openvrml/viewer.h =================================================================== --- trunk/src/libopenvrml/openvrml/viewer.h 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml/openvrml/viewer.h 2009-04-30 07:20:11 UTC (rev 3898) @@ -30,6 +30,7 @@ class browser; class node; + class background_node; class geometry_node; class texture_node; @@ -70,24 +71,13 @@ void begin_object(const char * id, bool retain = false); void end_object(); - void insert_background(const std::vector<float> & ground_angle, - const std::vector<color> & ground_color, - const std::vector<float> & sky_angle, - const std::vector<color> & sky_color, - texture_node & front, - texture_node & back, - texture_node & left, - texture_node & right, - texture_node & top, - texture_node & bottom); - + void insert_background(const background_node & n); void insert_box(const geometry_node & n, const vec3f & size); void insert_cone(const geometry_node & n, - float height, float radius, bool bottom, - bool side); + float height, float radius, bool bottom, bool side); void insert_cylinder(const geometry_node & n, - float height, float radius, bool bottom, - bool side, bool top); + float height, float radius, + bool bottom, bool side, bool top); void insert_elevation_grid(const geometry_node & n, unsigned int mask, const std::vector<float> & height, @@ -214,18 +204,7 @@ virtual void do_begin_object(const char * id, bool retain = false) = 0; virtual void do_end_object() = 0; - virtual - void - do_insert_background(const std::vector<float> & ground_angle, - const std::vector<color> & ground_color, - const std::vector<float> & sky_angle, - const std::vector<color> & sky_color, - texture_node & front, - texture_node & back, - texture_node & left, - texture_node & right, - texture_node & top, - texture_node & bottom) = 0; + virtual void do_insert_background(const background_node & n) = 0; virtual void do_insert_box(const geometry_node & n, const vec3f & size) = 0; Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -1156,39 +1156,20 @@ /** * @brief Insert a background into a display list. * - * @param[in] groundAngle ground angles. - * @param[in] groundColor ground colors. - * @param[in] skyAngle sky angles. - * @param[in] skyColor sky colors. - * @param[in] front front texture. - * @param[in] back back texture. - * @param[in] left left texture. - * @param[in] right right texture. - * @param[in] top top texture. - * @param[in] bottom bottom texture. + * @param[in] n a @c background_node. */ -void -openvrml::gl::viewer:: -do_insert_background(const std::vector<float> & groundAngle, - const std::vector<color> & groundColor, - const std::vector<float> & skyAngle, - const std::vector<color> & skyColor, - texture_node & front, - texture_node & back, - texture_node & left, - texture_node & right, - texture_node & top, - texture_node & bottom) +void openvrml::gl::viewer::do_insert_background(const background_node & n) { using std::vector; float r = 0.0, g = 0.0, b = 0.0, a = 1.0; // Clear to last sky color - if (!skyColor.empty()) { - r = skyColor.back().r(); - g = skyColor.back().g(); - b = skyColor.back().b(); + if (!n.sky_color().empty()) { + const color & last_sky_color = n.sky_color().back(); + r = last_sky_color.r(); + g = last_sky_color.g(); + b = last_sky_color.b(); } GLuint glid = 0; @@ -1196,14 +1177,15 @@ // Need to separate the geometry from the transformation so the // dlist doesn't have to get rebuilt for every mouse movement... // Don't bother with a dlist if we aren't drawing anything - if (!this->select_mode && (!skyAngle.empty() - || !groundAngle.empty() - || !front.image().array().empty() - || !back.image().array().empty() - || !left.image().array().empty() - || !right.image().array().empty() - || !top.image().array().empty() - || !bottom.image().array().empty())) { + if (!this->select_mode + && (!n.sky_angle().empty() + || !n.ground_angle().empty() + || (n.front() && !n.front()->image().array().empty()) + || (n.back() && !n.back()->image().array().empty()) + || (n.left() && !n.left()->image().array().empty()) + || (n.right() && !n.right()->image().array().empty()) + || (n.top() && !n.top()->image().array().empty()) + || (n.bottom() && !n.bottom()->image().array().empty()))) { glid = glGenLists(1); glNewList(glid, GL_COMPILE_AND_EXECUTE); } @@ -1217,7 +1199,8 @@ glClear(mask); // Draw the background as big spheres centered at the view position - if (!this->select_mode && (!skyAngle.empty() || !groundAngle.empty())) { + if (!this->select_mode + && (!n.sky_angle().empty() || !n.ground_angle().empty())) { glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); @@ -1230,10 +1213,10 @@ static const double cd = 2.0 * pi / nCirc; double heightAngle0, heightAngle1 = 0.0; - vector<color>::const_iterator c0, c1 = skyColor.begin(); + vector<color>::const_iterator c0, c1 = n.sky_color().begin(); - for (vector<float>::const_iterator angle = skyAngle.begin(); - angle != skyAngle.end(); + for (vector<float>::const_iterator angle = n.sky_angle().begin(); + angle != n.sky_angle().end(); ++angle) { heightAngle0 = heightAngle1; heightAngle1 = *angle; @@ -1275,10 +1258,10 @@ // Ground heightAngle1 = pi; - c1 = groundColor.begin(); + c1 = n.ground_color().begin(); - for (vector<float>::const_iterator angle = groundAngle.begin(); - angle != groundAngle.end(); + for (vector<float>::const_iterator angle = n.ground_angle().begin(); + angle != n.ground_angle().end(); ++angle) { heightAngle0 = heightAngle1; heightAngle1 = pi - *angle; @@ -1324,84 +1307,102 @@ glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - front.render_texture(*this); - if (!front.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(-1, -1, -1); - glTexCoord2f(1, 0); - glVertex3f(1, -1, -1); - glTexCoord2f(1, 1); - glVertex3f(1, 1, -1); - glTexCoord2f(0, 1); - glVertex3f(-1, 1, -1); - glEnd(); // GL_QUADS + if (n.front()) { + n.front()->render_texture(*this); + if (!n.front()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(-1, -1, -1); + glTexCoord2f(1, 0); + glVertex3f(1, -1, -1); + glTexCoord2f(1, 1); + glVertex3f(1, 1, -1); + glTexCoord2f(0, 1); + glVertex3f(-1, 1, -1); + glEnd(); // GL_QUADS + } } - back.render_texture(*this); - if (!back.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(1, -1, 1); - glTexCoord2f(1, 0); - glVertex3f(-1, -1, 1); - glTexCoord2f(1, 1); - glVertex3f(-1, 1, 1); - glTexCoord2f(0, 1); - glVertex3f(1, 1, 1); - glEnd(); // GL_QUADS + + if (n.back()) { + n.back()->render_texture(*this); + if (!n.back()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(1, -1, 1); + glTexCoord2f(1, 0); + glVertex3f(-1, -1, 1); + glTexCoord2f(1, 1); + glVertex3f(-1, 1, 1); + glTexCoord2f(0, 1); + glVertex3f(1, 1, 1); + glEnd(); // GL_QUADS + } } - left.render_texture(*this); - if (!left.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(-1, -1, 1); - glTexCoord2f(1, 0); - glVertex3f(-1, -1, -1); - glTexCoord2f(1, 1); - glVertex3f(-1, 1, -1); - glTexCoord2f(0, 1); - glVertex3f(-1, 1, 1); - glEnd(); // GL_QUADS + + if (n.left()) { + n.left()->render_texture(*this); + if (!n.left()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(-1, -1, 1); + glTexCoord2f(1, 0); + glVertex3f(-1, -1, -1); + glTexCoord2f(1, 1); + glVertex3f(-1, 1, -1); + glTexCoord2f(0, 1); + glVertex3f(-1, 1, 1); + glEnd(); // GL_QUADS + } } - right.render_texture(*this); - if (!right.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(1, -1, -1); - glTexCoord2f(1, 0); - glVertex3f(1, -1, 1); - glTexCoord2f(1, 1); - glVertex3f(1, 1, 1); - glTexCoord2f(0, 1); - glVertex3f(1, 1, -1); - glEnd(); // GL_QUADS + + if (n.right()) { + n.right()->render_texture(*this); + if (!n.right()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(1, -1, -1); + glTexCoord2f(1, 0); + glVertex3f(1, -1, 1); + glTexCoord2f(1, 1); + glVertex3f(1, 1, 1); + glTexCoord2f(0, 1); + glVertex3f(1, 1, -1); + glEnd(); // GL_QUADS + } } - top.render_texture(*this); - if (!top.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(-1, 1, -1); - glTexCoord2f(1, 0); - glVertex3f(1, 1, -1); - glTexCoord2f(1, 1); - glVertex3f(1, 1, 1); - glTexCoord2f(0, 1); - glVertex3f(-1, 1, 1); - glEnd(); // GL_QUADS + + if (n.top()) { + n.top()->render_texture(*this); + if (!n.top()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(-1, 1, -1); + glTexCoord2f(1, 0); + glVertex3f(1, 1, -1); + glTexCoord2f(1, 1); + glVertex3f(1, 1, 1); + glTexCoord2f(0, 1); + glVertex3f(-1, 1, 1); + glEnd(); // GL_QUADS + } } - bottom.render_texture(*this); - if (!bottom.image().array().empty()) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex3f(-1, -1, 1); - glTexCoord2f(1, 0); - glVertex3f(1, -1, 1); - glTexCoord2f(1, 1); - glVertex3f(1, -1, -1); - glTexCoord2f(0, 1); - glVertex3f(-1, -1, -1); - glEnd(); // GL_QUADS + + if (n.bottom()) { + n.bottom()->render_texture(*this); + if (!n.bottom()->image().array().empty()) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex3f(-1, -1, 1); + glTexCoord2f(1, 0); + glVertex3f(1, -1, 1); + glTexCoord2f(1, 1); + glVertex3f(1, -1, -1); + glTexCoord2f(0, 1); + glVertex3f(-1, -1, -1); + glEnd(); // GL_QUADS + } } + glDisable(GL_TEXTURE_2D); } Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.h =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-30 07:20:11 UTC (rev 3898) @@ -199,20 +199,8 @@ virtual void do_end_object(); // Insert objects into the display list - virtual - void - do_insert_background(const std::vector<float> & groundAngle, - const std::vector<color> & groundColor, - const std::vector<float> & skyAngle, - const std::vector<color> & skyColor, - texture_node & front, - texture_node & back, - texture_node & left, - texture_node & right, - texture_node & top, - texture_node & bottom); + virtual void do_insert_background(const background_node & n); - virtual void do_insert_box(const geometry_node & n, const vec3f & size); virtual void do_insert_cone(const geometry_node & n, Modified: trunk/src/node/vrml97/background.cpp =================================================================== --- trunk/src/node/vrml97/background.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/node/vrml97/background.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -47,7 +47,8 @@ /** * @brief @c node_metatype identifier. */ -const char * const openvrml_node_vrml97::background_metatype::id = "urn:X-openvrml:node:Background"; +const char * const openvrml_node_vrml97::background_metatype::id = + "urn:X-openvrml:node:Background"; /** * @brief Construct. @@ -58,8 +59,8 @@ background_metatype(openvrml::browser & browser): node_metatype(background_metatype::id, browser), first(0), - null_texture_node_metatype_(browser), - null_texture_node_type_(this->null_texture_node_metatype_) + default_background_node_metatype_(browser), + default_background_node_type_(this->default_background_node_metatype_) {} /** @@ -181,50 +182,6 @@ } } -namespace { - - class OPENVRML_LOCAL null_texture_node : public openvrml::texture_node { - public: - explicit null_texture_node(const openvrml::null_node_type & type) - OPENVRML_NOTHROW; - virtual ~null_texture_node() OPENVRML_NOTHROW; - - private: - virtual void do_field(const std::string & id, - const openvrml::field_value & value) - OPENVRML_NOTHROW; - - virtual - const openvrml::field_value & - do_field(const std::string & id) const - OPENVRML_NOTHROW; - - virtual void do_process_event(const std::string & id, - const openvrml::field_value & value, - double timestamp) - OPENVRML_NOTHROW; - - virtual - const openvrml::field_value & - do_eventout(const std::string & id) const - OPENVRML_NOTHROW; - - virtual - openvrml::event_listener & - do_event_listener(const std::string & id) - OPENVRML_THROW1(openvrml::unsupported_interface); - - virtual - openvrml::event_emitter & - do_event_emitter(const std::string & id) - OPENVRML_THROW1(openvrml::unsupported_interface); - - virtual const openvrml::image & do_image() const OPENVRML_NOTHROW; - virtual bool do_repeat_s() const OPENVRML_NOTHROW; - virtual bool do_repeat_t() const OPENVRML_NOTHROW; - }; -} - /** * @brief @c node_metatype%-specific rendering. * @@ -243,22 +200,11 @@ // // Default background. // - using std::vector; - static const vector<float> ground_angle; - static const vector<color> ground_color; - static const vector<float> sky_angle; - static const vector<color> sky_color; - static null_texture_node front(this->null_texture_node_type_); - static null_texture_node back(this->null_texture_node_type_); - static null_texture_node left(this->null_texture_node_type_); - static null_texture_node right(this->null_texture_node_type_); - static null_texture_node top(this->null_texture_node_type_); - static null_texture_node bottom(this->null_texture_node_type_); - v.insert_background(ground_angle, ground_color, - sky_angle, sky_color, - front, back, - left, right, - top, bottom); + static const boost::shared_ptr<openvrml::scope> null_scope_ptr; + static const background_node + default_background(this->default_background_node_type_, + null_scope_ptr); + v.insert_background(default_background); } else { assert(this->bound_nodes.top()); background_node & background = *this->bound_nodes.top(); @@ -270,16 +216,7 @@ v.remove_object(background); } - v.insert_background(background.ground_angle_.value(), - background.ground_color_.value(), - background.sky_angle_.value(), - background.sky_color_.value(), - *background.front, - *background.back, - *background.left, - *background.right, - *background.top, - *background.bottom); + v.insert_background(background); background.modified(false); } @@ -675,8 +612,9 @@ const boost::shared_ptr<openvrml::scope> & scope): node(type, scope), bounded_volume_node(type, scope), - openvrml::node_impl_util::abstract_node<background_node>(type, scope), child_node(type, scope), + openvrml::node_impl_util::abstract_node<background_node>(type, scope), + openvrml::background_node(type, scope), set_bind_listener_(*this), ground_angle_(*this), ground_color_(*this), @@ -693,6 +631,12 @@ is_bound_emitter_(*this, this->is_bound_), bind_time_emitter_(*this, this->bind_time_) { + // + // The scope may be null if this is the default background. In that case, + // we can leave the texture nodes null. + // + if (!scope) { return; } + using openvrml::mfstring; using openvrml::node_cast; using openvrml::texture_node; @@ -829,82 +773,112 @@ || (this->bottom && this->bottom->modified()); } -namespace { +/** + * @brief Ground angles. + * + * @return a vector of angles corresponding to ground colors. + */ +const std::vector<float> & +openvrml_node_vrml97::background_node::do_ground_angle() const OPENVRML_NOTHROW +{ + return this->ground_angle_.value(); +} - const boost::shared_ptr<openvrml::scope> null_scope_ptr; +/** + * @brief Ground colors. + * + * @return a vector of ground colors. + */ +const std::vector<openvrml::color> & +openvrml_node_vrml97::background_node::do_ground_color() const OPENVRML_NOTHROW +{ + return this->ground_color_.value(); +} - null_texture_node::null_texture_node(const openvrml::null_node_type & type) - OPENVRML_NOTHROW: - openvrml::node(type, null_scope_ptr), - openvrml::texture_node(type, null_scope_ptr) - {} +/** + * @brief Sky angles. + * + * @return a vector of angles corresponding to sky colors. + */ +const std::vector<float> & +openvrml_node_vrml97::background_node::do_sky_angle() const OPENVRML_NOTHROW +{ + return this->sky_angle_.value(); +} - null_texture_node::~null_texture_node() OPENVRML_NOTHROW - {} +/** + * @brief Sky colors. + * + * @return a vector of sky colors. + */ +const std::vector<openvrml::color> & +openvrml_node_vrml97::background_node::do_sky_color() const OPENVRML_NOTHROW +{ + return this->sky_color_.value(); +} - void null_texture_node::do_field(const std::string &, - const openvrml::field_value &) - OPENVRML_NOTHROW - { - assert(false && "do not call this function"); - } +/** + * @brief Front texture. + * + * @return the front texture. + */ +openvrml::texture_node * openvrml_node_vrml97::background_node::do_front() const + OPENVRML_NOTHROW +{ + return this->front.get(); +} - const openvrml::field_value & - null_texture_node::do_field(const std::string &) const OPENVRML_NOTHROW - { - assert(false && "do not call this function"); - static const openvrml::sfbool value; - return value; - } +/** + * @brief Back texture. + * + * @return the back texture. + */ +openvrml::texture_node * openvrml_node_vrml97::background_node::do_back() const + OPENVRML_NOTHROW +{ + return this->back.get(); +} - void null_texture_node::do_process_event(const std::string &, - const openvrml::field_value &, - double) - OPENVRML_NOTHROW - { - assert(false && "do not call this function"); - } +/** + * @brief Left texture. + * + * @return the left texture. + */ +openvrml::texture_node * openvrml_node_vrml97::background_node::do_left() const + OPENVRML_NOTHROW +{ + return this->left.get(); +} - const openvrml::field_value & - null_texture_node::do_eventout(const std::string &) const - OPENVRML_NOTHROW - { - assert(false && "do not call this function"); - static const openvrml::sfbool value; - return value; - } +/** + * @brief Right texture. + * + * @return the right texture. + */ +openvrml::texture_node * openvrml_node_vrml97::background_node::do_right() const + OPENVRML_NOTHROW +{ + return this->right.get(); +} - openvrml::event_listener & - null_texture_node::do_event_listener(const std::string & id) - OPENVRML_THROW1(openvrml::unsupported_interface) - { - assert(false && "do not call this function"); - throw openvrml::unsupported_interface(this->node::type(), id); - return *static_cast<openvrml::event_listener *>(0); - } +/** + * @brief Top texture. + * + * @return the top texture. + */ +openvrml::texture_node * openvrml_node_vrml97::background_node::do_top() const + OPENVRML_NOTHROW +{ + return this->top.get(); +} - openvrml::event_emitter & - null_texture_node::do_event_emitter(const std::string & id) - OPENVRML_THROW1(openvrml::unsupported_interface) - { - assert(false && "do not call this function"); - throw openvrml::unsupported_interface(this->node::type(), id); - return *static_cast<openvrml::event_emitter *>(0); - } - - const openvrml::image & null_texture_node::do_image() const OPENVRML_NOTHROW - { - static const openvrml::image img; - return img; - } - - bool null_texture_node::do_repeat_s() const OPENVRML_NOTHROW - { - return false; - } - - bool null_texture_node::do_repeat_t() const OPENVRML_NOTHROW - { - return false; - } +/** + * @brief Bottom texture. + * + * @return the bottom texture. + */ +openvrml::texture_node * +openvrml_node_vrml97::background_node::do_bottom() const OPENVRML_NOTHROW +{ + return this->bottom.get(); } Modified: trunk/src/node/vrml97/background.h =================================================================== --- trunk/src/node/vrml97/background.h 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/node/vrml97/background.h 2009-04-30 07:20:11 UTC (rev 3898) @@ -32,8 +32,8 @@ class OPENVRML_LOCAL background_metatype : public openvrml::node_metatype { background_node * first; openvrml::node_impl_util::bound_node_stack<background_node> bound_nodes; - openvrml::null_node_metatype null_texture_node_metatype_; - openvrml::null_node_type null_texture_node_type_; + openvrml::null_node_metatype default_background_node_metatype_; + openvrml::null_node_type default_background_node_type_; public: static const char * const id; @@ -64,7 +64,7 @@ class OPENVRML_LOCAL background_node : public openvrml::node_impl_util::abstract_node<background_node>, - public openvrml::child_node { + public openvrml::background_node { friend class background_metatype; @@ -112,5 +112,20 @@ virtual void do_shutdown(double timestamp) OPENVRML_NOTHROW; virtual bool do_modified() const OPENVRML_THROW1(boost::thread_resource_error); + + virtual const std::vector<float> & do_ground_angle() const + OPENVRML_NOTHROW; + virtual const std::vector<openvrml::color> & do_ground_color() const + OPENVRML_NOTHROW; + virtual const std::vector<float> & do_sky_angle() const + OPENVRML_NOTHROW; + virtual const std::vector<openvrml::color> & do_sky_color() const + OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_front() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_back() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_left() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_right() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_top() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_bottom() const OPENVRML_NOTHROW; }; } Modified: trunk/src/node/x3d-environmental-effects/texture_background.cpp =================================================================== --- trunk/src/node/x3d-environmental-effects/texture_background.cpp 2009-04-30 03:31:52 UTC (rev 3897) +++ trunk/src/node/x3d-environmental-effects/texture_background.cpp 2009-04-30 07:20:11 UTC (rev 3898) @@ -34,7 +34,7 @@ class OPENVRML_LOCAL texture_background_node : public abstract_node<texture_background_node>, - public child_node { + public background_node { friend class openvrml_node_x3d_environmental_effects::texture_background_metatype; @@ -73,6 +73,25 @@ const node_type & type, const boost::shared_ptr<openvrml::scope> & scope); virtual ~texture_background_node() OPENVRML_NOTHROW; + + private: + virtual bool do_modified() const + OPENVRML_THROW1(boost::thread_resource_error); + + virtual const std::vector<float> & do_ground_angle() const + OPENVRML_NOTHROW; + virtual const std::vector<openvrml::color> & do_ground_color() const + OPENVRML_NOTHROW; + virtual const std::vector<float> & do_sky_angle() const + OPENVRML_NOTHROW; + virtual const std::vector<openvrml::color> & do_sky_color() const + OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_front() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_back() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_left() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_right() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_top() const OPENVRML_NOTHROW; + virtual openvrml::texture_node * do_bottom() const OPENVRML_NOTHROW; }; @@ -214,8 +233,9 @@ 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), - child_node(type, scope), + background_node(type, scope), set_bind_listener_(*this), ground_angle_(*this), ground_color_(*this), @@ -237,6 +257,133 @@ */ texture_background_node::~texture_background_node() OPENVRML_NOTHROW {} + + bool texture_background_node::do_modified() const + OPENVRML_THROW1(boost::thread_resource_error) + { + return (this->front_texture_.value() + && this->front_texture_.value()->modified()) + || (this->back_texture_.value() + && this->back_texture_.value()->modified()) + || (this->left_texture_.value() + && this->left_texture_.value()->modified()) + || (this->right_texture_.value() + && this->right_texture_.value()->modified()) + || (this->top_texture_.value() + && this->top_texture_.value()->modified()) + || (this->bottom_texture_.value() + && this->bottom_texture_.value()->modified()); + } + + /** + * @brief Ground angles. + * + * @return a vector of angles corresponding to ground colors. + */ + const std::vector<float> & + texture_background_node::do_ground_angle() const OPENVRML_NOTHROW + { + return this->ground_angle_.value(); + } + + /** + * @brief Ground colors. + * + * @return a vector of ground colors. + */ + const std::vector<openvrml::color> & + texture_background_node::do_ground_color() const OPENVRML_NOTHROW + { + return this->ground_color_.value(); + } + + /** + * @brief Sky angles. + * + * @return a vector of angles corresponding to sky colors. + */ + const std::vector<float> & + texture_background_node::do_sky_angle() const OPENVRML_NOTHROW + { + return this->sky_angle_.value(); + } + + /** + * @brief Sky colors. + * + * @return a vector of sky colors. + */ + const std::vector<openvrml::color> & + texture_background_node::do_sky_color() const OPENVRML_NOTHROW + { + return this->sky_color_.value(); + } + + /** + * @brief Front texture. + * + * @return the front texture. + */ + openvrml::texture_node * texture_background_node::do_front() const + OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->front_texture_.value().get()); + } + + /** + * @brief Back texture. + * + * @return the back texture. + */ + openvrml::texture_node * texture_background_node::do_back() const + OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->back_texture_.value().get()); + } + + /** + * @brief Left texture. + * + * @return the left texture. + */ + openvrml::texture_node * texture_background_node::do_left() const + OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->left_texture_.value().get()); + } + + /** + * @brief Right texture. + * + * @return the right texture. + */ + openvrml::texture_node * texture_background_node::do_right() const + OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->right_texture_.value().get()); + } + + /** + * @brief Top texture. + * + * @return the top texture. + */ + openvrml::texture_node * texture_background_node::do_top() const + OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->top_texture_.value().get()); + } + + /** + * @brief Bottom texture. + * + * @return the bottom texture. + */ + openvrml::texture_node * + texture_background_node::do_bottom() const OPENVRML_NOTHROW + { + return dynamic_cast<texture_node *>(this->bottom_texture_.value().get()); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-01 04:54:23
|
Revision: 3899 http://openvrml.svn.sourceforge.net/openvrml/?rev=3899&view=rev Author: braden Date: 2009-05-01 04:54:12 +0000 (Fri, 01 May 2009) Log Message: ----------- Store/retrieve the display list. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-30 07:20:11 UTC (rev 3898) +++ trunk/ChangeLog 2009-05-01 04:54:12 UTC (rev 3899) @@ -1,3 +1,9 @@ +2009-05-01 Braden McDaniel <br...@en...> + + * src/libopenvrml-gl/openvrml/gl/viewer.cpp + (openvrml::gl::viewer::do_insert_background(const + background_node&)): Store/retrieve the display list. + 2009-04-30 Braden McDaniel <br...@en...> Added abstract node type openvrml::background_node. Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-30 07:20:11 UTC (rev 3898) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-05-01 04:54:12 UTC (rev 3899) @@ -1160,16 +1160,10 @@ */ void openvrml::gl::viewer::do_insert_background(const background_node & n) { - using std::vector; - - float r = 0.0, g = 0.0, b = 0.0, a = 1.0; - - // Clear to last sky color - if (!n.sky_color().empty()) { - const color & last_sky_color = n.sky_color().back(); - r = last_sky_color.r(); - g = last_sky_color.g(); - b = last_sky_color.b(); + const list_map_t::const_iterator list = this->list_map_.find(&n); + if (list != this->list_map_.end()) { + glCallList(list->second); + return; } GLuint glid = 0; @@ -1190,7 +1184,18 @@ glNewList(glid, GL_COMPILE_AND_EXECUTE); } + GLclampf r = 0.0, g = 0.0, b = 0.0, a = 1.0; + + // Clear to last sky color + if (!n.sky_color().empty()) { + const color & last_sky_color = n.sky_color().back(); + r = last_sky_color.r(); + g = last_sky_color.g(); + b = last_sky_color.b(); + } + glClearColor(r, g, b, a); + GLuint mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT; # if USE_STENCIL_SHAPE mask |= GL_STENCIL_BUFFER_BIT; @@ -1201,6 +1206,8 @@ // Draw the background as big spheres centered at the view position if (!this->select_mode && (!n.sky_angle().empty() || !n.ground_angle().empty())) { + using std::vector; + glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); @@ -1212,31 +1219,31 @@ static const size_t nCirc = 8; // number of circumferential slices static const double cd = 2.0 * pi / nCirc; - double heightAngle0, heightAngle1 = 0.0; + double height_angle0, height_angle1 = 0.0; vector<color>::const_iterator c0, c1 = n.sky_color().begin(); for (vector<float>::const_iterator angle = n.sky_angle().begin(); angle != n.sky_angle().end(); ++angle) { - heightAngle0 = heightAngle1; - heightAngle1 = *angle; + height_angle0 = height_angle1; + height_angle1 = *angle; c0 = c1; ++c1; - double circAngle0, circAngle1 = 0.0; - double sha0 = sin(heightAngle0), cha0 = cos(heightAngle0); - double sha1 = sin(heightAngle1), cha1 = cos(heightAngle1); + double circ_angle0, circ_angle1 = 0.0; + double sha0 = sin(height_angle0), cha0 = cos(height_angle0); + double sha1 = sin(height_angle1), cha1 = cos(height_angle1); double sca0, cca0; - double sca1 = sin(circAngle1), cca1 = cos(circAngle1); + double sca1 = sin(circ_angle1), cca1 = cos(circ_angle1); glBegin(GL_QUADS); for (size_t nc = 0; nc < nCirc; ++nc) { - circAngle0 = circAngle1; - circAngle1 = (nc + 1) * cd; + circ_angle0 = circ_angle1; + circ_angle1 = (nc + 1) * cd; sca0 = sca1; - sca1 = sin(circAngle1); + sca1 = sin(circ_angle1); cca0 = cca1; - cca1 = cos(circAngle1); + cca1 = cos(circ_angle1); glColor3fv(&(*c1)[0]); glVertex3f(GLfloat(sha1 * cca0), @@ -1257,31 +1264,31 @@ } // Ground - heightAngle1 = pi; + height_angle1 = pi; c1 = n.ground_color().begin(); for (vector<float>::const_iterator angle = n.ground_angle().begin(); angle != n.ground_angle().end(); ++angle) { - heightAngle0 = heightAngle1; - heightAngle1 = pi - *angle; + height_angle0 = height_angle1; + height_angle1 = pi - *angle; c0 = c1; ++c1; - double circAngle0, circAngle1 = 0.0; - double sha0 = sin(heightAngle0), cha0 = cos(heightAngle0); - double sha1 = sin(heightAngle1), cha1 = cos(heightAngle1); + double circ_angle0, circ_angle1 = 0.0; + double sha0 = sin(height_angle0), cha0 = cos(height_angle0); + double sha1 = sin(height_angle1), cha1 = cos(height_angle1); double sca0, cca0; - double sca1 = sin(circAngle1), cca1 = cos(circAngle1); + double sca1 = sin(circ_angle1), cca1 = cos(circ_angle1); glBegin(GL_QUADS); for (size_t nc = 0; nc < nCirc; ++nc) { - circAngle0 = circAngle1; - circAngle1 = (nc + 1) * cd; + circ_angle0 = circ_angle1; + circ_angle1 = (nc + 1) * cd; sca0 = sca1; - sca1 = sin(circAngle1); + sca1 = sin(circ_angle1); cca0 = cca1; - cca1 = cos(circAngle1); + cca1 = cos(circ_angle1); glColor3fv(&(*c1)[0]); glVertex3f(GLfloat(sha1 * cca1), @@ -1415,7 +1422,10 @@ # endif // USE_STENCIL_SHAPE - if (glid) { glEndList(); } + if (glid) { + glEndList(); + this->list_map_.insert(list_map_t::value_type(&n, glid)); + } // Save bg color so we can choose a fg color (doesn't help bg textures...) this->background.r(r); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-01 05:45:46
|
Revision: 3900 http://openvrml.svn.sourceforge.net/openvrml/?rev=3900&view=rev Author: braden Date: 2009-05-01 05:45:39 +0000 (Fri, 01 May 2009) Log Message: ----------- Remove the texture objects from the viewer if the background has been modified. Modified Paths: -------------- trunk/ChangeLog trunk/src/node/vrml97/background.cpp trunk/src/node/vrml97/background.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-01 04:54:12 UTC (rev 3899) +++ trunk/ChangeLog 2009-05-01 05:45:39 UTC (rev 3900) @@ -1,5 +1,18 @@ 2009-05-01 Braden McDaniel <br...@en...> + * src/node/vrml97/background.cpp + (openvrml_node_vrml97::background_metatype::do_render(openvrml::viewer&) + const): Remove the texture objects from the viewer if the + background has been modified. + * src/node/vrml97/background.cpp + (openvrml_node_vrml97::background_node): Changed front, back, + left, right, top, and bottom members to front_, back_, left_, + right_, top_, and bottom_. This avoids shadowing the + openvrml::background_node member functions and is consistent with + existing conventions in OpenVRML. + +2009-05-01 Braden McDaniel <br...@en...> + * src/libopenvrml-gl/openvrml/gl/viewer.cpp (openvrml::gl::viewer::do_insert_background(const background_node&)): Store/retrieve the display list. Modified: trunk/src/node/vrml97/background.cpp =================================================================== --- trunk/src/node/vrml97/background.cpp 2009-05-01 04:54:12 UTC (rev 3899) +++ trunk/src/node/vrml97/background.cpp 2009-05-01 05:45:39 UTC (rev 3900) @@ -214,6 +214,28 @@ if (background.modified()) { v.remove_object(background); + + // + // This could be a bit more surgical; but for now don't bother. + // + if (background.front()) { + v.remove_texture_object(*background.front()); + } + if (background.back()) { + v.remove_texture_object(*background.back()); + } + if (background.left()) { + v.remove_texture_object(*background.left()); + } + if (background.right()) { + v.remove_texture_object(*background.right()); + } + if (background.top()) { + v.remove_texture_object(*background.top()); + } + if (background.bottom()) { + v.remove_texture_object(*background.bottom()); + } } v.insert_background(background); @@ -645,17 +667,17 @@ scope->find_type("ImageTexture"); assert(image_texture_type); - this->front = + this->front_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); - this->back = + this->back_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); - this->left = + this->left_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); - this->right = + this->right_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); - this->top = + this->top_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); - this->bottom = + this->bottom_ = node_cast<texture_node *>(image_texture_type->create_node(scope).get()); // @@ -663,12 +685,12 @@ // know more about image_texture_node's internals. But it's probably okay // if background_node is a little heavy. // - this->front_url_.add(this->front->event_listener<mfstring>("url")); - this->back_url_.add(this->back->event_listener<mfstring>("url")); - this->left_url_.add(this->left->event_listener<mfstring>("url")); - this->right_url_.add(this->right->event_listener<mfstring>("url")); - this->top_url_.add(this->top->event_listener<mfstring>("url")); - this->bottom_url_.add(this->bottom->event_listener<mfstring>("url")); + this->front_url_.add(this->front_->event_listener<mfstring>("url")); + this->back_url_.add(this->back_->event_listener<mfstring>("url")); + this->left_url_.add(this->left_->event_listener<mfstring>("url")); + this->right_url_.add(this->right_->event_listener<mfstring>("url")); + this->top_url_.add(this->top_->event_listener<mfstring>("url")); + this->bottom_url_.add(this->bottom_->event_listener<mfstring>("url")); } /** @@ -720,19 +742,19 @@ openvrml_node_vrml97::background_node::do_initialize(const double timestamp) OPENVRML_NOTHROW { - set_url(*this->front, this->front_url_, timestamp); - set_url(*this->back, this->back_url_, timestamp); - set_url(*this->left, this->left_url_, timestamp); - set_url(*this->right, this->right_url_, timestamp); - set_url(*this->top, this->top_url_, timestamp); - set_url(*this->bottom, this->bottom_url_, timestamp); + set_url(*this->front_, this->front_url_, timestamp); + set_url(*this->back_, this->back_url_, timestamp); + set_url(*this->left_, this->left_url_, timestamp); + set_url(*this->right_, this->right_url_, timestamp); + set_url(*this->top_, this->top_url_, timestamp); + set_url(*this->bottom_, this->bottom_url_, timestamp); - this->front->initialize(*this->scene(), timestamp); - this->back->initialize(*this->scene(), timestamp); - this->left->initialize(*this->scene(), timestamp); - this->right->initialize(*this->scene(), timestamp); - this->top->initialize(*this->scene(), timestamp); - this->bottom->initialize(*this->scene(), timestamp); + this->front_->initialize(*this->scene(), timestamp); + this->back_->initialize(*this->scene(), timestamp); + this->left_->initialize(*this->scene(), timestamp); + this->right_->initialize(*this->scene(), timestamp); + this->top_->initialize(*this->scene(), timestamp); + this->bottom_->initialize(*this->scene(), timestamp); using boost::polymorphic_downcast; background_metatype & nodeClass = @@ -765,12 +787,12 @@ bool openvrml_node_vrml97::background_node::do_modified() const OPENVRML_THROW1(boost::thread_resource_error) { - return (this->front && this->front->modified()) - || (this->back && this->back->modified()) - || (this->left && this->left->modified()) - || (this->right && this->right->modified()) - || (this->top && this->top->modified()) - || (this->bottom && this->bottom->modified()); + return (this->front_ && this->front_->modified()) + || (this->back_ && this->back_->modified()) + || (this->left_ && this->left_->modified()) + || (this->right_ && this->right_->modified()) + || (this->top_ && this->top_->modified()) + || (this->bottom_ && this->bottom_->modified()); } /** @@ -825,7 +847,7 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_front() const OPENVRML_NOTHROW { - return this->front.get(); + return this->front_.get(); } /** @@ -836,7 +858,7 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_back() const OPENVRML_NOTHROW { - return this->back.get(); + return this->back_.get(); } /** @@ -847,7 +869,7 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_left() const OPENVRML_NOTHROW { - return this->left.get(); + return this->left_.get(); } /** @@ -858,7 +880,7 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_right() const OPENVRML_NOTHROW { - return this->right.get(); + return this->right_.get(); } /** @@ -869,7 +891,7 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_top() const OPENVRML_NOTHROW { - return this->top.get(); + return this->top_.get(); } /** @@ -880,5 +902,5 @@ openvrml::texture_node * openvrml_node_vrml97::background_node::do_bottom() const OPENVRML_NOTHROW { - return this->bottom.get(); + return this->bottom_.get(); } Modified: trunk/src/node/vrml97/background.h =================================================================== --- trunk/src/node/vrml97/background.h 2009-05-01 04:54:12 UTC (rev 3899) +++ trunk/src/node/vrml97/background.h 2009-05-01 05:45:39 UTC (rev 3900) @@ -93,12 +93,12 @@ openvrml::sftime bind_time_; sftime_emitter bind_time_emitter_; - boost::intrusive_ptr<openvrml::texture_node> front; - boost::intrusive_ptr<openvrml::texture_node> back; - boost::intrusive_ptr<openvrml::texture_node> left; - boost::intrusive_ptr<openvrml::texture_node> right; - boost::intrusive_ptr<openvrml::texture_node> top; - boost::intrusive_ptr<openvrml::texture_node> bottom; + boost::intrusive_ptr<openvrml::texture_node> front_; + boost::intrusive_ptr<openvrml::texture_node> back_; + boost::intrusive_ptr<openvrml::texture_node> left_; + boost::intrusive_ptr<openvrml::texture_node> right_; + boost::intrusive_ptr<openvrml::texture_node> top_; + boost::intrusive_ptr<openvrml::texture_node> bottom_; public: background_node(const openvrml::node_type & type, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-03 14:50:01
|
Revision: 3901 http://openvrml.svn.sourceforge.net/openvrml/?rev=3901&view=rev Author: braden Date: 2009-05-03 14:49:50 +0000 (Sun, 03 May 2009) Log Message: ----------- Improved lod_node::do_modified only to check the currently applicable child node(s). Modified Paths: -------------- trunk/ChangeLog trunk/src/node/vrml97/lod.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-01 05:45:39 UTC (rev 3900) +++ trunk/ChangeLog 2009-05-03 14:49:50 UTC (rev 3901) @@ -1,3 +1,14 @@ +2009-05-03 Braden McDaniel <br...@en...> + + Improved lod_node::do_modified only to check the currently + applicable child node(s). + + * src/node/vrml97/lod.cpp + (lod_node::do_modified() const): Just check current_children_. + (lod_node::do_render_child(openvrml::viewer &, + openvrml::rendering_context)): Update current_children_ with the + currently appropriate "level". + 2009-05-01 Braden McDaniel <br...@en...> * src/node/vrml97/background.cpp Modified: trunk/src/node/vrml97/lod.cpp =================================================================== --- trunk/src/node/vrml97/lod.cpp 2009-05-01 05:45:39 UTC (rev 3900) +++ trunk/src/node/vrml97/lod.cpp 2009-05-03 14:49:50 UTC (rev 3901) @@ -120,11 +120,8 @@ bool lod_node::do_modified() const OPENVRML_THROW1(boost::thread_resource_error) { - // This should really check which range is being rendered... - for (size_t i = 0; i < this->children_.value().size(); ++i) { - if (this->children_.value()[i]->modified()) { return true; } - } - return false; + return !this->current_children_.value().empty() + && this->current_children_.value()[0]->modified(); } /** @@ -132,53 +129,51 @@ * * Render one of the children. * - * @param viewer a Viewer. + * @param viewer a @c viewer. * @param context a rendering context. */ - void - lod_node:: - do_render_child(openvrml::viewer & viewer, - const openvrml::rendering_context context) + void lod_node::do_render_child(openvrml::viewer & viewer, + const openvrml::rendering_context context) { - this->node::modified(false); - if (this->children_.mfnode::value().empty()) { return; } + using openvrml::mat4f; + using openvrml::vec3f; + using openvrml::make_vec3f; + using openvrml::node; + using boost::intrusive_ptr; + using std::vector; - float x, y, z; + if (this->children_.value().empty()) { return; } - openvrml::mat4f MV = context.matrix(); - MV = MV.inverse(); - x = MV[3][0]; y = MV[3][1]; z = MV[3][2]; - float dx = x - this->center_.value().x(); - float dy = y - this->center_.value().y(); - float dz = z - this->center_.value().z(); - float d2 = dx * dx + dy * dy + dz * dz; + const mat4f modelview = context.matrix().inverse(); + vec3f v = make_vec3f(modelview[3][0], modelview[3][1], modelview[3][2]); + v -= this->center_.value(); + const float d2 = v.dot(v); size_t i; - for (i = 0; i < this->range_.value().size(); ++i) { - if (d2 < this->range_.value()[i] * this->range_.value()[i]) { - break; + if (this->range_.value().empty()) { + i = this->children_.value().size() - 1; + } else { + for (i = 0; i < this->range_.value().size(); ++i) { + if (d2 < this->range_.value()[i] * this->range_.value()[i]) { + break; + } } } - // Should choose an "optimal" level... - if (this->range_.value().empty()) { - i = this->children_.mfnode::value().size() - 1; - } - // Not enough levels... - if (i >= this->children_.mfnode::value().size()) { - i = this->children_.mfnode::value().size() - 1; + if (i >= this->children_.value().size()) { + i = this->children_.value().size() - 1; } + vector<intrusive_ptr<node> > current_child(1); + current_child[0] = this->children_.value()[i]; + this->current_children_.value(current_child); + child_node * const child = - openvrml::node_cast<child_node *>( - this->children_.mfnode::value()[i].get()); + openvrml::node_cast<child_node *>(current_child[0].get()); if (child) { child->render_child(viewer, context); } - // Don't re-render on their accounts - for (i = 0; i < this->children_.mfnode::value().size(); ++i) { - this->children_.mfnode::value()[i]->modified(false); - } + current_child[0]->modified(false); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-04 04:08:22
|
Revision: 3902 http://openvrml.svn.sourceforge.net/openvrml/?rev=3902&view=rev Author: braden Date: 2009-05-04 04:08:11 +0000 (Mon, 04 May 2009) Log Message: ----------- Initialize the viewer in openvrml::gl::viewer::checkSensitive. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-03 14:49:50 UTC (rev 3901) +++ trunk/ChangeLog 2009-05-04 04:08:11 UTC (rev 3902) @@ -1,3 +1,15 @@ +2009-05-04 Braden McDaniel <br...@en...> + + Initialize the viewer in openvrml::gl::viewer::checkSensitive. + + * src/libopenvrml-gl/openvrml/gl/viewer.cpp + (openvrml::gl::viewer::initialize()): Return if the viewer has + already been initialized. + (openvrml::gl::viewer::redraw()): Moved "already-initialized" + check to the initialize function. + (openvrml::gl::viewer::checkSensitive(int, int, event_type)): Call + viewer::initialize. + 2009-05-03 Braden McDaniel <br...@en...> Improved lod_node::do_modified only to check the currently Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp =================================================================== --- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-05-03 14:49:50 UTC (rev 3901) +++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-05-04 04:08:11 UTC (rev 3902) @@ -944,6 +944,8 @@ */ void openvrml::gl::viewer::initialize() { + if (this->gl_initialized) { return; } + assert(!this->tesselator); this->tesselator = gluNewTess(); @@ -3978,7 +3980,7 @@ { assert(this->browser()); - if (!this->gl_initialized) { initialize(); } + this->initialize(); double start = browser::current_time(); @@ -4433,6 +4435,8 @@ { assert(this->browser()); + this->initialize(); + double timeNow = browser::current_time(); GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-04 06:57:27
|
Revision: 3903 http://openvrml.svn.sourceforge.net/openvrml/?rev=3903&view=rev Author: braden Date: 2009-05-04 06:57:19 +0000 (Mon, 04 May 2009) Log Message: ----------- Break out of the loop if the traversal has been halted. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/node.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-04 04:08:11 UTC (rev 3902) +++ trunk/ChangeLog 2009-05-04 06:57:19 UTC (rev 3903) @@ -1,5 +1,12 @@ 2009-05-04 Braden McDaniel <br...@en...> + * src/libopenvrml/openvrml/node.cpp + (openvrml::node_traverser::traverse(const + std::vector<boost::intrusive_ptr<node> > &)): Break out of the + loop if the traversal has been halted. + +2009-05-04 Braden McDaniel <br...@en...> + Initialize the viewer in openvrml::gl::viewer::checkSensitive. * src/libopenvrml-gl/openvrml/gl/viewer.cpp Modified: trunk/src/libopenvrml/openvrml/node.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/node.cpp 2009-05-04 04:08:11 UTC (rev 3902) +++ trunk/src/libopenvrml/openvrml/node.cpp 2009-05-04 06:57:19 UTC (rev 3903) @@ -5815,13 +5815,14 @@ * branch to traverse. */ void -openvrml::node_traverser::traverse( - const std::vector<boost::intrusive_ptr<node> > & nodes) +openvrml::node_traverser:: +traverse(const std::vector<boost::intrusive_ptr<node> > & nodes) { assert(this->traversed_nodes.empty()); try { typedef std::vector<boost::intrusive_ptr<node> > nodes_t; - for (nodes_t::const_iterator node(nodes.begin()); node != nodes.end(); + for (nodes_t::const_iterator node(nodes.begin()); + node != nodes.end() && !this->halt; ++node) { if (*node) { if (this->traversed_nodes.find(node->get()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-06 09:36:19
|
Revision: 3904 http://openvrml.svn.sourceforge.net/openvrml/?rev=3904&view=rev Author: braden Date: 2009-05-06 09:36:16 +0000 (Wed, 06 May 2009) Log Message: ----------- Fixed race condition when realizing the OpenvrmlXembedBrowserPlug. Modified Paths: -------------- trunk/ChangeLog trunk/src/openvrml-xembed/browser.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-04 06:57:19 UTC (rev 3903) +++ trunk/ChangeLog 2009-05-06 09:36:16 UTC (rev 3904) @@ -1,3 +1,18 @@ +2009-05-06 Braden McDaniel <br...@en...> + + Fixed race condition when realizing the OpenvrmlXembedBrowserPlug. + + * src/openvrml-xembed/browser.cpp + (OpenvrmlXembedBrowserPrivate_): Changed browser_plug_set_cond to + browser_plug_realized_cond to reflect that the condition variable + will be signaled after the plug has been realized. + (openvrml_xembed_browser_get_id(OpenvrmlXembedBrowser *)): + Surround call to gtk_plug_get_id with + gdk_threads_enter/gdk_threads_leave. + (openvrml_xembed_browser_ready_dispatch(GSource *, GSourceFunc, + gpointer)): Realize the browser_plug before signaling the + condition variable. + 2009-05-04 Braden McDaniel <br...@en...> * src/libopenvrml/openvrml/node.cpp Modified: trunk/src/openvrml-xembed/browser.cpp =================================================================== --- trunk/src/openvrml-xembed/browser.cpp 2009-05-04 06:57:19 UTC (rev 3903) +++ trunk/src/openvrml-xembed/browser.cpp 2009-05-06 09:36:16 UTC (rev 3904) @@ -120,7 +120,7 @@ browser_listener * listener; OpenvrmlXembedBrowserPlug * browser_plug; GMutex * browser_plug_mutex; - GCond * browser_plug_set_cond; + GCond * browser_plug_realized_cond; bool expect_initial_stream; }; @@ -237,9 +237,9 @@ browser->priv->listener = new browser_listener(*browser); browser->priv->browser_control->add_listener(*browser->priv->listener); - browser->priv->browser_plug = 0; - browser->priv->browser_plug_mutex = g_mutex_new(); - browser->priv->browser_plug_set_cond = g_cond_new(); + browser->priv->browser_plug = 0; + browser->priv->browser_plug_mutex = g_mutex_new(); + browser->priv->browser_plug_realized_cond = g_cond_new(); } catch (std::exception & ex) { // // ex is most likely std::bad_alloc. @@ -253,7 +253,7 @@ void openvrml_xembed_browser_finalize(GObject * const obj) { OpenvrmlXembedBrowser * const browser = OPENVRML_XEMBED_BROWSER(obj); - g_cond_free(browser->priv->browser_plug_set_cond); + g_cond_free(browser->priv->browser_plug_realized_cond); g_mutex_free(browser->priv->browser_plug_mutex); browser->priv->browser_control->remove_listener(*browser->priv->listener); delete browser->priv->listener; @@ -448,11 +448,13 @@ g_assert(browser); g_mutex_lock(browser->priv->browser_plug_mutex); while (!browser->priv->browser_plug) { - g_cond_wait(browser->priv->browser_plug_set_cond, + g_cond_wait(browser->priv->browser_plug_realized_cond, browser->priv->browser_plug_mutex); } g_assert(browser->priv->browser_plug); + gdk_threads_enter(); const guint64 id = gtk_plug_get_id(GTK_PLUG(browser->priv->browser_plug)); + gdk_threads_leave(); g_mutex_unlock(browser->priv->browser_plug_mutex); return id; } @@ -1269,12 +1271,14 @@ g_mutex_lock(browser_ready_source->ready_browser->priv->browser_plug_mutex); browser_ready_source->ready_browser->priv->browser_plug = OPENVRML_XEMBED_BROWSER_PLUG(browser_plug); + + gtk_widget_realize(browser_plug); + g_cond_signal( - browser_ready_source->ready_browser->priv->browser_plug_set_cond); + browser_ready_source->ready_browser->priv->browser_plug_realized_cond); g_mutex_unlock( browser_ready_source->ready_browser->priv->browser_plug_mutex); - gtk_widget_realize(browser_plug); gtk_widget_show_all(browser_plug); g_source_destroy(source); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-08 05:41:34
|
Revision: 3905 http://openvrml.svn.sourceforge.net/openvrml/?rev=3905&view=rev Author: braden Date: 2009-05-08 05:41:33 +0000 (Fri, 08 May 2009) Log Message: ----------- Make sure the plug's window pointer is nonnull. Modified Paths: -------------- trunk/ChangeLog trunk/src/openvrml-xembed/browser.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-06 09:36:16 UTC (rev 3904) +++ trunk/ChangeLog 2009-05-08 05:41:33 UTC (rev 3905) @@ -1,3 +1,9 @@ +2009-05-08 Braden McDaniel <br...@en...> + + * src/openvrml-xembed/browser.cpp + (openvrml_xembed_browser_get_id(OpenvrmlXembedBrowser *)): Make + sure the plug's window pointer is nonnull. + 2009-05-06 Braden McDaniel <br...@en...> Fixed race condition when realizing the OpenvrmlXembedBrowserPlug. Modified: trunk/src/openvrml-xembed/browser.cpp =================================================================== --- trunk/src/openvrml-xembed/browser.cpp 2009-05-06 09:36:16 UTC (rev 3904) +++ trunk/src/openvrml-xembed/browser.cpp 2009-05-08 05:41:33 UTC (rev 3905) @@ -447,11 +447,13 @@ { g_assert(browser); g_mutex_lock(browser->priv->browser_plug_mutex); - while (!browser->priv->browser_plug) { + while (!(browser->priv->browser_plug + && GTK_WIDGET(browser->priv->browser_plug)->window)) { g_cond_wait(browser->priv->browser_plug_realized_cond, browser->priv->browser_plug_mutex); } g_assert(browser->priv->browser_plug); + g_assert(GTK_WIDGET(browser->priv->browser_plug)->window); gdk_threads_enter(); const guint64 id = gtk_plug_get_id(GTK_PLUG(browser->priv->browser_plug)); gdk_threads_leave(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-09 06:10:59
|
Revision: 3906 http://openvrml.svn.sourceforge.net/openvrml/?rev=3906&view=rev Author: braden Date: 2009-05-09 06:10:56 +0000 (Sat, 09 May 2009) Log Message: ----------- Catch (and swallow) any invalid_url exceptions thrown when encountering bad URIs for EXTERNPROTO implementations. Modified Paths: -------------- trunk/ChangeLog trunk/src/libopenvrml/openvrml/local/parse_vrml.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-08 05:41:33 UTC (rev 3905) +++ trunk/ChangeLog 2009-05-09 06:10:56 UTC (rev 3906) @@ -1,3 +1,12 @@ +2009-05-09 Braden McDaniel <br...@en...> + + * src/libopenvrml/openvrml/local/parse_vrml.h + (openvrml::local::vrml97_parse_actions::on_externproto_t::operator()(const + std::string &, const node_interface_set &, const + std::vector<std::string> &) const): Catch (and swallow) any + invalid_url exceptions thrown when encountering bad URIs for + EXTERNPROTO implementations. + 2009-05-08 Braden McDaniel <br...@en...> * src/openvrml-xembed/browser.cpp Modified: trunk/src/libopenvrml/openvrml/local/parse_vrml.h =================================================================== --- trunk/src/libopenvrml/openvrml/local/parse_vrml.h 2009-05-08 05:41:33 UTC (rev 3905) +++ trunk/src/libopenvrml/openvrml/local/parse_vrml.h 2009-05-09 06:10:56 UTC (rev 3906) @@ -181,15 +181,15 @@ const uri base_uri = anonymous_stream_id(uri(this->actions_.uri_)) ? this->actions_.scene_.browser().world_url().empty() - ? create_file_url(uri()) - : uri(this->actions_.scene_.browser().world_url()) + ? create_file_url(uri()) + : uri(this->actions_.scene_.browser().world_url()) : uri(this->actions_.uri_); shared_ptr<node_type> node_type; for (vector<string>::const_iterator resource_id = uri_list.begin(); resource_id != uri_list.end(); - ++resource_id) { + ++resource_id) try { const uri absolute_uri = relative(uri(*resource_id)) ? resolve_against(uri(*resource_id), base_uri) : uri(*resource_id); @@ -202,6 +202,8 @@ interfaces); break; } + } catch (invalid_url &) { + // If a URI is bogus, ignore it and move on. } if (!node_type) { @@ -223,7 +225,7 @@ for (vector<string>::const_iterator resource_id = uri_list.begin(); resource_id != uri_list.end(); - ++resource_id) { + ++resource_id) try { const uri absolute_uri = relative(uri(*resource_id)) ? resolve_against(uri(*resource_id), base_uri) : uri(*resource_id); @@ -231,6 +233,9 @@ .add_node_metatype( node_metatype_id(absolute_uri), externproto_class); + } catch (invalid_url &) { + // We don't want to register node_types under bogus + // URIs; ignore the bad ones and move on. } node_type = externproto_class->create_type(node_type_id, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-13 04:16:45
|
Revision: 3907 http://openvrml.svn.sourceforge.net/openvrml/?rev=3907&view=rev Author: braden Date: 2009-05-13 04:16:43 +0000 (Wed, 13 May 2009) Log Message: ----------- Make sure the stream is valid before reading it. Modified Paths: -------------- trunk/ChangeLog trunk/src/node/vrml97/image_texture.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-09 06:10:56 UTC (rev 3906) +++ trunk/ChangeLog 2009-05-13 04:16:43 UTC (rev 3907) @@ -1,3 +1,9 @@ +2009-05-13 Braden McDaniel <br...@en...> + + * src/node/vrml97/image_texture.cpp + (image_texture_node::update_texture()): Make sure the stream is + valid before reading it. + 2009-05-09 Braden McDaniel <br...@en...> * src/libopenvrml/openvrml/local/parse_vrml.h Modified: trunk/src/node/vrml97/image_texture.cpp =================================================================== --- trunk/src/node/vrml97/image_texture.cpp 2009-05-09 06:10:56 UTC (rev 3906) +++ trunk/src/node/vrml97/image_texture.cpp 2009-05-13 04:16:43 UTC (rev 3907) @@ -245,14 +245,16 @@ try { if (!this->url_.value().empty()) { using std::auto_ptr; - auto_ptr<openvrml::resource_istream> in( - this->scene()->get_resource(this->url_.value())); - auto_ptr<openvrml::stream_listener> listener( - new image_stream_listener(in->url(), - this->image_, - *this, - this->image_mutex_)); - this->scene()->read_stream(in, listener); + auto_ptr<openvrml::resource_istream> in = + this->scene()->get_resource(this->url_.value()); + if (*in) { + auto_ptr<openvrml::stream_listener> listener( + new image_stream_listener(in->url(), + this->image_, + *this, + this->image_mutex_)); + this->scene()->read_stream(in, listener); + } } } catch (std::exception & ex) { this->scene()->browser().err(ex.what()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-13 04:22:30
|
Revision: 3908 http://openvrml.svn.sourceforge.net/openvrml/?rev=3908&view=rev Author: braden Date: 2009-05-13 04:22:22 +0000 (Wed, 13 May 2009) Log Message: ----------- Make sure NewStream gets called before calling DestroyStream in cases where no data was written to the stream. Modified Paths: -------------- trunk/ChangeLog trunk/src/openvrml-player/curlbrowserhost.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-13 04:16:43 UTC (rev 3907) +++ trunk/ChangeLog 2009-05-13 04:22:22 UTC (rev 3908) @@ -1,5 +1,12 @@ 2009-05-13 Braden McDaniel <br...@en...> + * src/openvrml-player/curlbrowserhost.cpp + (openvrml_player_curl_browser_host_curl_source_callback(gpointer)): + Make sure NewStream gets called before calling DestroyStream in + cases where no data was written to the stream. + +2009-05-13 Braden McDaniel <br...@en...> + * src/node/vrml97/image_texture.cpp (image_texture_node::update_texture()): Make sure the stream is valid before reading it. Modified: trunk/src/openvrml-player/curlbrowserhost.cpp =================================================================== --- trunk/src/openvrml-player/curlbrowserhost.cpp 2009-05-13 04:16:43 UTC (rev 3907) +++ trunk/src/openvrml-player/curlbrowserhost.cpp 2009-05-13 04:22:22 UTC (rev 3908) @@ -716,18 +716,34 @@ msg->easy_handle)); g_assert(stream_data); // - // If the stream data was never initialized, then new-stream was - // never sent for it. In that case, we shouldn't send - // destroy-stream. + // If the stream data was never initialized, we need to call + // NewStream before calling DestroyStream below. // - if (stream_data->initialized()) { + if (!stream_data->initialized()) { + const char * type = 0; + CURLcode result = curl_easy_getinfo(msg->easy_handle, + CURLINFO_CONTENT_TYPE, + &type); + if (!type) { type = "application/octet-stream"; } + const char * url = 0; + result = curl_easy_getinfo(msg->easy_handle, + CURLINFO_EFFECTIVE_URL, + &url); dbus_g_proxy_call_no_reply( browser_host->priv->browser, - "DestroyStream", - G_TYPE_UINT64, guint64(msg->easy_handle), + "NewStream", + G_TYPE_UINT64, reinterpret_cast<guint64>(msg->easy_handle), + G_TYPE_STRING, type, + G_TYPE_STRING, url, G_TYPE_INVALID); } + dbus_g_proxy_call_no_reply( + browser_host->priv->browser, + "DestroyStream", + G_TYPE_UINT64, reinterpret_cast<guint64>(msg->easy_handle), + G_TYPE_INVALID); + g_hash_table_remove(browser_host->priv->stream_data, msg->easy_handle); g_assert(curl_source->outstanding_handles > 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-25 20:07:04
|
Revision: 3909 http://openvrml.svn.sourceforge.net/openvrml/?rev=3909&view=rev Author: braden Date: 2009-05-25 20:06:55 +0000 (Mon, 25 May 2009) Log Message: ----------- The Microsoft compiler doesn't like "using openvrml::node" here for some reason. Modified Paths: -------------- trunk/ChangeLog trunk/src/node/vrml97/lod.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-13 04:22:22 UTC (rev 3908) +++ trunk/ChangeLog 2009-05-25 20:06:55 UTC (rev 3909) @@ -1,3 +1,10 @@ +2009-05-25 Braden McDaniel <br...@en...> + + * src/node/vrml97/lod.cpp + (lod_node::do_render_child(openvrml::viewer &, const + openvrml::rendering_context)): The Microsoft compiler doesn't like + "using openvrml::node" here for some reason. + 2009-05-13 Braden McDaniel <br...@en...> * src/openvrml-player/curlbrowserhost.cpp Modified: trunk/src/node/vrml97/lod.cpp =================================================================== --- trunk/src/node/vrml97/lod.cpp 2009-05-13 04:22:22 UTC (rev 3908) +++ trunk/src/node/vrml97/lod.cpp 2009-05-25 20:06:55 UTC (rev 3909) @@ -138,7 +138,6 @@ using openvrml::mat4f; using openvrml::vec3f; using openvrml::make_vec3f; - using openvrml::node; using boost::intrusive_ptr; using std::vector; @@ -165,7 +164,7 @@ i = this->children_.value().size() - 1; } - vector<intrusive_ptr<node> > current_child(1); + vector<intrusive_ptr<openvrml::node> > current_child(1); current_child[0] = this->children_.value()[i]; this->current_children_.value(current_child); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2009-05-28 02:26:56
|
Revision: 3910 http://openvrml.svn.sourceforge.net/openvrml/?rev=3910&view=rev Author: braden Date: 2009-05-28 02:26:51 +0000 (Thu, 28 May 2009) Log Message: ----------- On Windows, use the registry to get the default data directory, script module path, and node module path. Modified Paths: -------------- trunk/ChangeLog trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml.vcproj trunk/src/libopenvrml/openvrml/local/component.cpp trunk/src/libopenvrml/openvrml/local/node_metatype_registry_impl.cpp trunk/src/libopenvrml/openvrml/script.cpp Added Paths: ----------- trunk/src/libopenvrml/openvrml/local/conf.cpp trunk/src/libopenvrml/openvrml/local/conf.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-25 20:06:55 UTC (rev 3909) +++ trunk/ChangeLog 2009-05-28 02:26:51 UTC (rev 3910) @@ -1,3 +1,24 @@ +2009-05-27 Braden McDaniel <br...@en...> + + On Windows, use the registry to get the default data directory, + script module path, and node module path. + + * ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml.vcproj: + Added conf.{cpp,h}. + * src/libopenvrml/openvrml/local/component.cpp + (openvrml::local::component_registry::component_registry()): + Delegate to openvrml::local::conf::datadir to get the data + directory. + * src/libopenvrml/openvrml/local/conf.cpp: Added file. + * src/libopenvrml/openvrml/local/conf.h: Added file. + * src/libopenvrml/openvrml/local/node_metatype_registry_impl.cpp + (openvrml::local::node_metatype_registry_impl::node_metatype_registry_impl(openvrml::browser&)): + Delegate to openvrml::local::conf::node_path to get the node + module path. + * src/libopenvrml/openvrml/script.cpp + (openvrml::script_factory_registry::impl::impl()): Delegate to + openvrml::local::conf::script_path to get the script module path. + 2009-05-25 Braden McDaniel <br...@en...> * src/node/vrml97/lod.cpp Modified: trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml.vcproj =================================================================== --- trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml.vcproj 2009-05-25 20:06:55 UTC (rev 3909) +++ trunk/ide-projects/Windows/VisualC9_0/OpenVRML/openvrml/openvrml.vcproj 2009-05-28 02:26:51 UTC (rev 3910) @@ -228,6 +228,10 @@ > </File> <File + RelativePath="..\..\..\..\..\src\libopenvrml\openvrml\local\conf.cpp" + > + </File> + <File RelativePath="..\..\..\..\..\src\libopenvrml\openvrml\local\dl.cpp" > </File> @@ -337,6 +341,10 @@ > </File> <File + RelativePath="..\..\..\..\..\src\libopenvrml\openvrml\local\conf.h" + > + </File> + <File RelativePath="..\..\..\..\..\src\libopenvrml\openvrml\local\dl.h" > </File> Modified: trunk/src/libopenvrml/openvrml/local/component.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/component.cpp 2009-05-25 20:06:55 UTC (rev 3909) +++ trunk/src/libopenvrml/openvrml/local/component.cpp 2009-05-28 02:26:51 UTC (rev 3910) @@ -20,6 +20,7 @@ # include "component.h" # include "xml_reader.h" +# include "conf.h" # include <private.h> # include <openvrml/browser.h> # include <openvrml/scope.h> @@ -307,14 +308,14 @@ this->levels_[i].begin(); node != this->levels_[i].end(); ++node) try { - this->add_scope_entry(b, - node->first.c_str(), - node->second.interfaces, - node->second.metatype_id.c_str(), - scope); - } catch (openvrml::unsupported_interface & ex) { - b.err(node->second.metatype_id + ": " + ex.what()); - } + this->add_scope_entry(b, + node->first.c_str(), + node->second.interfaces, + node->second.metatype_id.c_str(), + scope); + } catch (openvrml::unsupported_interface & ex) { + b.err(node->second.metatype_id + ": " + ex.what()); + } } } @@ -350,25 +351,21 @@ std::string key; bool succeeded; - path data_path; - const char * datadir_env = getenv("OPENVRML_DATADIR"); - data_path = datadir_env - ? datadir_env - : OPENVRML_PKGDATADIR_; + path data_path = conf::datadir(); const path component_path = data_path / "component"; for (directory_iterator entry(component_path); entry != directory_iterator(); ++entry) { if (!is_directory(entry->path())) try { - auto_ptr<component> - c(new component(entry->path().file_string())); - std::string key = c->id(); - succeeded = this->insert(key, c.release()).second; - assert(succeeded); - } catch (const std::runtime_error & ex) { - std::cerr << ex.what() << std::endl; - } + auto_ptr<component> + c(new component(entry->path().file_string())); + std::string key = c->id(); + succeeded = this->insert(key, c.release()).second; + assert(succeeded); + } catch (const std::runtime_error & ex) { + std::cerr << ex.what() << std::endl; + } } } @@ -403,15 +400,13 @@ std::auto_ptr<scope> root_scope(new scope(uri)); for (map_t::const_iterator entry = this->components_.begin(); entry != this->components_.end(); - ++entry) { - try { - const component & c = local::component_registry_.at(entry->first); - c.add_to_scope(browser, *root_scope, entry->second); - } catch (boost::bad_ptr_container_operation & ex) { - OPENVRML_PRINT_EXCEPTION_(ex); - } catch (std::invalid_argument & ex) { - OPENVRML_PRINT_EXCEPTION_(ex); - } + ++entry) try { + const component & c = local::component_registry_.at(entry->first); + c.add_to_scope(browser, *root_scope, entry->second); + } catch (boost::bad_ptr_container_operation & ex) { + OPENVRML_PRINT_EXCEPTION_(ex); + } catch (std::invalid_argument & ex) { + OPENVRML_PRINT_EXCEPTION_(ex); } return root_scope; } @@ -425,15 +420,13 @@ std::auto_ptr<node_type_decls> node_type_descs(new node_type_decls); for (map_t::const_iterator entry = this->components_.begin(); entry != this->components_.end(); - ++entry) { - try { - const component & c = local::component_registry_.at(entry->first); - c.add_to_node_type_desc_map(*node_type_descs, entry->second); - } catch (boost::bad_ptr_container_operation & ex) { - OPENVRML_PRINT_EXCEPTION_(ex); - } catch (std::invalid_argument & ex) { - OPENVRML_PRINT_EXCEPTION_(ex); - } + ++entry) try { + const component & c = local::component_registry_.at(entry->first); + c.add_to_node_type_desc_map(*node_type_descs, entry->second); + } catch (boost::bad_ptr_container_operation & ex) { + OPENVRML_PRINT_EXCEPTION_(ex); + } catch (std::invalid_argument & ex) { + OPENVRML_PRINT_EXCEPTION_(ex); } return node_type_descs; } Added: trunk/src/libopenvrml/openvrml/local/conf.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/conf.cpp (rev 0) +++ trunk/src/libopenvrml/openvrml/local/conf.cpp 2009-05-28 02:26:51 UTC (rev 3910) @@ -0,0 +1,203 @@ +// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*- +// +// OpenVRML +// +// Copyright 2009 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 "conf.h" +# include <boost/multi_index/detail/scope_guard.hpp> +# include <boost/ref.hpp> +# ifdef _WIN32 +# include <windows.h> +# include <vector> +# else +# include <cstdlib> +# endif +# include <exception> + +using namespace boost::multi_index::detail; // for scope_guard + +namespace { + + class OPENVRML_LOCAL no_environment_var : public std::runtime_error { + public: + explicit no_environment_var(const std::string & var); + }; + + no_environment_var::no_environment_var(const std::string & var): + std::runtime_error("no environment variable \"" + var + "\"") + {} + + OPENVRML_LOCAL const std::string get_env(const std::string & var) + OPENVRML_THROW1(no_environment_var) + { +# ifdef _WIN32 + DWORD size; + std::vector<char> buf(128); + while ((size = GetEnvironmentVariable(var.c_str(), + &buf.front(), + buf.size())) + && size > buf.size()) { + buf.resize(size); + } + if (size == 0) { throw no_environment_var(var); } + return &buf.front(); +# else + const char * val = std::getenv(var.c_str()); + if (!val) { throw no_environment_var(var); } + return val; +# endif + } + +# ifdef _WIN32 + void throw_runtime_error(LONG result) OPENVRML_THROW1(std::runtime_error) + { + using boost::ref; + + static const LPCVOID source; + LPTSTR buf = 0; + scope_guard buf_guard = make_guard(LocalFree, ref(buf)); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + source, + result, + LANG_USER_DEFAULT, + reinterpret_cast< LPTSTR >(&buf), + 0, + 0); + + throw std::runtime_error(buf); + } + + const std::string query_registry_value(HKEY key, const std::string & name) + OPENVRML_THROW2(std::runtime_error, std::bad_alloc) + { + LONG result; + static DWORD * const reserved; + DWORD type; + std::vector<BYTE> data(64); + DWORD size = data.size(); + while ((result = RegQueryValueEx(key, + name.c_str(), + reserved, + &type, + &data.front(), + &size)) + == ERROR_MORE_DATA) { + data.resize(data.size() * 2); + } + + if (result != 0) { throw_runtime_error(result); } + + _ASSERTE(type == REG_SZ); + + return std::string(&data.front(), &data.front() + size - 1); + } + + const std::string get_registry_setting(const std::string & name) + OPENVRML_THROW2(std::runtime_error, std::bad_alloc) + { + static const ULONG options = 0; + HKEY key; + LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenVRML\\OpenVRML", + options, + KEY_READ, + &key); + if (result != ERROR_SUCCESS) { + throw_runtime_error(result); + } + + return query_registry_value(key, name); + } +# endif +} + +const std::string openvrml::local::conf::datadir() + OPENVRML_THROW2(std::runtime_error, std::bad_alloc) +{ + std::string result; + try { + result = get_env("OPENVRML_DATADIR"); + } catch (const no_environment_var &) { +# ifdef _WIN32 + result = get_registry_setting("Datadir"); +# else + result = OPENVRML_PKGDATADIR_; +# endif + } + return result; +} + +namespace { + const char path_separator = +# ifdef _WIN32 + ';'; +# else + ':'; +# endif + + OPENVRML_LOCAL void append_to_path(std::string & path, + const std::string & appended_part) + OPENVRML_THROW1(std::bad_alloc) + { + if (!path.empty() && !appended_part.empty()) { + path += path_separator; + } + path += appended_part; + } +} + +const std::string openvrml::local::conf::node_path() + OPENVRML_THROW2(std::runtime_error, std::bad_alloc) +{ + std::string env_path; + try { + env_path = get_env("OPENVRML_NODE_PATH"); + } catch (const no_environment_var &) {} + + std::string system_path; +# ifdef _WIN32 + system_path = get_registry_setting("NodePath"); +# else + system_path = OPENVRML_PKGLIBDIR_ "/node"; +# endif + + std::string result = env_path; + append_to_path(result, system_path); + return result; +} + +const std::string openvrml::local::conf::script_path() + OPENVRML_THROW2(std::runtime_error, std::bad_alloc) +{ + std::string env_path; + try { + env_path = get_env("OPENVRML_SCRIPT_PATH"); + } catch (const no_environment_var &) {} + + std::string system_path; +# ifdef _WIN32 + system_path = get_registry_setting("ScriptPath"); +# else + system_path = OPENVRML_PKGLIBDIR_ "/script"; +# endif + + std::string result = env_path; + append_to_path(result, system_path); + return result; +} Property changes on: trunk/src/libopenvrml/openvrml/local/conf.cpp ___________________________________________________________________ Added: svn:executable + * Added: trunk/src/libopenvrml/openvrml/local/conf.h =================================================================== --- trunk/src/libopenvrml/openvrml/local/conf.h (rev 0) +++ trunk/src/libopenvrml/openvrml/local/conf.h 2009-05-28 02:26:51 UTC (rev 3910) @@ -0,0 +1,40 @@ +// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*- +// +// OpenVRML +// +// Copyright 2009 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_LOCAL_CONF_H +# define OPENVRML_LOCAL_CONF_H + +# include <openvrml-common.h> +# include <string> + +namespace openvrml { + + namespace local { + + namespace conf { + + OPENVRML_LOCAL const std::string datadir(); + OPENVRML_LOCAL const std::string node_path(); + OPENVRML_LOCAL const std::string script_path(); + } + } +} + +# endif // ifndef OPENVRML_LOCAL_CONF_H Property changes on: trunk/src/libopenvrml/openvrml/local/conf.h ___________________________________________________________________ Added: svn:executable + * Modified: trunk/src/libopenvrml/openvrml/local/node_metatype_registry_impl.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/local/node_metatype_registry_impl.cpp 2009-05-25 20:06:55 UTC (rev 3909) +++ trunk/src/libopenvrml/openvrml/local/node_metatype_registry_impl.cpp 2009-05-28 02:26:51 UTC (rev 3910) @@ -19,6 +19,7 @@ // # include "node_metatype_registry_impl.h" +# include "conf.h" # include <openvrml/browser.h> # include <boost/multi_index/detail/scope_guard.hpp> # include <iostream> @@ -57,15 +58,6 @@ return 0; } -namespace { - -# ifdef _WIN32 - const char pathsep_char = ';'; -# else - const char pathsep_char = ':'; -# endif -} - /** * @internal * @@ -83,14 +75,9 @@ throw std::runtime_error("dlinit_failure"); } - std::ostringstream node_path; - node_path << OPENVRML_PKGLIBDIR_ "/node"; - const char * const node_path_env = getenv("OPENVRML_NODE_PATH"); - if (node_path_env) { - node_path << pathsep_char << node_path_env; - } + const std::string node_path = conf::node_path(); - result = dl::foreachfile(node_path.str().c_str(), + result = dl::foreachfile(node_path.c_str(), openvrml_open_node_module, this); assert(result == 0); // We always return 0 from the callback. Modified: trunk/src/libopenvrml/openvrml/script.cpp =================================================================== --- trunk/src/libopenvrml/openvrml/script.cpp 2009-05-25 20:06:55 UTC (rev 3909) +++ trunk/src/libopenvrml/openvrml/script.cpp 2009-05-28 02:26:51 UTC (rev 3910) @@ -22,6 +22,7 @@ # include "script.h" # include "browser.h" # include "scene.h" +# include <openvrml/local/conf.h> # include <openvrml/local/dl.h> # include <openvrml/local/uri.h> # include <openvrml/local/field_value_types.h> @@ -360,15 +361,6 @@ * instantiate @c script_factory_registry. */ -namespace { - -# ifdef _WIN32 - const char pathsep_char = ';'; -# else - const char pathsep_char = ':'; -# endif -} - extern "C" int openvrml_get_script_factory(const char * filename, void * data); /** @@ -450,14 +442,9 @@ throw std::runtime_error("dlinit failure"); } - std::ostringstream script_path; - script_path << OPENVRML_PKGLIBDIR_ "/script"; - const char * const script_path_env = getenv("OPENVRML_SCRIPT_PATH"); - if (script_path_env) { - script_path << pathsep_char << script_path_env; - } + const std::string script_path = local::conf::script_path(); - result = dl::foreachfile(script_path.str().c_str(), + result = dl::foreachfile(script_path.c_str(), openvrml_get_script_factory, this); assert(result == 0); // We always return 0 from the callback. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |