Panda3D
Loading...
Searching...
No Matches
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
24class 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 */
31class EXPCL_PANDA_GOBJ UserVertexTransform : public VertexTransform {
32PUBLISHED:
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
42private:
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
61 typedef CycleDataReader<CData> CDReader;
62 typedef CycleDataWriter<CData> CDWriter;
63
64public:
65 static void register_with_read_factory();
66 virtual void write_datagram(BamWriter *manager, Datagram &dg);
67
68protected:
69 static TypedWritable *make_from_bam(const FactoryParams &params);
70 void fillin(DatagramIterator &scan, BamReader *manager);
71
72public:
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
86private:
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
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A single page of data maintained by a PipelineCycler.
Definition cycleData.h:50
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
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static void register_with_read_factory()
Tells the BamReader how to create objects of type UserVertexTransform.
const std::string & get_name() const
Returns the name passed to the constructor.
void set_matrix(const LMatrix4 &matrix)
Stores the indicated matrix.
virtual void get_matrix(LMatrix4 &matrix) const
Returns the transform's matrix.
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.
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(),...
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.