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
userVertexTransform.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleData
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
CycleData::get_parent_type
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
Definition: cycleData.cxx:76
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
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
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
UserVertexTransform
This is a specialization on VertexTransform that allows the user to specify any arbitrary transform m...
Definition: userVertexTransform.h:31
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
CycleData::write_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:32
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
cycleData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition: cycleDataReader.h:35
cycleDataReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
vertexTransform.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleData::fillin
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
pipelineCycler.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleDataWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
VertexTransform
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
Definition: vertexTransform.h:35
PipelineCycler< CData >