Panda3D
fadeLodNode.h
1 // Filename: fadeLodNode.h
2 // Created by: sshodhan (14Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FADELODNODE_H
16 #define FADELODNODE_H
17 
18 #include "pandabase.h"
19 
20 #include "lodNode.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : FadeLODNode
24 // Description : A Level-of-Detail node with alpha based switching.
25 ////////////////////////////////////////////////////////////////////
26 class EXPCL_PANDA_PGRAPHNODES FadeLODNode : public LODNode {
27 PUBLISHED:
28  FadeLODNode(const string &name);
29 
30 protected:
31  FadeLODNode(const FadeLODNode &copy);
32 public:
33  virtual PandaNode *make_copy() const;
34  virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
35  virtual void output(ostream &out) const;
36 
37 PUBLISHED:
38  INLINE void set_fade_time(PN_stdfloat t);
39  INLINE PN_stdfloat get_fade_time() const;
40 
41  void set_fade_bin(const string &name, int draw_order);
42  INLINE const string &get_fade_bin_name() const;
43  INLINE int get_fade_bin_draw_order() const;
44 
45  void set_fade_state_override(int override);
46  INLINE int get_fade_state_override() const;
47 
48 private:
49  CPT(RenderState) get_fade_1_old_state();
50  CPT(RenderState) get_fade_1_new_state(PN_stdfloat in_alpha);
51  CPT(RenderState) get_fade_2_old_state(PN_stdfloat out_alpha);
52  CPT(RenderState) get_fade_2_new_state();
53 
54 private:
55  PN_stdfloat _fade_time;
56  string _fade_bin_name;
57  int _fade_bin_draw_order;
58  int _fade_state_override;
59 
60  CPT(RenderState) _fade_1_new_state;
61  CPT(RenderState) _fade_1_old_state;
62  CPT(RenderState) _fade_2_new_state;
63  CPT(RenderState) _fade_2_old_state;
64 
65 public:
66  static void register_with_read_factory();
67  virtual void write_datagram(BamWriter *manager, Datagram &dg);
68 
69 protected:
70  static TypedWritable *make_from_bam(const FactoryParams &params);
71  void fillin(DatagramIterator &scan, BamReader *manager);
72 
73 public:
74  static TypeHandle get_class_type() {
75  return _type_handle;
76  }
77  static void init_type() {
78  LODNode::init_type();
79  register_type(_type_handle, "FadeLODNode",
80  LODNode::get_class_type());
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 };
90 
91 #include "fadeLodNode.I"
92 
93 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
Definition: lodNode.cxx:75
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
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:160
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
static void register_with_read_factory()
Tells the BamReader how to create objects of type LODNode.
Definition: lodNode.cxx:762
A Level-of-Detail node with alpha based switching.
Definition: fadeLodNode.h:26
A Level-of-Detail node.
Definition: lodNode.h:31
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
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:773
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48