#include <llcamera.h>
Public Types | |
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 | setUserClipPlane (LLPlane plane) |
void | disableUserClipPlane () |
U8 | calcPlaneMask (const LLPlane &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 LLPlane & | getWorldPlane (S32 index) const |
const LLVector3 & | getWorldPlanePos () const |
size_t | writeFrustumToBuffer (char *buffer) const |
size_t | readFrustumFromBuffer (const char *buffer) |
void | calcAgentFrustumPlanes (LLVector3 *frust) |
S32 | sphereInFrustumOld (const LLVector3 ¢er, const F32 radius) const |
S32 | sphereInFrustum (const LLVector3 ¢er, const F32 radius) const |
S32 | pointInFrustum (const LLVector3 &point) const |
S32 | sphereInFrustumFull (const LLVector3 ¢er, const F32 radius) const |
S32 | AABBInFrustum (const LLVector3 ¢er, const LLVector3 &radius) |
S32 | AABBInFrustumNoFarClip (const LLVector3 ¢er, const LLVector3 &radius) |
S32 | sphereInFrustumQuick (const LLVector3 &sphere_center, const F32 radius) |
F32 | heightInPixels (const LLVector3 ¢er, 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] |
F32 | mFrustumCornerDist |
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] |
frustum_plane | mAgentPlanes [7] |
U32 | mPlaneCount |
LLVector3 | mWorldPlanePos |
Friends | |
std::ostream & | operator<< (std::ostream &s, const LLCamera &C) |
Classes | |
struct | frustum_plane |
Definition at line 75 of file llcamera.h.
anonymous enum |
Definition at line 79 of file llcamera.h.
anonymous enum |
Definition at line 86 of file llcamera.h.
anonymous enum |
Definition at line 93 of file llcamera.h.
anonymous enum |
Definition at line 98 of file llcamera.h.
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 53 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.
void LLCamera::setUserClipPlane | ( | LLPlane | plane | ) |
Definition at line 83 of file llcamera.cpp.
References calcPlaneMask(), mAgentPlanes, LLCamera::frustum_plane::mask, mPlaneCount, and LLCamera::frustum_plane::p.
Referenced by LLPipeline::generateWaterReflection(), and LLPipeline::updateCull().
void LLCamera::disableUserClipPlane | ( | ) |
Definition at line 90 of file llcamera.cpp.
References mPlaneCount.
Referenced by LLPipeline::updateCull().
Definition at line 540 of file llcamera.cpp.
References LLVector4::mV.
Referenced by calcAgentFrustumPlanes(), and setUserClipPlane().
void LLCamera::setView | ( | F32 | new_view | ) |
Definition at line 95 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(), LLViewerJoystick::moveFlycam(), LLDynamicTexture::postRender(), LLDynamicTexture::preRender(), LLImagePreviewSculpted::render(), LLImagePreviewAvatar::render(), LLPreviewAnimation::render(), update_fov(), and LLAgent::updateCamera().
void LLCamera::setViewHeightInPixels | ( | S32 | height | ) |
Definition at line 103 of file llcamera.cpp.
References calculateFrustumPlanes(), and mViewHeightInPixels.
Referenced by idle_startup(), LLAgent::init(), and LLViewerWindow::reshape().
void LLCamera::setAspect | ( | F32 | new_aspect | ) |
Definition at line 111 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::setNear | ( | F32 | new_near | ) |
Definition at line 120 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::setFar | ( | F32 | new_far | ) |
Definition at line 129 of file llcamera.cpp.
References calculateFrustumPlanes(), MAX_FAR_PLANE, mFarPlane, and MIN_FAR_PLANE.
Referenced by display_update_camera(), LLPipeline::generateWaterReflection(), LLToolSelectRect::handleRectangleSelection(), LLViewerWindow::hitObjectOrLandGlobalAsync(), LLViewerWindow::hitUIElementAsync(), LLAgent::init(), LLSpatialPartition::processImagery(), and LLWorld::updateVisibilities().
F32 LLCamera::getView | ( | ) | const [inline] |
Definition at line 145 of file llcamera.h.
References mView.
Referenced by LLAgent::calcCustomizeAvatarUIOffset(), LLViewerCamera::calcProjection(), LLVolumeImplFlexible::doIdleUpdate(), LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLPipeline::generateImpostor(), LLViewerCamera::getPixelVectors(), LLViewZoomDefault::handleEvent(), LLDrawable::incrementVisible(), LLViewerWindow::mouseDirectionCamera(), LLViewerWindow::mouseDirectionGlobal(), LLViewerJoystick::moveFlycam(), operator<<(), LLDynamicTexture::postRender(), LLManipScale::render(), LLSelectNode::renderOneSilhouette(), LLManipTranslate::renderSnapGuides(), LLManipTranslate::renderTranslationHandles(), LLViewerCamera::setPerspective(), and LLManipRotate::updateVisiblity().
S32 LLCamera::getViewHeightInPixels | ( | ) | const [inline] |
Definition at line 146 of file llcamera.h.
References mViewHeightInPixels.
Referenced by LLViewerCamera::getPixelVectors(), LLManipScale::render(), LLManipTranslate::renderSnapGuides(), LLManipTranslate::renderTranslationHandles(), LLVOTree::setPixelAreaAndAngle(), LLVOGrass::setPixelAreaAndAngle(), and LLManipRotate::updateVisiblity().
F32 LLCamera::getAspect | ( | ) | const [inline] |
Definition at line 147 of file llcamera.h.
References mAspect.
Referenced by LLVOAvatar::buildSkeleton(), LLAgent::calcCustomizeAvatarUIOffset(), LLViewerCamera::calcProjection(), LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLManip::getMousePointOnPlaneGlobal(), LLViewerWindow::mouseDirectionCamera(), LLManip::nearestPointOnLineFromMouse(), operator<<(), LLDynamicTexture::postRender(), LLViewerCamera::setPerspective(), LLVOAvatar::updateCharacter(), and LLHUDText::updateScreenPos().
F32 LLCamera::getNear | ( | ) | const [inline] |
Definition at line 148 of file llcamera.h.
References mNearPlane.
Referenced by LLAgent::calcCameraMinDistance(), LLViewerCamera::calcProjection(), LLToolSelectRect::handleRectangleSelection(), LLMorphView::initialize(), LLDynamicTexture::postRender(), LLViewerWindow::rawSnapshot(), LLToolPlacer::raycastForNewObjPos(), LLViewerCamera::setPerspective(), LLViewerWindow::setup3DRender(), LLViewerWindow::thumbnailSnapshot(), LLVOSky::updateFog(), and LLHUDText::updateVisibility().
F32 LLCamera::getFar | ( | ) | const [inline] |
Definition at line 149 of file llcamera.h.
References mFarPlane.
Referenced by LLNetMap::draw(), LLWorldMapView::drawFrustum(), LLPipeline::generateReflectionMap(), LLPipeline::generateWaterReflection(), LLViewerCamera::getProjection(), LLToolSelectRect::handleRectangleSelection(), LLViewerCamera::LLViewerCamera(), LLViewerWindow::rawSnapshot(), LLTracker::renderBeacon(), LLPipeline::renderGeom(), LLViewerCamera::setPerspective(), LLViewerWindow::thumbnailSnapshot(), LLViewerCamera::updateFrustumPlanes(), LLWorld::updateVisibilities(), and LLWorld::updateWaterObjects().
F32 LLCamera::getYaw | ( | ) | const [inline] |
Definition at line 151 of file llcamera.h.
References LLCoordFrame::mXAxis, VX, and VY.
Referenced by calculateWorldFrustumPlanes(), LLVOAvatar::getImpostorValues(), and LLWLParamManager::update().
F32 LLCamera::getPitch | ( | ) | const [inline] |
Definition at line 155 of file llcamera.h.
References LLCoordFrame::mXAxis, sqrtf, VX, VY, and VZ.
Referenced by LLVOAvatar::getImpostorValues().
const LLVector3& LLCamera::getWorldPlanePos | ( | ) | const [inline] |
size_t LLCamera::writeFrustumToBuffer | ( | char * | buffer | ) | const |
size_t LLCamera::readFrustumFromBuffer | ( | const char * | buffer | ) |
void LLCamera::calcAgentFrustumPlanes | ( | LLVector3 * | frust | ) |
Definition at line 560 of file llcamera.cpp.
References calcPlaneMask(), LLCoordFrame::getOrigin(), i, mAgentFrustum, mAgentPlanes, LLCamera::frustum_plane::mask, mFrustumCornerDist, mPlaneCount, p, LLCamera::frustum_plane::p, and planeFromPoints().
Referenced by LLViewerCamera::updateFrustumPlanes().
Definition at line 273 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, and VZ.
Definition at line 369 of file llcamera.cpp.
References d, LLPlane::dist(), i, mAgentPlanes, and LLCamera::frustum_plane::p.
Referenced by LLToolSelectRect::handleRectangleSelection(), pointInFrustum(), sphereInFrustumFull(), and LLWorld::updateVisibilities().
Definition at line 176 of file llcamera.h.
References sphereInFrustum().
Referenced by LLViewerCamera::areVertsVisible().
Definition at line 177 of file llcamera.h.
References sphereInFrustum().
Definition at line 167 of file llcamera.cpp.
References d, i, mAgentPlanes, LLCamera::frustum_plane::mask, mPlaneCount, LLVector4::mV, n, LLCamera::frustum_plane::p, p, S32, and LLVector3::scaledVec().
Definition at line 208 of file llcamera.cpp.
References d, i, mAgentPlanes, LLCamera::frustum_plane::mask, mPlaneCount, LLVector4::mV, n, LLCamera::frustum_plane::p, p, S32, and LLVector3::scaledVec().
Referenced by LLSpatialBridge::setVisible().
Definition at line 393 of file llcamera.cpp.
References LLVector3::magVec(), LLCoordFrame::mOrigin, mView, and mViewHeightInPixels.
F32 LLCamera::visibleDistance | ( | const LLVector3 & | pos, | |
F32 | rad, | |||
F32 | fudgescale = 1.0f , |
|||
U32 | planemask = PLANE_ALL_MASK | |||
) | const |
Definition at line 425 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 457 of file llcamera.cpp.
References LLPlane::dist(), HORIZ_PLANE_NUM, LLVector3::magVec(), mFixedDistance, mHorizPlanes, LLCoordFrame::mOrigin, and p.
void LLCamera::setFixedDistance | ( | F32 | distance | ) | [inline] |
void LLCamera::calculateFrustumPlanes | ( | ) | [protected] |
Definition at line 515 of file llcamera.cpp.
References mAspect, mFarPlane, mView, and tanf.
Referenced by calculateFrustumPlanesFromWindow(), LLCamera(), setAspect(), setFar(), setNear(), setView(), and setViewHeightInPixels().
Definition at line 599 of file llcamera.cpp.
References mFarPlane, mFrustCenter, mFrustRadiusSquared, mLocalPlanes, PLANE_BOTTOM, PLANE_LEFT, PLANE_RIGHT, PLANE_TOP, LLPlane::setVec(), LLVector3::setVec(), LLCoordFrame::transformToAbsolute(), and X_AXIS.
Definition at line 629 of file llcamera.cpp.
References calculateFrustumPlanes(), mAspect, mFarPlane, mView, and tanf.
Referenced by LLViewerCamera::setPerspective().
void LLCamera::calculateWorldFrustumPlanes | ( | ) | [protected] |
Definition at line 643 of file llcamera.cpp.
References d, 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().
std::ostream& operator<< | ( | std::ostream & | s, | |
const LLCamera & | C | |||
) | [friend] |
Definition at line 484 of file llcamera.cpp.
F32 LLCamera::mView [protected] |
Definition at line 105 of file llcamera.h.
Referenced by calculateFrustumPlanes(), calculateFrustumPlanesFromWindow(), getView(), heightInPixels(), LLCamera(), readFrustumFromBuffer(), setView(), and writeFrustumToBuffer().
F32 LLCamera::mAspect [protected] |
Definition at line 106 of file llcamera.h.
Referenced by calculateFrustumPlanes(), calculateFrustumPlanesFromWindow(), getAspect(), LLCamera(), readFrustumFromBuffer(), setAspect(), LLViewerCamera::updateCameraLocation(), and writeFrustumToBuffer().
S32 LLCamera::mViewHeightInPixels [protected] |
Definition at line 107 of file llcamera.h.
Referenced by getViewHeightInPixels(), heightInPixels(), setViewHeightInPixels(), and LLViewerCamera::updateCameraLocation().
F32 LLCamera::mNearPlane [protected] |
Definition at line 108 of file llcamera.h.
Referenced by calculateWorldFrustumPlanes(), getNear(), LLCamera(), operator<<(), readFrustumFromBuffer(), setNear(), 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().
LLPlane LLCamera::mLocalPlanes[4] [protected] |
Definition at line 110 of file llcamera.h.
Referenced by calculateFrustumPlanes(), calculateWorldFrustumPlanes(), operator<<(), and sphereInFrustumOld().
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] |
LLPlane LLCamera::mWorldPlanes[PLANE_NUM] [protected] |
Definition at line 115 of file llcamera.h.
Referenced by calculateWorldFrustumPlanes(), getWorldPlane(), and visibleDistance().
LLPlane LLCamera::mHorizPlanes[HORIZ_PLANE_NUM] [protected] |
Definition at line 116 of file llcamera.h.
Referenced by calculateWorldFrustumPlanes(), and visibleHorizDistance().
frustum_plane LLCamera::mAgentPlanes[7] [protected] |
Definition at line 123 of file llcamera.h.
Referenced by AABBInFrustum(), AABBInFrustumNoFarClip(), calcAgentFrustumPlanes(), setUserClipPlane(), and sphereInFrustum().
U32 LLCamera::mPlaneCount [protected] |
Definition at line 125 of file llcamera.h.
Referenced by AABBInFrustum(), AABBInFrustumNoFarClip(), calcAgentFrustumPlanes(), disableUserClipPlane(), and setUserClipPlane().
LLVector3 LLCamera::mWorldPlanePos [protected] |
Definition at line 127 of file llcamera.h.
Referenced by calculateWorldFrustumPlanes(), and getWorldPlanePos().
Definition at line 130 of file llcamera.h.
Referenced by calcAgentFrustumPlanes(), and LLSpatialBridge::setVisible().