From: Braden M. <br...@us...> - 2006-10-31 03:43:09
|
Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17911/src/libopenvrml/openvrml Modified Files: viewer.cpp viewer.h Log Message: Applied nonvirtual interface pattern to openvrml::viewer. Index: viewer.h =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/viewer.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** viewer.h 12 Feb 2006 09:40:17 -0000 1.12 --- viewer.h 31 Oct 2006 03:43:06 -0000 1.13 *************** *** 67,195 **** openvrml::browser * browser() const OPENVRML_NOTHROW; ! virtual rendering_mode mode() = 0; ! virtual double frame_rate() = 0; ! virtual void reset_user_navigation() = 0; ! virtual object_t begin_object(const char * id, ! bool retain = false) = 0; ! virtual void end_object() = 0; ! virtual object_t ! 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 image & front, ! const image & back, ! const image & left, ! const image & right, ! const image & top, ! const image & bottom) = 0; ! virtual object_t insert_box(const vec3f & size) = 0; ! virtual object_t insert_cone(float height, float radius, bool bottom, ! bool side) = 0; ! virtual object_t ! insert_cylinder(float height, float radius, bool bottom, bool side, ! bool top) = 0; ! virtual object_t ! insert_elevation_grid(unsigned int mask, ! const std::vector<float> & height, ! int32 x_dimension, int32 z_dimension, ! float x_spacing, float z_spacing, const std::vector<color> & color, const std::vector<vec3f> & normal, ! const std::vector<vec2f> & tex_coord) = 0; ! virtual object_t ! insert_extrusion(unsigned int mask, ! const std::vector<vec3f> & spine, ! const std::vector<vec2f> & cross_section, ! const std::vector<rotation> & orientation, ! const std::vector<vec2f> & scale) = 0; ! virtual object_t ! insert_line_set(const std::vector<vec3f> & coord, ! const std::vector<int32> & coord_index, ! bool color_per_vertex, ! const std::vector<color> & color, ! const std::vector<int32> & color_index) = 0; ! virtual object_t ! insert_point_set(const std::vector<vec3f> & coord, ! const std::vector<color> & color) = 0; ! virtual object_t ! insert_shell(unsigned int mask, ! const std::vector<vec3f> & coord, ! const std::vector<int32> & coord_index, ! const std::vector<color> & color, ! const std::vector<int32> & color_index, ! const std::vector<vec3f> & normal, ! const std::vector<int32> & normal_index, ! const std::vector<vec2f> & tex_coord, ! const std::vector<int32> & tex_coord_index) = 0; ! virtual object_t insert_sphere(float radius) = 0; ! virtual object_t insert_dir_light(float ambient_intensity, ! float intensity, ! const color & color, ! const vec3f & direction) = 0; ! virtual object_t insert_point_light(float ambient_intensity, ! const vec3f & attenuation, ! const color & color, ! float intensity, ! const vec3f & location, ! float radius) = 0; ! virtual object_t insert_spot_light(float ambient_intensity, ! const vec3f & attenuation, ! float beam_width, ! const color & color, ! float cut_off_angle, ! const vec3f & direction, ! float intensity, ! const vec3f & location, ! float radius) = 0; ! virtual object_t insert_reference(object_t existing_object) = 0; ! virtual void remove_object(object_t ref) = 0; ! virtual void enable_lighting(bool val) = 0; ! virtual void set_fog(const color & color, float visibility_range, ! const char * type) = 0; ! virtual void set_color(const color & rgb, float a = 1.0) = 0; ! virtual void set_material(float ambient_intensity, ! const color & diffuse_color, ! const color & emissive_color, ! float shininess, ! const color & specular_color, ! float transparency) = 0; ! virtual void set_material_mode(size_t tex_components, ! bool geometry_color) = 0; ! virtual void set_sensitive(node * object) = 0; ! virtual texture_object_t insert_texture(const image & img, ! bool repeat_s, ! bool repeat_t, ! bool retainHint = false) = 0; ! virtual void insert_texture_reference(texture_object_t ref, ! size_t components) = 0; ! virtual void remove_texture_object(texture_object_t ref) = 0; ! virtual void set_texture_transform(const vec2f & center, ! float rotation, ! const vec2f & scale, ! const vec2f & translation) = 0; ! virtual void set_viewpoint(const vec3f & position, ! const rotation & orientation, ! float field_of_view, ! float avatar_size, ! float visibility_limit) = 0; ! virtual void transform(const mat4f & mat) = 0; ! virtual void transform_points(size_t nPoints, vec3f * point) const = 0; // still working on some navigation api issues, so don't depend on --- 67,187 ---- openvrml::browser * browser() const OPENVRML_NOTHROW; ! rendering_mode mode(); ! double frame_rate(); ! void reset_user_navigation(); ! object_t begin_object(const char * id, bool retain = false); ! void end_object(); ! object_t 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 image & front, ! const image & back, ! const image & left, ! const image & right, ! const image & top, ! const image & bottom); ! object_t insert_box(const vec3f & size); ! object_t insert_cone(float height, float radius, bool bottom, ! bool side); ! object_t insert_cylinder(float height, float radius, bool bottom, ! bool side, bool top); ! object_t insert_elevation_grid(unsigned int mask, ! const std::vector<float> & height, ! int32 x_dimension, int32 z_dimension, ! float x_spacing, float z_spacing, ! const std::vector<color> & color, ! const std::vector<vec3f> & normal, ! const std::vector<vec2f> & tex_coord); ! object_t insert_extrusion(unsigned int mask, ! const std::vector<vec3f> & spine, ! const std::vector<vec2f> & cross_section, ! const std::vector<rotation> & orientation, ! const std::vector<vec2f> & scale); ! object_t insert_line_set(const std::vector<vec3f> & coord, ! const std::vector<int32> & coord_index, ! bool color_per_vertex, ! const std::vector<color> & color, ! const std::vector<int32> & color_index); ! object_t insert_point_set(const std::vector<vec3f> & coord, ! const std::vector<color> & color); ! object_t insert_shell(unsigned int mask, ! const std::vector<vec3f> & coord, ! const std::vector<int32> & coord_index, const std::vector<color> & color, + const std::vector<int32> & color_index, const std::vector<vec3f> & normal, ! const std::vector<int32> & normal_index, ! const std::vector<vec2f> & tex_coord, ! const std::vector<int32> & tex_coord_index); ! object_t insert_sphere(float radius); ! object_t insert_dir_light(float ambient_intensity, ! float intensity, ! const color & color, ! const vec3f & direction); ! object_t insert_point_light(float ambient_intensity, ! const vec3f & attenuation, ! const color & color, ! float intensity, ! const vec3f & location, ! float radius); ! object_t insert_spot_light(float ambient_intensity, ! const vec3f & attenuation, ! float beam_width, ! const color & color, ! float cut_off_angle, ! const vec3f & direction, ! float intensity, ! const vec3f & location, ! float radius); ! object_t insert_reference(object_t existing_object); ! void remove_object(object_t ref); ! void enable_lighting(bool val); ! void set_fog(const color & color, float visibility_range, ! const char * type); ! void set_color(const color & rgb, float a = 1.0); ! void set_material(float ambient_intensity, ! const color & diffuse_color, ! const color & emissive_color, ! float shininess, ! const color & specular_color, ! float transparency); ! void set_material_mode(size_t tex_components, ! bool geometry_color); ! void set_sensitive(node * object); ! texture_object_t insert_texture(const image & img, ! bool repeat_s, ! bool repeat_t, ! bool retainHint = false); ! void insert_texture_reference(texture_object_t ref, ! size_t components); ! void remove_texture_object(texture_object_t ref); ! void set_texture_transform(const vec2f & center, ! float rotation, ! const vec2f & scale, ! const vec2f & translation); ! void set_viewpoint(const vec3f & position, ! const rotation & orientation, ! float field_of_view, ! float avatar_size, ! float visibility_limit); ! void transform(const mat4f & mat); ! void transform_points(size_t nPoints, vec3f * point) const; // still working on some navigation api issues, so don't depend on *************** *** 197,212 **** // shouldn't have to worry about it. // ! virtual const openvrml::frustum& frustum() const; ! virtual void frustum(const openvrml::frustum & f); ! virtual bounding_volume::intersection ! intersect_view_volume(const bounding_volume & bvolume) const; ! virtual void ! draw_bounding_sphere(const bounding_sphere & bs, ! bounding_volume::intersection intersection) = 0; protected: viewer() OPENVRML_NOTHROW; }; } --- 189,342 ---- // shouldn't have to worry about it. // ! const openvrml::frustum& frustum() const; ! void frustum(const openvrml::frustum & f); ! bounding_volume::intersection ! intersect_view_volume(const bounding_volume & bvolume) const; ! void draw_bounding_sphere(const bounding_sphere & bs, ! bounding_volume::intersection intersection); protected: viewer() OPENVRML_NOTHROW; + + virtual bounding_volume::intersection + do_intersect_view_volume(const bounding_volume & bvolume) const; + + virtual const openvrml::frustum& do_frustum() const; + virtual void do_frustum(const openvrml::frustum & f); + + private: + virtual rendering_mode do_mode() = 0; + virtual double do_frame_rate() = 0; + virtual void do_reset_user_navigation() = 0; + + virtual object_t do_begin_object(const char * id, + bool retain = false) = 0; + virtual void do_end_object() = 0; + + virtual object_t + 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 image & front, + const image & back, + const image & left, + const image & right, + const image & top, + const image & bottom) = 0; + + virtual object_t do_insert_box(const vec3f & size) = 0; + virtual object_t do_insert_cone(float height, float radius, bool bottom, + bool side) = 0; + virtual object_t + do_insert_cylinder(float height, float radius, bool bottom, bool side, + bool top) = 0; + virtual object_t + do_insert_elevation_grid(unsigned int mask, + const std::vector<float> & height, + int32 x_dimension, int32 z_dimension, + float x_spacing, float z_spacing, + const std::vector<color> & color, + const std::vector<vec3f> & normal, + const std::vector<vec2f> & tex_coord) = 0; + virtual object_t + do_insert_extrusion(unsigned int mask, + const std::vector<vec3f> & spine, + const std::vector<vec2f> & cross_section, + const std::vector<rotation> & orientation, + const std::vector<vec2f> & scale) = 0; + virtual object_t + do_insert_line_set(const std::vector<vec3f> & coord, + const std::vector<int32> & coord_index, + bool color_per_vertex, + const std::vector<color> & color, + const std::vector<int32> & color_index) = 0; + virtual object_t + do_insert_point_set(const std::vector<vec3f> & coord, + const std::vector<color> & color) = 0; + virtual object_t + do_insert_shell(unsigned int mask, + const std::vector<vec3f> & coord, + const std::vector<int32> & coord_index, + const std::vector<color> & color, + const std::vector<int32> & color_index, + const std::vector<vec3f> & normal, + const std::vector<int32> & normal_index, + const std::vector<vec2f> & tex_coord, + const std::vector<int32> & tex_coord_index) = 0; + virtual object_t do_insert_sphere(float radius) = 0; + virtual object_t do_insert_dir_light(float ambient_intensity, + float intensity, + const color & color, + const vec3f & direction) = 0; + virtual object_t do_insert_point_light(float ambient_intensity, + const vec3f & attenuation, + const color & color, + float intensity, + const vec3f & location, + float radius) = 0; + virtual object_t do_insert_spot_light(float ambient_intensity, + const vec3f & attenuation, + float beam_width, + const color & color, + float cut_off_angle, + const vec3f & direction, + float intensity, + const vec3f & location, + float radius) = 0; + virtual object_t do_insert_reference(object_t existing_object) = 0; + + virtual void do_remove_object(object_t ref) = 0; + + virtual void do_enable_lighting(bool val) = 0; + + virtual void do_set_fog(const color & color, float visibility_range, + const char * type) = 0; + + virtual void do_set_color(const color & rgb, float a = 1.0) = 0; + + virtual void do_set_material(float ambient_intensity, + const color & diffuse_color, + const color & emissive_color, + float shininess, + const color & specular_color, + float transparency) = 0; + + virtual void do_set_material_mode(size_t tex_components, + bool geometry_color) = 0; + + virtual void do_set_sensitive(node * object) = 0; + + virtual texture_object_t do_insert_texture(const image & img, + bool repeat_s, + bool repeat_t, + bool retainHint = false) = 0; + + virtual void do_insert_texture_reference(texture_object_t ref, + size_t components) = 0; + virtual void do_remove_texture_object(texture_object_t ref) = 0; + + virtual void do_set_texture_transform(const vec2f & center, + float rotation, + const vec2f & scale, + const vec2f & translation) = 0; + + virtual void do_set_viewpoint(const vec3f & position, + const rotation & orientation, + float field_of_view, + float avatar_size, + float visibility_limit) = 0; + + virtual void do_transform(const mat4f & mat) = 0; + + virtual void do_transform_points(size_t nPoints, + vec3f * point) const = 0; + + virtual void + do_draw_bounding_sphere( + const bounding_sphere & bs, + bounding_volume::intersection intersection) = 0; }; } Index: viewer.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/viewer.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** viewer.cpp 25 Feb 2006 08:37:27 -0000 1.13 --- viewer.cpp 31 Oct 2006 03:43:06 -0000 1.14 *************** *** 1,3 **** ! // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; -*- // // OpenVRML --- 1,3 ---- ! // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*- // // OpenVRML *************** *** 40,45 **** * @var openvrml::browser * openvrml::viewer::browser_ [...1212 lines suppressed...] * + * This function delegates to + * <code>viewer::do_frustum(const openvrml::frustum &)<code>. + * * @param[in] f new frustum value. */ void openvrml::viewer::frustum(const openvrml::frustum & f) { + this->do_frustum(f); + } + + /** + * @brief Set the frustum. + * + * @param[in] f new frustum value. + */ + void openvrml::viewer::do_frustum(const openvrml::frustum & f) + { this->frustum_ = f; } |