Panda3D

auxBitplaneAttrib.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 auxBitplaneAttrib.h
10 * @author drose
11 * @date 2002-03-04
12 */
13
14 #ifndef AUXBITPLANEATTRIB_H
15 #define AUXBITPLANEATTRIB_H
16
17 #include "pandabase.h"
18 #include "renderAttrib.h"
19
20 class FactoryParams;
21
22 /**
23 * Modern frame buffers can have 'aux' bitplanes, which are additional
24 * bitplanes above and beyond the standard depth and color. This attrib
25 * controls what gets rendered into those additional bitplanes. It can also
26 * affect what goes into the alpha channel of the primary color buffer.
27 *
28 * ABO_glow: copy the glow map into the alpha channel of the primary frame
29 * buffer. If there is no glow map, set it to zero. Caveat: it is not
30 * possible to write glow or depth values to the framebuffer alpha channel at
31 * the same time as using alpha blending or alpha testing. Any attempt to use
32 * transparency, blending, or alpha testing will cause this flag to be
33 * overridden.
34 *
35 * ABO_aux_normal: put the camera-space normal into the into the R,G
36 * components of the first auxiliary bitplane.
37 *
38 * ABO_aux_modelz: put the clip-space Z coordinate of the center of the model
39 * (after perspective divide) into the B channel of the first auxiliary
40 * bitplane.
41 *
42 * ABO_aux_glow: put a copy of the glow map into the alpha channel of the
43 * first auxiliary bitplane. If there is no glow map, set it to zero.
44 *
45 * AuxBitplaneAttrib is relevant only when shader generation is enabled.
46 * Otherwise, it has no effect.
47 *
48 */
49 class EXPCL_PANDA_PGRAPH AuxBitplaneAttrib : public RenderAttrib {
50 private:
51 INLINE AuxBitplaneAttrib(int outputs);
52
53 PUBLISHED:
54 enum AuxBitplaneOutput {
55 ABO_glow = 1,
56
57 ABO_aux_normal = 2,
58 ABO_aux_glow = 4,
59 };
60 static CPT(RenderAttrib) make();
61 static CPT(RenderAttrib) make(int outputs);
62 static CPT(RenderAttrib) make_default();
63
64 INLINE int get_outputs() const;
65
66 PUBLISHED:
67 MAKE_PROPERTY(outputs, get_outputs);
68
69 public:
70 virtual void output(std::ostream &out) const;
71
72 protected:
73 virtual int compare_to_impl(const RenderAttrib *other) const;
74 virtual size_t get_hash_impl() const;
75
76 private:
77 int _outputs;
78
79 static CPT(RenderAttrib) _default;
80
81 PUBLISHED:
82 static int get_class_slot() {
83 return _attrib_slot;
84 }
85 virtual int get_slot() const {
86 return get_class_slot();
87 }
88 MAKE_PROPERTY(class_slot, get_class_slot);
89
90 public:
91 static void register_with_read_factory();
92 virtual void write_datagram(BamWriter *manager, Datagram &dg);
93
94 protected:
95 static TypedWritable *make_from_bam(const FactoryParams &params);
96 void fillin(DatagramIterator &scan, BamReader *manager);
97
98 public:
99 static TypeHandle get_class_type() {
100 return _type_handle;
101 }
102 static void init_type() {
103 RenderAttrib::init_type();
104 register_type(_type_handle, "AuxBitplaneAttrib",
105 RenderAttrib::get_class_type());
106 _attrib_slot = register_slot(_type_handle, 100, new AuxBitplaneAttrib(0));
107 }
108 virtual TypeHandle get_type() const {
109 return get_class_type();
110 }
111 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
112
113 private:
114 static TypeHandle _type_handle;
115 static int _attrib_slot;
116 };
117
118 #include "auxBitplaneAttrib.I"
119
120 #endif
auxBitplaneAttrib.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AuxBitplaneAttrib
Modern frame buffers can have 'aux' bitplanes, which are additional bitplanes above and beyond the st...
Definition: auxBitplaneAttrib.h:49
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
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
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
RenderAttrib
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
RenderAttrib::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: renderAttrib.cxx:527
RenderAttrib::register_slot
static int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
Definition: renderAttrib.I:101
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
pandabase.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
renderAttrib.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.