From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/llviewercamera.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llviewercamera.h') diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 78ca2b3076..f65a2017bf 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -35,8 +35,8 @@ #include "lltrace.h" class LLViewerObject; -const BOOL FOR_SELECTION = TRUE; -const BOOL NOT_FOR_SELECTION = FALSE; +const bool FOR_SELECTION = true; +const bool NOT_FOR_SELECTION = false; class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton { @@ -64,17 +64,17 @@ public: const LLVector3 &up_direction, const LLVector3 &point_of_interest); - static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE); + static void updateFrustumPlanes(LLCamera& camera, bool ortho = false, bool zflip = false, bool no_hacks = false); static void updateCameraAngle(void* user_data, const LLSD& value); - void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0); + void setPerspective(bool for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, bool limit_select_distance, F32 z_near = 0, F32 z_far = 0); const LLMatrix4 &getProjection() const; const LLMatrix4 &getModelview() const; // Warning! These assume the current global matrices are correct void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const; - BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const; - BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; + bool projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp = true) const; + bool projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; LLVector3 getVelocityDir() const {return mVelocityDir;} static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } @@ -92,10 +92,10 @@ public: void setDefaultFOV(F32 fov) ; F32 getDefaultFOV() { return mCameraFOVDefault; } - BOOL isDefaultFOVChanged(); + bool isDefaultFOVChanged(); - BOOL cameraUnderWater() const; - BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts); + bool cameraUnderWater() const; + bool areVertsVisible(LLViewerObject* volumep, bool all_verts); const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } F32 getPixelMeterRatio() const { return mPixelMeterRatio; } -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/llviewercamera.h | 264 ++++++++++++++++++++--------------------- 1 file changed, 132 insertions(+), 132 deletions(-) (limited to 'indra/newview/llviewercamera.h') diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 09b1a31e7e..6d8fb2a520 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -1,132 +1,132 @@ -/** - * @file llviewercamera.h - * @brief LLViewerCamera class header file - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVIEWERCAMERA_H -#define LL_LLVIEWERCAMERA_H - -#include "llcamera.h" -#include "llsingleton.h" -#include "lltimer.h" -#include "m4math.h" -#include "llcoord.h" -#include "lltrace.h" - -class LLViewerObject; -const bool FOR_SELECTION = true; -const bool NOT_FOR_SELECTION = false; - -class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton -{ - LL_ALIGN_NEW -public: - LLViewerCamera(); - - typedef enum - { - CAMERA_WORLD = 0, - CAMERA_SUN_SHADOW0, - CAMERA_SUN_SHADOW1, - CAMERA_SUN_SHADOW2, - CAMERA_SUN_SHADOW3, - CAMERA_SPOT_SHADOW0, - CAMERA_SPOT_SHADOW1, - CAMERA_WATER0, - CAMERA_WATER1, - NUM_CAMERAS - } eCameraID; - - static eCameraID sCurCameraID; - - void updateCameraLocation(const LLVector3 ¢er, - const LLVector3 &up_direction, - const LLVector3 &point_of_interest); - - static void updateFrustumPlanes(LLCamera& camera, bool ortho = false, bool zflip = false, bool no_hacks = false); - static void updateCameraAngle(void* user_data, const LLSD& value); - void setPerspective(bool for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, bool limit_select_distance, F32 z_near = 0, F32 z_far = 0); - - const LLMatrix4 &getProjection() const; - const LLMatrix4 &getModelview() const; - - // Warning! These assume the current global matrices are correct - void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const; - bool projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp = true) const; - bool projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; - - LLVector3 getVelocityDir() const {return mVelocityDir;} - static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } - static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; } - F32 getCosHalfFov() {return mCosHalfCameraFOV;} - F32 getAverageSpeed() {return mAverageSpeed ;} - F32 getAverageAngularSpeed() {return mAverageAngularSpeed;} - - void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right); - LLVector3 roundToPixel(const LLVector3 &pos_agent); - - // Sets the current matrix - /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator - void setViewNoBroadcast(F32 vertical_fov_rads); // set FOV without broadcasting to simulator (for temporary local cameras) - void setDefaultFOV(F32 fov) ; - F32 getDefaultFOV() { return mCameraFOVDefault; } - - bool isDefaultFOVChanged(); - - bool cameraUnderWater() const; - bool areVertsVisible(LLViewerObject* volumep, bool all_verts); - - const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } - F32 getPixelMeterRatio() const { return mPixelMeterRatio; } - S32 getScreenPixelArea() const { return mScreenPixelArea; } - - void setZoomParameters(F32 factor, S16 subregion) { mZoomFactor = factor; mZoomSubregion = subregion; } - F32 getZoomFactor() { return mZoomFactor; } - S16 getZoomSubRegion() { return mZoomSubregion; } - -protected: - void calcProjection(const F32 far_distance) const; - - static LLTrace::CountStatHandle<> sVelocityStat; - static LLTrace::CountStatHandle<> sAngularVelocityStat; - - LLVector3 mVelocityDir ; - F32 mAverageSpeed ; - F32 mAverageAngularSpeed ; - mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix - mutable LLMatrix4 mModelviewMatrix; - F32 mCameraFOVDefault; - F32 mPrevCameraFOVDefault; - F32 mCosHalfCameraFOV; - LLVector3 mLastPointOfInterest; - F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance. - S32 mScreenPixelArea; // Pixel area of entire window - F32 mZoomFactor; - S16 mZoomSubregion; - -public: -}; - - -#endif // LL_LLVIEWERCAMERA_H +/** + * @file llviewercamera.h + * @brief LLViewerCamera class header file + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLVIEWERCAMERA_H +#define LL_LLVIEWERCAMERA_H + +#include "llcamera.h" +#include "llsingleton.h" +#include "lltimer.h" +#include "m4math.h" +#include "llcoord.h" +#include "lltrace.h" + +class LLViewerObject; +const bool FOR_SELECTION = true; +const bool NOT_FOR_SELECTION = false; + +class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton +{ + LL_ALIGN_NEW +public: + LLViewerCamera(); + + typedef enum + { + CAMERA_WORLD = 0, + CAMERA_SUN_SHADOW0, + CAMERA_SUN_SHADOW1, + CAMERA_SUN_SHADOW2, + CAMERA_SUN_SHADOW3, + CAMERA_SPOT_SHADOW0, + CAMERA_SPOT_SHADOW1, + CAMERA_WATER0, + CAMERA_WATER1, + NUM_CAMERAS + } eCameraID; + + static eCameraID sCurCameraID; + + void updateCameraLocation(const LLVector3 ¢er, + const LLVector3 &up_direction, + const LLVector3 &point_of_interest); + + static void updateFrustumPlanes(LLCamera& camera, bool ortho = false, bool zflip = false, bool no_hacks = false); + static void updateCameraAngle(void* user_data, const LLSD& value); + void setPerspective(bool for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, bool limit_select_distance, F32 z_near = 0, F32 z_far = 0); + + const LLMatrix4 &getProjection() const; + const LLMatrix4 &getModelview() const; + + // Warning! These assume the current global matrices are correct + void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const; + bool projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp = true) const; + bool projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; + + LLVector3 getVelocityDir() const {return mVelocityDir;} + static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } + static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; } + F32 getCosHalfFov() {return mCosHalfCameraFOV;} + F32 getAverageSpeed() {return mAverageSpeed ;} + F32 getAverageAngularSpeed() {return mAverageAngularSpeed;} + + void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right); + LLVector3 roundToPixel(const LLVector3 &pos_agent); + + // Sets the current matrix + /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator + void setViewNoBroadcast(F32 vertical_fov_rads); // set FOV without broadcasting to simulator (for temporary local cameras) + void setDefaultFOV(F32 fov) ; + F32 getDefaultFOV() { return mCameraFOVDefault; } + + bool isDefaultFOVChanged(); + + bool cameraUnderWater() const; + bool areVertsVisible(LLViewerObject* volumep, bool all_verts); + + const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } + F32 getPixelMeterRatio() const { return mPixelMeterRatio; } + S32 getScreenPixelArea() const { return mScreenPixelArea; } + + void setZoomParameters(F32 factor, S16 subregion) { mZoomFactor = factor; mZoomSubregion = subregion; } + F32 getZoomFactor() { return mZoomFactor; } + S16 getZoomSubRegion() { return mZoomSubregion; } + +protected: + void calcProjection(const F32 far_distance) const; + + static LLTrace::CountStatHandle<> sVelocityStat; + static LLTrace::CountStatHandle<> sAngularVelocityStat; + + LLVector3 mVelocityDir ; + F32 mAverageSpeed ; + F32 mAverageAngularSpeed ; + mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix + mutable LLMatrix4 mModelviewMatrix; + F32 mCameraFOVDefault; + F32 mPrevCameraFOVDefault; + F32 mCosHalfCameraFOV; + LLVector3 mLastPointOfInterest; + F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance. + S32 mScreenPixelArea; // Pixel area of entire window + F32 mZoomFactor; + S16 mZoomSubregion; + +public: +}; + + +#endif // LL_LLVIEWERCAMERA_H -- cgit v1.2.3 From 57ade10b70af9869a2d6ee8a41c22650a57586d9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 Jun 2024 09:45:54 +0300 Subject: viewer#1672 Crash at setDefaultFOV Some things can make a copy of camera, like LLViewerWindow::cubeSnapshot so need to store and clean up the connection --- indra/newview/llviewercamera.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewercamera.h') diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 6d8fb2a520..a204b85d88 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -43,6 +43,7 @@ class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton