summaryrefslogtreecommitdiff
path: root/indra/newview/llvlcomposition.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvlcomposition.h')
-rw-r--r--indra/newview/llvlcomposition.h94
1 files changed, 78 insertions, 16 deletions
diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h
index 2dd04ac5a5..cde0e216c3 100644
--- a/indra/newview/llvlcomposition.h
+++ b/indra/newview/llvlcomposition.h
@@ -28,23 +28,79 @@
#define LL_LLVLCOMPOSITION_H
#include "llviewerlayer.h"
-#include "llviewertexture.h"
+#include "llpointer.h"
+
+#include "llimage.h"
class LLSurface;
-class LLVLComposition : public LLViewerLayer
+class LLViewerFetchedTexture;
+class LLFetchedGLTFMaterial;
+
+class LLTerrainMaterials
{
public:
+ friend class LLDrawPoolTerrain;
+
+ LLTerrainMaterials();
+ virtual ~LLTerrainMaterials();
+
+ // Heights map into textures (or materials) as 0-1 = first, 1-2 = second, etc.
+ // So we need to compress heights into this range.
+ static const S32 ASSET_COUNT = 4;
+
+ enum class Type
+ {
+ TEXTURE,
+ PBR,
+ COUNT
+ };
+
+ BOOL generateMaterials();
+
+ void boost();
+
+ virtual LLUUID getDetailAssetID(S32 asset);
+ virtual void setDetailAssetID(S32 asset, const LLUUID& id);
+ Type getMaterialType();
+ bool texturesReady(bool boost, bool strict);
+ // strict = true -> all materials must be sufficiently loaded
+ // strict = false -> at least one material must be loaded
+ bool materialsReady(bool boost, bool strict);
+
+protected:
+ void unboost();
+ static bool textureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost);
+ // strict = true -> all materials must be sufficiently loaded
+ // strict = false -> at least one material must be loaded
+ static bool materialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict);
+ LLPointer<LLViewerFetchedTexture> mDetailTextures[ASSET_COUNT];
+ LLPointer<LLFetchedGLTFMaterial> mDetailMaterials[ASSET_COUNT];
+ bool mMaterialTexturesSet[ASSET_COUNT];
+};
+
+// Local materials to override all regions
+extern LLTerrainMaterials gLocalTerrainMaterials;
+
+class LLVLComposition : public LLTerrainMaterials, public LLViewerLayer
+{
+public:
+ // Heights map into textures (or materials) as 0-1 = first, 1-2 = second, etc.
+ // So we need to compress heights into this range.
+ static const S32 ASSET_COUNT = 4;
+ static const LLUUID (&getDefaultTextures())[ASSET_COUNT];
+
LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale);
/*virtual*/ ~LLVLComposition();
void setSurface(LLSurface *surfacep);
// Viewer side hack to generate composition values
- BOOL generateHeights(const F32 x, const F32 y, const F32 width, const F32 height);
- BOOL generateComposition();
+ bool generateHeights(const F32 x, const F32 y, const F32 width, const F32 height);
+ bool generateComposition();
// Generate texture from composition values.
- BOOL generateTexture(const F32 x, const F32 y, const F32 width, const F32 height);
+ bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height);
+ bool generateTexture(const F32 x, const F32 y, const F32 width, const F32 height);
// Use these as indeces ito the get/setters below that use 'corner'
enum ECorner
@@ -55,32 +111,38 @@ public:
NORTHEAST = 3,
CORNER_COUNT = 4
};
- LLUUID getDetailTextureID(S32 corner);
- LLViewerFetchedTexture* getDetailTexture(S32 corner);
+
+ void setDetailAssetID(S32 asset, const LLUUID& id) override;
F32 getStartHeight(S32 corner);
F32 getHeightRange(S32 corner);
- void setDetailTextureID(S32 corner, const LLUUID& id);
void setStartHeight(S32 corner, F32 start_height);
void setHeightRange(S32 corner, F32 range);
friend class LLVOSurfacePatch;
friend class LLDrawPoolTerrain;
- void setParamsReady() { mParamsReady = TRUE; }
- BOOL getParamsReady() const { return mParamsReady; }
+ void setParamsReady() { mParamsReady = true; }
+ bool getParamsReady() const { return mParamsReady; }
+
protected:
- BOOL mParamsReady;
+ static bool textureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost = false);
+ static bool materialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost = false);
+
+ bool mParamsReady = false;
LLSurface *mSurfacep;
- BOOL mTexturesLoaded;
- LLPointer<LLViewerFetchedTexture> mDetailTextures[CORNER_COUNT];
- LLPointer<LLImageRaw> mRawImages[CORNER_COUNT];
+ // Final minimap raw images
+ LLPointer<LLImageRaw> mRawImages[LLTerrainMaterials::ASSET_COUNT];
+
+ // Only non-null during minimap tile generation
+ LLPointer<LLImageRaw> mRawImagesBaseColor[LLTerrainMaterials::ASSET_COUNT];
+ LLPointer<LLImageRaw> mRawImagesEmissive[LLTerrainMaterials::ASSET_COUNT];
F32 mStartHeight[CORNER_COUNT];
F32 mHeightRange[CORNER_COUNT];
- F32 mTexScaleX;
- F32 mTexScaleY;
+ F32 mTexScaleX = 16.f;
+ F32 mTexScaleY = 16.f;
};
#endif //LL_LLVLCOMPOSITION_H