From 17f7b439d617bfdf4c865f1478ade662e86b61d2 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 7 Aug 2024 20:56:10 +0200 Subject: #1922 Make PBR scale and offset crosshair work like Texture crosshair do --- indra/llrender/llrender.h | 19 +++++++++++-------- indra/llrender/llvertexbuffer.cpp | 12 ++++++++++++ indra/llrender/llvertexbuffer.h | 9 +++++---- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index e6b4118beb..010ab122b6 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -293,15 +293,18 @@ public: enum eTexIndex : U8 { - DIFFUSE_MAP = 0, - ALTERNATE_DIFFUSE_MAP = 1, - NORMAL_MAP = 1, - SPECULAR_MAP = 2, - BASECOLOR_MAP = 3, + // Channels for material textures + DIFFUSE_MAP = 0, + ALTERNATE_DIFFUSE_MAP = 1, + NORMAL_MAP = 1, + SPECULAR_MAP = 2, + // Channels for PBR textures + BASECOLOR_MAP = 3, METALLIC_ROUGHNESS_MAP = 4, - GLTF_NORMAL_MAP = 5, - EMISSIVE_MAP = 6, - NUM_TEXTURE_CHANNELS = 7, + GLTF_NORMAL_MAP = 5, + EMISSIVE_MAP = 6, + // Total number of channels + NUM_TEXTURE_CHANNELS = 7, }; enum eVolumeTexIndex : U8 diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 2eb7c21f77..02afcf12c6 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -794,6 +794,18 @@ void LLVertexBuffer::setLabel(const char* label) { } #endif +void LLVertexBuffer::clone(LLVertexBuffer& target) const +{ + target.mTypeMask = mTypeMask; + target.mIndicesType = mIndicesType; + target.mIndicesStride = mIndicesStride; + if (target.getNumVerts() != getNumVerts() || + target.getNumIndices() != getNumIndices()) + { + target.allocateBuffer(getNumVerts(), getNumIndices()); + } +} + void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const { llassert(validateRange(start, end, count, indices_offset)); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 49500e28ce..4ada0c335b 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -163,13 +163,13 @@ public: // set for rendering // assumes (and will assert on) the following: - // - this buffer has no pending unampBuffer call + // - this buffer has no pending unmapBuffer call // - a shader is currently bound // - This buffer has sufficient attributes within it to satisfy the needs of the currently bound shader void setBuffer(); // Only call each getVertexPointer, etc, once before calling unmapBuffer() - // call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer() + // call unmapBuffer() after calls to getXXXStrider() before any calls to setBuffer() // example: // vb->getVertexBuffer(verts); // vb->getNormalStrider(norms); @@ -218,12 +218,12 @@ public: U32 getNumIndices() const { return mNumIndices; } U32 getTypeMask() const { return mTypeMask; } - bool hasDataType(AttributeType type) const { return ((1 << type) & getTypeMask()); } + bool hasDataType(AttributeType type) const { return ((1 << type) & getTypeMask()); } U32 getSize() const { return mSize; } U32 getIndicesSize() const { return mIndicesSize; } U8* getMappedData() const { return mMappedData; } U8* getMappedIndices() const { return mMappedIndexData; } - U32 getOffset(AttributeType type) const { return mOffsets[type]; } + U32 getOffset(AttributeType type) const { return mOffsets[type]; } // these functions assume (and assert on) the current VBO being bound // Detailed error checking can be enabled by setting gDebugGL to true @@ -242,6 +242,7 @@ public: void setLabel(const char* label); #endif + void clone(LLVertexBuffer& target) const; protected: U32 mGLBuffer = 0; // GL VBO handle -- cgit v1.2.3