mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
early-out on empty Geoms
This commit is contained in:
parent
0c56b38f6a
commit
b706a17f25
@ -91,6 +91,19 @@ get_vertex_data(Thread *current_thread) const {
|
||||
return cdata->_data.get_read_pointer();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Geom::is_empty
|
||||
// Access: Published
|
||||
// Description: Returns true if there appear to be no vertices to be
|
||||
// rendered by this Geom, false if has some actual data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool Geom::
|
||||
is_empty() const {
|
||||
CDReader cdata(_cycler);
|
||||
return (cdata->_data.get_read_pointer()->get_num_rows() == 0 ||
|
||||
cdata->_primitives.empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Geom::get_num_primitives
|
||||
// Access: Published
|
||||
|
@ -89,6 +89,8 @@ PUBLISHED:
|
||||
void offset_vertices(const GeomVertexData *data, int offset);
|
||||
int make_nonindexed(bool composite_only);
|
||||
|
||||
INLINE bool is_empty() const;
|
||||
|
||||
INLINE int get_num_primitives() const;
|
||||
INLINE CPT(GeomPrimitive) get_primitive(int i) const;
|
||||
INLINE PT(GeomPrimitive) modify_primitive(int i);
|
||||
|
@ -266,6 +266,9 @@ traverse_below(CullTraverserData &data) {
|
||||
|
||||
for (int i = 0; i < num_geoms; i++) {
|
||||
const Geom *geom = geoms.get_geom(i);
|
||||
if (geom->is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CPT(RenderState) state = data._state->compose(geoms.get_geom_state(i));
|
||||
if (state->has_cull_callback() && !state->cull_callback(this, data)) {
|
||||
@ -730,6 +733,9 @@ start_decal(const CullTraverserData &data) {
|
||||
|
||||
for (int i = num_geoms - 1; i >= 0; i--) {
|
||||
const Geom *geom = geoms.get_geom(i);
|
||||
if (geom->is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CPT(RenderState) state = data._state->compose(geoms.get_geom_state(i));
|
||||
if (state->has_cull_callback() && !state->cull_callback(this, data)) {
|
||||
@ -839,6 +845,9 @@ r_get_decals(CullTraverserData &data, CullableObject *decals) {
|
||||
|
||||
for (int i = num_geoms - 1; i >= 0; i--) {
|
||||
const Geom *geom = geoms.get_geom(i);
|
||||
if (geom->is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CPT(RenderState) state = data._state->compose(geoms.get_geom_state(i));
|
||||
if (state->has_cull_callback() && !state->cull_callback(this, data)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user