Panda3D
fadeLodNode.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 fadeLodNode.h
10 * @author sshodhan
11 * @date 2004-06-14
12 */
13
14#ifndef FADELODNODE_H
15#define FADELODNODE_H
16
17#include "pandabase.h"
18
19#include "lodNode.h"
20
21/**
22 * A Level-of-Detail node with alpha based switching.
23 */
24class EXPCL_PANDA_PGRAPHNODES FadeLODNode : public LODNode {
25PUBLISHED:
26 explicit FadeLODNode(const std::string &name);
27
28protected:
29 FadeLODNode(const FadeLODNode &copy);
30public:
31 virtual PandaNode *make_copy() const;
32 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
33 virtual void output(std::ostream &out) const;
34
35PUBLISHED:
36 INLINE void set_fade_time(PN_stdfloat t);
37 INLINE PN_stdfloat get_fade_time() const;
38 MAKE_PROPERTY(fade_time, get_fade_time, set_fade_time);
39
40 void set_fade_bin(const std::string &name, int draw_order);
41 INLINE const std::string &get_fade_bin_name() const;
42 INLINE int get_fade_bin_draw_order() const;
43 MAKE_PROPERTY(fade_bin_name, get_fade_bin_name);
44 MAKE_PROPERTY(fade_bin_draw_order, get_fade_bin_draw_order);
45
46 void set_fade_state_override(int override);
47 INLINE int get_fade_state_override() const;
48 MAKE_PROPERTY(fade_state_override, get_fade_state_override,
49 set_fade_state_override);
50
51private:
52 CPT(RenderState) get_fade_1_old_state();
53 CPT(RenderState) get_fade_1_new_state(PN_stdfloat in_alpha);
54 CPT(RenderState) get_fade_2_old_state(PN_stdfloat out_alpha);
55 CPT(RenderState) get_fade_2_new_state();
56
57private:
58 PN_stdfloat _fade_time;
59 std::string _fade_bin_name;
60 int _fade_bin_draw_order;
61 int _fade_state_override;
62
63 CPT(RenderState) _fade_1_new_state;
64 CPT(RenderState) _fade_1_old_state;
65 CPT(RenderState) _fade_2_new_state;
66 CPT(RenderState) _fade_2_old_state;
67
68public:
69 static void register_with_read_factory();
70 virtual void write_datagram(BamWriter *manager, Datagram &dg);
71
72protected:
73 static TypedWritable *make_from_bam(const FactoryParams &params);
74 void fillin(DatagramIterator &scan, BamReader *manager);
75
76public:
77 static TypeHandle get_class_type() {
78 return _type_handle;
79 }
80 static void init_type() {
81 LODNode::init_type();
82 register_type(_type_handle, "FadeLODNode",
83 LODNode::get_class_type());
84 }
85 virtual TypeHandle get_type() const {
86 return get_class_type();
87 }
88 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
89
90private:
91 static TypeHandle _type_handle;
92};
93
94#include "fadeLodNode.I"
95
96#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 collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition: cullTraverser.h:45
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...
Definition: factoryParams.h:36
A Level-of-Detail node with alpha based switching.
Definition: fadeLodNode.h:24
A Level-of-Detail node.
Definition: lodNode.h:28
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
Definition: lodNode.cxx:136
static void register_with_read_factory()
Tells the BamReader how to create objects of type LODNode.
Definition: lodNode.cxx:682
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
Definition: lodNode.cxx:69
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: lodNode.cxx:691
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:47
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.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.
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