+ inside = (boundingSphere.w > Math::MACHINE_EPSILON_1000) &&
+ (camera.CheckSphereInFrustum(updateBufferIndex, Vector3(boundingSphere), boundingSphere.w));
+
+ if(inside && !isLayer3d && viewportSet)
+ {
+ SetNodeUpdateArea(node, isLayer3d, nodeWorldMatrix, nodeSize, nodeUpdateArea);
+ nodeUpdateAreaSet = true;
+
+ const Vector3& scale = nodeWorldMatrix.GetScale();
+ const Vector3& size = Vector3(nodeUpdateArea.z, nodeUpdateArea.w, 1.0f) * scale;
+
+ if(size.LengthSquared() > Math::MACHINE_EPSILON_1000)
+ {
+ MatrixUtils::MultiplyTransformMatrix(nodeModelViewMatrix, nodeWorldMatrix, viewMatrix);
+ nodeModelViewMatrixSet = true;
+
+ // Assume actors are at z=0, compute AABB in view space & test rect intersection
+ // against z=0 plane boundaries for frustum. (NOT viewport). This should take into account
+ // magnification due to FOV etc.
+
+ // TODO : Below logic might need to refactor it.
+ // If camera is Perspective, we need to calculate clipping box by FoV. Currently, we just believe default camera setup OrthographicSize well.
+ // - If then, It must use math calculate like tan(fov) internally. So, we might need calculate it only one times, and cache.
+ ClippingBox boundingBox = RenderItem::CalculateTransformSpaceAABB(nodeModelViewMatrix, Vector3(nodeUpdateArea.x, nodeUpdateArea.y, 0.0f), Vector3(nodeUpdateArea.z, nodeUpdateArea.w, 0.0f));
+ ClippingBox clippingBox = camera.GetOrthographicClippingBox(updateBufferIndex);
+ inside = clippingBox.Intersects(boundingBox);
+ }
+ }
+ /*
+ * Note, the API Camera::CheckAABBInFrustum() can be used to test if a bounding box is (partially/fully) inside the view frustum.
+ */