Panda3D
 All Classes Functions Variables Enumerations
fogAttrib.h
1 // Filename: fogAttrib.h
2 // Created by: drose (14Mar02)
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 FOGATTRIB_H
16 #define FOGATTRIB_H
17 
18 #include "pandabase.h"
19 
20 #include "renderAttrib.h"
21 #include "fog.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : FogAttrib
25 // Description : Applies a Fog to the geometry at and below this node.
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDA_PGRAPH FogAttrib : public RenderAttrib {
28 private:
29  INLINE FogAttrib();
30 
31 PUBLISHED:
32  static CPT(RenderAttrib) make(Fog *fog);
33  static CPT(RenderAttrib) make_off();
34  static CPT(RenderAttrib) make_default();
35 
36  INLINE bool is_off() const;
37  INLINE Fog *get_fog() const;
38 
39 public:
40  virtual void output(ostream &out) const;
41 
42 protected:
43  virtual int compare_to_impl(const RenderAttrib *other) const;
44  virtual size_t get_hash_impl() const;
45  virtual CPT(RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const;
46 
47 private:
48  PT(Fog) _fog;
49 
50 PUBLISHED:
51  static int get_class_slot() {
52  return _attrib_slot;
53  }
54  virtual int get_slot() const {
55  return get_class_slot();
56  }
57 
58 public:
59  static void register_with_read_factory();
60  virtual void write_datagram(BamWriter *manager, Datagram &dg);
61  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
62 
63 protected:
64  static TypedWritable *make_from_bam(const FactoryParams &params);
65  void fillin(DatagramIterator &scan, BamReader *manager);
66 
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  RenderAttrib::init_type();
73  register_type(_type_handle, "FogAttrib",
74  RenderAttrib::get_class_type());
75  _attrib_slot = register_slot(_type_handle, 100, make_default);
76  }
77  virtual TypeHandle get_type() const {
78  return get_class_type();
79  }
80  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
81 
82 private:
83  static TypeHandle _type_handle;
84  static int _attrib_slot;
85 };
86 
87 #include "fogAttrib.I"
88 
89 #endif
90 
static int register_slot(TypeHandle type_handle, int sort, RenderAttribRegistry::MakeDefaultFunc *make_default_func)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
Definition: renderAttrib.I:163
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
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
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is our own Panda specialization on the default STL list.
Definition: plist.h:38
Applies a Fog to the geometry at and below this node.
Definition: fogAttrib.h:27
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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()...
Specifies how atmospheric fog effects are applied to geometry.
Definition: fog.h:46
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
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43