SL-17116 work on implementing MaterialID in ExtraParams of ObjectUpdate and related messages

master
Brad Kittenbrink 2022-04-27 14:48:25 -07:00
parent 030d61ac58
commit c9fbd9e2e8
7 changed files with 136 additions and 5 deletions

View File

@ -90,6 +90,7 @@ if (LL_TESTS)
INCLUDE(LLAddBuildTest)
SET(llprimitive_TEST_SOURCE_FILES
llmediaentry.cpp
llprimitive.cpp
)
LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}")
endif (LL_TESTS)

View File

@ -27,8 +27,6 @@
#ifndef LL_LLMATERIAL_H
#define LL_LLMATERIAL_H
#include <boost/shared_ptr.hpp>
#include "llmaterialid.h"
#include "llsd.h"
#include "v4coloru.h"
@ -54,8 +52,6 @@ public:
ALPHA_SHADER_COUNT = 4
} eShaderCount;
static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255));
static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR;
static const U8 DEFAULT_ENV_INTENSITY = 0;

View File

@ -39,6 +39,7 @@
#include "llsdutil_math.h"
#include "llprimtexturelist.h"
#include "llmaterialid.h"
#include "llsdutil.h"
/**
* exported constants
@ -1690,6 +1691,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size)
return (size == 28);
case PARAMS_EXTENDED_MESH:
return (size == 4);
case PARAMS_RENDER_MATERIAL:
return (size == 16);
}
return FALSE;
@ -2181,3 +2184,69 @@ bool LLExtendedMeshParams::fromLLSD(LLSD& sd)
return false;
}
//============================================================================
LLRenderMaterialParams::LLRenderMaterialParams()
{
mType = PARAMS_RENDER_MATERIAL;
}
BOOL LLRenderMaterialParams::pack(LLDataPacker &dp) const
{
return dp.packUUID(mMaterial, "material");
// return TRUE;
}
BOOL LLRenderMaterialParams::unpack(LLDataPacker &dp)
{
return dp.unpackUUID(mMaterial, "material");
// return TRUE;
}
bool LLRenderMaterialParams::operator==(const LLNetworkData& data) const
{
if (data.mType != PARAMS_RENDER_MATERIAL)
{
return false;
}
const LLRenderMaterialParams &param = static_cast<const LLRenderMaterialParams&>(data);
return param.mMaterial == mMaterial;
}
void LLRenderMaterialParams::copy(const LLNetworkData& data)
{
llassert_always(data.mType == PARAMS_RENDER_MATERIAL);
const LLRenderMaterialParams &param = static_cast<const LLRenderMaterialParams&>(data);
mMaterial = param.mMaterial;
}
LLSD LLRenderMaterialParams::asLLSD() const
{
return llsd::map("material", mMaterial);
}
bool LLRenderMaterialParams::fromLLSD(LLSD& sd)
{
if (sd.has("material"))
{
setMaterial(sd["material"]);
return true;
}
return false;
}
void LLRenderMaterialParams::setMaterial(const LLUUID & id)
{
mMaterial = id;
}
LLUUID LLRenderMaterialParams::getMaterial() const
{
return mMaterial;
}

View File

@ -107,6 +107,7 @@ public:
PARAMS_RESERVED = 0x50, // Used on server-side
PARAMS_MESH = 0x60,
PARAMS_EXTENDED_MESH = 0x70,
PARAMS_RENDER_MATERIAL = 0x80,
};
public:
@ -320,6 +321,25 @@ public:
};
class LLRenderMaterialParams : public LLNetworkData
{
private:
LLUUID mMaterial;
public:
LLRenderMaterialParams();
BOOL pack(LLDataPacker &dp) const override;
BOOL unpack(LLDataPacker &dp) override;
bool operator==(const LLNetworkData& data) const override;
void copy(const LLNetworkData& data) override;
LLSD asLLSD() const;
operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd);
void setMaterial(const LLUUID & id);
LLUUID getMaterial() const;
};
// This code is not naming-standards compliant. Leaving it like this for
// now to make the connection to code in
// BOOL packTEMessage(LLDataPacker &dp) const;

View File

@ -25,7 +25,7 @@
#include "linden_common.h"
char * _PREHASH_TextureEntry;
const char * const _PREHASH_TextureEntry = "TextureEntry";
S32 LLMessageSystem::getSizeFast(char const*, char const*) const
{

View File

@ -71,6 +71,46 @@ private:
S32 mCurrDetailTest;
};
LLMaterialID::LLMaterialID() {}
LLMaterialID::LLMaterialID(LLMaterialID const &m) = default;
LLMaterialID::~LLMaterialID() {}
void LLMaterialID::set(void const*) { }
U8 const * LLMaterialID::get() const { return mID; }
LLPrimTextureList::LLPrimTextureList() { }
LLPrimTextureList::~LLPrimTextureList() { }
S32 LLPrimTextureList::setBumpMap(const U8 index, const U8 bump) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setOffsetS(const U8 index, const F32 s) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setOffsetT(const U8 index, const F32 t) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry &te) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setRotation(const U8 index, const F32 r) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setBumpShiny(const U8 index, const U8 bump_shiny) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setFullbright(const U8 index, const U8 t) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setMaterialID(const U8 index, const LLMaterialID& pMaterialID) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setMediaFlags(const U8 index, const U8 media_flags) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setMediaTexGen(const U8 index, const U8 media) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setBumpShinyFullbright(const U8 index, const U8 bump) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setID(const U8 index, const LLUUID& id) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setGlow(const U8 index, const F32 glow) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setAlpha(const U8 index, const F32 alpha) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setColor(const U8 index, const LLColor3& color) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setColor(const U8 index, const LLColor4& color) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setScale(const U8 index, const F32 s, const F32 t) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setScaleS(const U8 index, const F32 s) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setScaleT(const U8 index, const F32 t) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setShiny(const U8 index, const U8 shiny) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setOffset(const U8 index, const F32 s, const F32 t) { return TEM_CHANGE_NONE; }
S32 LLPrimTextureList::setTexGen(const U8 index, const U8 texgen) { return TEM_CHANGE_NONE; }
LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index) { return LLMaterialPtr(); }
void LLPrimTextureList::copy(LLPrimTextureList const & ptl) { mEntryList = ptl.mEntryList; } // do we need to call getTexture()->newCopy()?
void LLPrimTextureList::take(LLPrimTextureList &other_list) { }
void LLPrimTextureList::setSize(S32 new_size) { mEntryList.resize(new_size); }
void LLPrimTextureList::setAllIDs(const LLUUID &id) { }
LLTextureEntry * LLPrimTextureList::getTexture(const U8 index) const { return nullptr; }
S32 LLPrimTextureList::size() const { return mEntryList.size(); }
class PRIMITIVE_TEST_SETUP
{
public:

View File

@ -6005,6 +6005,11 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para
{
new_block = new LLExtendedMeshParams();
break;
}
case LLNetworkData::PARAMS_RENDER_MATERIAL:
{
new_block = new LLRenderMaterialParams();
break;
}
default:
{