OpenGLContext.frustum
View frustum modeling as series of clipping planes
The Frustum object itself is only responsible for
extracting the clipping planes from an OpenGL model-view
matrix. The bulk of the frustum-culling algorithm is
implemented in the bounding volume objects found in the
OpenGLContext.scenegraph.boundingvolume module.
Based on code from:
http://www.markmorley.com/opengl/frustumculling.html
Functions
viewingMatrix(
projection
= None
,
model
= None
)
Calculate the total viewing matrix from given data
- projection
- the projection matrix, if not provided than the result of glGetDoublev( GL_PROJECTION_MATRIX) will be used.
- model
- the model-view matrix, if not provided than the result of glGetDoublev( GL_MODELVIEW_MATRIX ) will be used.
Note:
Unless there is a valid projection and model-view
matrix, the function will raise a RuntimeError
Classes
Holder for frustum specification for intersection tests
Note:
the Frustum can include an arbitrary number of
clipping planes, though the most common usage
is to define 6 clipping planes from the OpenGL
model-view matrices.
normalized
field SFBool normalized 1
planes
exposedField MFVec4f planes []
fromViewingMatrix(
cls
,
matrix
= None
,
normalize
= 1
)
Extract and calculate frustum clipping planes from OpenGL
The default initializer allows you to create
Frustum objects with arbitrary clipping planes,
while this alternate initializer provides
automatic clipping-plane extraction from the
model-view matrix.
- matrix
- the combined model-view matrix
- normalize
- whether to normalize the plane equations to allow for sphere bounding-volumes and use of distance equations for LOD-style operations.