sgUtil.h
Classes:
class
Public Functions
bool
Detailed Description
Public Functions
sgComputeNewFrustum(const Frustum & oldFrustum, const F64 nearPlane, const F64 farPlane, const RectI & oldViewport, const SGWinding * windings, const U32 numWindings, const MatrixF & modelview, F64 * newFrustum, RectI & newViewport, const bool flippedMatrix)
sgComputeOSFrustumPlanes(const F64 frustumParameters, const MatrixF & worldSpaceToObjectSpace, const Point3F & wsCamPoint, PlaneF & outFarPlane, PlaneF & outXMinPlane, PlaneF & outXMaxPlane, PlaneF & outYMinPlane, PlaneF & outYMaxPlane)
Compute frustrum planes.
Frustum parameters are:
[0] = left
[1] = right
[2] = top
[3] = bottom
[4] = near
[5] = far
sgOrientClipPlanes(PlaneF * planes, const Point3F & camPos, const Point3F & leftUp, const Point3F & leftDown, const Point3F & rightUp, const Point3F & rightDown)
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SGUTIL_H_ 25#define _SGUTIL_H_ 26 27#ifndef _PLATFORM_H_ 28#include "platform/platform.h" 29#endif 30#ifndef _MPOINT3_H_ 31#include "math/mPoint3.h" 32#endif 33 34class Frustum; 35class RectI; 36class MatrixF; 37class PlaneF; 38 39struct SGWinding 40{ 41 Point3F points[32]; 42 U32 numPoints; 43}; 44 45bool sgComputeNewFrustum(const Frustum &oldFrustum, 46 const F64 nearPlane, 47 const F64 farPlane, 48 const RectI& oldViewport, 49 const SGWinding* windings, 50 const U32 numWindings, 51 const MatrixF& modelview, 52 F64 *newFrustum, 53 RectI& newViewport, 54 const bool flippedMatrix); 55 56/// Compute frustrum planes. 57/// 58/// Frustum parameters are: 59/// - [0] = left 60/// - [1] = right 61/// - [2] = top 62/// - [3] = bottom 63/// - [4] = near 64/// - [5] = far 65void sgComputeOSFrustumPlanes(const F64 frustumParameters[6], 66 const MatrixF& worldSpaceToObjectSpace, 67 const Point3F& wsCamPoint, 68 PlaneF& outFarPlane, 69 PlaneF& outXMinPlane, 70 PlaneF& outXMaxPlane, 71 PlaneF& outYMinPlane, 72 PlaneF& outYMaxPlane); 73 74void sgOrientClipPlanes(PlaneF * planes, const Point3F & camPos, const Point3F & leftUp, const Point3F & leftDown, const Point3F & rightUp, const Point3F & rightDown); 75 76#endif // _H_SGUTIL_ 77