Panda3D
userVertexTransform.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 userVertexTransform.h
10  * @author drose
11  * @date 2005-03-24
12  */
13 
14 #ifndef USERVERTEXTRANSFORM_H
15 #define USERVERTEXTRANSFORM_H
16 
17 #include "pandabase.h"
18 #include "vertexTransform.h"
19 #include "cycleData.h"
20 #include "cycleDataReader.h"
21 #include "cycleDataWriter.h"
22 #include "pipelineCycler.h"
23 
24 class FactoryParams;
25 
26 /**
27  * This is a specialization on VertexTransform that allows the user to specify
28  * any arbitrary transform matrix he likes. This is rarely used except for
29  * testing.
30  */
31 class EXPCL_PANDA_GOBJ UserVertexTransform : public VertexTransform {
32 PUBLISHED:
33  explicit UserVertexTransform(const std::string &name);
34 
35  INLINE const std::string &get_name() const;
36 
37  INLINE void set_matrix(const LMatrix4 &matrix);
38  virtual void get_matrix(LMatrix4 &matrix) const;
39 
40  virtual void output(std::ostream &out) const;
41 
42 private:
43  std::string _name;
44 
45  // This is the data that must be cycled between pipeline stages.
46  class EXPCL_PANDA_GOBJ CData : public CycleData {
47  public:
48  INLINE CData();
49  INLINE CData(const CData &copy);
50  virtual CycleData *make_copy() const;
51  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
52  virtual void fillin(DatagramIterator &scan, BamReader *manager);
53  virtual TypeHandle get_parent_type() const {
54  return UserVertexTransform::get_class_type();
55  }
56 
57  LMatrix4 _matrix;
58  };
59 
60  PipelineCycler<CData> _cycler;
63 
64 public:
65  static void register_with_read_factory();
66  virtual void write_datagram(BamWriter *manager, Datagram &dg);
67 
68 protected:
69  static TypedWritable *make_from_bam(const FactoryParams &params);
70  void fillin(DatagramIterator &scan, BamReader *manager);
71 
72 public:
73  static TypeHandle get_class_type() {
74  return _type_handle;
75  }
76  static void init_type() {
77  VertexTransform::init_type();
78  register_type(_type_handle, "UserVertexTransform",
79  VertexTransform::get_class_type());
80  }
81  virtual TypeHandle get_type() const {
82  return get_class_type();
83  }
84  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
85 
86 private:
87  static TypeHandle _type_handle;
88 };
89 
90 #include "userVertexTransform.I"
91 
92 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:47
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
Definition: cycleData.cxx:76
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
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:32
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
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's make_from_bam() method to read in all...
Definition: cycleData.cxx:58
This is a specialization on VertexTransform that allows the user to specify any arbitrary transform m...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.