diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llprimitive/llmaterial.cpp | 43 | ||||
| -rw-r--r-- | indra/llprimitive/llmaterial.h | 3 | ||||
| -rw-r--r-- | indra/newview/llmaterialmgr.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llmaterialmgr.h | 1 | 
4 files changed, 39 insertions, 13 deletions
| diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index 645fcf7b46..f6fd8e557a 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -55,11 +55,6 @@   * Materials constants   */ -const LLColor4U MATERIALS_DEFAULT_SPECULAR_COLOR = LLColor4U(255, 255, 255, 255); -const U8 MATERIALS_DEFAULT_SPECULAR_EXP          = 128; -const U8 MATERIALS_DEFAULT_ENV_INTENSITY         = 128; -const U8 MATERIALS_DEFAULT_DIFFUSE_ALPHA_MODE    = 0; -const U8 MATERIALS_DEFAULT_ALPHA_MASK_CUTOFF     = 128;  const F32 MATERIALS_MULTIPLIER                   = 10000.f;  /** @@ -94,11 +89,20 @@ template<> LLUUID getMaterialField(const LLSD& data, const std::string& field, c  const LLMaterial LLMaterial::null;  LLMaterial::LLMaterial() -	: mSpecularLightColor(MATERIALS_DEFAULT_SPECULAR_COLOR) -	, mSpecularLightExponent(MATERIALS_DEFAULT_SPECULAR_EXP) -	, mEnvironmentIntensity(MATERIALS_DEFAULT_ENV_INTENSITY) -	, mDiffuseAlphaMode(MATERIALS_DEFAULT_DIFFUSE_ALPHA_MODE) -	, mAlphaMaskCutoff(MATERIALS_DEFAULT_ALPHA_MASK_CUTOFF) +	: mNormalOffsetX(.0f) +	, mNormalOffsetY(.0f) +	, mNormalRepeatX(.0f) +	, mNormalRepeatY(.0f) +	, mNormalRotation(.0f) +	, mSpecularOffsetX(.0f) +	, mSpecularOffsetY(.0f) +	, mSpecularRepeatX(.0f) +	, mSpecularRepeatY(.0f) +	, mSpecularRotation(.0f) +	, mSpecularLightExponent(0) +	, mEnvironmentIntensity(0) +	, mDiffuseAlphaMode(0) +	, mAlphaMaskCutoff(0)  {  } @@ -159,8 +163,21 @@ void LLMaterial::fromLLSD(const LLSD& material_data)  bool LLMaterial::isNull() const  { -	// *TODO: find a better way of defining a 'null' material? +	return (*this == null); +} + +bool LLMaterial::operator == (const LLMaterial& rhs) const +{  	return  -		(mNormalID.isNull()) && (.0f == mNormalOffsetX) && (.0f == mNormalOffsetY) && (.0f == mNormalRepeatX) && (.0f == mNormalRepeatY) &&  -		(mSpecularID.isNull()) && (.0f == mSpecularOffsetX) && (.0f == mSpecularOffsetY) && (.0f == mSpecularRepeatX) && (.0f == mSpecularRepeatY); +		(mNormalID == rhs.mNormalID) && (mNormalOffsetX == rhs.mNormalOffsetX) && (mNormalOffsetY == rhs.mNormalOffsetY) && +		(mNormalRepeatX == rhs.mNormalRepeatX) && (mNormalRepeatY == rhs.mNormalRepeatY) && (mNormalRotation == rhs.mNormalRotation) && +		(mSpecularID == rhs.mSpecularID) && (mSpecularOffsetX == rhs.mSpecularOffsetX) && (mSpecularOffsetY == rhs.mSpecularOffsetY) && +		(mSpecularRepeatX == rhs.mSpecularRepeatX) && (mSpecularRepeatY == rhs.mSpecularRepeatY) && (mSpecularRotation == rhs.mSpecularRotation) && +		(mSpecularLightColor == rhs.mSpecularLightColor) && (mSpecularLightExponent == rhs.mSpecularLightExponent) && +		(mEnvironmentIntensity == rhs.mEnvironmentIntensity) && (mDiffuseAlphaMode == rhs.mDiffuseAlphaMode) && (mAlphaMaskCutoff == rhs.mAlphaMaskCutoff); +} + +bool LLMaterial::operator != (const LLMaterial& rhs) const +{ +	return !(*this == rhs);  } 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; diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index de82ec80c8..253b0c124e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -246,6 +246,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial&  	}  } +void LLMaterialMgr::remove(const LLUUID& object_id, const U8 te) +{ +	put(object_id, te, LLMaterial::null); +} +  const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)  {  	LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 1672d11d38..6f444309d3 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -50,6 +50,7 @@ public:  	void                        getAll(const LLUUID& region_id);  	boost::signals2::connection getAll(const LLUUID& region_id, getall_callback_t::slot_type cb);  	void put(const LLUUID& object_id, const U8 te, const LLMaterial& material); +	void remove(const LLUUID& object_id, const U8 te);  protected:  	void clearGetQueues(const LLUUID& region_id); | 
