Panda3D
|
A specialization on EggBinMaker for making polysets that share the same basic rendering characteristic. More...
#include "eggPolysetMaker.h"
Public Types | |
enum | BinNumber { BN_none = 0, BN_polyset } |
enum | Properties { P_has_texture = 0x001, P_texture = 0x002, P_has_material = 0x004, P_material = 0x008, P_has_poly_color = 0x010, P_poly_color = 0x020, P_has_poly_normal = 0x040, P_has_vertex_normal = 0x080, P_has_vertex_color = 0x100, P_bface = 0x200 } |
Public Member Functions | |
virtual TypeHandle | force_init_type () |
virtual int | get_bin_number (const EggNode *node) |
virtual TypeHandle | get_type () const |
void | set_properties (int properties) |
Sets the set of properties that determines which polygons are allowed to be grouped together into a single polyset. | |
virtual bool | sorts_less (int bin_number, const EggNode *a, const EggNode *b) |
May be overridden in derived classes to create additional bins within a particular bin number, based on some arbitrary property of nodes. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
A specialization on EggBinMaker for making polysets that share the same basic rendering characteristic.
This really just defines the example functions described in the leading comment to EggBinMaker.
It makes some common assumptions about how polysets should be grouped; if these are not sufficient, you can always rederive your own further specialization of this class.
Definition at line 36 of file eggPolysetMaker.h.
static void EggPolysetMaker::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from EggBinMaker.
Definition at line 75 of file eggPolysetMaker.h.
References EggBinMaker::init_type().
void EggPolysetMaker::set_properties | ( | int | properties | ) |
Sets the set of properties that determines which polygons are allowed to be grouped together into a single polyset.
This is the bitwise 'or' of all the properties that matter. If this is 0, all polygons (within a given group) will be lumped into a common polyset regardless of their properties.
Definition at line 41 of file eggPolysetMaker.cxx.
bool EggPolysetMaker::sorts_less | ( | int | bin_number, |
const EggNode * | a, | ||
const EggNode * | b | ||
) | [virtual] |
May be overridden in derived classes to create additional bins within a particular bin number, based on some arbitrary property of nodes.
This function establishes an arbitrary but fixed ordering between nodes; if two nodes do not sort to the same position, different bins are created for each one (with the same bin number on each bin).
Reimplemented from EggBinMaker.
Definition at line 66 of file eggPolysetMaker.cxx.
References EggPrimitive::get_bface_flag(), EggAttributes::get_color(), EggPrimitive::get_material(), EggPrimitive::get_num_textures(), EggPrimitive::get_texture(), EggPrimitive::has_material(), EggPrimitive::has_vertex_color(), EggPrimitive::has_vertex_normal(), EggMaterial::sorts_less_than(), and EggTexture::sorts_less_than().