Panda3D

Loading...
Searching...
No Matches
fogAttrib.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 fogAttrib.h
10 * @author drose
11 * @date 2002-03-14
12 */
13
14#ifndef FOGATTRIB_H
15#define FOGATTRIB_H
16
17#include "pandabase.h"
18
19#include "renderAttrib.h"
20#include "fog.h"
21
22/**
23 * Applies a Fog to the geometry at and below this node.
24 */
25 class EXPCL_PANDA_PGRAPH FogAttrib : public RenderAttrib {
26 private:
27 INLINE FogAttrib();
28
29PUBLISHED:
30 static CPT(RenderAttrib) make(Fog *fog);
31 static CPT(RenderAttrib) make_off();
32 static CPT(RenderAttrib) make_default();
33
34 INLINE bool is_off() const;
35 INLINE Fog *get_fog() const;
36
37PUBLISHED:
38 MAKE_PROPERTY(fog, get_fog);
39
40 public:
41 virtual void output(std::ostream &out) const;
42
43 protected:
44 virtual int compare_to_impl(const RenderAttrib *other) const;
45 virtual size_t get_hash_impl() const;
46
47 private:
48 PT(Fog) _fog;
49
50PUBLISHED:
51 static int get_class_slot() {
52 return _attrib_slot;
53 }
54 virtual int get_slot() const {
55 return get_class_slot();
56 }
57 MAKE_PROPERTY(class_slot, get_class_slot);
58
59 public:
60 static void register_with_read_factory();
61 virtual void write_datagram(BamWriter *manager, Datagram &dg);
62 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
63
64 protected:
65 static TypedWritable *make_from_bam(const FactoryParams &params);
66 void fillin(DatagramIterator &scan, BamReader *manager);
67
68 public:
69 static TypeHandle get_class_type() {
70 return _type_handle;
71 }
72 static void init_type() {
73 RenderAttrib::init_type();
74 register_type(_type_handle, "FogAttrib",
75 RenderAttrib::get_class_type());
76 _attrib_slot = register_slot(_type_handle, 100, new FogAttrib);
77 }
78 virtual TypeHandle get_type() const {
79 return get_class_type();
80 }
81 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
82
83 private:
84 static TypeHandle _type_handle;
85 static int _attrib_slot;
86};
87
88#include "fogAttrib.I"
89
90#endif
FogAttrib::get_fog
get_fog
If the FogAttrib is not an 'off' FogAttrib, returns the fog that is associated.
Definition fogAttrib.h:38
FogAttrib::make
static ConstPointerTo< RenderAttrib > make(Fog *fog)
Constructs a new FogAttrib object suitable for rendering the indicated fog onto geometry.
Definition fogAttrib.cxx:29
FogAttrib::is_off
bool is_off() const
Returns true if the FogAttrib is an 'off' FogAttrib, indicating that it should disable fog.
Definition fogAttrib.I:26
FogAttrib::make_off
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new FogAttrib object suitable for rendering unfogd geometry.
Definition fogAttrib.cxx:48
FogAttrib::make_default
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
Definition fogAttrib.cxx:40
Fog
Specifies how atmospheric fog effects are applied to geometry.
Definition fog.h:41
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
TypedWritable::complete_pointers
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().
Definition typedWritable.cxx:81
fogAttrib.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
fog.h
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.