Panda3D
Loading...
Searching...
No Matches
occluderEffect.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 occluderEffect.h
10 * @author drose
11 * @date 2011-03-17
12 */
13
14#ifndef OCCLUDEREFFECT_H
15#define OCCLUDEREFFECT_H
16
17#include "pandabase.h"
18
19#include "occluderNode.h"
20#include "renderEffect.h"
21#include "nodePath.h"
22#include "ordered_vector.h"
23#include "pmap.h"
24
25/**
26 * This functions similarly to a LightAttrib or ClipPlaneAttrib. It indicates
27 * the set of occluders that modify the geometry at this level and below.
28 * Unlike a ClipPlaneAttrib, an OccluderEffect takes effect immediately when
29 * it is encountered during traversal, and thus can only add occluders; it may
30 * not remove them.
31 */
32class EXPCL_PANDA_PGRAPH OccluderEffect : public RenderEffect {
33private:
34 INLINE OccluderEffect();
35 INLINE OccluderEffect(const OccluderEffect &copy);
36
37PUBLISHED:
38 static CPT(RenderEffect) make();
39
40 INLINE int get_num_on_occluders() const;
41 INLINE NodePath get_on_occluder(int n) const;
42 MAKE_SEQ(get_on_occluders, get_num_on_occluders, get_on_occluder);
43 INLINE bool has_on_occluder(const NodePath &occluder) const;
44
45 INLINE bool is_identity() const;
46
47 CPT(RenderEffect) add_on_occluder(const NodePath &occluder) const;
48 CPT(RenderEffect) remove_on_occluder(const NodePath &occluder) const;
49
50public:
51 virtual void output(std::ostream &out) const;
52
53protected:
54 virtual int compare_to_impl(const RenderEffect *other) const;
55
56private:
57 void sort_on_occluders();
58
59private:
60 typedef ov_set<NodePath> Occluders;
61 Occluders _on_occluders;
62
63 UpdateSeq _sort_seq;
64
65 static CPT(RenderEffect) _empty_effect;
66
67public:
68 static void register_with_read_factory();
69 virtual void write_datagram(BamWriter *manager, Datagram &dg);
70 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
71 virtual bool require_fully_complete() const;
72
73protected:
74 static TypedWritable *make_from_bam(const FactoryParams &params);
75 void fillin(DatagramIterator &scan, BamReader *manager);
76
77public:
78 static TypeHandle get_class_type() {
79 return _type_handle;
80 }
81 static void init_type() {
82 RenderEffect::init_type();
83 register_type(_type_handle, "OccluderEffect",
84 RenderEffect::get_class_type());
85 }
86 virtual TypeHandle get_type() const {
87 return get_class_type();
88 }
89 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
90
91private:
92 static TypeHandle _type_handle;
93};
94
95#include "occluderEffect.I"
96
97#endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
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...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
bool is_identity() const
Returns true if this is an identity effect: it does not change the set of occluders in use.
ConstPointerTo< RenderEffect > add_on_occluder(const NodePath &occluder) const
Returns a new OccluderEffect, just like this one, but with the indicated occluder added to the list o...
ConstPointerTo< RenderEffect > remove_on_occluder(const NodePath &occluder) const
Returns a new OccluderEffect, just like this one, but with the indicated occluder removed from the li...
static void register_with_read_factory()
Tells the BamReader how to create objects of type OccluderEffect.
get_num_on_occluders
Returns the number of occluders that are enabled by the effectute.
static ConstPointerTo< RenderEffect > make()
Constructs a new OccluderEffect object that does nothing.
bool has_on_occluder(const NodePath &occluder) const
Returns true if the indicated occluder is enabled by the effect, false otherwise.
get_on_occluder
Returns the nth occluder enabled by the effectute, sorted in render order.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
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
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.