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

RenderModeAttrib Class Reference

Specifies how polygons are to be drawn. More...

#include "renderModeAttrib.h"

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

List of all members.

Public Types

enum  Mode {
  M_unchanged, M_filled, M_wireframe, M_point,
  M_filled_flat
}

Public Member Functions

virtual TypeHandle force_init_type ()
int get_geom_rendering (int geom_rendering) const
 Returns the union of the Geom::GeomRendering bits that will be required once this RenderModeAttrib is applied to a geom which includes the indicated geom_rendering bits.
Mode get_mode () const
 Returns the render mode.
bool get_perspective () const
 Returns the perspective flag.
virtual int get_slot () const
PN_stdfloat get_thickness () const
 Returns the line width or point thickness.
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(Mode mode
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 RenderModeAttrib.

Public Attributes

static PN_stdfloat bool perspective = false)
static PN_stdfloat thickness = 1.0f

Protected Member Functions

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

Detailed Description

Specifies how polygons are to be drawn.

Definition at line 29 of file renderModeAttrib.h.


Member Function Documentation

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

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

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

Reimplemented from RenderAttrib.

Definition at line 121 of file renderModeAttrib.cxx.

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

Reimplemented from RenderAttrib.

Definition at line 240 of file renderModeAttrib.cxx.

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

Referenced by make_from_bam().

int RenderModeAttrib::get_geom_rendering ( int  geom_rendering) const [inline]

Returns the union of the Geom::GeomRendering bits that will be required once this RenderModeAttrib is applied to a geom which includes the indicated geom_rendering bits.

Definition at line 80 of file renderModeAttrib.I.

Referenced by RenderState::get_geom_rendering().

size_t RenderModeAttrib::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 147 of file renderModeAttrib.cxx.

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

RenderModeAttrib::Mode RenderModeAttrib::get_mode ( ) const [inline]

Returns the render mode.

Definition at line 37 of file renderModeAttrib.I.

Referenced by NodePath::get_render_mode().

bool RenderModeAttrib::get_perspective ( ) const [inline]

Returns the perspective flag.

When this is true, the point thickness represented by get_thickness() is actually a width in 3-d units, and the points should scale according to perspective. When it is false, the default, the point thickness is actually a width in pixels, and points are a uniform size regardless of distance from the camera.

Definition at line 67 of file renderModeAttrib.I.

Referenced by NodePath::get_render_mode_perspective().

PN_stdfloat RenderModeAttrib::get_thickness ( ) const [inline]

Returns the line width or point thickness.

This is only relevant when rendering points or lines, such as when the mode is M_wireframe or M_point (or when rendering actual points or lines primitives in M_polygon mode).

Definition at line 51 of file renderModeAttrib.I.

Referenced by NodePath::get_render_mode_thickness().

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

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

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

Definition at line 221 of file renderModeAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

void RenderModeAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type RenderModeAttrib.

Definition at line 193 of file renderModeAttrib.cxx.

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

void RenderModeAttrib::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 204 of file renderModeAttrib.cxx.

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


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