Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions

StencilAttrib Class Reference

A StencilAttrib is a collection of all stencil render states. More...

#include "stencilAttrib.h"

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

List of all members.

Public Types

enum  StencilComparisonFunction {
  SCF_never, SCF_less_than, SCF_equal, SCF_less_than_or_equal,
  SCF_greater_than, SCF_not_equal, SCF_greater_than_or_equal, SCF_always
}
enum  StencilMask { SM_default = ~0 }
enum  StencilOperation {
  SO_keep, SO_zero, SO_replace, SO_increment,
  SO_decrement, SO_invert, SO_increment_saturate, SO_decrement_saturate
}
enum  StencilRenderState {
  SRS_front_enable, SRS_back_enable, SRS_front_comparison_function, SRS_front_stencil_fail_operation,
  SRS_front_stencil_pass_z_fail_operation, SRS_front_stencil_pass_z_pass_operation, SRS_reference, SRS_read_mask,
  SRS_write_mask, SRS_back_comparison_function, SRS_back_stencil_fail_operation, SRS_back_stencil_pass_z_fail_operation,
  SRS_back_stencil_pass_z_pass_operation, SRS_clear, SRS_clear_value, SRS_total,
  SRS_first = 0
}

Public Member Functions

virtual TypeHandle force_init_type ()
unsigned int get_render_state (unsigned int render_state_identifier) const
 Returns render state.
virtual int get_slot () const
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_off()
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make_2_sided(unsigned int front_enable
static CPT (RenderAttrib) make_with_clear(unsigned int front_enable
static CPT (RenderAttrib) make(unsigned int front_enable
static CPT (RenderAttrib) make_2_sided_with_clear(unsigned int front_enable
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 StencilAttrib.

Public Attributes

static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int 
back_comparison_function
static unsigned int back_enable
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int 
back_stencil_fail_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int 
back_stencil_pass_z_fail_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int 
back_stencil_pass_z_pass_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int 
clear
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int 
clear
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int 
clear_value
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int
unsigned int 
clear_value
static unsigned int front_comparison_function
static unsigned int unsigned int front_comparison_function
static unsigned int unsigned
int unsigned int unsigned int 
front_stencil_pass_z_pass_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int 
front_stencil_pass_z_pass_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int 
read_mask
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int 
read_mask
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int 
reference
static unsigned int unsigned
int unsigned int unsigned int
unsigned int 
reference
static unsigned int unsigned int stencil_fail_operation
static unsigned int unsigned
int unsigned int 
stencil_fail_operation
static unsigned int unsigned
int unsigned int unsigned int 
stencil_pass_z_fail_operation
static unsigned int unsigned
int unsigned int 
stencil_pass_z_fail_operation
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int 
write_mask
static unsigned int unsigned
int unsigned int unsigned int
unsigned int unsigned int
unsigned int unsigned int 
write_mask

Static Public Attributes

static const char * stencil_render_state_name_array [SRS_total]

Protected Member Functions

virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived StencilAttrib types to return a unique number indicating whether this StencilAttrib is equivalent to the other one.
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 StencilAttrib.
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 StencilAttrib is encountered in the Bam file.

Detailed Description

A StencilAttrib is a collection of all stencil render states.

The render states in a StencilAttrib are read-only. A StencilAttrib is created with make or make_2_sided. To determine if two sided stencil is supported, call the function GraphicsStateGuardian:: get_supports_two_sided_stencil.

Definition at line 32 of file stencilAttrib.h.


Member Function Documentation

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

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

This should return 0 if the two StencilAttrib 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 StencilAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 310 of file stencilAttrib.cxx.

void StencilAttrib::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 StencilAttrib.

Reimplemented from RenderAttrib.

Definition at line 405 of file stencilAttrib.cxx.

References DatagramIterator::get_int32().

Referenced by make_from_bam().

size_t StencilAttrib::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 342 of file stencilAttrib.cxx.

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

unsigned int StencilAttrib::get_render_state ( unsigned int  render_state_identifier) const [inline]

Returns render state.

Definition at line 21 of file stencilAttrib.I.

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

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

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

Definition at line 386 of file stencilAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

void StencilAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type StencilAttrib.

Definition at line 357 of file stencilAttrib.cxx.

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

void StencilAttrib::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 368 of file stencilAttrib.cxx.

References Datagram::add_int32().


Member Data Documentation

const char * StencilAttrib::stencil_render_state_name_array [static]
Initial value:
{
  "SRS_front_enable",
  "SRS_back_enable",

  "SRS_front_comparison_function",
  "SRS_front_stencil_fail_operation",
  "SRS_front_stencil_pass_z_fail_operation",
  "SRS_front_stencil_pass_z_pass_operation",

  "SRS_reference",
  "SRS_read_mask",
  "SRS_write_mask",

  "SRS_back_comparison_function",
  "SRS_back_stencil_fail_operation",
  "SRS_back_stencil_pass_z_fail_operation",
  "SRS_back_stencil_pass_z_pass_operation",

  "SRS_clear",
  "SRS_clear_value",
}

Definition at line 156 of file stencilAttrib.h.


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