Panda3D
Loading...
Searching...
No Matches
vertexTransform.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 vertexTransform.h
10 * @author drose
11 * @date 2005-03-23
12 */
13
14#ifndef VERTEXTRANSFORM_H
15#define VERTEXTRANSFORM_H
16
17#include "pandabase.h"
19#include "updateSeq.h"
20#include "luse.h"
21#include "ordered_vector.h"
22#include "cycleData.h"
23#include "cycleDataReader.h"
24#include "cycleDataWriter.h"
25#include "pipelineCycler.h"
26
27class TransformTable;
28
29/**
30 * This is an abstract base class that holds a pointer to some transform,
31 * computed in some arbitrary way, that is to be applied to vertices during
32 * rendering. This is used to implement soft-skinned and animated vertices.
33 * Derived classes will define how the transform is actually computed.
34 */
35class EXPCL_PANDA_GOBJ VertexTransform : public TypedWritableReferenceCount {
36PUBLISHED:
38 virtual ~VertexTransform();
39
40 virtual void get_matrix(LMatrix4 &matrix) const=0;
41 virtual void mult_matrix(LMatrix4 &result, const LMatrix4 &previous) const;
42 virtual void accumulate_matrix(LMatrix4 &accum, PN_stdfloat weight) const;
43
44 INLINE UpdateSeq get_modified(Thread *current_thread = Thread::get_current_thread()) const;
45 MAKE_PROPERTY(modified, get_modified);
46
47 virtual void output(std::ostream &out) const;
48 virtual void write(std::ostream &out, int indent_level) const;
49
50 static UpdateSeq get_next_modified(Thread *current_thread);
51 INLINE static UpdateSeq get_global_modified(Thread *current_thread);
52
53protected:
54 void mark_modified(Thread *current_thread);
55
56private:
58 Palettes _tables;
59
60 // This is the data that must be cycled between pipeline stages.
61 class EXPCL_PANDA_GOBJ CData : public CycleData {
62 public:
63 INLINE CData();
64 INLINE CData(const CData &copy);
65 virtual CycleData *make_copy() const;
66 virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
67 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
68 virtual void fillin(DatagramIterator &scan, BamReader *manager);
69 virtual TypeHandle get_parent_type() const {
70 VertexTransform::init_type();
71 return VertexTransform::get_class_type();
72 }
73
74 UpdateSeq _modified;
75 };
76
78 typedef CycleDataReader<CData> CDReader;
79 typedef CycleDataWriter<CData> CDWriter;
80
81 static PipelineCycler<CData> _global_cycler;
82 static UpdateSeq _next_modified;
83
84public:
85 virtual void write_datagram(BamWriter *manager, Datagram &dg);
86
87protected:
88 void fillin(DatagramIterator &scan, BamReader *manager);
89
90public:
91 static TypeHandle get_class_type() {
92 return _type_handle;
93 }
94 static void init_type() {
95 TypedWritableReferenceCount::init_type();
96 register_type(_type_handle, "VertexTransform",
97 TypedWritableReferenceCount::get_class_type());
98 }
99 virtual TypeHandle get_type() const {
100 return get_class_type();
101 }
102 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
103
104private:
105 static TypeHandle _type_handle;
106
107 friend class TransformTable;
108};
109
110INLINE std::ostream &operator << (std::ostream &out, const VertexTransform &obj);
111
112#include "vertexTransform.I"
113
114#endif
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
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
A thread; that is, a lightweight process.
Definition thread.h:46
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition thread.h:109
Stores the total set of VertexTransforms that the vertices in a particular GeomVertexData object migh...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Base class for objects that can be written to and read from Bam files.
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...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is a sequence number that increments monotonically.
Definition updateSeq.h:37
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
This is our own Panda specialization on the default STL list.
Definition plist.h:35
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.