Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions
ScissorAttrib Class Reference

This restricts rendering to within a rectangular region of the scene, without otherwise affecting the viewport or lens properties. More...

#include "scissorAttrib.h"

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

List of all members.

Public Member Functions

virtual TypeHandle force_init_type ()
const LVecBase4get_frame () const
 Returns the left, right, bottom, top coordinates of the scissor frame.
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(PN_stdfloat left
static CPT (RenderAttrib) make(const LVecBase4 &frame)
static CPT (RenderAttrib) make_default()
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 ScissorAttrib.

Public Attributes

static PN_stdfloat PN_stdfloat bottom
static PN_stdfloat right
static PN_stdfloat PN_stdfloat
PN_stdfloat 
top

Protected Member Functions

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

Detailed Description

This restricts rendering to within a rectangular region of the scene, without otherwise affecting the viewport or lens properties.

Geometry that falls outside the scissor region is not rendered. It is akin to the OpenGL glScissor() function.

The ScissorAttrib always specifies its region relative to its enclosing DisplayRegion, in screen space, and performs no culling.

See ScissorEffect if you wish to define a region relative to 2-D or 3-D coordinates in the scene graph, with culling.

Definition at line 41 of file scissorAttrib.h.


Member Function Documentation

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

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

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

Reimplemented from RenderAttrib.

Definition at line 112 of file scissorAttrib.cxx.

References LVecBase4f::compare_to().

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

Reimplemented from RenderAttrib.

Definition at line 218 of file scissorAttrib.cxx.

References LVecBase4f::read_datagram().

Referenced by make_from_bam().

const LVecBase4 & ScissorAttrib::get_frame ( ) const [inline]

Returns the left, right, bottom, top coordinates of the scissor frame.

This defines a frame within the current DisplayRegion, where 0,0 is the lower-left corner of the DisplayRegion, and 1,1 is the upper-right corner.

Definition at line 39 of file scissorAttrib.I.

Referenced by PGItem::activate_region().

size_t ScissorAttrib::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 129 of file scissorAttrib.cxx.

References LVecBase4f::add_hash().

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

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

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

Definition at line 199 of file scissorAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

Tells the BamReader how to create objects of type ScissorAttrib.

Definition at line 173 of file scissorAttrib.cxx.

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

void ScissorAttrib::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 184 of file scissorAttrib.cxx.

References LVecBase4f::write_datagram().


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