From f614a4dd6413e9b347d56eaf1561022e18623eb3 Mon Sep 17 00:00:00 2001 From: Zachary Pavlov Date: Wed, 1 Jul 2009 19:56:20 +0000 Subject: [PATCH] uv scrolling support for maya --- panda/src/egg/eggGroup.I | 25 +++++++++++++++++++++++++ panda/src/egg/eggGroup.cxx | 17 +++++++++++++++++ panda/src/egg/eggGroup.h | 10 ++++++++++ panda/src/egg/parser.yxx | 6 ++++++ 4 files changed, 58 insertions(+) diff --git a/panda/src/egg/eggGroup.I b/panda/src/egg/eggGroup.I index f9f44fe61e..b064821d07 100644 --- a/panda/src/egg/eggGroup.I +++ b/panda/src/egg/eggGroup.I @@ -1051,3 +1051,28 @@ INLINE EggGroup::VertexRef::size_type EggGroup:: vref_size() const { return _vref.size(); } + +INLINE void EggGroup:: +set_scroll_u(const double u_speed) { + _u_speed = u_speed; +} + +INLINE void EggGroup:: +set_scroll_v(const double v_speed) { + _v_speed = v_speed; +} + +INLINE double EggGroup:: +get_scroll_u() const { + return _u_speed; +} + +INLINE double EggGroup:: +get_scroll_v() const { + return _v_speed; +} + +INLINE bool EggGroup:: +has_scrolling_uvs() { + return (_u_speed != 0) || (_v_speed != 0); +} diff --git a/panda/src/egg/eggGroup.cxx b/panda/src/egg/eggGroup.cxx index 181bb8d11c..e8d2f24071 100644 --- a/panda/src/egg/eggGroup.cxx +++ b/panda/src/egg/eggGroup.cxx @@ -40,6 +40,8 @@ EggGroup(const string &name) : EggGroupNode(name) { _blend_operand_a = BO_unspecified; _blend_operand_b = BO_unspecified; _blend_color = Colorf::zero(); + _u_speed = 0; + _v_speed = 0; } //////////////////////////////////////////////////////////////////// @@ -75,6 +77,8 @@ operator = (const EggGroup ©) { _blend_operand_b = copy._blend_operand_b; _blend_color = copy._blend_color; _tag_data = copy._tag_data; + _u_speed = copy._u_speed; + _v_speed = copy._v_speed; _default_pose = copy._default_pose; unref_all_vertices(); @@ -226,6 +230,19 @@ write(ostream &out, int indent_level) const { _default_pose.write(out, indent_level + 2, ""); } + if(get_scroll_u() != 0) { + indent(out, indent_level) + << " scroll_u { " << get_scroll_u() << " }\n"; + + } + + if(get_scroll_v() != 0) { + indent(out, indent_level) + << " scroll_v { " << get_scroll_v() << " }\n"; + + } + + write_object_types(out, indent_level + 2); write_decal_flags(out, indent_level + 2); write_tags(out, indent_level + 2); diff --git a/panda/src/egg/eggGroup.h b/panda/src/egg/eggGroup.h index 93b8b859d9..fc1f306478 100644 --- a/panda/src/egg/eggGroup.h +++ b/panda/src/egg/eggGroup.h @@ -270,6 +270,13 @@ PUBLISHED: INLINE void set_default_pose(const EggTransform &transform); INLINE void clear_default_pose(); + INLINE void set_scroll_u(const double u_speed); + INLINE void set_scroll_v(const double v_speed); + INLINE double get_scroll_u() const; + INLINE double get_scroll_v() const; + + INLINE bool has_scrolling_uvs(); + public: INLINE TagData::const_iterator tag_begin() const; INLINE TagData::const_iterator tag_end() const; @@ -369,6 +376,9 @@ private: PT(EggSwitchCondition) _lod; TagData _tag_data; + double _u_speed; + double _v_speed; + // This is the entry for a . It is not the // entry (that is stored via inheritance, in the // EggTransform class we inherit from). diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index ae5e42b819..d394b7cafc 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -1292,6 +1292,12 @@ group_body: } else if (cmp_nocase_uh(name, "indexed") == 0) { group->set_indexed_flag(value != 0); + } else if (cmp_nocase_uh(name, "scroll_u") == 0) { + group->set_scroll_u(value); + + } else if (cmp_nocase_uh(name, "scroll_v") == 0) { + group->set_scroll_v(value); + } else if (cmp_nocase_uh(name, "blend") == 0) { EggGroup::BlendMode blend_mode = EggGroup::string_blend_mode(strval);