Panda3D
 All Classes Functions Variables Enumerations
userVertexTransform.h
1 // Filename: userVertexTransform.h
2 // Created by: drose (24Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef USERVERTEXTRANSFORM_H
16 #define USERVERTEXTRANSFORM_H
17 
18 #include "pandabase.h"
19 #include "vertexTransform.h"
20 #include "cycleData.h"
21 #include "cycleDataReader.h"
22 #include "cycleDataWriter.h"
23 #include "pipelineCycler.h"
24 
25 class FactoryParams;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : UserVertexTransform
29 // Description : This is a specialization on VertexTransform that
30 // allows the user to specify any arbitrary transform
31 // matrix he likes. This is rarely used except for
32 // testing.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_GOBJ UserVertexTransform : public VertexTransform {
35 PUBLISHED:
36  UserVertexTransform(const string &name);
37 
38  INLINE const string &get_name() const;
39 
40  INLINE void set_matrix(const LMatrix4 &matrix);
41  virtual void get_matrix(LMatrix4 &matrix) const;
42 
43  virtual void output(ostream &out) const;
44 
45 private:
46  string _name;
47 
48  // This is the data that must be cycled between pipeline stages.
49  class EXPCL_PANDA_GOBJ CData : public CycleData {
50  public:
51  INLINE CData();
52  INLINE CData(const CData &copy);
53  virtual CycleData *make_copy() const;
54  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
55  virtual void fillin(DatagramIterator &scan, BamReader *manager);
56  virtual TypeHandle get_parent_type() const {
57  return UserVertexTransform::get_class_type();
58  }
59 
60  LMatrix4 _matrix;
61  };
62 
63  PipelineCycler<CData> _cycler;
66 
67 public:
68  static void register_with_read_factory();
69  virtual void write_datagram(BamWriter *manager, Datagram &dg);
70 
71 protected:
72  static TypedWritable *make_from_bam(const FactoryParams &params);
73  void fillin(DatagramIterator &scan, BamReader *manager);
74 
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  VertexTransform::init_type();
81  register_type(_type_handle, "UserVertexTransform",
82  VertexTransform::get_class_type());
83  }
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 
89 private:
90  static TypeHandle _type_handle;
91 };
92 
93 #include "userVertexTransform.I"
94 
95 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class&#39;s make_from_bam() method to read in all...
Definition: cycleData.cxx:68
This is a specialization on VertexTransform that allows the user to specify any arbitrary transform m...
A class to retrieve the individual data elements previously stored in a Datagram. ...
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: cycleData.cxx:34
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43