MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / IsVisible

Method IsVisible

GTE/Graphics/Culler.cpp:63–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63bool Culler::IsVisible(BoundingSphere<float> const& sphere)
64{
65 if (sphere.GetRadius() == 0.0f)
66 {
67 // The node is a dummy node and cannot be visible.
68 return false;
69 }
70
71 // Start with the last pushed plane, which is potentially the most
72 // restrictive plane.
73 int32_t index = mPlaneQuantity - 1;
74 uint32_t mask = (1u << index);
75
76 for (int32_t i = 0; i < mPlaneQuantity; ++i, --index, mask >>= 1)
77 {
78 if (mPlaneState & mask)
79 {
80 int32_t side = sphere.WhichSide(mPlane[index]);
81
82 if (side < 0)
83 {
84 // The object is on the negative side of the plane, so
85 // cull it.
86 return false;
87 }
88
89 if (side > 0)
90 {
91 // The object is on the positive side of plane. There is
92 // no need to compare subobjects against this plane, so
93 // mark it as inactive.
94 mPlaneState &= ~mask;
95 }
96 }
97 }
98
99 return true;
100}
101
102void Culler::Insert(Visual* visible)
103{

Callers 1

OnGetVisibleSetMethod · 0.80

Calls 2

GetRadiusMethod · 0.45
WhichSideMethod · 0.45

Tested by

no test coverage detected