Browse Source

uv scrolling support for maya

Zachary Pavlov 16 years ago
parent
commit
f614a4dd64
4 changed files with 58 additions and 0 deletions
  1. 25 0
      panda/src/egg/eggGroup.I
  2. 17 0
      panda/src/egg/eggGroup.cxx
  3. 10 0
      panda/src/egg/eggGroup.h
  4. 6 0
      panda/src/egg/parser.yxx

+ 25 - 0
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);
+}

+ 17 - 0
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 &copy) {
   _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, "<DefaultPose>");
   }
 
+  if(get_scroll_u() != 0) {
+    indent(out, indent_level) 
+      << "<Scalar> scroll_u { " << get_scroll_u() << " }\n";
+
+  }
+
+  if(get_scroll_v() != 0) {
+    indent(out, indent_level) 
+      << "<Scalar> 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);

+ 10 - 0
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 <DefaultPose> entry for a <Joint>.  It is not the
   // <Transform> entry (that is stored via inheritance, in the
   // EggTransform class we inherit from).

+ 6 - 0
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);