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

Method GetVisibleSet

GTE/Graphics/BspNode.cpp:131–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void BspNode::GetVisibleSet(Culler& culler,
132 std::shared_ptr<Camera> const& camera, bool noCull)
133{
134 // Get visible geometry in back-to-front order. If a global effect is
135 // active, the geometry objects in the subtree will be drawn using it.
136 Spatial* posChild = GetPositiveChild();
137 Spatial* copChild = GetCoplanarChild();
138 Spatial* negChild = GetNegativeChild();
139
140 int32_t positionSide = WhichSide(camera->GetPosition());
141 int32_t frustumSide = WhichSide(camera);
142
143 if (positionSide > 0)
144 {
145 // Camera origin on positive side of plane.
146
147 if (frustumSide <= 0)
148 {
149 // The frustum is on the negative side of the plane or straddles
150 // the plane. In either case, the negative child is potentially
151 // visible.
152 if (negChild)
153 {
154 negChild->OnGetVisibleSet(culler, camera, noCull);
155 }
156 }
157
158 if (frustumSide == 0)
159 {
160 // The frustum straddles the plane. The coplanar child is
161 // potentially visible.
162 if (copChild)
163 {
164 copChild->OnGetVisibleSet(culler, camera, noCull);
165 }
166 }
167
168 if (frustumSide >= 0)
169 {
170 // The frustum is on the positive side of the plane or straddles
171 // the plane. In either case, the positive child is potentially
172 // visible.
173 if (posChild)
174 {
175 posChild->OnGetVisibleSet(culler, camera, noCull);
176 }
177 }
178 }
179 else if (positionSide < 0)
180 {
181 // Camera origin on negative side of plane.
182
183 if (frustumSide >= 0)
184 {
185 // The frustum is on the positive side of the plane or straddles
186 // the plane. In either case, the positive child is potentially
187 // visible.
188 if (posChild)

Callers

nothing calls this directly

Calls 3

OnGetVisibleSetMethod · 0.80
DotFunction · 0.50
GetPositionMethod · 0.45

Tested by

no test coverage detected