Panda3D
Loading...
Searching...
No Matches
animChannelMatrixXfmTable.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 animChannelMatrixXfmTable.h
10 * @author drose
11 * @date 1999-02-20
12 */
13
14#ifndef ANIMCHANNELMATRIXXFMTABLE_H
15#define ANIMCHANNELMATRIXXFMTABLE_H
16
17#include "pandabase.h"
18
19#include "animChannel.h"
20
21#include "pointerToArray.h"
22#include "pta_stdfloat.h"
23#include "compose_matrix.h"
24
25/**
26 * An animation channel that issues a matrix each frame, read from a table
27 * such as might have been read from an egg file. The table actually consists
28 * of nine sub-tables, each representing one component of the transform:
29 * scale, rotate, translate.
30 */
31class EXPCL_PANDA_CHAN AnimChannelMatrixXfmTable : public AnimChannelMatrix {
32protected:
33 AnimChannelMatrixXfmTable();
34 AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable &copy);
35
36PUBLISHED:
37 explicit AnimChannelMatrixXfmTable(AnimGroup *parent, const std::string &name);
38 virtual ~AnimChannelMatrixXfmTable();
39
40public:
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 static INLINE bool is_valid_id(char table_id);
54
55 void set_table(char table_id, const CPTA_stdfloat &table);
56 INLINE CPTA_stdfloat get_table(char table_id) const;
57
58 void clear_all_tables();
59 INLINE bool has_table(char table_id) const;
60 INLINE void clear_table(char table_id);
61
62 MAKE_MAP_PROPERTY(tables, has_table, get_table, set_table, clear_table);
63
64public:
65 virtual void write(std::ostream &out, int indent_level) const;
66
67protected:
68 virtual AnimGroup *make_copy(AnimGroup *parent) const;
69
70 INLINE static char get_table_id(int table_index);
71 static int get_table_index(char table_id);
72 INLINE static PN_stdfloat get_default_value(int table_index);
73
74 CPTA_stdfloat _tables[num_matrix_components];
75
76public:
77 static void register_with_read_factory();
78 virtual void write_datagram(BamWriter* manager, Datagram &me);
79
81
82protected:
83 void fillin(DatagramIterator& scan, BamReader* manager);
84
85public:
86 virtual TypeHandle get_type() const {
87 return get_class_type();
88 }
89 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
90 static TypeHandle get_class_type() {
91 return _type_handle;
92 }
93 static void init_type() {
94 AnimChannelMatrix::init_type();
95 register_type(_type_handle, "AnimChannelMatrixXfmTable",
96 AnimChannelMatrix::get_class_type());
97 }
98
99private:
100 static TypeHandle _type_handle;
101};
102
104
105#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
set_table
Assigns the indicated table.
clear_table
Removes the indicated table from the definition.
has_table
Returns true if the indicated subtable has been assigned.
void clear_all_tables()
Removes all the tables from the channel, and resets it to its initial state.
static bool is_valid_id(char table_id)
Returns true if the given letter is one of the nine valid table id's.
get_table
Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not.
static TypedWritable * make_AnimChannelMatrixXfmTable(const FactoryParams &params)
Factory method to generate an AnimChannelMatrixXfmTable object.
virtual void get_value(int frame, LMatrix4 &mat)
Gets the value of the channel at the indicated frame.
virtual void get_scale(int frame, LVecBase3 &scale)
virtual void get_hpr(int frame, LVecBase3 &hpr)
virtual void get_quat(int frame, LQuaternion &quat)
virtual void get_pos(int frame, LVecBase3 &pos)
virtual void get_value_no_scale_shear(int frame, ValueType &value)
virtual void get_shear(int frame, LVecBase3 &shear)
virtual void write(std::ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition bamWriter.h:63
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...