mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
Add UvScrollNode::_w_speed
This commit is contained in:
parent
abc5c381be
commit
a585faa807
@ -1086,6 +1086,11 @@ set_scroll_v(const double v_speed) {
|
||||
_v_speed = v_speed;
|
||||
}
|
||||
|
||||
INLINE void EggGroup::
|
||||
set_scroll_w(const double w_speed) {
|
||||
_w_speed = w_speed;
|
||||
}
|
||||
|
||||
INLINE void EggGroup::
|
||||
set_scroll_r(const double r_speed) {
|
||||
_r_speed = r_speed;
|
||||
@ -1101,6 +1106,11 @@ get_scroll_v() const {
|
||||
return _v_speed;
|
||||
}
|
||||
|
||||
INLINE double EggGroup::
|
||||
get_scroll_w() const {
|
||||
return _w_speed;
|
||||
}
|
||||
|
||||
INLINE double EggGroup::
|
||||
get_scroll_r() const {
|
||||
return _r_speed;
|
||||
@ -1109,5 +1119,5 @@ get_scroll_r() const {
|
||||
|
||||
INLINE bool EggGroup::
|
||||
has_scrolling_uvs() {
|
||||
return (_u_speed != 0) || (_v_speed != 0) || (_r_speed != 0);
|
||||
return (_u_speed != 0) || (_v_speed != 0) || (_w_speed != 0) || (_r_speed != 0);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ EggGroup(const string &name) : EggGroupNode(name) {
|
||||
_blend_color = LColor::zero();
|
||||
_u_speed = 0;
|
||||
_v_speed = 0;
|
||||
_w_speed = 0;
|
||||
_r_speed = 0;
|
||||
}
|
||||
|
||||
@ -80,6 +81,7 @@ operator = (const EggGroup ©) {
|
||||
_tag_data = copy._tag_data;
|
||||
_u_speed = copy._u_speed;
|
||||
_v_speed = copy._v_speed;
|
||||
_w_speed = copy._w_speed;
|
||||
_r_speed = copy._r_speed;
|
||||
_default_pose = copy._default_pose;
|
||||
|
||||
@ -232,25 +234,30 @@ write(ostream &out, int indent_level) const {
|
||||
_default_pose.write(out, indent_level + 2, "<DefaultPose>");
|
||||
}
|
||||
|
||||
if(get_scroll_u() != 0) {
|
||||
if (get_scroll_u() != 0) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "<Scalar> scroll_u { " << get_scroll_u() << " }\n";
|
||||
|
||||
}
|
||||
|
||||
if(get_scroll_v() != 0) {
|
||||
if (get_scroll_v() != 0) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "<Scalar> scroll_v { " << get_scroll_v() << " }\n";
|
||||
|
||||
}
|
||||
|
||||
if(get_scroll_r() != 0) {
|
||||
if (get_scroll_w() != 0) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "<Scalar> scroll_w { " << get_scroll_w() << " }\n";
|
||||
|
||||
}
|
||||
|
||||
if (get_scroll_r() != 0) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "<Scalar> scroll_r { " << get_scroll_r() << " }\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
write_object_types(out, indent_level + 2);
|
||||
write_decal_flags(out, indent_level + 2);
|
||||
write_tags(out, indent_level + 2);
|
||||
|
@ -277,9 +277,11 @@ PUBLISHED:
|
||||
|
||||
INLINE void set_scroll_u(const double u_speed);
|
||||
INLINE void set_scroll_v(const double v_speed);
|
||||
INLINE void set_scroll_w(const double w_speed);
|
||||
INLINE void set_scroll_r(const double r_speed);
|
||||
INLINE double get_scroll_u() const;
|
||||
INLINE double get_scroll_v() const;
|
||||
INLINE double get_scroll_w() const;
|
||||
INLINE double get_scroll_r() const;
|
||||
|
||||
INLINE bool has_scrolling_uvs();
|
||||
@ -385,6 +387,7 @@ private:
|
||||
|
||||
double _u_speed;
|
||||
double _v_speed;
|
||||
double _w_speed;
|
||||
double _r_speed;
|
||||
|
||||
// This is the <DefaultPose> entry for a <Joint>. It is not the
|
||||
|
@ -3597,6 +3597,9 @@ yyreduce:
|
||||
} else if (cmp_nocase_uh(name, "scroll_v") == 0) {
|
||||
group->set_scroll_v(value);
|
||||
|
||||
} else if (cmp_nocase_uh(name, "scroll_w") == 0) {
|
||||
group->set_scroll_w(value);
|
||||
|
||||
} else if (cmp_nocase_uh(name, "scroll_r") == 0) {
|
||||
group->set_scroll_r(value);
|
||||
|
||||
|
@ -1351,6 +1351,9 @@ group_body:
|
||||
} else if (cmp_nocase_uh(name, "scroll_v") == 0) {
|
||||
group->set_scroll_v(value);
|
||||
|
||||
} else if (cmp_nocase_uh(name, "scroll_w") == 0) {
|
||||
group->set_scroll_w(value);
|
||||
|
||||
} else if (cmp_nocase_uh(name, "scroll_r") == 0) {
|
||||
group->set_scroll_r(value);
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ make_node(EggGroup *egg_group, PandaNode *parent) {
|
||||
make_node(*ci, node);
|
||||
}
|
||||
} else if (egg_group->has_scrolling_uvs()) {
|
||||
node = new UvScrollNode(egg_group->get_name(), egg_group->get_scroll_u(), egg_group->get_scroll_v(), egg_group->get_scroll_r());
|
||||
node = new UvScrollNode(egg_group->get_name(), egg_group->get_scroll_u(), egg_group->get_scroll_v(), egg_group->get_scroll_w(), egg_group->get_scroll_r());
|
||||
|
||||
EggGroup::const_iterator ci;
|
||||
for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) {
|
||||
|
@ -19,10 +19,11 @@
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE UvScrollNode::
|
||||
UvScrollNode(const string &name, PN_stdfloat u_speed, PN_stdfloat v_speed, PN_stdfloat r_speed) :
|
||||
UvScrollNode(const string &name, PN_stdfloat u_speed, PN_stdfloat v_speed, PN_stdfloat w_speed, PN_stdfloat r_speed) :
|
||||
PandaNode(name),
|
||||
_u_speed(u_speed),
|
||||
_v_speed(v_speed),
|
||||
_w_speed(w_speed),
|
||||
_r_speed(r_speed),
|
||||
_start_time(ClockObject::get_global_clock()->get_frame_time())
|
||||
{
|
||||
@ -39,6 +40,7 @@ UvScrollNode(const string &name) :
|
||||
PandaNode(name),
|
||||
_u_speed(0),
|
||||
_v_speed(0),
|
||||
_w_speed(0),
|
||||
_r_speed(0),
|
||||
_start_time(ClockObject::get_global_clock()->get_frame_time())
|
||||
{
|
||||
@ -47,7 +49,7 @@ UvScrollNode(const string &name) :
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvSctrollNode::set_u_speed
|
||||
// Function: UvScrollNode::set_u_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -57,7 +59,7 @@ set_u_speed(PN_stdfloat u_speed) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvSctrollNode::set_v_speed
|
||||
// Function: UvScrollNode::set_v_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -67,7 +69,17 @@ set_v_speed(PN_stdfloat v_speed) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvSctrollNode::set_r_speed
|
||||
// Function: UvScrollNode::set_w_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void UvScrollNode::
|
||||
set_w_speed(PN_stdfloat w_speed) {
|
||||
_w_speed = w_speed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvScrollNode::set_r_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -87,7 +99,7 @@ get_u_speed() const {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvSctrollNode::get_v_speed
|
||||
// Function: UvScrollNode::get_v_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -96,6 +108,16 @@ get_v_speed() const {
|
||||
return _v_speed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvScrollNode::get_w_speed
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat UvScrollNode::
|
||||
get_w_speed() const {
|
||||
return _w_speed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: UvSctrollNode::get_r_speed
|
||||
// Access: Published
|
||||
@ -116,6 +138,7 @@ UvScrollNode(const UvScrollNode ©) :
|
||||
PandaNode(copy),
|
||||
_u_speed(copy._u_speed),
|
||||
_v_speed(copy._v_speed),
|
||||
_w_speed(copy._w_speed),
|
||||
_r_speed(copy._r_speed),
|
||||
_start_time(copy._start_time)
|
||||
{
|
||||
|
@ -61,6 +61,7 @@ write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
PandaNode::write_datagram(manager, dg);
|
||||
dg.add_stdfloat(_u_speed);
|
||||
dg.add_stdfloat(_v_speed);
|
||||
dg.add_stdfloat(_w_speed);
|
||||
dg.add_stdfloat(_r_speed);
|
||||
}
|
||||
|
||||
@ -97,7 +98,10 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
||||
|
||||
_u_speed = scan.get_stdfloat();
|
||||
_v_speed = scan.get_stdfloat();
|
||||
if(manager->get_file_minor_ver() >=22) {
|
||||
if (manager->get_file_minor_ver() >= 33) {
|
||||
_w_speed = scan.get_stdfloat();
|
||||
}
|
||||
if (manager->get_file_minor_ver() >= 22) {
|
||||
_r_speed = scan.get_stdfloat();
|
||||
}
|
||||
|
||||
@ -132,13 +136,15 @@ bool UvScrollNode::
|
||||
cull_callback(CullTraverser * trav, CullTraverserData &data) {
|
||||
double elapsed = ClockObject::get_global_clock()->get_frame_time() - _start_time;
|
||||
CPT(TransformState) ts = TransformState::make_pos_hpr(
|
||||
LVecBase3(cmod(elapsed*_u_speed,1.0)/1.0, cmod(elapsed*_v_speed,1.0)/1.0,0),
|
||||
LVecBase3((cmod(elapsed*_r_speed,1.0)/1.0)*360,0,0));
|
||||
|
||||
LVecBase3(cmod(elapsed * _u_speed, 1.0) / 1.0,
|
||||
cmod(elapsed * _v_speed, 1.0) / 1.0,
|
||||
cmod(elapsed * _w_speed, 1.0) / 1.0),
|
||||
LVecBase3((cmod(elapsed * _r_speed, 1.0) / 1.0) * 360, 0, 0));
|
||||
|
||||
CPT(RenderAttrib) tm = TexMatrixAttrib::make(TextureStage::get_default(), ts);
|
||||
CPT(RenderState) rs = RenderState::make_empty()->set_attrib(tm);
|
||||
data._state = data._state->compose(rs);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : UvScrollNode
|
||||
// Description : This node is placed at key points within the scene
|
||||
// graph to animate uvs.
|
||||
// graph to animate uvs.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA_PGRAPH UvScrollNode : public PandaNode {
|
||||
PUBLISHED:
|
||||
INLINE UvScrollNode(const string &name, PN_stdfloat u_speed, PN_stdfloat v_speed, PN_stdfloat r_speed);
|
||||
INLINE UvScrollNode(const string &name, PN_stdfloat u_speed, PN_stdfloat v_speed, PN_stdfloat w_speed, PN_stdfloat r_speed);
|
||||
INLINE UvScrollNode(const string &name);
|
||||
|
||||
protected:
|
||||
@ -43,14 +43,17 @@ public:
|
||||
PUBLISHED:
|
||||
INLINE void set_u_speed(PN_stdfloat u_speed);
|
||||
INLINE void set_v_speed(PN_stdfloat v_speed);
|
||||
INLINE void set_w_speed(PN_stdfloat w_speed);
|
||||
INLINE void set_r_speed(PN_stdfloat r_speed);
|
||||
INLINE PN_stdfloat get_u_speed() const;
|
||||
INLINE PN_stdfloat get_v_speed() const;
|
||||
INLINE PN_stdfloat get_w_speed() const;
|
||||
INLINE PN_stdfloat get_r_speed() const;
|
||||
|
||||
|
||||
private:
|
||||
PN_stdfloat _u_speed;
|
||||
PN_stdfloat _v_speed;
|
||||
PN_stdfloat _w_speed;
|
||||
PN_stdfloat _r_speed;
|
||||
|
||||
double _start_time;
|
||||
|
@ -33,7 +33,7 @@ static const unsigned short _bam_major_ver = 6;
|
||||
// Bumped to major version 6 on 2/11/06 to factor out PandaNode::CData.
|
||||
|
||||
static const unsigned short _bam_first_minor_ver = 14;
|
||||
static const unsigned short _bam_minor_ver = 32;
|
||||
static const unsigned short _bam_minor_ver = 33;
|
||||
// Bumped to minor version 14 on 12/19/07 to change default ColorAttrib.
|
||||
// Bumped to minor version 15 on 4/9/08 to add TextureAttrib::_implicit_sort.
|
||||
// Bumped to minor version 16 on 5/13/08 to add Texture::_quality_level.
|
||||
@ -53,6 +53,7 @@ static const unsigned short _bam_minor_ver = 32;
|
||||
// Bumped to minor version 30 on 1/22/12 to add Texture::_pad_*_size.
|
||||
// Bumped to minor version 31 on 2/16/12 to add DepthOffsetAttrib::_min_value, _max_value.
|
||||
// Bumped to minor version 32 on 6/11/12 to add Texture::_has_read_mipmaps.
|
||||
// Bumped to minor version 33 on 8/17/13 to add UvScrollNode::_w_speed.
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user