diff options
Diffstat (limited to 'indra/newview/llvovolume.h')
-rw-r--r-- | indra/newview/llvovolume.h | 225 |
1 files changed, 123 insertions, 102 deletions
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 59599ddc0c..aadc1fbcf3 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -34,8 +34,8 @@ #include "lllocalbitmaps.h" #include "m3math.h" // LLMatrix3 #include "m4math.h" // LLMatrix4 -#include <map> -#include <set> +#include <unordered_map> +#include <unordered_set> class LLViewerTextureAnim; @@ -68,7 +68,12 @@ public: using FaceIndex = S32; static const FaceIndex UPDATE_ALL_FACES = -1; static const FaceIndex DO_NOT_UPDATE_FACES = -2; - void update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* src_volume, FaceIndex face_index = UPDATE_ALL_FACES, bool rebuild_face_octrees = true); + void update( + const LLMeshSkinInfo* skin, + LLVOAvatar* avatar, + const LLVolume* src_volume, + FaceIndex face_index = UPDATE_ALL_FACES, + bool rebuild_face_octrees = true); std::string mExtraDebugText; }; @@ -117,49 +122,51 @@ public: }; public: - LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - /*virtual*/ void markDead(); // Override (and call through to parent) to clean up media references + LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); + void markDead() override; // Override (and call through to parent) to clean up media references - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); + LLDrawable* createDrawable(LLPipeline *pipeline) override; void deleteFaces(); void animateTextures(); BOOL isVisible() const ; - /*virtual*/ BOOL isActive() const; - /*virtual*/ BOOL isAttachment() const; - /*virtual*/ BOOL isRootEdit() const; // overridden for sake of attachments treating themselves as a root object - /*virtual*/ BOOL isHUDAttachment() const; + BOOL isActive() const override; + BOOL isAttachment() const override; + BOOL isRootEdit() const override; // overridden for sake of attachments treating themselves as a root object + BOOL isHUDAttachment() const override; void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point); - /*virtual*/ BOOL setParent(LLViewerObject* parent); - S32 getLOD() const { return mLOD; } + /*virtual*/ BOOL setParent(LLViewerObject* parent) override; + S32 getLOD() const override { return mLOD; } void setNoLOD() { mLOD = NO_LOD; mLODChanged = TRUE; } bool isNoLOD() const { return NO_LOD == mLOD; } - const LLVector3 getPivotPositionAgent() const; + const LLVector3 getPivotPositionAgent() const override; const LLMatrix4& getRelativeXform() const { return mRelativeXform; } const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } - /*virtual*/ const LLMatrix4 getRenderMatrix() const; - typedef std::map<LLUUID, S32> texture_cost_t; + /*virtual*/ const LLMatrix4 getRenderMatrix() const override; + typedef std::unordered_set<const LLViewerTexture*> texture_cost_t; + static S32 getTextureCost(const LLViewerTexture* img); U32 getRenderCost(texture_cost_t &textures) const; - /*virtual*/ F32 getEstTrianglesMax() const; - /*virtual*/ F32 getEstTrianglesStreamingCost() const; - /* virtual*/ F32 getStreamingCost() const; - /*virtual*/ bool getCostData(LLMeshCostData& costs) const; + /*virtual*/ F32 getEstTrianglesMax() const override; + /*virtual*/ F32 getEstTrianglesStreamingCost() const override; + /* virtual*/ F32 getStreamingCost() const override; + /*virtual*/ bool getCostData(LLMeshCostData& costs) const override; - /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const; - /*virtual*/ U32 getHighLODTriangleCount(); + /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const override; + /*virtual*/ U32 getHighLODTriangleCount() override; /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, BOOL pick_rigged = FALSE, + BOOL pick_unselectable = TRUE, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point LLVector4a* normal = NULL, // return the surface normal at the intersection point LLVector4a* tangent = NULL // return the surface tangent at the intersection point - ); + ) override; LLVector3 agentPositionToVolume(const LLVector3& pos) const; LLVector3 agentDirectionToVolume(const LLVector3& dir) const; @@ -169,55 +176,58 @@ public: BOOL getVolumeChanged() const { return mVolumeChanged; } - /*virtual*/ F32 getRadius() const { return mVObjRadius; }; - const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; + F32 getVObjRadius() const override { return mVObjRadius; }; + const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const override; - void markForUpdate(BOOL priority); - void markForUnload() { LLViewerObject::markForUnload(TRUE); mVolumeChanged = TRUE; } - void faceMappingChanged() { mFaceMappingChanged=TRUE; }; + void markForUpdate() override; + void faceMappingChanged() override { mFaceMappingChanged=TRUE; } - /*virtual*/ void onShift(const LLVector4a &shift_vector); // Called when the drawable shifts + /*virtual*/ void onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts - /*virtual*/ void parameterChanged(U16 param_type, bool local_origin); - /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); + /*virtual*/ void parameterChanged(U16 param_type, bool local_origin) override; + /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) override; + + // update mReflectionProbe based on isReflectionProbe() + void updateReflectionProbePtr(); /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, - LLDataPacker *dp); - - /*virtual*/ void setSelected(BOOL sel); - /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp); - - /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped); - - /*virtual*/ void changeTEImage(S32 index, LLViewerTexture* new_image) ; - /*virtual*/ void setNumTEs(const U8 num_tes); - /*virtual*/ void setTEImage(const U8 te, LLViewerTexture *imagep); - /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); - /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); - /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); - /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump); - /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny); - /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright); - /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump); - /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags); - /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); - /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID); + LLDataPacker *dp) override; + + /*virtual*/ void setSelected(BOOL sel) override; + /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp) override; + + /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped) override; + + /*virtual*/ void changeTEImage(S32 index, LLViewerTexture* new_image) override; + /*virtual*/ void setNumTEs(const U8 num_tes) override; + /*virtual*/ void setTEImage(const U8 te, LLViewerTexture *imagep) override; + /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid) override; + /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color) override; + /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color) override; + /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump) override; + /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny) override; + /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright) override; + /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump) override; + /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags) override; + /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow) override; + /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) override; static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te); - /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams); - /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); - /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); - /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); - /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen); - /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media); - /*virtual*/ BOOL setMaterial(const U8 material); + /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) override; + S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat) override; + /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t) override; + /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s) override; + /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t) override; + /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen) override; + /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media) override; + /*virtual*/ BOOL setMaterial(const U8 material) override; void setTexture(const S32 face); S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];} - /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); + /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override; void updateSculptTexture(); void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;} void sculpt(); @@ -226,21 +236,21 @@ public: void* user_data, S32 status, LLExtStat ext_status); void updateRelativeXform(bool force_identity = false); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - /*virtual*/ void updateFaceSize(S32 idx); - /*virtual*/ BOOL updateLOD(); - void updateRadius(); - /*virtual*/ void updateTextures(); + /*virtual*/ BOOL updateGeometry(LLDrawable *drawable) override; + /*virtual*/ void updateFaceSize(S32 idx) override; + /*virtual*/ BOOL updateLOD() override; + void updateRadius() override; + /*virtual*/ void updateTextures() override; void updateTextureVirtualSize(bool forced = false); void updateFaceFlags(); void regenFaces(); BOOL genBBoxes(BOOL force_global, BOOL should_update_octree_bounds = TRUE); void preRebuild(); - virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max); - virtual F32 getBinRadius(); + virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max) override; + virtual F32 getBinRadius() override; - virtual U32 getPartitionType() const; + virtual U32 getPartitionType() const override; // For Lights void setIsLight(BOOL is_light); @@ -257,6 +267,7 @@ public: void setSpotLightParams(LLVector3 params); BOOL getIsLight() const; + bool getIsLightFast() const; // Get the light color in sRGB color space NOT scaled by intensity. @@ -283,21 +294,43 @@ public: F32 getLightRadius() const; F32 getLightFalloff(const F32 fudge_factor = 1.f) const; F32 getLightCutoff() const; - + + // Reflection Probes + bool setIsReflectionProbe(BOOL is_probe); + bool setReflectionProbeAmbiance(F32 ambiance); + bool setReflectionProbeNearClip(F32 near_clip); + bool setReflectionProbeIsBox(bool is_box); + bool setReflectionProbeIsDynamic(bool is_dynamic); + + BOOL isReflectionProbe() const override; + F32 getReflectionProbeAmbiance() const; + F32 getReflectionProbeNearClip() const; + bool getReflectionProbeIsBox() const; + bool getReflectionProbeIsDynamic() const; + // Flexible Objects U32 getVolumeInterfaceID() const; - virtual BOOL isFlexible() const; - virtual BOOL isSculpted() const; - virtual BOOL isMesh() const; - virtual BOOL isRiggedMesh() const; - virtual BOOL hasLightTexture() const; + virtual BOOL isFlexible() const override; + virtual BOOL isSculpted() const override; + virtual BOOL isMesh() const override; + virtual BOOL isRiggedMesh() const override; + virtual BOOL hasLightTexture() const override; + + // fast variants above that use state that is filled in later + // not reliable early in the life of an object, but should be used after + // object is loaded + bool isFlexibleFast() const; + bool isSculptedFast() const; + bool isMeshFast() const; + bool isRiggedMeshFast() const; + bool isAnimatedObjectFast() const; - BOOL isVolumeGlobal() const; BOOL canBeFlexible() const; BOOL setIsFlexible(BOOL is_flexible); const LLMeshSkinInfo* getSkinInfo() const; + const bool isSkinInfoUnavaliable() const { return mSkinInfoUnavaliable; } //convenience accessor for mesh ID (which is stored in sculpt id for legacy reasons) const LLUUID& getMeshID() const { return getVolume()->getParams().getSculptID(); } @@ -307,12 +340,12 @@ public: void onSetExtendedMeshFlags(U32 flags); void setExtendedMeshFlags(U32 flags); bool canBeAnimatedObject() const; - bool isAnimatedObject() const; - virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent); - virtual void afterReparent(); + bool isAnimatedObject() const override; + virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent) override; + virtual void afterReparent() override; //virtual - void updateRiggingInfo(); + void updateRiggingInfo() override; S32 mLastRiggingInfoLOD; // Functions that deal with media, or media navigation @@ -369,7 +402,10 @@ public: // Rigged volume update (for raycasting) // By default, this updates the bounding boxes of all the faces and builds an octree for precise per-triangle raycasting - void updateRiggedVolume(bool force_treat_as_rigged, LLRiggedVolume::FaceIndex face_index = LLRiggedVolume::UPDATE_ALL_FACES, bool rebuild_face_octrees = true); + void updateRiggedVolume( + bool force_treat_as_rigged, + LLRiggedVolume::FaceIndex face_index = LLRiggedVolume::UPDATE_ALL_FACES, + bool rebuild_face_octrees = true); LLRiggedVolume* getRiggedVolume(); //returns true if volume should be treated as a rigged volume @@ -386,8 +422,7 @@ protected: S32 computeLODDetail(F32 distance, F32 radius, F32 lod_factor); BOOL calcLOD(); LLFace* addFace(S32 face_index); - void updateTEData(); - + // stats tracking for render complexity static S32 mRenderComplexity_last; static S32 mRenderComplexity_current; @@ -435,11 +470,18 @@ private: S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; S32 mMDCImplCount; + // cached value of getIsLight to avoid redundant map lookups + // accessed by getIsLightFast + mutable bool mIsLight = false; + + // cached value of getIsAnimatedObject to avoid redundant map lookups + // accessed by getIsAnimatedObjectFast + mutable bool mIsAnimatedObject = false; bool mResetDebugText; LLPointer<LLRiggedVolume> mRiggedVolume; - bool mSkinInfoFailed; + bool mSkinInfoUnavaliable; LLConstPointer<LLMeshSkinInfo> mSkinInfo; // statics public: @@ -449,31 +491,10 @@ public: static LLPointer<LLObjectMediaDataClient> sObjectMediaClient; static LLPointer<LLObjectMediaNavigateClient> sObjectMediaNavigateClient; - protected: static S32 sNumLODChanges; friend class LLVolumeImplFlexible; - -public: - bool notifyAboutCreatingTexture(LLViewerTexture *texture); - bool notifyAboutMissingAsset(LLViewerTexture *texture); - -private: - struct material_info - { - LLRender::eTexIndex map; - U8 te; - - material_info(LLRender::eTexIndex map_, U8 te_) - : map(map_) - , te(te_) - {} - }; - - typedef std::multimap<LLUUID, material_info> mmap_UUID_MAP_t; - mmap_UUID_MAP_t mWaitingTextureInfo; - }; #endif // LL_LLVOVOLUME_H |