diff options
Diffstat (limited to 'indra/newview/llsurfacepatch.h')
-rw-r--r-- | indra/newview/llsurfacepatch.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h index 43843aba0b..195250d2c0 100644 --- a/indra/newview/llsurfacepatch.h +++ b/indra/newview/llsurfacepatch.h @@ -44,13 +44,13 @@ class LLPatchVisibilityInfo { public: LLPatchVisibilityInfo() : - mbIsVisible(FALSE), + mbIsVisible(false), mDistance(0.f), mRenderLevel(0), mRenderStride(0) { }; ~LLPatchVisibilityInfo() { }; - BOOL mbIsVisible; + bool mbIsVisible; F32 mDistance; // Distance from camera S32 mRenderLevel; U32 mRenderStride; @@ -73,10 +73,11 @@ public: void colorPatch(const U8 r, const U8 g, const U8 b); - BOOL updateTexture(); + bool updateTexture(); void updateVerticalStats(); void updateCompositionStats(); + template<bool PBR> void updateNormals(); void updateEastEdge(); @@ -88,7 +89,7 @@ public: void dirtyZ(); // Dirty the z values of this patch void setHasReceivedData(); - BOOL getHasReceivedData() const; + bool getHasReceivedData() const; F32 getDistance() const; F32 getMaxZ() const; @@ -102,9 +103,18 @@ public: LLVector3 getPointAgent(const U32 x, const U32 y) const; // get the point at the offset. LLVector2 getTexCoords(const U32 x, const U32 y) const; + // Per-vertex normals + // *TODO: PBR=true is a test implementation solely for proof-of-concept. + // Final implementation would likely be very different and may not even use + // this function. If we decide to keep calcNormalFlat, remove index as it + // is a debug parameter for testing. + template<bool PBR> void calcNormal(const U32 x, const U32 y, const U32 stride); const LLVector3 &getNormal(const U32 x, const U32 y) const; + // Per-triangle normals for flat edges + void calcNormalFlat(LLVector3& normal_out, const U32 x, const U32 y, const U32 index /* 0 or 1 */); + void eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1); @@ -124,7 +134,7 @@ public: // +---+---+---+ - BOOL getVisible() const; + bool getVisible() const; U32 getRenderStride() const; S32 getRenderLevel() const; @@ -134,21 +144,21 @@ public: F32 *getDataZ() const { return mDataZ; } void dirty(); // Mark this surface patch as dirty... - void clearDirty() { mDirty = FALSE; } + void clearDirty() { mDirty = false; } void clearVObj(); public: - BOOL mHasReceivedData; // has the patch EVER received height data? - BOOL mSTexUpdate; // Does the surface texture need to be updated? + bool mHasReceivedData; // has the patch EVER received height data? + bool mSTexUpdate; // Does the surface texture need to be updated? protected: LLSurfacePatch *mNeighborPatches[8]; // Adjacent patches - BOOL mNormalsInvalid[9]; // Which normals are invalid + bool mNormalsInvalid[9]; // Which normals are invalid - BOOL mDirty; - BOOL mDirtyZStats; - BOOL mHeightsGenerated; + bool mDirty; + bool mDirtyZStats; + bool mHeightsGenerated; U32 mDataOffset; F32 *mDataZ; @@ -181,5 +191,8 @@ protected: LLSurface *mSurfacep; // Pointer to "parent" surface }; +extern template void LLSurfacePatch::updateNormals</*PBR=*/false>(); +extern template void LLSurfacePatch::updateNormals</*PBR=*/true>(); + #endif // LL_LLSURFACEPATCH_H |