Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions
LightRampAttrib Class Reference

A Light Ramp is any unary operator that takes a rendered pixel as input, and adjusts the brightness of that pixel. More...

#include "lightRampAttrib.h"

Inheritance diagram for LightRampAttrib:
RenderAttrib TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Types

enum  LightRampMode {
  LRT_default, LRT_identity, LRT_single_threshold, LRT_double_threshold,
  LRT_hdr0, LRT_hdr1, LRT_hdr2
}

Public Member Functions

virtual TypeHandle force_init_type ()
PN_stdfloat get_level (int n) const
 Returns the nth lighting level.
LightRampMode get_mode () const
 Returns the LightRampAttrib mode.
virtual int get_slot () const
PN_stdfloat get_threshold (int n) const
 Returns the nth threshold level.
virtual TypeHandle get_type () const
virtual void output (ostream &out) const
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 Public Member Functions

static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make_identity()
static CPT (RenderAttrib) make_single_threshold(PN_stdfloat thresh0
static CPT (RenderAttrib) make_double_threshold(PN_stdfloat thresh0
static CPT (RenderAttrib) make_hdr0()
static CPT (RenderAttrib) make_hdr1()
static CPT (RenderAttrib) make_hdr2()
static int get_class_slot ()
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type LightRampAttrib.

Public Attributes

static PN_stdfloat lev0
static PN_stdfloat PN_stdfloat
PN_stdfloat 
lev1
static PN_stdfloat PN_stdfloat thresh1

Protected Member Functions

virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived LightRampAttrib types to return a unique number indicating whether this LightRampAttrib is equivalent to the other one.
virtual CPT (RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new LightRampAttrib.
virtual size_t get_hash_impl () const
 Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type LightRampAttrib is encountered in the Bam file.

Detailed Description

A Light Ramp is any unary operator that takes a rendered pixel as input, and adjusts the brightness of that pixel.

For example, gamma correction is a kind of light ramp. So is HDR tone mapping. So is cartoon shading. See the constructors for an explanation of each kind of ramp.

Definition at line 32 of file lightRampAttrib.h.


Member Function Documentation

int LightRampAttrib::compare_to_impl ( const RenderAttrib other) const [protected, virtual]

Intended to be overridden by derived LightRampAttrib types to return a unique number indicating whether this LightRampAttrib is equivalent to the other one.

This should return 0 if the two LightRampAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.

This will only be called with two LightRampAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 243 of file lightRampAttrib.cxx.

void LightRampAttrib::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new LightRampAttrib.

Reimplemented from RenderAttrib.

Definition at line 353 of file lightRampAttrib.cxx.

References DatagramIterator::get_int8(), and DatagramIterator::get_stdfloat().

Referenced by make_from_bam().

size_t LightRampAttrib::get_hash_impl ( ) const [protected, virtual]

Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.

Reimplemented from RenderAttrib.

Definition at line 274 of file lightRampAttrib.cxx.

References integer_hash< Key, Compare >::add_hash(), and floating_point_hash< Key >::add_hash().

PN_stdfloat LightRampAttrib::get_level ( int  n) const [inline]

Returns the nth lighting level.

Definition at line 47 of file lightRampAttrib.I.

LightRampAttrib::LightRampMode LightRampAttrib::get_mode ( ) const [inline]

Returns the LightRampAttrib mode.

Definition at line 37 of file lightRampAttrib.I.

Referenced by ShaderGenerator::analyze_renderstate().

PN_stdfloat LightRampAttrib::get_threshold ( int  n) const [inline]

Returns the nth threshold level.

Definition at line 58 of file lightRampAttrib.I.

TypedWritable * LightRampAttrib::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type LightRampAttrib is encountered in the Bam file.

It should create the LightRampAttrib and extract its information from the file.

Definition at line 334 of file lightRampAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

Tells the BamReader how to create objects of type LightRampAttrib.

Definition at line 302 of file lightRampAttrib.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void LightRampAttrib::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from RenderAttrib.

Definition at line 313 of file lightRampAttrib.cxx.

References Datagram::add_int8(), and Datagram::add_stdfloat().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations