Panda3D

Loading...
Searching...
No Matches
depthWriteAttrib.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 depthWriteAttrib.h
10 * @author drose
11 * @date 2002-03-04
12 */
13
14#ifndef DEPTHWRITEATTRIB_H
15#define DEPTHWRITEATTRIB_H
16
17#include "pandabase.h"
18
19#include "renderAttrib.h"
20
21 class FactoryParams;
22
23/**
24 * Enables or disables writing to the depth buffer.
25 */
26 class EXPCL_PANDA_PGRAPH DepthWriteAttrib : public RenderAttrib {
27PUBLISHED:
28 enum Mode {
29 M_off,
30 M_on
31 };
32
33 private:
34 INLINE DepthWriteAttrib(Mode mode = M_on);
35
36PUBLISHED:
37 static CPT(RenderAttrib) make(Mode mode);
38 static CPT(RenderAttrib) make_default();
39
40 INLINE Mode get_mode() const;
41
42PUBLISHED:
43 MAKE_PROPERTY(mode, get_mode);
44
45 public:
46 virtual void output(std::ostream &out) const;
47
48 protected:
49 virtual int compare_to_impl(const RenderAttrib *other) const;
50 virtual size_t get_hash_impl() const;
51
52 private:
53 Mode _mode;
54
55PUBLISHED:
56 static int get_class_slot() {
57 return _attrib_slot;
58 }
59 virtual int get_slot() const {
60 return get_class_slot();
61 }
62 MAKE_PROPERTY(class_slot, get_class_slot);
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 RenderAttrib::init_type();
78 register_type(_type_handle, "DepthWriteAttrib",
79 RenderAttrib::get_class_type());
80 _attrib_slot = register_slot(_type_handle, 100, new DepthWriteAttrib);
81 }
82 virtual TypeHandle get_type() const {
83 return get_class_type();
84 }
85 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
86
87 private:
88 static TypeHandle _type_handle;
89 static int _attrib_slot;
90};
91
92#include "depthWriteAttrib.I"
93
94#endif
DepthWriteAttrib::make
static ConstPointerTo< RenderAttrib > make(Mode mode)
Constructs a new DepthWriteAttrib object.
Definition depthWriteAttrib.cxx:29
DepthWriteAttrib::make_default
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
Definition depthWriteAttrib.cxx:39
DepthWriteAttrib::get_mode
get_mode
Returns the depth write mode.
Definition depthWriteAttrib.h:43
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::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
depthWriteAttrib.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.