16 mModelPlane({ 0.0f, 0.0f, 0.0f, 0.0f }),
67 if (posChild || negChild)
73 bspChild =
dynamic_cast<BspNode*
>(negChild.get());
80 return negChild.get();
85 bspChild =
dynamic_cast<BspNode*
>(posChild.get());
92 return posChild.get();
105 plane[0] = normal[0];
106 plane[1] = normal[1];
107 plane[2] = normal[2];
124 #if defined(GTE_USE_MAT_VEC) 133 std::shared_ptr<Camera>
const& camera,
bool noCull)
141 int positionSide =
WhichSide(camera->GetPosition());
144 if (positionSide > 0)
148 if (frustumSide <= 0)
155 negChild->OnGetVisibleSet(culler, camera, noCull);
159 if (frustumSide == 0)
165 copChild->OnGetVisibleSet(culler, camera, noCull);
169 if (frustumSide >= 0)
176 posChild->OnGetVisibleSet(culler, camera, noCull);
180 else if (positionSide < 0)
184 if (frustumSide >= 0)
191 posChild->OnGetVisibleSet(culler, camera, noCull);
195 if (frustumSide == 0)
201 copChild->OnGetVisibleSet(culler, camera, noCull);
205 if (frustumSide <= 0)
212 negChild->OnGetVisibleSet(culler, camera, noCull);
227 posChild->OnGetVisibleSet(culler, camera, noCull);
232 copChild->OnGetVisibleSet(culler, camera, noCull);
237 negChild->OnGetVisibleSet(culler, camera, noCull);
244 negChild->OnGetVisibleSet(culler, camera, noCull);
249 copChild->OnGetVisibleSet(culler, camera, noCull);
254 posChild->OnGetVisibleSet(culler, camera, noCull);
263 return (dot > 0.0
f ? +1 : (dot < 0.0
f ? -1 : 0));
268 float const* frustum = camera->GetFrustum();
276 float NdD =
Dot(normal, camera->GetDVector());
277 float NdU =
Dot(normal, camera->GetUVector());
278 float NdR =
Dot(normal, camera->GetRVector());
281 int positive = 0, negative = 0;
293 sgnDist = NdEmC + PDMin + NUMin + NRMin;
298 else if (sgnDist < 0.0
f)
305 sgnDist = NdEmC + PDMin + NUMin + NRMax;
310 else if (sgnDist < 0.0
f)
317 sgnDist = NdEmC + PDMin + NUMax + NRMin;
322 else if (sgnDist < 0.0
f)
329 sgnDist = NdEmC + PDMin + NUMax + NRMax;
334 else if (sgnDist < 0.0
f)
341 float FUMin = FdN * NUMin;
342 float FUMax = FdN * NUMax;
343 float FRMin = FdN * NRMin;
344 float FRMax = FdN * NRMax;
348 sgnDist = NdEmC + PDMax + FUMin + FRMin;
353 else if (sgnDist < 0.0
f)
360 sgnDist = NdEmC + PDMax + FUMin + FRMax;
365 else if (sgnDist < 0.0
f)
372 sgnDist = NdEmC + PDMax + FUMax + FRMin;
377 else if (sgnDist < 0.0
f)
384 sgnDist = NdEmC + PDMax + FUMax + FRMax;
389 else if (sgnDist < 0.0
f)
void SetWorldPlane(Plane3< float > const &plane)
virtual void UpdateWorldData(double applicationTime)
Plane3< float > GetWorldPlane() const
std::shared_ptr< Spatial > GetNegativeChild()
std::shared_ptr< Spatial > GetCoplanarChild()
virtual void UpdateWorldData(double applicationTime)
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real Normalize(GVector< Real > &v, bool robust=false)
std::shared_ptr< Spatial > GetPositiveChild()
Spatial * GetContainingNode(Vector4< float > const &point)
Plane3< float > GetModelPlane() const
GLuint GLsizei GLsizei * length
Vector4< float > mModelPlane
std::vector< std::shared_ptr< Spatial > > mChild
void NormalizePlane(Vector4< float > &plane)
int WhichSide(Vector4< float > const &point) const
virtual void GetVisibleSet(Culler &culler, std::shared_ptr< Camera > const &camera, bool noCull)
void SetModelPlane(Plane3< float > const &plane)
Vector4< float > mWorldPlane