void CClientLeafSystem::ProjectFlashlight( ClientLeafShadowHandle_t handle, const VMatrix &worldToShadow ) { // Remove the shadow from any leaves it current exists in RemoveShadowFromLeaves( handle ); RemoveShadowFromRenderables( handle ); Assert( ( m_Shadows[handle].m_Flags & SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) == SHADOW_FLAGS_FLASHLIGHT ); // This will help us to avoid adding the shadow multiple times to a renderable ++m_ShadowEnum; // Use an AABB around the frustum to enumerate leaves. Vector mins, maxs; CalculateAABBFromProjectionMatrix( worldToShadow, &mins, &maxs ); CShadowLeafEnum leafEnum; ISpatialQuery* pQuery = engine->GetBSPTreeQuery(); pQuery->EnumerateLeavesInBox( mins, maxs, &leafEnum, handle ); }
static int vmatrix_CalculateAABBFromProjectionMatrix (lua_State *L) { CalculateAABBFromProjectionMatrix(luaL_checkvmatrix(L, 1), &luaL_checkvector(L, 2), &luaL_checkvector(L, 3)); return 0; }