30class EXPCL_PANDA_PGRAPH LightAttrib :
public RenderAttrib {
33 LightAttrib(
const LightAttrib ©);
36 virtual ~LightAttrib();
45 static CPT(RenderAttrib)
make(Operation op,
47 static CPT(RenderAttrib)
make(Operation op,
49 static CPT(RenderAttrib)
make(Operation op,
52 static CPT(RenderAttrib)
make(Operation op,
68 static CPT(RenderAttrib)
make();
100 virtual void output(std::ostream &out)
const;
101 virtual void write(std::ostream &out,
int indent_level)
const;
104 virtual int compare_to_impl(
const RenderAttrib *other)
const;
105 virtual size_t get_hash_impl()
const;
106 virtual CPT(RenderAttrib) compose_impl(
const RenderAttrib *other)
const;
107 virtual CPT(RenderAttrib) invert_compose_impl(
const RenderAttrib *other)
const;
110 INLINE
void check_sorted()
const;
111 void sort_on_lights();
115 Lights _on_lights, _off_lights;
116 bool _off_all_lights;
120 typedef pvector<NodePath> OrderedLights;
121 OrderedLights _sorted_on_lights;
122 size_t _num_non_ambient_lights;
126 static CPT(RenderAttrib) _empty_attrib;
127 static CPT(RenderAttrib) _all_off_attrib;
130 static int get_class_slot() {
133 virtual int get_slot()
const {
134 return get_class_slot();
136 MAKE_PROPERTY(class_slot, get_class_slot);
140 typedef pvector<PT(PandaNode) > NodeList;
159 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
166 static void init_type() {
167 RenderAttrib::init_type();
169 RenderAttrib::get_class_type());
172 virtual TypeHandle get_type()
const {
173 return get_class_type();
175 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
178 static TypeHandle _type_handle;
179 static int _attrib_slot;
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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 ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Indicates which set of lights should be considered "on" to illuminate geometry at this level and belo...
get_off_light
Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order.
LColor get_ambient_contribution() const
Returns the total contribution of all the ambient lights.
static void register_with_read_factory()
Tells the BamReader how to create objects of type LightAttrib.
int get_num_lights() const
Returns the number of lights listed in the attribute.
bool has_all_off() const
Returns true if this attrib turns off all lights (although it may also turn some on).
ConstPointerTo< RenderAttrib > add_light(Light *light) const
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of ligh...
get_num_off_lights
Returns the number of lights that are turned off by the attribute.
NodePath get_most_important_light() const
Returns the most important light (that is, the light with the highest priority) in the LightAttrib,...
ConstPointerTo< RenderAttrib > remove_light(Light *light) const
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of ...
static ConstPointerTo< RenderAttrib > make_all_off()
Constructs a new LightAttrib object that turns off all lights (and hence disables lighting).
static ConstPointerTo< RenderAttrib > make(Operation op, Light *light)
Constructs a new LightAttrib object that turns on (or off, according to op) the indicated light(s).
get_num_on_lights
Returns the number of lights that are turned on by the attribute.
bool has_any_on_light() const
Returns true if any light is turned on by the attrib, false otherwise.
ConstPointerTo< RenderAttrib > add_off_light(const NodePath &light) const
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of ligh...
bool has_off_light(const NodePath &light) const
Returns true if the indicated light is turned off by the attrib, false otherwise.
bool has_light(Light *light) const
Returns true if the indicated light is listed in the attrib, false otherwise.
ConstPointerTo< RenderAttrib > add_on_light(const NodePath &light) const
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of ligh...
bool has_on_light(const NodePath &light) const
Returns true if the indicated light is turned on by the attrib, false otherwise.
ConstPointerTo< RenderAttrib > remove_on_light(const NodePath &light) const
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of ...
bool is_identity() const
Returns true if this is an identity attrib: it does not change the set of lights in use.
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
Operation get_operation() const
Returns the basic operation type of the LightAttrib.
ConstPointerTo< RenderAttrib > replace_off_light(const NodePath &source, const NodePath &dest) const
Returns a new LightAttrib, just like this one, but with the indicated light replaced with the given o...
size_t get_num_non_ambient_lights() const
Returns the number of non-ambient lights that are turned on by this attribute.
ConstPointerTo< RenderAttrib > replace_on_light(const NodePath &source, const NodePath &dest) const
Returns a new LightAttrib, just like this one, but with the indicated light replaced with the given o...
Light * get_light(int n) const
Returns the nth light listed in the attribute.
get_on_light
Returns the nth light turned on by the attribute, sorted in render order.
ConstPointerTo< RenderAttrib > remove_off_light(const NodePath &light) const
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of ...
The abstract interface to all kinds of lights.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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 ...
TypeHandle is the identifier used to differentiate C++ class types.
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.
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.
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.