51 std::shared_ptr<Spatial>
const& scene)
57 scene->OnGetVisibleSet(*
this, camera,
false);
61 LogError(
"A scene is required for culling.");
112 float dMax = camera->GetDMax();
113 float dMin = camera->GetDMin(), dMin2 = dMin * dMin;
114 float rMax = camera->GetRMax(), rMax2 = rMax * rMax;
115 float rMin = camera->GetRMin(), rMin2 = rMin * rMin;
116 float uMax = camera->GetUMax(), uMax2 = uMax * uMax;
117 float uMin = camera->GetUMin(), uMin2 = uMin * uMin;
124 float dirDotEye =
Dot(D, P);
128 float invLength, a0, a1,
c;
131 c = -(dirDotEye + dMin);
135 c = dirDotEye + dMax;
139 invLength = 1.0f / sqrt(dMin2 + uMin2);
140 a0 = -uMin*invLength;
141 a1 = +dMin*invLength;
147 invLength = 1.0f / sqrt(dMin2 + uMax2);
148 a0 = +uMax*invLength;
149 a1 = -dMin*invLength;
155 invLength = 1.0f / sqrt(dMin2 + rMin2);
156 a0 = -rMin*invLength;
157 a1 = +dMin*invLength;
163 invLength = 1.0f / sqrt(dMin2 + rMax2);
164 a0 = +rMax*invLength;
165 a1 = -dMin*invLength;
int WhichSide(CullingPlane const &plane) const
void Set(Vector4< float > const &N, float c)
virtual void Insert(Visual *visible)
#define LogError(message)
bool PushPlane(CullingPlane const &plane)
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
CullingPlane mPlane[MAX_PLANE_QUANTITY]
bool IsVisible(BoundingSphere const &sphere)
void PushViewFrustumPlanes(std::shared_ptr< Camera > const &camera)
void ComputeVisibleSet(std::shared_ptr< Camera > const &camera, std::shared_ptr< Spatial > const &scene)