|
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.
|