mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
pgraph: minor optimizations to GeomNode::add_for_draw()
This commit is contained in:
parent
26ba2b15cd
commit
d64944c108
@ -507,8 +507,10 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
|
|||||||
<< " draw_mask = " << data._draw_mask << "\n";
|
<< " draw_mask = " << data._draw_mask << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thread *current_thread = trav->get_current_thread();
|
||||||
|
|
||||||
// Get all the Geoms, with no decalling.
|
// Get all the Geoms, with no decalling.
|
||||||
Geoms geoms = get_geoms(trav->get_current_thread());
|
Geoms geoms = get_geoms(current_thread);
|
||||||
int num_geoms = geoms.get_num_geoms();
|
int num_geoms = geoms.get_num_geoms();
|
||||||
trav->_geoms_pcollector.add_level(num_geoms);
|
trav->_geoms_pcollector.add_level(num_geoms);
|
||||||
CPT(TransformState) internal_transform = data.get_internal_transform(trav);
|
CPT(TransformState) internal_transform = data.get_internal_transform(trav);
|
||||||
@ -532,9 +534,9 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
|
|||||||
if (num_geoms > 1) {
|
if (num_geoms > 1) {
|
||||||
if (data._view_frustum != nullptr) {
|
if (data._view_frustum != nullptr) {
|
||||||
// Cull the individual Geom against the view frustum.
|
// Cull the individual Geom against the view frustum.
|
||||||
CPT(BoundingVolume) geom_volume = geom->get_bounds();
|
CPT(BoundingVolume) geom_volume = geom->get_bounds(current_thread);
|
||||||
const GeometricBoundingVolume *geom_gbv =
|
const GeometricBoundingVolume *geom_gbv =
|
||||||
DCAST(GeometricBoundingVolume, geom_volume);
|
geom_volume->as_geometric_bounding_volume();
|
||||||
|
|
||||||
int result = data._view_frustum->contains(geom_gbv);
|
int result = data._view_frustum->contains(geom_gbv);
|
||||||
if (result == BoundingVolume::IF_no_intersection) {
|
if (result == BoundingVolume::IF_no_intersection) {
|
||||||
@ -544,9 +546,9 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
|
|||||||
}
|
}
|
||||||
if (!data._cull_planes->is_empty()) {
|
if (!data._cull_planes->is_empty()) {
|
||||||
// Also cull the Geom against the cull planes.
|
// Also cull the Geom against the cull planes.
|
||||||
CPT(BoundingVolume) geom_volume = geom->get_bounds();
|
CPT(BoundingVolume) geom_volume = geom->get_bounds(current_thread);
|
||||||
const GeometricBoundingVolume *geom_gbv =
|
const GeometricBoundingVolume *geom_gbv =
|
||||||
DCAST(GeometricBoundingVolume, geom_volume);
|
geom_volume->as_geometric_bounding_volume();
|
||||||
int result;
|
int result;
|
||||||
data._cull_planes->do_cull(result, state, geom_gbv);
|
data._cull_planes->do_cull(result, state, geom_gbv);
|
||||||
if (result == BoundingVolume::IF_no_intersection) {
|
if (result == BoundingVolume::IF_no_intersection) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user