Panda3D

Loading...
Searching...
No Matches
userVertexSlider.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 userVertexSlider.h
10 * @author drose
11 * @date 2005-03-28
12 */
13
14#ifndef USERVERTEXSLIDER_H
15#define USERVERTEXSLIDER_H
16
17#include "pandabase.h"
18#include "vertexSlider.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 VertexSlider that allows the user to specify
28 * any arbitrary slider valie he likes. This is rarely used except for
29 * testing.
30 */
31 class EXPCL_PANDA_GOBJ UserVertexSlider : public VertexSlider {
32PUBLISHED:
33 explicit UserVertexSlider(const std::string &name);
34 explicit UserVertexSlider(const InternalName *name);
35
36 INLINE void set_slider(PN_stdfloat slider);
37 virtual PN_stdfloat get_slider() const;
38
39 private:
40 // This is the data that must be cycled between pipeline stages.
41 class EXPCL_PANDA_GOBJ CData : public CycleData {
42 public:
43 INLINE CData();
44 INLINE CData(const CData &copy);
45 virtual CycleData *make_copy() const;
46 virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
47 virtual void fillin(DatagramIterator &scan, BamReader *manager);
48 virtual TypeHandle get_parent_type() const {
49 return UserVertexSlider::get_class_type();
50 }
51
52 PN_stdfloat _slider;
53 };
54
55 PipelineCycler<CData> _cycler;
56 typedef CycleDataReader<CData> CDReader;
57 typedef CycleDataWriter<CData> CDWriter;
58
59 public:
60 static void register_with_read_factory();
61 virtual void write_datagram(BamWriter *manager, Datagram &dg);
62
63 protected:
64 static TypedWritable *make_from_bam(const FactoryParams &params);
65 void fillin(DatagramIterator &scan, BamReader *manager);
66
67 public:
68 static TypeHandle get_class_type() {
69 return _type_handle;
70 }
71 static void init_type() {
72 VertexSlider::init_type();
73 register_type(_type_handle, "UserVertexSlider",
74 VertexSlider::get_class_type());
75 }
76 virtual TypeHandle get_type() const {
77 return get_class_type();
78 }
79 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
80
81 private:
82 static TypeHandle _type_handle;
83};
84
85#include "userVertexSlider.I"
86
87#endif
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition cycleDataReader.h:35
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition cycleDataWriter.h:34
CycleData
A single page of data maintained by a PipelineCycler.
Definition cycleData.h:50
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition datagramIterator.h:30
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
InternalName
Encodes a string name in a hash table, mapping it to a pointer.
Definition internalName.h:38
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
UserVertexSlider::set_slider
void set_slider(PN_stdfloat slider)
Stores the indicated slider value.
Definition userVertexSlider.I:18
UserVertexSlider::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type UserVertexSlider.
Definition userVertexSlider.cxx:59
UserVertexSlider::get_slider
virtual PN_stdfloat get_slider() const
Returns the current slider value.
Definition userVertexSlider.cxx:42
UserVertexSlider::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition userVertexSlider.cxx:68
cycleDataReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleDataWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pipelineCycler.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PipelineCycler
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
Definition pipelineCycler.h:46
userVertexSlider.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
vertexSlider.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.