15 #include "eggPolysetMaker.h"
16 #include "eggPolygon.h"
42 _properties = properties;
51 get_bin_number(
const EggNode *node) {
52 if (node->
is_of_type(EggPolygon::get_class_type())) {
53 return (
int)BN_polyset;
67 nassertr((BinNumber)bin_number == BN_polyset,
false);
72 if ((_properties & (P_has_texture | P_texture)) != 0) {
75 if (a_has_texture != b_has_texture) {
76 return ((
int)a_has_texture < (int)b_has_texture);
79 if ((_properties & (P_texture)) != 0) {
81 for (
int i = 0; i < num_textures; i++) {
84 if (a_texture != b_texture) {
85 return (a_texture->
sorts_less_than(*b_texture, ~EggTexture::E_tref_name));
92 if ((_properties & (P_has_material | P_material)) != 0) {
97 if ((_properties & (P_material)) != 0) {
102 if ((_properties & (P_has_poly_color)) != 0) {
103 if (pa->has_color() != pb->has_color()) {
104 return ((
int)pa->has_color() < (int)pb->has_color());
107 if ((_properties & (P_poly_color)) != 0) {
112 if ((_properties & (P_has_poly_normal)) != 0) {
113 if (pa->has_normal() != pb->has_normal()) {
114 return ((
int)pa->has_normal() < (int)pb->has_normal());
117 if ((_properties & (P_has_vertex_normal)) != 0) {
120 if (pa_has_normal != pb_has_normal) {
121 return ((
int)pa_has_normal < (
int)pb_has_normal);
124 if ((_properties & (P_has_vertex_color)) != 0) {
127 if (pa_has_color != pb_has_color) {
128 return ((
int)pa_has_color < (
int)pb_has_color);
131 if ((_properties & (P_bface)) != 0) {
void set_properties(int properties)
Sets the set of properties that determines which polygons are allowed to be grouped together into a s...
LColor get_color() const
Returns the color set on this particular attribute.
bool sorts_less_than(const EggMaterial &other, int eq) const
An ordering operator to compare two materials for sorting order.
bool get_bface_flag() const
Retrieves the backfacing flag of the polygon.
Defines a texture map that may be applied to geometry.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
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...
EggTexture * get_texture() const
Returns the first texture on the primitive, if any, or NULL if there are no textures on the primitive...
bool has_vertex_color() const
Returns true if any vertex on the primitive has a specific color set, false otherwise.
bool has_vertex_normal() const
Returns true if any vertex on the primitive has a specific normal set, false otherwise.
EggMaterial * get_material() const
Returns a pointer to the applied material, or NULL if there is no material applied.
bool sorts_less_than(const EggTexture &other, int eq) const
An ordering operator to compare two textures for sorting order.
int get_num_textures() const
Returns the number of textures applied to the primitive.
bool has_material() const
Returns true if the primitive is materiald (and get_material() will return a real pointer)...
A base class for things that may be directly added into the egg hierarchy.
TypeHandle is the identifier used to differentiate C++ class types.