Panda3D

Loading...
Searching...
No Matches
animChannelMatrixDynamic.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file animChannelMatrixDynamic.h
10 * @author drose
11 * @date 2003-10-20
12 */
13
14#ifndef ANIMCHANNELMATRIXDYNAMIC_H
15#define ANIMCHANNELMATRIXDYNAMIC_H
16
17#include "pandabase.h"
18
19#include "animChannel.h"
20#include "transformState.h"
21#include "pandaNode.h"
22#include "pointerTo.h"
23
24/**
25 * An animation channel that accepts a matrix each frame from some dynamic
26 * input provided by code.
27 *
28 * This object operates in two modes: in explicit mode, the programmer should
29 * call set_value() each frame to indicate the new value; in implicit mode,
30 * the programmer should call set_value_node() to indicate the node whose
31 * transform will be copied to the joint each frame.
32 */
33 class EXPCL_PANDA_CHAN AnimChannelMatrixDynamic : public AnimChannelMatrix {
34 protected:
35 AnimChannelMatrixDynamic();
36 AnimChannelMatrixDynamic(AnimGroup *parent, const AnimChannelMatrixDynamic &copy);
37
38 public:
39 AnimChannelMatrixDynamic(const std::string &name);
40
41 virtual bool has_changed(int last_frame, double last_frac,
42 int this_frame, double this_frac);
43 virtual void get_value(int frame, LMatrix4 &mat);
44
45 virtual void get_value_no_scale_shear(int frame, LMatrix4 &value);
46 virtual void get_scale(int frame, LVecBase3 &scale);
47 virtual void get_hpr(int frame, LVecBase3 &hpr);
48 virtual void get_quat(int frame, LQuaternion &quat);
49 virtual void get_pos(int frame, LVecBase3 &pos);
50 virtual void get_shear(int frame, LVecBase3 &shear);
51
52PUBLISHED:
53 void set_value(const LMatrix4 &value);
54 void set_value(const TransformState *value);
55 void set_value_node(PandaNode *node);
56
57 INLINE const TransformState *get_value_transform() const;
58 INLINE PandaNode *get_value_node() const;
59
60 MAKE_PROPERTY(value_node, get_value_node, set_value_node);
61
62 protected:
63 virtual AnimGroup *make_copy(AnimGroup *parent) const;
64
65
66 private:
67 // This is filled in only if we are using the set_value_node() interface to
68 // get an implicit value from the transform on the indicated node each
69 // frame.
70 PT(PandaNode) _value_node;
71
72 CPT(TransformState) _value;
73 CPT(TransformState) _last_value;
74
75 public:
76 static void register_with_read_factory();
77 virtual void write_datagram(BamWriter *manager, Datagram &dg);
78 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
79 void fillin(DatagramIterator &scan, BamReader *manager);
80
81 static TypedWritable *make_AnimChannelMatrixDynamic(const FactoryParams &params);
82
83 public:
84 virtual TypeHandle get_type() const {
85 return get_class_type();
86 }
87 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
88 static TypeHandle get_class_type() {
89 return _type_handle;
90 }
91 static void init_type() {
92 AnimChannelMatrix::init_type();
93 register_type(_type_handle, "AnimChannelMatrixDynamic",
94 AnimChannelMatrix::get_class_type());
95 }
96
97 private:
98 static TypeHandle _type_handle;
99};
100
101#include "animChannelMatrixDynamic.I"
102
103#endif
animChannelMatrixDynamic.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
animChannel.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AnimChannelBase::has_changed
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().
Definition animChannelBase.cxx:30
AnimChannelBase::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
Definition animChannelBase.cxx:39
AnimChannelMatrixDynamic::get_value_node
get_value_node
Returns the node that was set via set_value_node(), if any.
Definition animChannelMatrixDynamic.h:60
AnimChannelMatrixDynamic::get_value_transform
const TransformState * get_value_transform() const
Returns the explicit TransformState value that was set via set_value(), if any.
Definition animChannelMatrixDynamic.I:19
AnimChannelMatrixDynamic::set_value_node
set_value_node
Specifies a node whose transform will be queried each frame to implicitly specify the transform of th...
Definition animChannelMatrixDynamic.h:60
AnimChannelMatrixDynamic::set_value
void set_value(const LMatrix4 &value)
Explicitly sets the matrix value.
Definition animChannelMatrixDynamic.cxx:167
AnimChannelMatrixDynamic::fillin
void fillin(DatagramIterator &scan, BamReader *manager)
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to r...
Definition animChannelMatrixDynamic.cxx:237
AnimChannelMatrixDynamic::get_value
virtual void get_value(int frame, LMatrix4 &mat)
Gets the value of the channel at the indicated frame.
Definition animChannelMatrixDynamic.cxx:79
AnimChannelMatrixDynamic::make_AnimChannelMatrixDynamic
static TypedWritable * make_AnimChannelMatrixDynamic(const FactoryParams &params)
Factory method to generate an AnimChannelMatrixDynamic object.
Definition animChannelMatrixDynamic.cxx:249
AnimChannel< ACMatrixSwitchType >::get_scale
virtual void get_scale(int frame, LVecBase3 &scale)
AnimChannel< ACMatrixSwitchType >::get_hpr
virtual void get_hpr(int frame, LVecBase3 &hpr)
AnimChannel< ACMatrixSwitchType >::get_quat
virtual void get_quat(int frame, LQuaternion &quat)
AnimChannel< ACMatrixSwitchType >::get_pos
virtual void get_pos(int frame, LVecBase3 &pos)
AnimChannel< ACMatrixSwitchType >::get_value_no_scale_shear
virtual void get_value_no_scale_shear(int frame, ValueType &value)
AnimChannel< ACMatrixSwitchType >::get_shear
virtual void get_shear(int frame, LVecBase3 &shear)
AnimGroup::complete_pointers
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointer...
Definition animGroup.cxx:277
AnimGroup::register_with_read_factory
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition animGroup.cxx:308
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition bamWriter.h:63
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition datagramIterator.h:30
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
TransformState
Indicates a coordinate-system transform on vertices.
Definition transformState.h:54
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition typedWritable.h:35
plist
This is our own Panda specialization on the default STL list.
Definition plist.h:35
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
transformState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.