From 6618cff96c75bd0183b173c30ec818404038c2dd Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Thu, 29 Nov 2012 00:00:18 +0100 Subject: Encapsulate material definitions in LLMaterial and refactor LLFloaterDebugMaterials to use the new class --- indra/llprimitive/llmaterial.h | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 indra/llprimitive/llmaterial.h (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h new file mode 100644 index 0000000000..d50ab30195 --- /dev/null +++ b/indra/llprimitive/llmaterial.h @@ -0,0 +1,94 @@ +/** + * @file llmaterial.h + * @brief Material definition + * + * $LicenseInfo:firstyear=2006&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_LLMATERIAL_H +#define LL_LLMATERIAL_H + +#include "llmaterialid.h" +#include "llsd.h" +#include "v4coloru.h" + +class LLMaterial +{ +public: + LLMaterial(); + LLMaterial(const LLSD& material_data); + + LLSD asLLSD() const; + void fromLLSD(const LLSD& material_data); + + const LLUUID& getNormalID() const { return mNormalID; } + void setNormalID(const LLUUID& normal_id) { mNormalID = normal_id; } + void getNormalOffset(F32& offset_x, F32& offset_y) const { offset_x = mNormalOffsetX; offset_y = mNormalOffsetY; } + void setNormalOffset(F32 offset_x, F32 offset_y) { mNormalOffsetX = offset_x; mNormalOffsetY = offset_y; } + void getNormalRepeat(F32& repeat_x, F32& repeat_y) const { repeat_x = mNormalRepeatX; repeat_y = mNormalRepeatY; } + void setNormalRepeat(F32 repeat_x, F32 repeat_y) { mNormalRepeatX = repeat_x; mNormalRepeatY = repeat_y; } + F32 getNormalRotation() const { return mNormalRotation; } + void setNormalRotation(F32 rot) { mNormalRotation = rot; } + + const LLUUID& getSpecularID() const { return mSpecularID; } + void setSpecularID(const LLUUID& specular_id) { mSpecularID = specular_id; } + void getSpecularOffset(F32& offset_x, F32& offset_y) const { offset_x = mSpecularOffsetX; offset_y = mSpecularOffsetY; } + void setSpecularOffset(F32 offset_x, F32 offset_y) { mSpecularOffsetX = offset_x; mSpecularOffsetY = offset_y; } + void getSpecularRepeat(F32& repeat_x, F32& repeat_y) const { repeat_x = mSpecularRepeatX; repeat_y = mSpecularRepeatY; } + void setSpecularRepeat(F32 repeat_x, F32 repeat_y) { mSpecularRepeatX = repeat_x; mSpecularRepeatY = repeat_y; } + F32 getSpecularRotation() const { return mSpecularRotation; } + void setSpecularRotation(F32 rot) { mSpecularRotation = rot; } + + const LLColor4U& getSpecularLightColor() const { return mSpecularLightColor; } + void setSpecularLightColor(const LLColor4U& color) { mSpecularLightColor = color; } + U8 getSpecularLightExponent() const { return mSpecularLightExponent; } + void setSpecularLightExponent(U8 exponent) { mSpecularLightExponent = exponent; } + U8 getEnvironmentIntensity() const { return mEnvironmentIntensity; } + void setEnvironmentIntensity(U8 intensity) { mEnvironmentIntensity = intensity; } + U8 getDiffuseAlphaMode() const { return mDiffuseAlphaMode; } + void setDiffuseAlphaMode(U8 alpha_mode) { mDiffuseAlphaMode = alpha_mode; } + U8 getAlphaMaskCutoff() const { return mAlphaMaskCutoff; } + void setAlphaMaskCutoff(U8 cutoff) { mAlphaMaskCutoff = cutoff; } + +protected: + LLUUID mNormalID; + F32 mNormalOffsetX; + F32 mNormalOffsetY; + F32 mNormalRepeatX; + F32 mNormalRepeatY; + F32 mNormalRotation; + + LLUUID mSpecularID; + F32 mSpecularOffsetX; + F32 mSpecularOffsetY; + F32 mSpecularRepeatX; + F32 mSpecularRepeatY; + F32 mSpecularRotation; + + LLColor4U mSpecularLightColor; + U8 mSpecularLightExponent; + U8 mEnvironmentIntensity; + U8 mDiffuseAlphaMode; + U8 mAlphaMaskCutoff; +}; + +#endif // LL_LLMATERIAL_H -- cgit v1.2.3 From 1e26dbdcd27a1f29fe249cc7e074e5ede284bac8 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 3 Dec 2012 01:46:26 +0100 Subject: Started LLMaterialMgr to handle viewer<->region materials communication * refactored LLFloaterDebugMaterials::requestPutMaterials() to use LLMaterialMgr instead * replaced "Object editing" results list with information about the active selection instead --- indra/llprimitive/llmaterial.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index d50ab30195..42e3dd04b9 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -69,6 +69,9 @@ public: U8 getAlphaMaskCutoff() const { return mAlphaMaskCutoff; } void setAlphaMaskCutoff(U8 cutoff) { mAlphaMaskCutoff = cutoff; } + bool isNull() const; + static const LLMaterial null; + protected: LLUUID mNormalID; F32 mNormalOffsetX; -- cgit v1.2.3 From 25bffc3d43ec7696c0a9fab43514affbfe006fb9 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 3 Dec 2012 15:20:11 +0100 Subject: Added LLMaterialMgr::get() to retrieve individual materials (with optional callback) --- indra/llprimitive/llmaterial.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 42e3dd04b9..da364e548c 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -27,6 +27,8 @@ #ifndef LL_LLMATERIAL_H #define LL_LLMATERIAL_H +#include + #include "llmaterialid.h" #include "llsd.h" #include "v4coloru.h" @@ -94,4 +96,6 @@ protected: U8 mAlphaMaskCutoff; }; +typedef boost::shared_ptr LLMaterialPtr; + #endif // LL_LLMATERIAL_H -- cgit v1.2.3 From 5f03e197f4cfb43de93dc42b16b54beafccd376a Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 25 Jan 2013 17:54:38 -0500 Subject: Trying to set materials up for rendering! Yay! --- indra/llprimitive/llmaterial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index da364e548c..6f94cfda17 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -60,7 +60,7 @@ public: F32 getSpecularRotation() const { return mSpecularRotation; } void setSpecularRotation(F32 rot) { mSpecularRotation = rot; } - const LLColor4U& getSpecularLightColor() const { return mSpecularLightColor; } + const LLColor4U getSpecularLightColor() const { return mSpecularLightColor; } void setSpecularLightColor(const LLColor4U& color) { mSpecularLightColor = color; } U8 getSpecularLightExponent() const { return mSpecularLightExponent; } void setSpecularLightExponent(U8 exponent) { mSpecularLightExponent = exponent; } -- cgit v1.2.3 From fbf8e51c6059791b12f60602b4dda0d72dc2d847 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 25 Feb 2013 00:16:14 +0100 Subject: Added LLMaterialMgr::remove() to remove material information from a face --- indra/llprimitive/llmaterial.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 6f94cfda17..5b56d11cd2 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -74,6 +74,9 @@ public: bool isNull() const; static const LLMaterial null; + bool operator == (const LLMaterial& rhs) const; + bool operator != (const LLMaterial& rhs) const; + protected: LLUUID mNormalID; F32 mNormalOffsetX; -- cgit v1.2.3 From 6300f4f768de13823a754831797cb34022f87b60 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 27 Mar 2013 21:59:14 -0500 Subject: NORSPEC-61 Hook up material parameters to shaders. --- indra/llprimitive/llmaterial.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 5b56d11cd2..fd35045e45 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -36,6 +36,20 @@ class LLMaterial { public: + + typedef enum + { + DIFFUSE_ALPHA_MODE_NONE = 0, + DIFFUSE_ALPHA_MODE_BLEND = 1, + DIFFUSE_ALPHA_MODE_MASK = 2, + DIFFUSE_ALPHA_MODE_EMISSIVE = 3 + } eDiffuseAlphaMode; + + typedef enum + { + SHADER_COUNT = 16 + } eShaderCount; + LLMaterial(); LLMaterial(const LLSD& material_data); @@ -77,6 +91,8 @@ public: bool operator == (const LLMaterial& rhs) const; bool operator != (const LLMaterial& rhs) const; + U32 getShaderMask(); + protected: LLUUID mNormalID; F32 mNormalOffsetX; -- cgit v1.2.3 From f189ba4a3d927fe0ecfb83b36b60a47c88525fdd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Apr 2013 16:56:59 -0500 Subject: NORSPEC-71 Lots more UI hookups Written with and Reviewed By Graham --- indra/llprimitive/llmaterial.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index fd35045e45..dc3484309c 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -32,8 +32,10 @@ #include "llmaterialid.h" #include "llsd.h" #include "v4coloru.h" +#include "llpointer.h" +#include "llrefcount.h" -class LLMaterial +class LLMaterial : public LLRefCount { public: @@ -115,6 +117,6 @@ protected: U8 mAlphaMaskCutoff; }; -typedef boost::shared_ptr LLMaterialPtr; +typedef LLPointer LLMaterialPtr; #endif // LL_LLMATERIAL_H -- cgit v1.2.3 From 9e3155c368fba6cb877c55ad4e0c90258a6e9ba9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 11:40:10 -0700 Subject: NORSPEC-82 NORSPEC-85 More UI shenanigans --- indra/llprimitive/llmaterial.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index dc3484309c..bedfc8f8c2 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -52,6 +52,9 @@ public: SHADER_COUNT = 16 } eShaderCount; + static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255)); + static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR; + LLMaterial(); LLMaterial(const LLSD& material_data); @@ -120,3 +123,4 @@ protected: typedef LLPointer LLMaterialPtr; #endif // LL_LLMATERIAL_H + -- cgit v1.2.3 From fafa21315f043ab51e3373e825c85646685778a6 Mon Sep 17 00:00:00 2001 From: g Date: Fri, 12 Apr 2013 15:21:35 -0700 Subject: Fix issue with alphaNonIndexedNoColorF shader and static init fail on default spec color (real source of NORSPEC-94, I think) --- indra/llprimitive/llmaterial.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index bedfc8f8c2..c2e49985a4 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -54,6 +54,7 @@ public: static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255)); static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR; + static const U8 DEFAULT_ENV_INTENSITY = ((U8)(0.05f * 255)); LLMaterial(); LLMaterial(const LLSD& material_data); -- cgit v1.2.3 From 0b4d76ce7856b060d4682955548ff047326c0aee Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 16 Apr 2013 08:27:30 -0700 Subject: NORSPEC-123 et al...roll back NSPEC 91 fix to avoid knock-on and set correct default env intensity --- indra/llprimitive/llmaterial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index c2e49985a4..df5a45cabd 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -54,7 +54,7 @@ public: static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255)); static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR; - static const U8 DEFAULT_ENV_INTENSITY = ((U8)(0.05f * 255)); + static const U8 DEFAULT_ENV_INTENSITY = 0; LLMaterial(); LLMaterial(const LLSD& material_data); -- cgit v1.2.3 From 67af268b785e8a47d7db10aa3a566c269b0f16e3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 17 Apr 2013 01:51:39 -0500 Subject: NORSPEC-90 Alpha pool hookups for materials. --- indra/llprimitive/llmaterial.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index c2e49985a4..3145891393 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -49,8 +49,11 @@ public: typedef enum { - SHADER_COUNT = 16 + SHADER_COUNT = 16, + ALPHA_SHADER_COUNT = 4 } eShaderCount; + + static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255)); static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR; -- cgit v1.2.3 From 18e3985120d53acdf07d43dce79312b78629e57a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 May 2013 15:44:44 -0500 Subject: NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value. --- indra/llprimitive/llmaterial.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index b294288c64..b265732adc 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -44,7 +44,8 @@ public: DIFFUSE_ALPHA_MODE_NONE = 0, DIFFUSE_ALPHA_MODE_BLEND = 1, DIFFUSE_ALPHA_MODE_MASK = 2, - DIFFUSE_ALPHA_MODE_EMISSIVE = 3 + DIFFUSE_ALPHA_MODE_EMISSIVE = 3, + DIFFUSE_ALPHA_MODE_DEFAULT = 4, } eDiffuseAlphaMode; typedef enum @@ -100,7 +101,7 @@ public: bool operator == (const LLMaterial& rhs) const; bool operator != (const LLMaterial& rhs) const; - U32 getShaderMask(); + U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT); protected: LLUUID mNormalID; -- cgit v1.2.3 From 7e4e59470f36ae7a0e01b8d2613af4c8fb6b0101 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 08:58:15 -0700 Subject: NORSPEC-233 WIP for individual material param edits across hetero object selections --- indra/llprimitive/llmaterial.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmaterial.h') diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index b265732adc..9f52a3f6c1 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -69,19 +69,43 @@ public: const LLUUID& getNormalID() const { return mNormalID; } void setNormalID(const LLUUID& normal_id) { mNormalID = normal_id; } void getNormalOffset(F32& offset_x, F32& offset_y) const { offset_x = mNormalOffsetX; offset_y = mNormalOffsetY; } + F32 getNormalOffsetX() const { return mNormalOffsetX; } + F32 getNormalOffsetY() const { return mNormalOffsetY; } + void setNormalOffset(F32 offset_x, F32 offset_y) { mNormalOffsetX = offset_x; mNormalOffsetY = offset_y; } + void setNormalOffsetX(F32 offset_x) { mNormalOffsetX = offset_x; } + void setNormalOffsetY(F32 offset_y) { mNormalOffsetY = offset_y; } + void getNormalRepeat(F32& repeat_x, F32& repeat_y) const { repeat_x = mNormalRepeatX; repeat_y = mNormalRepeatY; } + F32 getNormalRepeatX() const { return mNormalRepeatX; } + F32 getNormalRepeatY() const { return mNormalRepeatY; } + void setNormalRepeat(F32 repeat_x, F32 repeat_y) { mNormalRepeatX = repeat_x; mNormalRepeatY = repeat_y; } - F32 getNormalRotation() const { return mNormalRotation; } + void setNormalRepeatX(F32 repeat_x) { mNormalRepeatX = repeat_x; } + void setNormalRepeatY(F32 repeat_y) { mNormalRepeatY = repeat_y; } + + F32 getNormalRotation() const { return mNormalRotation; } void setNormalRotation(F32 rot) { mNormalRotation = rot; } const LLUUID& getSpecularID() const { return mSpecularID; } void setSpecularID(const LLUUID& specular_id) { mSpecularID = specular_id; } void getSpecularOffset(F32& offset_x, F32& offset_y) const { offset_x = mSpecularOffsetX; offset_y = mSpecularOffsetY; } + F32 getSpecularOffsetX() const { return mSpecularOffsetX; } + F32 getSpecularOffsetY() const { return mSpecularOffsetY; } + void setSpecularOffset(F32 offset_x, F32 offset_y) { mSpecularOffsetX = offset_x; mSpecularOffsetY = offset_y; } + void setSpecularOffsetX(F32 offset_x) { mSpecularOffsetX = offset_x; } + void setSpecularOffsetY(F32 offset_y) { mSpecularOffsetY = offset_y; } + void getSpecularRepeat(F32& repeat_x, F32& repeat_y) const { repeat_x = mSpecularRepeatX; repeat_y = mSpecularRepeatY; } + F32 getSpecularRepeatX() const { return mSpecularRepeatX; } + F32 getSpecularRepeatY() const { return mSpecularRepeatY; } + void setSpecularRepeat(F32 repeat_x, F32 repeat_y) { mSpecularRepeatX = repeat_x; mSpecularRepeatY = repeat_y; } - F32 getSpecularRotation() const { return mSpecularRotation; } + void setSpecularRepeatX(F32 repeat_x) { mSpecularRepeatX = repeat_x; } + void setSpecularRepeatY(F32 repeat_y) { mSpecularRepeatY = repeat_y; } + + F32 getSpecularRotation() const { return mSpecularRotation; } void setSpecularRotation(F32 rot) { mSpecularRotation = rot; } const LLColor4U getSpecularLightColor() const { return mSpecularLightColor; } -- cgit v1.2.3