LLCamera Class Reference

#include <llcamera.h>

Inheritance diagram for LLCamera:

Inheritance graph
[legend]
Collaboration diagram for LLCamera:

Collaboration graph
[legend]
List of all members.

Public Types

 PLANE_LEFT = 0
 PLANE_RIGHT = 1
 PLANE_BOTTOM = 2
 PLANE_TOP = 3
 PLANE_NUM = 4
 PLANE_LEFT_MASK = (1<<PLANE_LEFT)
 PLANE_RIGHT_MASK = (1<<PLANE_RIGHT)
 PLANE_BOTTOM_MASK = (1<<PLANE_BOTTOM)
 PLANE_TOP_MASK = (1<<PLANE_TOP)
 PLANE_ALL_MASK = 0xf
 HORIZ_PLANE_LEFT = 0
 HORIZ_PLANE_RIGHT = 1
 HORIZ_PLANE_NUM = 2
 HORIZ_PLANE_LEFT_MASK = (1<<HORIZ_PLANE_LEFT)
 HORIZ_PLANE_RIGHT_MASK = (1<<HORIZ_PLANE_RIGHT)
 HORIZ_PLANE_ALL_MASK = 0x3
enum  {
  PLANE_LEFT = 0, PLANE_RIGHT = 1, PLANE_BOTTOM = 2, PLANE_TOP = 3,
  PLANE_NUM = 4
}
enum  {
  PLANE_LEFT_MASK = (1<<PLANE_LEFT), PLANE_RIGHT_MASK = (1<<PLANE_RIGHT), PLANE_BOTTOM_MASK = (1<<PLANE_BOTTOM), PLANE_TOP_MASK = (1<<PLANE_TOP),
  PLANE_ALL_MASK = 0xf
}
enum  { HORIZ_PLANE_LEFT = 0, HORIZ_PLANE_RIGHT = 1, HORIZ_PLANE_NUM = 2 }
enum  { HORIZ_PLANE_LEFT_MASK = (1<<HORIZ_PLANE_LEFT), HORIZ_PLANE_RIGHT_MASK = (1<<HORIZ_PLANE_RIGHT), HORIZ_PLANE_ALL_MASK = 0x3 }

Public Member Functions

 LLCamera ()
 LLCamera (F32 z_field_of_view, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane)
void setView (F32 new_view)
void setViewHeightInPixels (S32 height)
void setAspect (F32 new_aspect)
void setNear (F32 new_near)
void setFar (F32 new_far)
F32 getView () const
S32 getViewHeightInPixels () const
F32 getAspect () const
F32 getNear () const
F32 getFar () const
F32 getYaw () const
F32 getPitch () const
const LLPlanegetWorldPlane (S32 index) const
const LLVector3getWorldPlanePos () const
size_t writeFrustumToBuffer (char *buffer) const
size_t readFrustumFromBuffer (const char *buffer)
void calcAgentFrustumPlanes (LLVector3 *frust)
S32 sphereInFrustumOld (const LLVector3 &center, const F32 radius) const
S32 sphereInFrustum (const LLVector3 &center, const F32 radius) const
S32 pointInFrustum (const LLVector3 &point) const
S32 sphereInFrustumFull (const LLVector3 &center, const F32 radius) const
S32 AABBInFrustum (const LLVector3 &center, const LLVector3 &radius)
S32 sphereInFrustumQuick (const LLVector3 &sphere_center, const F32 radius)
F32 heightInPixels (const LLVector3 &center, F32 radius) const
F32 visibleDistance (const LLVector3 &pos, F32 rad, F32 fudgescale=1.0f, U32 planemask=PLANE_ALL_MASK) const
F32 visibleHorizDistance (const LLVector3 &pos, F32 rad, F32 fudgescale=1.0f, U32 planemask=HORIZ_PLANE_ALL_MASK) const
void setFixedDistance (F32 distance)

Public Attributes

LLVector3 mAgentFrustum [8]

Protected Member Functions

void calculateFrustumPlanes ()
void calculateFrustumPlanes (F32 left, F32 right, F32 top, F32 bottom)
void calculateFrustumPlanesFromWindow (F32 x1, F32 y1, F32 x2, F32 y2)
void calculateWorldFrustumPlanes ()

Protected Attributes

F32 mView
F32 mAspect
S32 mViewHeightInPixels
F32 mNearPlane
F32 mFarPlane
LLPlane mLocalPlanes [4]
F32 mFixedDistance
LLVector3 mFrustCenter
F32 mFrustRadiusSquared
LLPlane mWorldPlanes [PLANE_NUM]
LLPlane mHorizPlanes [HORIZ_PLANE_NUM]
LLPlane mAgentPlanes [6]
U8 mAgentPlaneMask [6]
LLVector3 mWorldPlanePos

Friends

std::ostream & operator<< (std::ostream &s, const LLCamera &C)

Detailed Description

Definition at line 75 of file llcamera.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
PLANE_LEFT 
PLANE_RIGHT 
PLANE_BOTTOM 
PLANE_TOP 
PLANE_NUM 

Definition at line 79 of file llcamera.h.

anonymous enum

Enumerator:
PLANE_LEFT_MASK 
PLANE_RIGHT_MASK 
PLANE_BOTTOM_MASK 
PLANE_TOP_MASK 
PLANE_ALL_MASK 

Definition at line 86 of file llcamera.h.

anonymous enum

Enumerator:
HORIZ_PLANE_LEFT 
HORIZ_PLANE_RIGHT 
HORIZ_PLANE_NUM 

Definition at line 93 of file llcamera.h.

anonymous enum

Enumerator:
HORIZ_PLANE_LEFT_MASK 
HORIZ_PLANE_RIGHT_MASK 
HORIZ_PLANE_ALL_MASK 

Definition at line 98 of file llcamera.h.


Constructor & Destructor Documentation

LLCamera::LLCamera (  ) 

Definition at line 39 of file llcamera.cpp.

References calculateFrustumPlanes().

LLCamera::LLCamera ( F32  z_field_of_view,
F32  aspect_ratio,
S32  view_height_in_pixels,
F32  near_plane,
F32  far_plane 
)

Definition at line 52 of file llcamera.cpp.

References calculateFrustumPlanes(), DEFAULT_FAR_PLANE, mAspect, MAX_ASPECT_RATIO, MAX_FAR_PLANE, MAX_FIELD_OF_VIEW, MAX_NEAR_PLANE, mFarPlane, MIN_ASPECT_RATIO, MIN_FAR_PLANE, MIN_FIELD_OF_VIEW, MIN_NEAR_PLANE, mNearPlane, and mView.


Member Function Documentation

int LLCamera::AABBInFrustum ( const LLVector3 center,
const LLVector3 radius 
)

Definition at line 153 of file llcamera.cpp.

References d, i, mAgentPlaneMask, mAgentPlanes, mask, n, p, S32, and LLVector3::scaledVec().

Referenced by LLOctreeCull::checkObjects(), earlyFail(), LLSpatialBridge::setVisible(), and LLOctreeCull::traverse().

void LLCamera::calcAgentFrustumPlanes ( LLVector3 frust  ) 

Definition at line 481 of file llcamera.cpp.

References i, mAgentFrustum, mAgentPlaneMask, mAgentPlanes, mask, n, p, and planeFromPoints().

Referenced by LLViewerWindow::hitObjectOrLandGlobalAsync(), and LLViewerCamera::updateFrustumPlanes().

void LLCamera::calculateFrustumPlanes ( F32  left,
F32  right,
F32  top,
F32  bottom 
) [protected]

Definition at line 534 of file llcamera.cpp.

References a, b, c, f, mFarPlane, mFrustCenter, mFrustRadiusSquared, mLocalPlanes, PLANE_BOTTOM, PLANE_LEFT, PLANE_RIGHT, PLANE_TOP, LLPlane::setVec(), LLCoordFrame::transformToAbsolute(), and X_AXIS.

void LLCamera::calculateFrustumPlanes (  )  [protected]

Definition at line 455 of file llcamera.cpp.

References bottom, f, left, mAspect, mFarPlane, mView, right, tanf, and top.

Referenced by calculateFrustumPlanesFromWindow(), LLCamera(), setAspect(), setFar(), setNear(), setView(), and setViewHeightInPixels().

void LLCamera::calculateFrustumPlanesFromWindow ( F32  x1,
F32  y1,
F32  x2,
F32  y2 
) [protected]

Definition at line 564 of file llcamera.cpp.

References bottom, calculateFrustumPlanes(), f, left, mAspect, mFarPlane, mView, right, tanf, and top.

Referenced by LLViewerCamera::setPerspective().

void LLCamera::calculateWorldFrustumPlanes (  )  [protected]

Definition at line 578 of file llcamera.cpp.

References d, f, getYaw(), HORIZ_PLANE_LEFT, HORIZ_PLANE_RIGHT, mHorizPlanes, mLocalPlanes, mNearPlane, LLCoordFrame::mOrigin, mWorldPlanePos, mWorldPlanes, LLCoordFrame::mXAxis, LLVector3::normVec(), p, PLANE_LEFT, PLANE_RIGHT, LLCoordFrame::rotateToAbsolute(), LLVector3::rotVec(), and LLCoordFrame::yaw().

F32 LLCamera::getAspect (  )  const [inline]

Definition at line 135 of file llcamera.h.

References mAspect.

Referenced by LLVOAvatar::buildSkeleton(), LLAgent::calcCustomizeAvatarUIOffset(), LLViewerCamera::calcProjection(), LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLManip::getMousePointOnPlaneGlobal(), LLToolsLookAtSelection::handleEvent(), LLManipTranslate::highlightManipulators(), LLManipScale::highlightManipulators(), LLViewerWindow::mouseDirectionCamera(), LLManip::nearestPointOnLineFromMouse(), operator<<(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLViewerWindow::renderSelections(), LLSelectMgr::renderSilhouettes(), LLVOAvatar::setPixelAreaAndAngle(), setup_hud_matrices(), LLVOAvatar::updateCharacter(), and LLHUDText::updateScreenPos().

F32 LLCamera::getFar (  )  const [inline]

Definition at line 137 of file llcamera.h.

References mFarPlane.

Referenced by LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLPipeline::generateReflectionMap(), LLViewerCamera::getProjection(), LLToolSelectRect::handleRectangleSelection(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLViewerCamera::LLViewerCamera(), LLViewerWindow::rawSnapshot(), LLTracker::renderBeacon(), LLPipeline::renderGeom(), LLViewerCamera::setPerspective(), LLViewerCamera::updateFrustumPlanes(), LLVOSky::updateSky(), and LLWorld::updateVisibilities().

F32 LLCamera::getNear (  )  const [inline]

Definition at line 136 of file llcamera.h.

References mNearPlane.

Referenced by LLViewerCamera::calcProjection(), LLToolSelectRect::handleRectangleSelection(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLMorphView::initialize(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLViewerWindow::rawSnapshot(), raycast_for_new_obj_pos(), LLViewerCamera::setPerspective(), LLViewerWindow::setup3DRender(), LLVOSky::updateFog(), LLVOAvatar::updateHeadOffset(), and LLHUDText::updateVisibility().

F32 LLCamera::getPitch (  )  const [inline]

Definition at line 143 of file llcamera.h.

References LLCoordFrame::mXAxis, sqrtf, VX, VY, and VZ.

F32 LLCamera::getView (  )  const [inline]

Definition at line 133 of file llcamera.h.

References mView.

Referenced by LLAgent::calcCustomizeAvatarUIOffset(), LLViewerCamera::calcProjection(), LLVolumeImplFlexible::doIdleUpdate(), LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLViewerCamera::getPixelVectors(), LLToolsLookAtSelection::handleEvent(), LLViewZoomDefault::handleEvent(), LLDrawable::incrementVisible(), LLViewerWindow::mouseDirectionCamera(), LLViewerWindow::mouseDirectionGlobal(), operator<<(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLManipScale::render(), LLSelectNode::renderOneSilhouette(), LLManipTranslate::renderSnapGuides(), LLManipTranslate::renderTranslationHandles(), LLViewerCamera::setPerspective(), LLVOTree::setPixelAreaAndAngle(), LLVOGrass::setPixelAreaAndAngle(), LLDebugText::update(), LLViewerJoystick::updateCamera(), and LLManipRotate::updateVisiblity().

S32 LLCamera::getViewHeightInPixels (  )  const [inline]

Definition at line 134 of file llcamera.h.

References mViewHeightInPixels.

Referenced by LLViewerCamera::getPixelVectors(), LLManipScale::render(), LLManipTranslate::renderSnapGuides(), LLManipTranslate::renderTranslationHandles(), LLVOTree::setPixelAreaAndAngle(), LLVOGrass::setPixelAreaAndAngle(), LLVOAvatar::setPixelAreaAndAngle(), and LLManipRotate::updateVisiblity().

const LLPlane& LLCamera::getWorldPlane ( S32  index  )  const [inline]

Definition at line 149 of file llcamera.h.

References mWorldPlanes.

const LLVector3& LLCamera::getWorldPlanePos (  )  const [inline]

Definition at line 150 of file llcamera.h.

References mWorldPlanePos.

F32 LLCamera::getYaw (  )  const [inline]

Definition at line 139 of file llcamera.h.

References LLCoordFrame::mXAxis, VX, and VY.

Referenced by calculateWorldFrustumPlanes().

F32 LLCamera::heightInPixels ( const LLVector3 center,
F32  radius 
) const

Definition at line 333 of file llcamera.cpp.

References angle, f, LLVector3::magVec(), LLCoordFrame::mOrigin, mView, and mViewHeightInPixels.

S32 LLCamera::pointInFrustum ( const LLVector3 point  )  const [inline]

Definition at line 164 of file llcamera.h.

References f, and sphereInFrustum().

Referenced by LLViewerCamera::areVertsVisible().

size_t LLCamera::readFrustumFromBuffer ( const char *  buffer  ) 

Definition at line 138 of file llcamera.cpp.

References mAspect, mFarPlane, mNearPlane, and mView.

void LLCamera::setAspect ( F32  new_aspect  ) 

Definition at line 97 of file llcamera.cpp.

References calculateFrustumPlanes(), mAspect, MAX_ASPECT_RATIO, and MIN_ASPECT_RATIO.

Referenced by LLPanelDisplay::applyResolution(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), idle_startup(), LLAgent::init(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLVisualParamHint::render(), LLImagePreviewSculpted::render(), LLImagePreviewAvatar::render(), and LLViewerWindow::reshape().

void LLCamera::setFar ( F32  new_far  ) 

Definition at line 115 of file llcamera.cpp.

References calculateFrustumPlanes(), MAX_FAR_PLANE, mFarPlane, and MIN_FAR_PLANE.

Referenced by display_update_camera(), LLToolSelectRect::handleRectangleSelection(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLAgent::init(), LLSpatialPartition::processImagery(), and LLWorld::updateVisibilities().

void LLCamera::setFixedDistance ( F32  distance  )  [inline]

Definition at line 177 of file llcamera.h.

References mFixedDistance.

void LLCamera::setNear ( F32  new_near  ) 

Definition at line 106 of file llcamera.cpp.

References calculateFrustumPlanes(), MAX_NEAR_PLANE, MIN_NEAR_PLANE, and mNearPlane.

Referenced by display(), LLToolSelectRect::handleRectangleSelection(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLAgent::init(), LLMorphView::initialize(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), and LLMorphView::shutdown().

void LLCamera::setView ( F32  new_view  ) 

Definition at line 81 of file llcamera.cpp.

References calculateFrustumPlanes(), MAX_FIELD_OF_VIEW, MIN_FIELD_OF_VIEW, and mView.

Referenced by LLViewZoomDefault::handleEvent(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLAgent::init(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLImagePreviewSculpted::render(), LLImagePreviewAvatar::render(), LLPreviewAnimation::render(), update_fov(), LLViewerJoystick::updateCamera(), and LLAgent::updateCamera().

void LLCamera::setViewHeightInPixels ( S32  height  ) 

Definition at line 89 of file llcamera.cpp.

References calculateFrustumPlanes(), and mViewHeightInPixels.

Referenced by idle_startup(), LLAgent::init(), and LLViewerWindow::reshape().

int LLCamera::sphereInFrustum ( const LLVector3 center,
const F32  radius 
) const

Definition at line 309 of file llcamera.cpp.

References d, i, and mAgentPlanes.

Referenced by LLToolSelectRect::handleRectangleSelection(), LLSpatialPartition::isVisible(), pointInFrustum(), sphereInFrustumFull(), LLWorld::updateVisibilities(), LLSurfacePatch::updateVisibility(), and LLHUDText::updateVisibility().

S32 LLCamera::sphereInFrustumFull ( const LLVector3 center,
const F32  radius 
) const [inline]

Definition at line 165 of file llcamera.h.

References sphereInFrustum().

int LLCamera::sphereInFrustumOld ( const LLVector3 center,
const F32  radius 
) const

Definition at line 213 of file llcamera.cpp.

References FALSE, mFarPlane, MIN_NEAR_PLANE, mLocalPlanes, LLCoordFrame::mOrigin, LLCoordFrame::mXAxis, LLCoordFrame::mYAxis, LLCoordFrame::mZAxis, PLANE_BOTTOM, PLANE_LEFT, PLANE_RIGHT, PLANE_TOP, TRUE, VX, VY, VZ, x, y, and z.

int LLCamera::sphereInFrustumQuick ( const LLVector3 sphere_center,
const F32  radius 
)

Definition at line 194 of file llcamera.cpp.

References mFarPlane, and mFrustCenter.

F32 LLCamera::visibleDistance ( const LLVector3 pos,
F32  rad,
F32  fudgescale = 1.0f,
U32  planemask = PLANE_ALL_MASK 
) const

Definition at line 365 of file llcamera.cpp.

References LLPlane::dist(), LLVector3::magVec(), mFixedDistance, LLCoordFrame::mOrigin, mWorldPlanes, LLCoordFrame::mXAxis, p, and PLANE_NUM.

F32 LLCamera::visibleHorizDistance ( const LLVector3 pos,
F32  rad,
F32  fudgescale = 1.0f,
U32  planemask = HORIZ_PLANE_ALL_MASK 
) const

Definition at line 397 of file llcamera.cpp.

References LLPlane::dist(), HORIZ_PLANE_NUM, LLVector3::magVec(), mFixedDistance, mHorizPlanes, LLCoordFrame::mOrigin, and p.

size_t LLCamera::writeFrustumToBuffer ( char *  buffer  )  const

Definition at line 126 of file llcamera.cpp.

References mAspect, mFarPlane, mNearPlane, and mView.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const LLCamera C 
) [friend]

Definition at line 424 of file llcamera.cpp.


Member Data Documentation

LLVector3 LLCamera::mAgentFrustum[8]

Definition at line 121 of file llcamera.h.

Referenced by calcAgentFrustumPlanes(), and LLViewerWindow::hitObjectOrLandGlobalAsync().

U8 LLCamera::mAgentPlaneMask[6] [protected]

Definition at line 118 of file llcamera.h.

Referenced by AABBInFrustum(), and calcAgentFrustumPlanes().

LLPlane LLCamera::mAgentPlanes[6] [protected]

Definition at line 117 of file llcamera.h.

Referenced by AABBInFrustum(), calcAgentFrustumPlanes(), and sphereInFrustum().

F32 LLCamera::mAspect [protected]

Definition at line 106 of file llcamera.h.

Referenced by calculateFrustumPlanes(), calculateFrustumPlanesFromWindow(), getAspect(), LLCamera(), readFrustumFromBuffer(), setAspect(), LLViewerCamera::updateCameraLocation(), and writeFrustumToBuffer().

F32 LLCamera::mFarPlane [protected]

Definition at line 109 of file llcamera.h.

Referenced by calculateFrustumPlanes(), calculateFrustumPlanesFromWindow(), getFar(), LLCamera(), operator<<(), readFrustumFromBuffer(), setFar(), sphereInFrustumOld(), sphereInFrustumQuick(), and writeFrustumToBuffer().

F32 LLCamera::mFixedDistance [protected]

Definition at line 111 of file llcamera.h.

Referenced by setFixedDistance(), visibleDistance(), and visibleHorizDistance().

LLVector3 LLCamera::mFrustCenter [protected]

Definition at line 112 of file llcamera.h.

Referenced by calculateFrustumPlanes(), and sphereInFrustumQuick().

F32 LLCamera::mFrustRadiusSquared [protected]

Definition at line 113 of file llcamera.h.

Referenced by calculateFrustumPlanes().

LLPlane LLCamera::mHorizPlanes[HORIZ_PLANE_NUM] [protected]

Definition at line 116 of file llcamera.h.

Referenced by calculateWorldFrustumPlanes(), and visibleHorizDistance().

LLPlane LLCamera::mLocalPlanes[4] [protected]

Definition at line 110 of file llcamera.h.

Referenced by calculateFrustumPlanes(), calculateWorldFrustumPlanes(), operator<<(), and sphereInFrustumOld().

F32 LLCamera::mNearPlane [protected]

Definition at line 108 of file llcamera.h.

Referenced by calculateWorldFrustumPlanes(), getNear(), LLCamera(), operator<<(), readFrustumFromBuffer(), setNear(), and writeFrustumToBuffer().

F32 LLCamera::mView [protected]

Definition at line 105 of file llcamera.h.

Referenced by calculateFrustumPlanes(), calculateFrustumPlanesFromWindow(), getView(), heightInPixels(), LLCamera(), readFrustumFromBuffer(), setView(), and writeFrustumToBuffer().

S32 LLCamera::mViewHeightInPixels [protected]

Definition at line 107 of file llcamera.h.

Referenced by getViewHeightInPixels(), heightInPixels(), setViewHeightInPixels(), and LLViewerCamera::updateCameraLocation().

LLVector3 LLCamera::mWorldPlanePos [protected]

Definition at line 119 of file llcamera.h.

Referenced by calculateWorldFrustumPlanes(), and getWorldPlanePos().

LLPlane LLCamera::mWorldPlanes[PLANE_NUM] [protected]

Definition at line 115 of file llcamera.h.

Referenced by calculateWorldFrustumPlanes(), getWorldPlane(), and visibleDistance().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:12 2010 for Second Life Viewer by  doxygen 1.4.7