summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 12:47:27 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 12:47:27 +0300
commitb06a99f7c76950484972e25d9dbbee8660a6a6c3 (patch)
tree58fb3b7d1c95cbd2eb938a9d0f252cdb3ab3b6a8 /indra/llprimitive
parentbf1235b017b254ba989b156c73c4ce18ba4e6c23 (diff)
Post-merge spaces fix
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llprimitive.cpp2892
-rw-r--r--indra/llprimitive/llprimitive.h894
-rw-r--r--indra/llprimitive/lltextureentry.cpp714
3 files changed, 2250 insertions, 2250 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 53d09df618..088d3d1339 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llprimitive.cpp
* @brief LLPrimitive base class
*
* $LicenseInfo:firstyear=2001&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$
*/
@@ -57,9 +57,9 @@ const F32 OBJECT_TWIST_INC = 18.f;
// This is used for linear paths,
// since twist is used in a slightly different manner.
-const F32 OBJECT_TWIST_LINEAR_MIN = -180.f;
-const F32 OBJECT_TWIST_LINEAR_MAX = 180.f;
-const F32 OBJECT_TWIST_LINEAR_INC = 9.f;
+const F32 OBJECT_TWIST_LINEAR_MIN = -180.f;
+const F32 OBJECT_TWIST_LINEAR_MAX = 180.f;
+const F32 OBJECT_TWIST_LINEAR_INC = 9.f;
const F32 OBJECT_MIN_HOLE_SIZE = 0.05f;
const F32 OBJECT_MAX_HOLE_SIZE_X = 1.0f;
@@ -94,7 +94,7 @@ const F32 REFLECTION_PROBE_DEFAULT_CLIP_DISTANCE = 0.f;
// "Tension" => [0,10], increments of 0.1
const F32 FLEXIBLE_OBJECT_MIN_TENSION = 0.0f;
const F32 FLEXIBLE_OBJECT_DEFAULT_TENSION = 1.0f;
-const F32 FLEXIBLE_OBJECT_MAX_TENSION = 10.0f;
+const F32 FLEXIBLE_OBJECT_MAX_TENSION = 10.0f;
// "Drag" => [0,10], increments of 0.1
const F32 FLEXIBLE_OBJECT_MIN_AIR_FRICTION = 0.0f;
@@ -112,7 +112,7 @@ const F32 FLEXIBLE_OBJECT_DEFAULT_WIND_SENSITIVITY = 0.0f;
const F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY = 10.0f;
// I'll explain later...
-const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE = 0.99f;
+const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE = 0.99f;
const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH = 1.0f;
const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = FALSE;
@@ -121,9 +121,9 @@ const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = FALSE;
const char *SCULPT_DEFAULT_TEXTURE = "be293869-d0d9-0a69-5989-ad27f1946fd4"; // old inverted texture: "7595d345-a24c-e7ef-f0bd-78793792133e";
// Texture rotations are sent over the wire as a S16. This is used to scale the actual float
-// value to a S16. Don't use 7FFF as it introduces some odd rounding with 180 since it
+// value to a S16. Don't use 7FFF as it introduces some odd rounding with 180 since it
// can't be divided by 2. See DEV-19108
-const F32 TEXTURE_ROTATION_PACK_FACTOR = ((F32) 0x08000);
+const F32 TEXTURE_ROTATION_PACK_FACTOR = ((F32) 0x08000);
struct material_id_type // originally from llrendermaterialtable
{
@@ -154,7 +154,7 @@ struct material_id_type // originally from llrendermaterialtable
const U8 material_id_type::s_null_id[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
-//static
+//static
// LEGACY: by default we use the LLVolumeMgr::gVolumeMgr global
// TODO -- eliminate this global from the codebase!
LLVolumeMgr* LLPrimitive::sVolumeManager = NULL;
@@ -162,61 +162,61 @@ LLVolumeMgr* LLPrimitive::sVolumeManager = NULL;
// static
void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager )
{
- if ( !volume_manager || sVolumeManager )
- {
- LL_ERRS() << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << LL_ENDL;
- }
- sVolumeManager = volume_manager;
+ if ( !volume_manager || sVolumeManager )
+ {
+ LL_ERRS() << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << LL_ENDL;
+ }
+ sVolumeManager = volume_manager;
}
// static
bool LLPrimitive::cleanupVolumeManager()
{
- BOOL res = FALSE;
- if (sVolumeManager)
- {
- res = sVolumeManager->cleanup();
- delete sVolumeManager;
- sVolumeManager = NULL;
- }
- return res;
+ BOOL res = FALSE;
+ if (sVolumeManager)
+ {
+ res = sVolumeManager->cleanup();
+ delete sVolumeManager;
+ sVolumeManager = NULL;
+ }
+ return res;
}
//===============================================================
LLPrimitive::LLPrimitive()
-: mTextureList(),
- mNumTEs(0),
- mMiscFlags(0),
- mNumBumpmapTEs(0)
+: mTextureList(),
+ mNumTEs(0),
+ mMiscFlags(0),
+ mNumBumpmapTEs(0)
{
- mPrimitiveCode = 0;
+ mPrimitiveCode = 0;
- mMaterial = LL_MCODE_STONE;
- mVolumep = NULL;
+ mMaterial = LL_MCODE_STONE;
+ mVolumep = NULL;
- mChanged = UNCHANGED;
+ mChanged = UNCHANGED;
- mPosition.setVec(0.f,0.f,0.f);
- mVelocity.setVec(0.f,0.f,0.f);
- mAcceleration.setVec(0.f,0.f,0.f);
+ mPosition.setVec(0.f,0.f,0.f);
+ mVelocity.setVec(0.f,0.f,0.f);
+ mAcceleration.setVec(0.f,0.f,0.f);
- mRotation.loadIdentity();
- mAngularVelocity.setVec(0.f,0.f,0.f);
-
- mScale.setVec(1.f,1.f,1.f);
+ mRotation.loadIdentity();
+ mAngularVelocity.setVec(0.f,0.f,0.f);
+
+ mScale.setVec(1.f,1.f,1.f);
}
//===============================================================
LLPrimitive::~LLPrimitive()
{
- clearTextureList();
- // Cleanup handled by volume manager
- if (mVolumep && sVolumeManager)
- {
- sVolumeManager->unrefVolume(mVolumep);
- }
- mVolumep = NULL;
+ clearTextureList();
+ // Cleanup handled by volume manager
+ if (mVolumep && sVolumeManager)
+ {
+ sVolumeManager->unrefVolume(mVolumep);
+ }
+ mVolumep = NULL;
}
void LLPrimitive::clearTextureList()
@@ -227,83 +227,83 @@ void LLPrimitive::clearTextureList()
// static
LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code)
{
- LLPrimitive *retval = new LLPrimitive();
-
- if (retval)
- {
- retval->init_primitive(p_code);
- }
- else
- {
- LL_ERRS() << "primitive allocation failed" << LL_ENDL;
- }
+ LLPrimitive *retval = new LLPrimitive();
- return retval;
+ if (retval)
+ {
+ retval->init_primitive(p_code);
+ }
+ else
+ {
+ LL_ERRS() << "primitive allocation failed" << LL_ENDL;
+ }
+
+ return retval;
}
//===============================================================
void LLPrimitive::init_primitive(LLPCode p_code)
{
- clearTextureList();
- mPrimitiveCode = p_code;
+ clearTextureList();
+ mPrimitiveCode = p_code;
}
void LLPrimitive::setPCode(const U8 p_code)
{
- mPrimitiveCode = p_code;
+ mPrimitiveCode = p_code;
}
//===============================================================
LLTextureEntry* LLPrimitive::getTE(const U8 index) const
{
- return mTextureList.getTexture(index);
+ return mTextureList.getTexture(index);
}
//===============================================================
void LLPrimitive::setNumTEs(const U8 num_tes)
{
- mTextureList.setSize(num_tes);
+ mTextureList.setSize(num_tes);
}
//===============================================================
void LLPrimitive::setAllTETextures(const LLUUID &tex_id)
{
- mTextureList.setAllIDs(tex_id);
+ mTextureList.setAllIDs(tex_id);
}
//===============================================================
void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te)
{
- if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
- {
- mNumBumpmapTEs++;
- }
+ if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
+ {
+ mNumBumpmapTEs++;
+ }
}
S32 LLPrimitive::setTETexture(const U8 index, const LLUUID &id)
{
- return mTextureList.setID(index, id);
+ return mTextureList.setID(index, id);
}
S32 LLPrimitive::setTEColor(const U8 index, const LLColor4 &color)
{
- return mTextureList.setColor(index, color);
+ return mTextureList.setColor(index, color);
}
S32 LLPrimitive::setTEColor(const U8 index, const LLColor3 &color)
{
- return mTextureList.setColor(index, color);
+ return mTextureList.setColor(index, color);
}
S32 LLPrimitive::setTEAlpha(const U8 index, const F32 alpha)
{
- return mTextureList.setAlpha(index, alpha);
+ return mTextureList.setAlpha(index, alpha);
}
//===============================================================
S32 LLPrimitive::setTEScale(const U8 index, const F32 s, const F32 t)
{
- return mTextureList.setScale(index, s, t);
+ return mTextureList.setScale(index, s, t);
}
@@ -311,7 +311,7 @@ S32 LLPrimitive::setTEScale(const U8 index, const F32 s, const F32 t)
// voodoo related to texture coords
S32 LLPrimitive::setTEScaleS(const U8 index, const F32 s)
{
- return mTextureList.setScaleS(index, s);
+ return mTextureList.setScaleS(index, s);
}
@@ -319,14 +319,14 @@ S32 LLPrimitive::setTEScaleS(const U8 index, const F32 s)
// voodoo related to texture coords
S32 LLPrimitive::setTEScaleT(const U8 index, const F32 t)
{
- return mTextureList.setScaleT(index, t);
+ return mTextureList.setScaleT(index, t);
}
//===============================================================
S32 LLPrimitive::setTEOffset(const U8 index, const F32 s, const F32 t)
{
- return mTextureList.setOffset(index, s, t);
+ return mTextureList.setOffset(index, s, t);
}
@@ -334,7 +334,7 @@ S32 LLPrimitive::setTEOffset(const U8 index, const F32 s, const F32 t)
// voodoo related to texture coords
S32 LLPrimitive::setTEOffsetS(const U8 index, const F32 s)
{
- return mTextureList.setOffsetS(index, s);
+ return mTextureList.setOffsetS(index, s);
}
@@ -342,289 +342,289 @@ S32 LLPrimitive::setTEOffsetS(const U8 index, const F32 s)
// voodoo related to texture coords
S32 LLPrimitive::setTEOffsetT(const U8 index, const F32 t)
{
- return mTextureList.setOffsetT(index, t);
+ return mTextureList.setOffsetT(index, t);
}
//===============================================================
S32 LLPrimitive::setTERotation(const U8 index, const F32 r)
{
- return mTextureList.setRotation(index, r);
+ return mTextureList.setRotation(index, r);
}
S32 LLPrimitive::setTEMaterialID(const U8 index, const LLMaterialID& pMaterialID)
{
- return mTextureList.setMaterialID(index, pMaterialID);
+ return mTextureList.setMaterialID(index, pMaterialID);
}
S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams)
{
- return mTextureList.setMaterialParams(index, pMaterialParams);
+ return mTextureList.setMaterialParams(index, pMaterialParams);
}
LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index)
{
- return mTextureList.getMaterialParams(index);
+ return mTextureList.getMaterialParams(index);
}
//===============================================================
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump)
{
- updateNumBumpmap(index, bump);
- return mTextureList.setBumpShinyFullbright(index, bump);
+ updateNumBumpmap(index, bump);
+ return mTextureList.setBumpShinyFullbright(index, bump);
}
S32 LLPrimitive::setTEMediaTexGen(const U8 index, const U8 media)
{
- return mTextureList.setMediaTexGen(index, media);
+ return mTextureList.setMediaTexGen(index, media);
}
S32 LLPrimitive::setTEBumpmap(const U8 index, const U8 bump)
{
- updateNumBumpmap(index, bump);
- return mTextureList.setBumpMap(index, bump);
+ updateNumBumpmap(index, bump);
+ return mTextureList.setBumpMap(index, bump);
}
S32 LLPrimitive::setTEBumpShiny(const U8 index, const U8 bump_shiny)
{
- updateNumBumpmap(index, bump_shiny);
- return mTextureList.setBumpShiny(index, bump_shiny);
+ updateNumBumpmap(index, bump_shiny);
+ return mTextureList.setBumpShiny(index, bump_shiny);
}
S32 LLPrimitive::setTETexGen(const U8 index, const U8 texgen)
{
- return mTextureList.setTexGen(index, texgen);
+ return mTextureList.setTexGen(index, texgen);
}
S32 LLPrimitive::setTEShiny(const U8 index, const U8 shiny)
{
- return mTextureList.setShiny(index, shiny);
+ return mTextureList.setShiny(index, shiny);
}
S32 LLPrimitive::setTEFullbright(const U8 index, const U8 fullbright)
{
- return mTextureList.setFullbright(index, fullbright);
+ return mTextureList.setFullbright(index, fullbright);
}
S32 LLPrimitive::setTEMediaFlags(const U8 index, const U8 media_flags)
{
- return mTextureList.setMediaFlags(index, media_flags);
+ return mTextureList.setMediaFlags(index, media_flags);
}
S32 LLPrimitive::setTEGlow(const U8 index, const F32 glow)
{
- return mTextureList.setGlow(index, glow);
+ return mTextureList.setGlow(index, glow);
}
void LLPrimitive::setAllTESelected(bool sel)
{
- for (int i = 0, cnt = getNumTEs(); i < cnt; i++)
- {
- setTESelected(i, sel);
- }
+ for (int i = 0, cnt = getNumTEs(); i < cnt; i++)
+ {
+ setTESelected(i, sel);
+ }
}
-
+
void LLPrimitive::setTESelected(const U8 te, bool sel)
{
- LLTextureEntry* tep = getTE(te);
- if ( (tep) && (tep->setSelected(sel)) && (!sel) && (tep->hasPendingMaterialUpdate()) )
- {
- LLMaterialID material_id = tep->getMaterialID();
- setTEMaterialID(te, material_id);
- }
+ LLTextureEntry* tep = getTE(te);
+ if ( (tep) && (tep->setSelected(sel)) && (!sel) && (tep->hasPendingMaterialUpdate()) )
+ {
+ LLMaterialID material_id = tep->getMaterialID();
+ setTEMaterialID(te, material_id);
+ }
}
LLPCode LLPrimitive::legacyToPCode(const U8 legacy)
{
- // TODO: Should this default to something valid?
- // Maybe volume?
- LLPCode pcode = 0;
-
- switch (legacy)
- {
- /*
- case BOX:
- pcode = LL_PCODE_CUBE;
- break;
- case CYLINDER:
- pcode = LL_PCODE_CYLINDER;
- break;
- case CONE:
- pcode = LL_PCODE_CONE;
- break;
- case HALF_CONE:
- pcode = LL_PCODE_CONE_HEMI;
- break;
- case HALF_CYLINDER:
- pcode = LL_PCODE_CYLINDER_HEMI;
- break;
- case HALF_SPHERE:
- pcode = LL_PCODE_SPHERE_HEMI;
- break;
- case PRISM:
- pcode = LL_PCODE_PRISM;
- break;
- case PYRAMID:
- pcode = LL_PCODE_PYRAMID;
- break;
- case SPHERE:
- pcode = LL_PCODE_SPHERE;
- break;
- case TETRAHEDRON:
- pcode = LL_PCODE_TETRAHEDRON;
- break;
- case DEMON:
- pcode = LL_PCODE_LEGACY_DEMON;
- break;
- case LSL_TEST:
- pcode = LL_PCODE_LEGACY_LSL_TEST;
- break;
- case ORACLE:
- pcode = LL_PCODE_LEGACY_ORACLE;
- break;
- case TEXTBUBBLE:
- pcode = LL_PCODE_LEGACY_TEXT_BUBBLE;
- break;
- case ATOR:
- pcode = LL_PCODE_LEGACY_ATOR;
- break;
- case BASIC_SHOT:
- pcode = LL_PCODE_LEGACY_SHOT;
- break;
- case BIG_SHOT:
- pcode = LL_PCODE_LEGACY_SHOT_BIG;
- break;
- case BIRD:
- pcode = LL_PCODE_LEGACY_BIRD;
- break;
- case ROCK:
- pcode = LL_PCODE_LEGACY_ROCK;
- break;
- case SMOKE:
- pcode = LL_PCODE_LEGACY_SMOKE;
- break;
- case SPARK:
- pcode = LL_PCODE_LEGACY_SPARK;
- break;
- */
- case PRIMITIVE_VOLUME:
- pcode = LL_PCODE_VOLUME;
- break;
- case GRASS:
- pcode = LL_PCODE_LEGACY_GRASS;
- break;
- case PART_SYS:
- pcode = LL_PCODE_LEGACY_PART_SYS;
- break;
- case PLAYER:
- pcode = LL_PCODE_LEGACY_AVATAR;
- break;
- case TREE:
- pcode = LL_PCODE_LEGACY_TREE;
- break;
- case TREE_NEW:
- pcode = LL_PCODE_TREE_NEW;
- break;
- default:
- LL_WARNS() << "Unknown legacy code " << legacy << " [" << (S32)legacy << "]!" << LL_ENDL;
- }
-
- return pcode;
+ // TODO: Should this default to something valid?
+ // Maybe volume?
+ LLPCode pcode = 0;
+
+ switch (legacy)
+ {
+ /*
+ case BOX:
+ pcode = LL_PCODE_CUBE;
+ break;
+ case CYLINDER:
+ pcode = LL_PCODE_CYLINDER;
+ break;
+ case CONE:
+ pcode = LL_PCODE_CONE;
+ break;
+ case HALF_CONE:
+ pcode = LL_PCODE_CONE_HEMI;
+ break;
+ case HALF_CYLINDER:
+ pcode = LL_PCODE_CYLINDER_HEMI;
+ break;
+ case HALF_SPHERE:
+ pcode = LL_PCODE_SPHERE_HEMI;
+ break;
+ case PRISM:
+ pcode = LL_PCODE_PRISM;
+ break;
+ case PYRAMID:
+ pcode = LL_PCODE_PYRAMID;
+ break;
+ case SPHERE:
+ pcode = LL_PCODE_SPHERE;
+ break;
+ case TETRAHEDRON:
+ pcode = LL_PCODE_TETRAHEDRON;
+ break;
+ case DEMON:
+ pcode = LL_PCODE_LEGACY_DEMON;
+ break;
+ case LSL_TEST:
+ pcode = LL_PCODE_LEGACY_LSL_TEST;
+ break;
+ case ORACLE:
+ pcode = LL_PCODE_LEGACY_ORACLE;
+ break;
+ case TEXTBUBBLE:
+ pcode = LL_PCODE_LEGACY_TEXT_BUBBLE;
+ break;
+ case ATOR:
+ pcode = LL_PCODE_LEGACY_ATOR;
+ break;
+ case BASIC_SHOT:
+ pcode = LL_PCODE_LEGACY_SHOT;
+ break;
+ case BIG_SHOT:
+ pcode = LL_PCODE_LEGACY_SHOT_BIG;
+ break;
+ case BIRD:
+ pcode = LL_PCODE_LEGACY_BIRD;
+ break;
+ case ROCK:
+ pcode = LL_PCODE_LEGACY_ROCK;
+ break;
+ case SMOKE:
+ pcode = LL_PCODE_LEGACY_SMOKE;
+ break;
+ case SPARK:
+ pcode = LL_PCODE_LEGACY_SPARK;
+ break;
+ */
+ case PRIMITIVE_VOLUME:
+ pcode = LL_PCODE_VOLUME;
+ break;
+ case GRASS:
+ pcode = LL_PCODE_LEGACY_GRASS;
+ break;
+ case PART_SYS:
+ pcode = LL_PCODE_LEGACY_PART_SYS;
+ break;
+ case PLAYER:
+ pcode = LL_PCODE_LEGACY_AVATAR;
+ break;
+ case TREE:
+ pcode = LL_PCODE_LEGACY_TREE;
+ break;
+ case TREE_NEW:
+ pcode = LL_PCODE_TREE_NEW;
+ break;
+ default:
+ LL_WARNS() << "Unknown legacy code " << legacy << " [" << (S32)legacy << "]!" << LL_ENDL;
+ }
+
+ return pcode;
}
U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode)
{
- U8 legacy;
- switch (pcode)
- {
+ U8 legacy;
+ switch (pcode)
+ {
/*
- case LL_PCODE_CUBE:
- legacy = BOX;
- break;
- case LL_PCODE_CYLINDER:
- legacy = CYLINDER;
- break;
- case LL_PCODE_CONE:
- legacy = CONE;
- break;
- case LL_PCODE_CONE_HEMI:
- legacy = HALF_CONE;
- break;
- case LL_PCODE_CYLINDER_HEMI:
- legacy = HALF_CYLINDER;
- break;
- case LL_PCODE_SPHERE_HEMI:
- legacy = HALF_SPHERE;
- break;
- case LL_PCODE_PRISM:
- legacy = PRISM;
- break;
- case LL_PCODE_PYRAMID:
- legacy = PYRAMID;
- break;
- case LL_PCODE_SPHERE:
- legacy = SPHERE;
- break;
- case LL_PCODE_TETRAHEDRON:
- legacy = TETRAHEDRON;
- break;
- case LL_PCODE_LEGACY_ATOR:
- legacy = ATOR;
- break;
- case LL_PCODE_LEGACY_SHOT:
- legacy = BASIC_SHOT;
- break;
- case LL_PCODE_LEGACY_SHOT_BIG:
- legacy = BIG_SHOT;
- break;
- case LL_PCODE_LEGACY_BIRD:
- legacy = BIRD;
- break;
- case LL_PCODE_LEGACY_DEMON:
- legacy = DEMON;
- break;
- case LL_PCODE_LEGACY_LSL_TEST:
- legacy = LSL_TEST;
- break;
- case LL_PCODE_LEGACY_ORACLE:
- legacy = ORACLE;
- break;
- case LL_PCODE_LEGACY_ROCK:
- legacy = ROCK;
- break;
- case LL_PCODE_LEGACY_TEXT_BUBBLE:
- legacy = TEXTBUBBLE;
- break;
- case LL_PCODE_LEGACY_SMOKE:
- legacy = SMOKE;
- break;
- case LL_PCODE_LEGACY_SPARK:
- legacy = SPARK;
- break;
+ case LL_PCODE_CUBE:
+ legacy = BOX;
+ break;
+ case LL_PCODE_CYLINDER:
+ legacy = CYLINDER;
+ break;
+ case LL_PCODE_CONE:
+ legacy = CONE;
+ break;
+ case LL_PCODE_CONE_HEMI:
+ legacy = HALF_CONE;
+ break;
+ case LL_PCODE_CYLINDER_HEMI:
+ legacy = HALF_CYLINDER;
+ break;
+ case LL_PCODE_SPHERE_HEMI:
+ legacy = HALF_SPHERE;
+ break;
+ case LL_PCODE_PRISM:
+ legacy = PRISM;
+ break;
+ case LL_PCODE_PYRAMID:
+ legacy = PYRAMID;
+ break;
+ case LL_PCODE_SPHERE:
+ legacy = SPHERE;
+ break;
+ case LL_PCODE_TETRAHEDRON:
+ legacy = TETRAHEDRON;
+ break;
+ case LL_PCODE_LEGACY_ATOR:
+ legacy = ATOR;
+ break;
+ case LL_PCODE_LEGACY_SHOT:
+ legacy = BASIC_SHOT;
+ break;
+ case LL_PCODE_LEGACY_SHOT_BIG:
+ legacy = BIG_SHOT;
+ break;
+ case LL_PCODE_LEGACY_BIRD:
+ legacy = BIRD;
+ break;
+ case LL_PCODE_LEGACY_DEMON:
+ legacy = DEMON;
+ break;
+ case LL_PCODE_LEGACY_LSL_TEST:
+ legacy = LSL_TEST;
+ break;
+ case LL_PCODE_LEGACY_ORACLE:
+ legacy = ORACLE;
+ break;
+ case LL_PCODE_LEGACY_ROCK:
+ legacy = ROCK;
+ break;
+ case LL_PCODE_LEGACY_TEXT_BUBBLE:
+ legacy = TEXTBUBBLE;
+ break;
+ case LL_PCODE_LEGACY_SMOKE:
+ legacy = SMOKE;
+ break;
+ case LL_PCODE_LEGACY_SPARK:
+ legacy = SPARK;
+ break;
*/
- case LL_PCODE_VOLUME:
- legacy = PRIMITIVE_VOLUME;
- break;
- case LL_PCODE_LEGACY_GRASS:
- legacy = GRASS;
- break;
- case LL_PCODE_LEGACY_PART_SYS:
- legacy = PART_SYS;
- break;
- case LL_PCODE_LEGACY_AVATAR:
- legacy = PLAYER;
- break;
- case LL_PCODE_LEGACY_TREE:
- legacy = TREE;
- break;
- case LL_PCODE_TREE_NEW:
- legacy = TREE_NEW;
- break;
- default:
- LL_WARNS() << "Unknown pcode " << (S32)pcode << ":" << pcode << "!" << LL_ENDL;
- return 0;
- }
- return legacy;
+ case LL_PCODE_VOLUME:
+ legacy = PRIMITIVE_VOLUME;
+ break;
+ case LL_PCODE_LEGACY_GRASS:
+ legacy = GRASS;
+ break;
+ case LL_PCODE_LEGACY_PART_SYS:
+ legacy = PART_SYS;
+ break;
+ case LL_PCODE_LEGACY_AVATAR:
+ legacy = PLAYER;
+ break;
+ case LL_PCODE_LEGACY_TREE:
+ legacy = TREE;
+ break;
+ case LL_PCODE_TREE_NEW:
+ legacy = TREE_NEW;
+ break;
+ default:
+ LL_WARNS() << "Unknown pcode " << (S32)pcode << ":" << pcode << "!" << LL_ENDL;
+ return 0;
+ }
+ return legacy;
}
@@ -632,491 +632,491 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode)
// Don't crash or LL_ERRS() here! This function is used for debug strings.
std::string LLPrimitive::pCodeToString(const LLPCode pcode)
{
- std::string pcode_string;
-
- U8 base_code = pcode & LL_PCODE_BASE_MASK;
- if (!pcode)
- {
- pcode_string = "null";
- }
- else if ((base_code) == LL_PCODE_LEGACY)
- {
- // It's a legacy object
- switch (pcode)
- {
- case LL_PCODE_LEGACY_GRASS:
- pcode_string = "grass";
- break;
- case LL_PCODE_LEGACY_PART_SYS:
- pcode_string = "particle system";
- break;
- case LL_PCODE_LEGACY_AVATAR:
- pcode_string = "avatar";
- break;
- case LL_PCODE_LEGACY_TEXT_BUBBLE:
- pcode_string = "text bubble";
- break;
- case LL_PCODE_LEGACY_TREE:
- pcode_string = "tree";
- break;
- case LL_PCODE_TREE_NEW:
- pcode_string = "tree_new";
- break;
- default:
- pcode_string = llformat( "unknown legacy pcode %i",(U32)pcode);
- }
- }
- else
- {
- std::string shape;
- std::string mask;
- if (base_code == LL_PCODE_CUBE)
- {
- shape = "cube";
- }
- else if (base_code == LL_PCODE_CYLINDER)
- {
- shape = "cylinder";
- }
- else if (base_code == LL_PCODE_CONE)
- {
- shape = "cone";
- }
- else if (base_code == LL_PCODE_PRISM)
- {
- shape = "prism";
- }
- else if (base_code == LL_PCODE_PYRAMID)
- {
- shape = "pyramid";
- }
- else if (base_code == LL_PCODE_SPHERE)
- {
- shape = "sphere";
- }
- else if (base_code == LL_PCODE_TETRAHEDRON)
- {
- shape = "tetrahedron";
- }
- else if (base_code == LL_PCODE_VOLUME)
- {
- shape = "volume";
- }
- else if (base_code == LL_PCODE_APP)
- {
- shape = "app";
- }
- else
- {
- LL_WARNS() << "Unknown base mask for pcode: " << base_code << LL_ENDL;
- }
-
- U8 mask_code = pcode & (~LL_PCODE_BASE_MASK);
- if (base_code == LL_PCODE_APP)
- {
- mask = llformat( "%x", mask_code);
- }
- else if (mask_code & LL_PCODE_HEMI_MASK)
- {
- mask = "hemi";
- }
- else
- {
- mask = llformat( "%x", mask_code);
- }
-
- if (mask[0])
- {
- pcode_string = llformat( "%s-%s", shape.c_str(), mask.c_str());
- }
- else
- {
- pcode_string = llformat( "%s", shape.c_str());
- }
- }
-
- return pcode_string;
+ std::string pcode_string;
+
+ U8 base_code = pcode & LL_PCODE_BASE_MASK;
+ if (!pcode)
+ {
+ pcode_string = "null";
+ }
+ else if ((base_code) == LL_PCODE_LEGACY)
+ {
+ // It's a legacy object
+ switch (pcode)
+ {
+ case LL_PCODE_LEGACY_GRASS:
+ pcode_string = "grass";
+ break;
+ case LL_PCODE_LEGACY_PART_SYS:
+ pcode_string = "particle system";
+ break;
+ case LL_PCODE_LEGACY_AVATAR:
+ pcode_string = "avatar";
+ break;
+ case LL_PCODE_LEGACY_TEXT_BUBBLE:
+ pcode_string = "text bubble";
+ break;
+ case LL_PCODE_LEGACY_TREE:
+ pcode_string = "tree";
+ break;
+ case LL_PCODE_TREE_NEW:
+ pcode_string = "tree_new";
+ break;
+ default:
+ pcode_string = llformat( "unknown legacy pcode %i",(U32)pcode);
+ }
+ }
+ else
+ {
+ std::string shape;
+ std::string mask;
+ if (base_code == LL_PCODE_CUBE)
+ {
+ shape = "cube";
+ }
+ else if (base_code == LL_PCODE_CYLINDER)
+ {
+ shape = "cylinder";
+ }
+ else if (base_code == LL_PCODE_CONE)
+ {
+ shape = "cone";
+ }
+ else if (base_code == LL_PCODE_PRISM)
+ {
+ shape = "prism";
+ }
+ else if (base_code == LL_PCODE_PYRAMID)
+ {
+ shape = "pyramid";
+ }
+ else if (base_code == LL_PCODE_SPHERE)
+ {
+ shape = "sphere";
+ }
+ else if (base_code == LL_PCODE_TETRAHEDRON)
+ {
+ shape = "tetrahedron";
+ }
+ else if (base_code == LL_PCODE_VOLUME)
+ {
+ shape = "volume";
+ }
+ else if (base_code == LL_PCODE_APP)
+ {
+ shape = "app";
+ }
+ else
+ {
+ LL_WARNS() << "Unknown base mask for pcode: " << base_code << LL_ENDL;
+ }
+
+ U8 mask_code = pcode & (~LL_PCODE_BASE_MASK);
+ if (base_code == LL_PCODE_APP)
+ {
+ mask = llformat( "%x", mask_code);
+ }
+ else if (mask_code & LL_PCODE_HEMI_MASK)
+ {
+ mask = "hemi";
+ }
+ else
+ {
+ mask = llformat( "%x", mask_code);
+ }
+
+ if (mask[0])
+ {
+ pcode_string = llformat( "%s-%s", shape.c_str(), mask.c_str());
+ }
+ else
+ {
+ pcode_string = llformat( "%s", shape.c_str());
+ }
+ }
+
+ return pcode_string;
}
void LLPrimitive::copyTEs(const LLPrimitive *primitivep)
{
- U32 i;
- if (primitivep->getExpectedNumTEs() != getExpectedNumTEs())
- {
- LL_WARNS() << "Primitives don't have same expected number of TE's" << LL_ENDL;
- }
- U32 num_tes = llmin(primitivep->getExpectedNumTEs(), getExpectedNumTEs());
- if (mTextureList.size() < getExpectedNumTEs())
- {
- mTextureList.setSize(getExpectedNumTEs());
- }
- for (i = 0; i < num_tes; i++)
- {
- mTextureList.copyTexture(i, *(primitivep->getTE(i)));
- }
-}
-
-S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& faceArray)
-{
- S32 i;
- for (i = 0; i < (S32)faceArray.size(); i++)
- {
- if (faceArray[i].mFaceID == face_ID)
- {
- return i;
- }
- }
- return -1;
+ U32 i;
+ if (primitivep->getExpectedNumTEs() != getExpectedNumTEs())
+ {
+ LL_WARNS() << "Primitives don't have same expected number of TE's" << LL_ENDL;
+ }
+ U32 num_tes = llmin(primitivep->getExpectedNumTEs(), getExpectedNumTEs());
+ if (mTextureList.size() < getExpectedNumTEs())
+ {
+ mTextureList.setSize(getExpectedNumTEs());
+ }
+ for (i = 0; i < num_tes; i++)
+ {
+ mTextureList.copyTexture(i, *(primitivep->getTE(i)));
+ }
+}
+
+S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& faceArray)
+{
+ S32 i;
+ for (i = 0; i < (S32)faceArray.size(); i++)
+ {
+ if (faceArray[i].mFaceID == face_ID)
+ {
+ return i;
+ }
+ }
+ return -1;
}
BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume)
{
- if (NO_LOD == detail)
- {
- // build the new object
- setChanged(GEOMETRY);
- sVolumeManager->unrefVolume(mVolumep);
- mVolumep = new LLVolume(volume_params, 1, TRUE, TRUE);
- setNumTEs(mVolumep->getNumFaces());
- return FALSE;
- }
-
- LLVolume *volumep;
- if (unique_volume)
- {
- F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail);
- if (mVolumep.notNull() && volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail()))
- {
- return FALSE;
- }
- volumep = new LLVolume(volume_params, volume_detail, FALSE, TRUE);
- }
- else
- {
- if (mVolumep.notNull())
- {
- F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail);
- if (volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail()))
- {
- return FALSE;
- }
- }
-
- volumep = sVolumeManager->refVolume(volume_params, detail);
- if (volumep == mVolumep)
- {
- sVolumeManager->unrefVolume( volumep ); // LLVolumeMgr::refVolume() creates a reference, but we don't need a second one.
- return TRUE;
- }
- }
-
- setChanged(GEOMETRY);
-
-
- if (!mVolumep)
- {
- mVolumep = volumep;
- //mFaceMask = mVolumep->generateFaceMask();
- setNumTEs(mVolumep->getNumFaces());
- return TRUE;
- }
-
-#if 0
- // #if 0'd out by davep
- // this is a lot of cruft to set texture entry values that just stay the same for LOD switch
- // or immediately get overridden by an object update message, also crashes occasionally
- U32 old_face_mask = mVolumep->mFaceMask;
-
- S32 face_bit = 0;
- S32 cur_mask = 0;
-
- // Grab copies of the old faces from the original shape, ordered by type.
- // We will use these to figure out what old texture info gets mapped to new
- // faces in the new shape.
- std::vector<LLProfile::Face> old_faces;
- for (S32 face = 0; face < mVolumep->getNumFaces(); face++)
- {
- old_faces.push_back(mVolumep->getProfile().mFaces[face]);
- }
-
- // Copy the old texture info off to the side, but not in the order in which
- // they live in the mTextureList, rather in order of ther "face id" which
- // is the corresponding value of LLVolueParams::LLProfile::mFaces::mIndex.
- //
- // Hence, some elements of old_tes::mEntryList will be invalid. It is
- // initialized to a size of 9 (max number of possible faces on a volume?)
- // and only the ones with valid types are filled in.
- LLPrimTextureList old_tes;
- old_tes.setSize(9);
- for (face_bit = 0; face_bit < 9; face_bit++)
- {
- cur_mask = 0x1 << face_bit;
- if (old_face_mask & cur_mask)
- {
- S32 te_index = face_index_from_id(cur_mask, old_faces);
- old_tes.copyTexture(face_bit, *(getTE(te_index)));
- //LL_INFOS() << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << LL_ENDL;
- }
- }
-
-
- // build the new object
- sVolumeManager->unrefVolume(mVolumep);
- mVolumep = volumep;
-
- U32 new_face_mask = mVolumep->mFaceMask;
- S32 i;
-
- if (old_face_mask == new_face_mask)
- {
- // nothing to do
- return TRUE;
- }
-
- if (mVolumep->getNumFaces() == 0 && new_face_mask != 0)
- {
- LL_WARNS() << "Object with 0 faces found...INCORRECT!" << LL_ENDL;
- setNumTEs(mVolumep->getNumFaces());
- return TRUE;
- }
-
- // initialize face_mapping
- S32 face_mapping[9];
- for (face_bit = 0; face_bit < 9; face_bit++)
- {
- face_mapping[face_bit] = face_bit;
- }
-
- // The new shape may have more faces than the original, but we can't just
- // add them to the end -- the ordering matters and it may be that we must
- // insert the new faces in the middle of the list. When we add a face it
- // will pick up the texture/color info of one of the old faces an so we
- // now figure out which old face info gets mapped to each new face, and
- // store in the face_mapping lookup table.
- for (face_bit = 0; face_bit < 9; face_bit++)
- {
- cur_mask = 0x1 << face_bit;
- if (!(new_face_mask & cur_mask))
- {
- // Face doesn't exist in new map.
- face_mapping[face_bit] = -1;
- continue;
- }
- else if (old_face_mask & cur_mask)
- {
- // Face exists in new and old map.
- face_mapping[face_bit] = face_bit;
- continue;
- }
-
- // OK, how we've got a mismatch, where we have to fill a new face with one from
- // the old face.
- if (cur_mask & (LL_FACE_PATH_BEGIN | LL_FACE_PATH_END | LL_FACE_INNER_SIDE))
- {
- // It's a top/bottom/hollow interior face.
- if (old_face_mask & LL_FACE_PATH_END)
- {
- face_mapping[face_bit] = 1;
- continue;
- }
- else
- {
- S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
- for (i = 0; i < 4; i++)
- {
- if (old_face_mask & cur_outer_mask)
- {
- face_mapping[face_bit] = 5 + i;
- break;
- }
- cur_outer_mask <<= 1;
- }
- if (i == 4)
- {
- LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL;
- }
- continue;
- }
- }
-
- if (cur_mask & (LL_FACE_PROFILE_BEGIN | LL_FACE_PROFILE_END))
- {
- // A cut slice. Use the hollow interior if we have it.
- if (old_face_mask & LL_FACE_INNER_SIDE)
- {
- face_mapping[face_bit] = 2;
- continue;
- }
-
- // No interior, use the bottom face.
- // Could figure out which of the outer faces was nearest, but that would be harder.
- if (old_face_mask & LL_FACE_PATH_END)
- {
- face_mapping[face_bit] = 1;
- continue;
- }
- else
- {
- S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
- for (i = 0; i < 4; i++)
- {
- if (old_face_mask & cur_outer_mask)
- {
- face_mapping[face_bit] = 5 + i;
- break;
- }
- cur_outer_mask <<= 1;
- }
- if (i == 4)
- {
- LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL;
- }
- continue;
- }
- }
-
- // OK, the face that's missing is an outer face...
- // Pull from the nearest adjacent outer face (there's always guaranteed to be one...
- S32 cur_outer = face_bit - 5;
- S32 min_dist = 5;
- S32 min_outer_bit = -1;
- S32 i;
- for (i = 0; i < 4; i++)
- {
- if (old_face_mask & (LL_FACE_OUTER_SIDE_0 << i))
- {
- S32 dist = abs(i - cur_outer);
- if (dist < min_dist)
- {
- min_dist = dist;
- min_outer_bit = i + 5;
- }
- }
- }
- if (-1 == min_outer_bit)
- {
- LL_INFOS() << (LLVolume *)mVolumep << LL_ENDL;
- LL_WARNS() << "Bad! No outer faces, impossible!" << LL_ENDL;
- }
- face_mapping[face_bit] = min_outer_bit;
- }
-
-
- setNumTEs(mVolumep->getNumFaces());
- for (face_bit = 0; face_bit < 9; face_bit++)
- {
- // For each possible face type on the new shape we check to see if that
- // face exists and if it does we create a texture entry that is a copy
- // of one of the originals. Since the originals might not have a
- // matching face, we use the face_mapping lookup table to figure out
- // which face information to copy.
- cur_mask = 0x1 << face_bit;
- if (new_face_mask & cur_mask)
- {
- if (-1 == face_mapping[face_bit])
- {
- LL_WARNS() << "No mapping from old face to new face!" << LL_ENDL;
- }
-
- S32 te_num = face_index_from_id(cur_mask, mVolumep->getProfile().mFaces);
- setTE(te_num, *(old_tes.getTexture(face_mapping[face_bit])));
- }
- }
+ if (NO_LOD == detail)
+ {
+ // build the new object
+ setChanged(GEOMETRY);
+ sVolumeManager->unrefVolume(mVolumep);
+ mVolumep = new LLVolume(volume_params, 1, TRUE, TRUE);
+ setNumTEs(mVolumep->getNumFaces());
+ return FALSE;
+ }
+
+ LLVolume *volumep;
+ if (unique_volume)
+ {
+ F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail);
+ if (mVolumep.notNull() && volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail()))
+ {
+ return FALSE;
+ }
+ volumep = new LLVolume(volume_params, volume_detail, FALSE, TRUE);
+ }
+ else
+ {
+ if (mVolumep.notNull())
+ {
+ F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail);
+ if (volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail()))
+ {
+ return FALSE;
+ }
+ }
+
+ volumep = sVolumeManager->refVolume(volume_params, detail);
+ if (volumep == mVolumep)
+ {
+ sVolumeManager->unrefVolume( volumep ); // LLVolumeMgr::refVolume() creates a reference, but we don't need a second one.
+ return TRUE;
+ }
+ }
+
+ setChanged(GEOMETRY);
+
+
+ if (!mVolumep)
+ {
+ mVolumep = volumep;
+ //mFaceMask = mVolumep->generateFaceMask();
+ setNumTEs(mVolumep->getNumFaces());
+ return TRUE;
+ }
+
+#if 0
+ // #if 0'd out by davep
+ // this is a lot of cruft to set texture entry values that just stay the same for LOD switch
+ // or immediately get overridden by an object update message, also crashes occasionally
+ U32 old_face_mask = mVolumep->mFaceMask;
+
+ S32 face_bit = 0;
+ S32 cur_mask = 0;
+
+ // Grab copies of the old faces from the original shape, ordered by type.
+ // We will use these to figure out what old texture info gets mapped to new
+ // faces in the new shape.
+ std::vector<LLProfile::Face> old_faces;
+ for (S32 face = 0; face < mVolumep->getNumFaces(); face++)
+ {
+ old_faces.push_back(mVolumep->getProfile().mFaces[face]);
+ }
+
+ // Copy the old texture info off to the side, but not in the order in which
+ // they live in the mTextureList, rather in order of ther "face id" which
+ // is the corresponding value of LLVolueParams::LLProfile::mFaces::mIndex.
+ //
+ // Hence, some elements of old_tes::mEntryList will be invalid. It is
+ // initialized to a size of 9 (max number of possible faces on a volume?)
+ // and only the ones with valid types are filled in.
+ LLPrimTextureList old_tes;
+ old_tes.setSize(9);
+ for (face_bit = 0; face_bit < 9; face_bit++)
+ {
+ cur_mask = 0x1 << face_bit;
+ if (old_face_mask & cur_mask)
+ {
+ S32 te_index = face_index_from_id(cur_mask, old_faces);
+ old_tes.copyTexture(face_bit, *(getTE(te_index)));
+ //LL_INFOS() << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << LL_ENDL;
+ }
+ }
+
+
+ // build the new object
+ sVolumeManager->unrefVolume(mVolumep);
+ mVolumep = volumep;
+
+ U32 new_face_mask = mVolumep->mFaceMask;
+ S32 i;
+
+ if (old_face_mask == new_face_mask)
+ {
+ // nothing to do
+ return TRUE;
+ }
+
+ if (mVolumep->getNumFaces() == 0 && new_face_mask != 0)
+ {
+ LL_WARNS() << "Object with 0 faces found...INCORRECT!" << LL_ENDL;
+ setNumTEs(mVolumep->getNumFaces());
+ return TRUE;
+ }
+
+ // initialize face_mapping
+ S32 face_mapping[9];
+ for (face_bit = 0; face_bit < 9; face_bit++)
+ {
+ face_mapping[face_bit] = face_bit;
+ }
+
+ // The new shape may have more faces than the original, but we can't just
+ // add them to the end -- the ordering matters and it may be that we must
+ // insert the new faces in the middle of the list. When we add a face it
+ // will pick up the texture/color info of one of the old faces an so we
+ // now figure out which old face info gets mapped to each new face, and
+ // store in the face_mapping lookup table.
+ for (face_bit = 0; face_bit < 9; face_bit++)
+ {
+ cur_mask = 0x1 << face_bit;
+ if (!(new_face_mask & cur_mask))
+ {
+ // Face doesn't exist in new map.
+ face_mapping[face_bit] = -1;
+ continue;
+ }
+ else if (old_face_mask & cur_mask)
+ {
+ // Face exists in new and old map.
+ face_mapping[face_bit] = face_bit;
+ continue;
+ }
+
+ // OK, how we've got a mismatch, where we have to fill a new face with one from
+ // the old face.
+ if (cur_mask & (LL_FACE_PATH_BEGIN | LL_FACE_PATH_END | LL_FACE_INNER_SIDE))
+ {
+ // It's a top/bottom/hollow interior face.
+ if (old_face_mask & LL_FACE_PATH_END)
+ {
+ face_mapping[face_bit] = 1;
+ continue;
+ }
+ else
+ {
+ S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
+ for (i = 0; i < 4; i++)
+ {
+ if (old_face_mask & cur_outer_mask)
+ {
+ face_mapping[face_bit] = 5 + i;
+ break;
+ }
+ cur_outer_mask <<= 1;
+ }
+ if (i == 4)
+ {
+ LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL;
+ }
+ continue;
+ }
+ }
+
+ if (cur_mask & (LL_FACE_PROFILE_BEGIN | LL_FACE_PROFILE_END))
+ {
+ // A cut slice. Use the hollow interior if we have it.
+ if (old_face_mask & LL_FACE_INNER_SIDE)
+ {
+ face_mapping[face_bit] = 2;
+ continue;
+ }
+
+ // No interior, use the bottom face.
+ // Could figure out which of the outer faces was nearest, but that would be harder.
+ if (old_face_mask & LL_FACE_PATH_END)
+ {
+ face_mapping[face_bit] = 1;
+ continue;
+ }
+ else
+ {
+ S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
+ for (i = 0; i < 4; i++)
+ {
+ if (old_face_mask & cur_outer_mask)
+ {
+ face_mapping[face_bit] = 5 + i;
+ break;
+ }
+ cur_outer_mask <<= 1;
+ }
+ if (i == 4)
+ {
+ LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL;
+ }
+ continue;
+ }
+ }
+
+ // OK, the face that's missing is an outer face...
+ // Pull from the nearest adjacent outer face (there's always guaranteed to be one...
+ S32 cur_outer = face_bit - 5;
+ S32 min_dist = 5;
+ S32 min_outer_bit = -1;
+ S32 i;
+ for (i = 0; i < 4; i++)
+ {
+ if (old_face_mask & (LL_FACE_OUTER_SIDE_0 << i))
+ {
+ S32 dist = abs(i - cur_outer);
+ if (dist < min_dist)
+ {
+ min_dist = dist;
+ min_outer_bit = i + 5;
+ }
+ }
+ }
+ if (-1 == min_outer_bit)
+ {
+ LL_INFOS() << (LLVolume *)mVolumep << LL_ENDL;
+ LL_WARNS() << "Bad! No outer faces, impossible!" << LL_ENDL;
+ }
+ face_mapping[face_bit] = min_outer_bit;
+ }
+
+
+ setNumTEs(mVolumep->getNumFaces());
+ for (face_bit = 0; face_bit < 9; face_bit++)
+ {
+ // For each possible face type on the new shape we check to see if that
+ // face exists and if it does we create a texture entry that is a copy
+ // of one of the originals. Since the originals might not have a
+ // matching face, we use the face_mapping lookup table to figure out
+ // which face information to copy.
+ cur_mask = 0x1 << face_bit;
+ if (new_face_mask & cur_mask)
+ {
+ if (-1 == face_mapping[face_bit])
+ {
+ LL_WARNS() << "No mapping from old face to new face!" << LL_ENDL;
+ }
+
+ S32 te_num = face_index_from_id(cur_mask, mVolumep->getProfile().mFaces);
+ setTE(te_num, *(old_tes.getTexture(face_mapping[face_bit])));
+ }
+ }
#else
- // build the new object
- sVolumeManager->unrefVolume(mVolumep);
- mVolumep = volumep;
+ // build the new object
+ sVolumeManager->unrefVolume(mVolumep);
+ mVolumep = volumep;
- setNumTEs(mVolumep->getNumFaces());
+ setNumTEs(mVolumep->getNumFaces());
#endif
- return TRUE;
+ return TRUE;
}
BOOL LLPrimitive::setMaterial(U8 material)
{
- if (material != mMaterial)
- {
- mMaterial = material;
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if (material != mMaterial)
+ {
+ mMaterial = material;
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
S32 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const
{
- S32 face_index;
- S32 i;
- U64 exception_faces;
- U8 *start_loc = cur_ptr;
-
- htolememcpy(cur_ptr,data_ptr + (last_face_index * data_size), type, data_size);
- cur_ptr += data_size;
-
- for (face_index = last_face_index-1; face_index >= 0; face_index--)
- {
- BOOL already_sent = FALSE;
- for (i = face_index+1; i <= last_face_index; i++)
- {
- if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size))
- {
- already_sent = TRUE;
- break;
- }
- }
-
- if (!already_sent)
- {
- exception_faces = 0;
- for (i = face_index; i >= 0; i--)
- {
- if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size))
- {
- exception_faces |= ((U64)1 << i);
- }
- }
-
- //assign exception faces to cur_ptr
- if (exception_faces >= ((U64)0x1 << 7))
- {
- if (exception_faces >= ((U64)0x1 << 14))
- {
- if (exception_faces >= ((U64)0x1 << 21))
- {
- if (exception_faces >= ((U64)0x1 << 28))
- {
- if (exception_faces >= ((U64)0x1 << 35))
- {
- if (exception_faces >= ((U64)0x1 << 42))
- {
- if (exception_faces >= ((U64)0x1 << 49))
- {
- *cur_ptr++ = (U8)(((exception_faces >> 49) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 42) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 35) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 28) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 21) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 14) & 0x7F) | 0x80);
- }
- *cur_ptr++ = (U8)(((exception_faces >> 7) & 0x7F) | 0x80);
- }
-
-
- *cur_ptr++ = (U8)(exception_faces & 0x7F);
-
- htolememcpy(cur_ptr,data_ptr + (face_index * data_size), type, data_size);
- cur_ptr += data_size;
- }
- }
- return (S32)(cur_ptr - start_loc);
+ S32 face_index;
+ S32 i;
+ U64 exception_faces;
+ U8 *start_loc = cur_ptr;
+
+ htolememcpy(cur_ptr,data_ptr + (last_face_index * data_size), type, data_size);
+ cur_ptr += data_size;
+
+ for (face_index = last_face_index-1; face_index >= 0; face_index--)
+ {
+ BOOL already_sent = FALSE;
+ for (i = face_index+1; i <= last_face_index; i++)
+ {
+ if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size))
+ {
+ already_sent = TRUE;
+ break;
+ }
+ }
+
+ if (!already_sent)
+ {
+ exception_faces = 0;
+ for (i = face_index; i >= 0; i--)
+ {
+ if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size))
+ {
+ exception_faces |= ((U64)1 << i);
+ }
+ }
+
+ //assign exception faces to cur_ptr
+ if (exception_faces >= ((U64)0x1 << 7))
+ {
+ if (exception_faces >= ((U64)0x1 << 14))
+ {
+ if (exception_faces >= ((U64)0x1 << 21))
+ {
+ if (exception_faces >= ((U64)0x1 << 28))
+ {
+ if (exception_faces >= ((U64)0x1 << 35))
+ {
+ if (exception_faces >= ((U64)0x1 << 42))
+ {
+ if (exception_faces >= ((U64)0x1 << 49))
+ {
+ *cur_ptr++ = (U8)(((exception_faces >> 49) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 42) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 35) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 28) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 21) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 14) & 0x7F) | 0x80);
+ }
+ *cur_ptr++ = (U8)(((exception_faces >> 7) & 0x7F) | 0x80);
+ }
+
+
+ *cur_ptr++ = (U8)(exception_faces & 0x7F);
+
+ htolememcpy(cur_ptr,data_ptr + (face_index * data_size), type, data_size);
+ cur_ptr += data_size;
+ }
+ }
+ return (S32)(cur_ptr - start_loc);
}
namespace
@@ -1136,7 +1136,7 @@ namespace
return false;
}
- // Extract the default value and fill the array.
+ // Extract the default value and fill the array.
htolememcpy(dest, source, type, size);
source += size;
for (S32 idx = 1; idx < dest_count; ++idx)
@@ -1149,7 +1149,7 @@ namespace
U64 index_flags(0);
U8 sbit(0);
- // Unpack the variable length bitfield. Each bit represents whether the following
+ // Unpack the variable length bitfield. Each bit represents whether the following
// value will be placed at the corresponding array index.
do
{
@@ -1203,194 +1203,194 @@ namespace
// Includes information about image ID, color, scale S,T, offset S,T and rotation
BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const
{
- const U32 MAX_TES = 45;
-
- U8 image_ids[MAX_TES*16];
- U8 colors[MAX_TES*4];
- F32 scale_s[MAX_TES];
- F32 scale_t[MAX_TES];
- S16 offset_s[MAX_TES];
- S16 offset_t[MAX_TES];
- S16 image_rot[MAX_TES];
- U8 bump[MAX_TES];
- U8 media_flags[MAX_TES];
+ const U32 MAX_TES = 45;
+
+ U8 image_ids[MAX_TES*16];
+ U8 colors[MAX_TES*4];
+ F32 scale_s[MAX_TES];
+ F32 scale_t[MAX_TES];
+ S16 offset_s[MAX_TES];
+ S16 offset_t[MAX_TES];
+ S16 image_rot[MAX_TES];
+ U8 bump[MAX_TES];
+ U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
- U8 material_data[MAX_TES*16];
-
- const U32 MAX_TE_BUFFER = 4096;
- U8 packed_buffer[MAX_TE_BUFFER];
- U8 *cur_ptr = packed_buffer;
-
- S32 last_face_index = llmin((U32) getNumTEs(), MAX_TES) - 1;
-
- if (last_face_index > -1)
- {
- // ...if we hit the front, send one image id
- S8 face_index;
- LLColor4U coloru;
- for (face_index = 0; face_index <= last_face_index; face_index++)
- {
- // Directly sending image_ids is not safe!
- memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
-
- // Cast LLColor4 to LLColor4U
- coloru.setVec( getTE(face_index)->getColor() );
-
- // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
- // as all zeros. However, the subtraction and addition must be done in unsigned
- // byte space, not in float space, otherwise off-by-one errors occur. JC
- colors[4*face_index] = 255 - coloru.mV[0];
- colors[4*face_index + 1] = 255 - coloru.mV[1];
- colors[4*face_index + 2] = 255 - coloru.mV[2];
- colors[4*face_index + 3] = 255 - coloru.mV[3];
-
- const LLTextureEntry* te = getTE(face_index);
- scale_s[face_index] = (F32) te->mScaleS;
- scale_t[face_index] = (F32) te->mScaleT;
- offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
- offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
- image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
- bump[face_index] = te->getBumpShinyFullbright();
- media_flags[face_index] = te->getMediaTexGen();
- glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
-
- // Directly sending material_ids is not safe!
- memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
- }
-
- cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)colors, 4 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)scale_s, 4 ,last_face_index, MVT_F32);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)scale_t, 4 ,last_face_index, MVT_F32);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)offset_s, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)offset_t, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)image_rot, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)bump, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)media_flags, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)glow, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)material_data, 16, last_face_index, MVT_LLUUID);
- }
- mesgsys->addBinaryDataFast(_PREHASH_TextureEntry, packed_buffer, (S32)(cur_ptr - packed_buffer));
-
- return FALSE;
+ U8 material_data[MAX_TES*16];
+
+ const U32 MAX_TE_BUFFER = 4096;
+ U8 packed_buffer[MAX_TE_BUFFER];
+ U8 *cur_ptr = packed_buffer;
+
+ S32 last_face_index = llmin((U32) getNumTEs(), MAX_TES) - 1;
+
+ if (last_face_index > -1)
+ {
+ // ...if we hit the front, send one image id
+ S8 face_index;
+ LLColor4U coloru;
+ for (face_index = 0; face_index <= last_face_index; face_index++)
+ {
+ // Directly sending image_ids is not safe!
+ memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
+
+ // Cast LLColor4 to LLColor4U
+ coloru.setVec( getTE(face_index)->getColor() );
+
+ // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
+ // as all zeros. However, the subtraction and addition must be done in unsigned
+ // byte space, not in float space, otherwise off-by-one errors occur. JC
+ colors[4*face_index] = 255 - coloru.mV[0];
+ colors[4*face_index + 1] = 255 - coloru.mV[1];
+ colors[4*face_index + 2] = 255 - coloru.mV[2];
+ colors[4*face_index + 3] = 255 - coloru.mV[3];
+
+ const LLTextureEntry* te = getTE(face_index);
+ scale_s[face_index] = (F32) te->mScaleS;
+ scale_t[face_index] = (F32) te->mScaleT;
+ offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
+ bump[face_index] = te->getBumpShinyFullbright();
+ media_flags[face_index] = te->getMediaTexGen();
+ glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
+
+ // Directly sending material_ids is not safe!
+ memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
+ }
+
+ cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)colors, 4 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)scale_s, 4 ,last_face_index, MVT_F32);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)scale_t, 4 ,last_face_index, MVT_F32);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)offset_s, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)offset_t, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)image_rot, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)bump, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)media_flags, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)glow, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)material_data, 16, last_face_index, MVT_LLUUID);
+ }
+ mesgsys->addBinaryDataFast(_PREHASH_TextureEntry, packed_buffer, (S32)(cur_ptr - packed_buffer));
+
+ return FALSE;
}
BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const
{
- const U32 MAX_TES = 45;
-
- U8 image_ids[MAX_TES*16];
- U8 colors[MAX_TES*4];
- F32 scale_s[MAX_TES];
- F32 scale_t[MAX_TES];
- S16 offset_s[MAX_TES];
- S16 offset_t[MAX_TES];
- S16 image_rot[MAX_TES];
- U8 bump[MAX_TES];
- U8 media_flags[MAX_TES];
+ const U32 MAX_TES = 45;
+
+ U8 image_ids[MAX_TES*16];
+ U8 colors[MAX_TES*4];
+ F32 scale_s[MAX_TES];
+ F32 scale_t[MAX_TES];
+ S16 offset_s[MAX_TES];
+ S16 offset_t[MAX_TES];
+ S16 image_rot[MAX_TES];
+ U8 bump[MAX_TES];
+ U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
- U8 material_data[MAX_TES*16];
-
- const U32 MAX_TE_BUFFER = 4096;
- U8 packed_buffer[MAX_TE_BUFFER];
- U8 *cur_ptr = packed_buffer;
-
- S32 last_face_index = getNumTEs() - 1;
-
- if (last_face_index > -1)
- {
- // ...if we hit the front, send one image id
- S8 face_index;
- LLColor4U coloru;
- for (face_index = 0; face_index <= last_face_index; face_index++)
- {
- // Directly sending image_ids is not safe!
- memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
-
- // Cast LLColor4 to LLColor4U
- coloru.setVec( getTE(face_index)->getColor() );
-
- // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
- // as all zeros. However, the subtraction and addition must be done in unsigned
- // byte space, not in float space, otherwise off-by-one errors occur. JC
- colors[4*face_index] = 255 - coloru.mV[0];
- colors[4*face_index + 1] = 255 - coloru.mV[1];
- colors[4*face_index + 2] = 255 - coloru.mV[2];
- colors[4*face_index + 3] = 255 - coloru.mV[3];
-
- const LLTextureEntry* te = getTE(face_index);
- scale_s[face_index] = (F32) te->mScaleS;
- scale_t[face_index] = (F32) te->mScaleT;
- offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
- offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
- image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
- bump[face_index] = te->getBumpShinyFullbright();
- media_flags[face_index] = te->getMediaTexGen();
+ U8 material_data[MAX_TES*16];
+
+ const U32 MAX_TE_BUFFER = 4096;
+ U8 packed_buffer[MAX_TE_BUFFER];
+ U8 *cur_ptr = packed_buffer;
+
+ S32 last_face_index = getNumTEs() - 1;
+
+ if (last_face_index > -1)
+ {
+ // ...if we hit the front, send one image id
+ S8 face_index;
+ LLColor4U coloru;
+ for (face_index = 0; face_index <= last_face_index; face_index++)
+ {
+ // Directly sending image_ids is not safe!
+ memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
+
+ // Cast LLColor4 to LLColor4U
+ coloru.setVec( getTE(face_index)->getColor() );
+
+ // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
+ // as all zeros. However, the subtraction and addition must be done in unsigned
+ // byte space, not in float space, otherwise off-by-one errors occur. JC
+ colors[4*face_index] = 255 - coloru.mV[0];
+ colors[4*face_index + 1] = 255 - coloru.mV[1];
+ colors[4*face_index + 2] = 255 - coloru.mV[2];
+ colors[4*face_index + 3] = 255 - coloru.mV[3];
+
+ const LLTextureEntry* te = getTE(face_index);
+ scale_s[face_index] = (F32) te->mScaleS;
+ scale_t[face_index] = (F32) te->mScaleT;
+ offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
+ bump[face_index] = te->getBumpShinyFullbright();
+ media_flags[face_index] = te->getMediaTexGen();
glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
- // Directly sending material_ids is not safe!
- memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
- }
-
- cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)colors, 4 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)scale_s, 4 ,last_face_index, MVT_F32);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)scale_t, 4 ,last_face_index, MVT_F32);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)offset_s, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)offset_t, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)image_rot, 2 ,last_face_index, MVT_S16Array);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)bump, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)media_flags, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)glow, 1 ,last_face_index, MVT_U8);
- *cur_ptr++ = 0;
- cur_ptr += packTEField(cur_ptr, (U8 *)material_data, 16, last_face_index, MVT_LLUUID);
- }
-
- dp.packBinaryData(packed_buffer, (S32)(cur_ptr - packed_buffer), "TextureEntry");
- return FALSE;
+ // Directly sending material_ids is not safe!
+ memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
+ }
+
+ cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)colors, 4 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)scale_s, 4 ,last_face_index, MVT_F32);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)scale_t, 4 ,last_face_index, MVT_F32);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)offset_s, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)offset_t, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)image_rot, 2 ,last_face_index, MVT_S16Array);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)bump, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)media_flags, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)glow, 1 ,last_face_index, MVT_U8);
+ *cur_ptr++ = 0;
+ cur_ptr += packTEField(cur_ptr, (U8 *)material_data, 16, last_face_index, MVT_LLUUID);
+ }
+
+ dp.packBinaryData(packed_buffer, (S32)(cur_ptr - packed_buffer), "TextureEntry");
+ return FALSE;
}
S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec)
{
- S32 retval = 0;
+ S32 retval = 0;
// temp buffer for material ID processing
- // data will end up in tec.material_id[]
+ // data will end up in tec.material_id[]
material_id_type material_data[LLTEContents::MAX_TES];
- if (block_num < 0)
- {
- tec.size = mesgsys->getSizeFast(block_name, _PREHASH_TextureEntry);
- }
- else
- {
- tec.size = mesgsys->getSizeFast(block_name, block_num, _PREHASH_TextureEntry);
- }
-
- if (tec.size == 0)
- {
- tec.face_count = 0;
- return retval;
- }
+ if (block_num < 0)
+ {
+ tec.size = mesgsys->getSizeFast(block_name, _PREHASH_TextureEntry);
+ }
+ else
+ {
+ tec.size = mesgsys->getSizeFast(block_name, block_num, _PREHASH_TextureEntry);
+ }
+
+ if (tec.size == 0)
+ {
+ tec.face_count = 0;
+ return retval;
+ }
else if (tec.size >= LLTEContents::MAX_TE_BUFFER)
{
LL_WARNS("TEXTUREENTRY") << "Excessive buffer size detected in Texture Entry! Truncating." << LL_ENDL;
@@ -1400,14 +1400,14 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name
// if block_num < 0 ask for block 0
mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, tec.packed_buffer, 0, std::max(block_num, 0), LLTEContents::MAX_TE_BUFFER - 1);
- // The last field is not zero terminated.
+ // The last field is not zero terminated.
// Rather than special case the upack functions. Just make it 0x00 terminated.
tec.packed_buffer[tec.size] = 0x00;
++tec.size;
- tec.face_count = llmin((U32)getNumTEs(),(U32)LLTEContents::MAX_TES);
+ tec.face_count = llmin((U32)getNumTEs(),(U32)LLTEContents::MAX_TES);
- U8 *cur_ptr = tec.packed_buffer;
+ U8 *cur_ptr = tec.packed_buffer;
LL_DEBUGS("TEXTUREENTRY") << "Texture Entry with buffere sized: " << tec.size << LL_ENDL;
U8 *buffer_end = tec.packed_buffer + tec.size;
@@ -1426,68 +1426,68 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name
return 0;
}
- if (cur_ptr >= buffer_end || !unpack_TEField<material_id_type>(material_data, tec.face_count, cur_ptr, buffer_end, MVT_LLUUID))
- {
- memset((void*)material_data, 0, sizeof(material_data));
- }
-
- for (U32 i = 0; i < tec.face_count; i++)
- {
- tec.material_ids[i].set(&(material_data[i]));
- }
-
- retval = 1;
- return retval;
- }
-
+ if (cur_ptr >= buffer_end || !unpack_TEField<material_id_type>(material_data, tec.face_count, cur_ptr, buffer_end, MVT_LLUUID))
+ {
+ memset((void*)material_data, 0, sizeof(material_data));
+ }
+
+ for (U32 i = 0; i < tec.face_count; i++)
+ {
+ tec.material_ids[i].set(&(material_data[i]));
+ }
+
+ retval = 1;
+ return retval;
+ }
+
S32 LLPrimitive::applyParsedTEMessage(LLTEContents& tec)
{
- S32 retval = 0;
-
- LLColor4 color;
- for (U32 i = 0; i < tec.face_count; i++)
- {
- LLUUID& req_id = ((LLUUID*)tec.image_data)[i];
- retval |= setTETexture(i, req_id);
- retval |= setTEScale(i, tec.scale_s[i], tec.scale_t[i]);
- retval |= setTEOffset(i, (F32)tec.offset_s[i] / (F32)0x7FFF, (F32) tec.offset_t[i] / (F32) 0x7FFF);
- retval |= setTERotation(i, ((F32)tec.image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
- retval |= setTEBumpShinyFullbright(i, tec.bump[i]);
- retval |= setTEMediaTexGen(i, tec.media_flags[i]);
- retval |= setTEGlow(i, (F32)tec.glow[i] / (F32)0xFF);
- retval |= setTEMaterialID(i, tec.material_ids[i]);
-
- // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
- // as all zeros. However, the subtraction and addition must be done in unsigned
- // byte space, not in float space, otherwise off-by-one errors occur. JC
- color.mV[VRED] = F32(255 - tec.colors[i].mV[VRED]) / 255.f;
- color.mV[VGREEN] = F32(255 - tec.colors[i].mV[VGREEN]) / 255.f;
- color.mV[VBLUE] = F32(255 - tec.colors[i].mV[VBLUE]) / 255.f;
- color.mV[VALPHA] = F32(255 - tec.colors[i].mV[VALPHA]) / 255.f;
-
- retval |= setTEColor(i, color);
- }
-
- return retval;
+ S32 retval = 0;
+
+ LLColor4 color;
+ for (U32 i = 0; i < tec.face_count; i++)
+ {
+ LLUUID& req_id = ((LLUUID*)tec.image_data)[i];
+ retval |= setTETexture(i, req_id);
+ retval |= setTEScale(i, tec.scale_s[i], tec.scale_t[i]);
+ retval |= setTEOffset(i, (F32)tec.offset_s[i] / (F32)0x7FFF, (F32) tec.offset_t[i] / (F32) 0x7FFF);
+ retval |= setTERotation(i, ((F32)tec.image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
+ retval |= setTEBumpShinyFullbright(i, tec.bump[i]);
+ retval |= setTEMediaTexGen(i, tec.media_flags[i]);
+ retval |= setTEGlow(i, (F32)tec.glow[i] / (F32)0xFF);
+ retval |= setTEMaterialID(i, tec.material_ids[i]);
+
+ // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
+ // as all zeros. However, the subtraction and addition must be done in unsigned
+ // byte space, not in float space, otherwise off-by-one errors occur. JC
+ color.mV[VRED] = F32(255 - tec.colors[i].mV[VRED]) / 255.f;
+ color.mV[VGREEN] = F32(255 - tec.colors[i].mV[VGREEN]) / 255.f;
+ color.mV[VBLUE] = F32(255 - tec.colors[i].mV[VBLUE]) / 255.f;
+ color.mV[VALPHA] = F32(255 - tec.colors[i].mV[VALPHA]) / 255.f;
+
+ retval |= setTEColor(i, color);
+ }
+
+ return retval;
}
S32 LLPrimitive::unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num)
{
- LLTEContents tec;
- S32 retval = parseTEMessage(mesgsys, block_name, block_num, tec);
- if (!retval)
- return retval;
- return applyParsedTEMessage(tec);
+ LLTEContents tec;
+ S32 retval = parseTEMessage(mesgsys, block_name, block_num, tec);
+ if (!retval)
+ return retval;
+ return applyParsedTEMessage(tec);
}
S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
{
- // use a negative block_num to indicate a single-block read (a non-variable block)
- S32 retval = 0;
- const U32 MAX_TES = 45;
+ // use a negative block_num to indicate a single-block read (a non-variable block)
+ S32 retval = 0;
+ const U32 MAX_TES = 45;
- // Avoid construction of 32 UUIDs per call
- static LLMaterialID material_ids[MAX_TES];
+ // Avoid construction of 32 UUIDs per call
+ static LLMaterialID material_ids[MAX_TES];
const U32 MAX_TE_BUFFER = 4096;
U8 packed_buffer[MAX_TE_BUFFER];
@@ -1504,7 +1504,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
material_id_type material_data[MAX_TES];
-
+
memset((void*)scale_s, 0, sizeof(scale_s));
memset((void*)scale_t, 0, sizeof(scale_t));
memset((void*)offset_s, 0, sizeof(offset_s));
@@ -1514,32 +1514,32 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
memset((void*)media_flags, 0, sizeof(media_flags));
memset((void*)glow, 0, sizeof(glow));
- S32 size;
- U32 face_count = 0;
+ S32 size;
+ U32 face_count = 0;
- if (!dp.unpackBinaryData(packed_buffer, size, "TextureEntry"))
- {
- retval = TEM_INVALID;
- LL_WARNS() << "Bad texture entry block! Abort!" << LL_ENDL;
- return retval;
- }
+ if (!dp.unpackBinaryData(packed_buffer, size, "TextureEntry"))
+ {
+ retval = TEM_INVALID;
+ LL_WARNS() << "Bad texture entry block! Abort!" << LL_ENDL;
+ return retval;
+ }
- if (size == 0)
- {
- return retval;
- }
+ if (size == 0)
+ {
+ return retval;
+ }
else if (size >= MAX_TE_BUFFER)
{
LL_WARNS("TEXTUREENTRY") << "Excessive buffer size detected in Texture Entry! Truncating." << LL_ENDL;
size = MAX_TE_BUFFER - 1;
}
- // The last field is not zero terminated.
+ // The last field is not zero terminated.
// Rather than special case the upack functions. Just make it 0x00 terminated.
packed_buffer[size] = 0x00;
++size;
- face_count = llmin((U32) getNumTEs(), MAX_TES);
- U32 i;
+ face_count = llmin((U32) getNumTEs(), MAX_TES);
+ U32 i;
U8 *cur_ptr = packed_buffer;
LL_DEBUGS("TEXTUREENTRY") << "Texture Entry with buffer sized: " << size << LL_ENDL;
@@ -1560,81 +1560,81 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
return 0;
}
- if (cur_ptr >= buffer_end || !unpack_TEField<material_id_type>(material_data, face_count, cur_ptr, buffer_end, MVT_LLUUID))
- {
- memset((void*)material_data, 0, sizeof(material_data));
- }
-
- for (i = 0; i < face_count; i++)
- {
- material_ids[i].set(&(material_data[i]));
- }
-
- LLColor4 color;
- for (i = 0; i < face_count; i++)
- {
- retval |= setTETexture(i, ((LLUUID*)image_data)[i]);
- retval |= setTEScale(i, scale_s[i], scale_t[i]);
- retval |= setTEOffset(i, (F32)offset_s[i] / (F32)0x7FFF, (F32) offset_t[i] / (F32) 0x7FFF);
- retval |= setTERotation(i, ((F32)image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
- retval |= setTEBumpShinyFullbright(i, bump[i]);
- retval |= setTEMediaTexGen(i, media_flags[i]);
- retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF);
- retval |= setTEMaterialID(i, material_ids[i]);
+ if (cur_ptr >= buffer_end || !unpack_TEField<material_id_type>(material_data, face_count, cur_ptr, buffer_end, MVT_LLUUID))
+ {
+ memset((void*)material_data, 0, sizeof(material_data));
+ }
- // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
- // as all zeros. However, the subtraction and addition must be done in unsigned
- // byte space, not in float space, otherwise off-by-one errors occur. JC
- color.mV[VRED] = F32(255 - colors[i].mV[VRED]) / 255.f;
- color.mV[VGREEN] = F32(255 - colors[i].mV[VGREEN]) / 255.f;
- color.mV[VBLUE] = F32(255 - colors[i].mV[VBLUE]) / 255.f;
- color.mV[VALPHA] = F32(255 - colors[i].mV[VALPHA]) / 255.f;
+ for (i = 0; i < face_count; i++)
+ {
+ material_ids[i].set(&(material_data[i]));
+ }
- retval |= setTEColor(i, color);
- }
+ LLColor4 color;
+ for (i = 0; i < face_count; i++)
+ {
+ retval |= setTETexture(i, ((LLUUID*)image_data)[i]);
+ retval |= setTEScale(i, scale_s[i], scale_t[i]);
+ retval |= setTEOffset(i, (F32)offset_s[i] / (F32)0x7FFF, (F32) offset_t[i] / (F32) 0x7FFF);
+ retval |= setTERotation(i, ((F32)image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
+ retval |= setTEBumpShinyFullbright(i, bump[i]);
+ retval |= setTEMediaTexGen(i, media_flags[i]);
+ retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF);
+ retval |= setTEMaterialID(i, material_ids[i]);
+
+ // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
+ // as all zeros. However, the subtraction and addition must be done in unsigned
+ // byte space, not in float space, otherwise off-by-one errors occur. JC
+ color.mV[VRED] = F32(255 - colors[i].mV[VRED]) / 255.f;
+ color.mV[VGREEN] = F32(255 - colors[i].mV[VGREEN]) / 255.f;
+ color.mV[VBLUE] = F32(255 - colors[i].mV[VBLUE]) / 255.f;
+ color.mV[VALPHA] = F32(255 - colors[i].mV[VALPHA]) / 255.f;
+
+ retval |= setTEColor(i, color);
+ }
- return retval;
+ return retval;
}
-U8 LLPrimitive::getExpectedNumTEs() const
+U8 LLPrimitive::getExpectedNumTEs() const
{
- U8 expected_face_count = 0;
- if (mVolumep)
- {
- expected_face_count = mVolumep->getNumFaces();
- }
- return expected_face_count;
+ U8 expected_face_count = 0;
+ if (mVolumep)
+ {
+ expected_face_count = mVolumep->getNumFaces();
+ }
+ return expected_face_count;
}
void LLPrimitive::copyTextureList(const LLPrimTextureList& other_list)
{
- mTextureList.copy(other_list);
+ mTextureList.copy(other_list);
}
void LLPrimitive::takeTextureList(LLPrimTextureList& other_list)
{
- mTextureList.take(other_list);
+ mTextureList.take(other_list);
}
void LLPrimitive::updateNumBumpmap(const U8 index, const U8 bump)
{
- LLTextureEntry* te = getTE(index);
- if(!te)
- {
- return;
- }
+ LLTextureEntry* te = getTE(index);
+ if(!te)
+ {
+ return;
+ }
- U8 old_bump = te->getBumpmap();
- if(old_bump > 0)
- {
- mNumBumpmapTEs--;
- }
- if((bump & TEM_BUMP_MASK) > 0)
- {
- mNumBumpmapTEs++;
- }
+ U8 old_bump = te->getBumpmap();
+ if(old_bump > 0)
+ {
+ mNumBumpmapTEs--;
+ }
+ if((bump & TEM_BUMP_MASK) > 0)
+ {
+ mNumBumpmapTEs++;
+ }
- return;
+ return;
}
//============================================================================
@@ -1645,180 +1645,180 @@ void LLPrimitive::updateNumBumpmap(const U8 index, const U8 bump)
// static
bool LLPrimitive::getTESTAxes(const U8 face, U32* s_axis, U32* t_axis)
{
- if (face == 0)
- {
- *s_axis = VX; *t_axis = VY;
- return true;
- }
- else if (face == 1)
- {
- *s_axis = VX; *t_axis = VZ;
- return true;
- }
- else if (face == 2)
- {
- *s_axis = VY; *t_axis = VZ;
- return true;
- }
- else if (face == 3)
- {
- *s_axis = VX; *t_axis = VZ;
- return true;
- }
- else if (face == 4)
- {
- *s_axis = VY; *t_axis = VZ;
- return true;
- }
- else if (face >= 5)
- {
- *s_axis = VX; *t_axis = VY;
- return true;
- }
- else
- {
- // unknown face
- return false;
- }
+ if (face == 0)
+ {
+ *s_axis = VX; *t_axis = VY;
+ return true;
+ }
+ else if (face == 1)
+ {
+ *s_axis = VX; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 2)
+ {
+ *s_axis = VY; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 3)
+ {
+ *s_axis = VX; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 4)
+ {
+ *s_axis = VY; *t_axis = VZ;
+ return true;
+ }
+ else if (face >= 5)
+ {
+ *s_axis = VX; *t_axis = VY;
+ return true;
+ }
+ else
+ {
+ // unknown face
+ return false;
+ }
}
//============================================================================
-//static
+//static
BOOL LLNetworkData::isValid(U16 param_type, U32 size)
{
- // ew - better mechanism needed
-
- switch(param_type)
- {
- case PARAMS_FLEXIBLE:
- return (size == 16);
- case PARAMS_LIGHT:
- return (size == 16);
- case PARAMS_SCULPT:
- return (size == 17);
- case PARAMS_LIGHT_IMAGE:
- return (size == 28);
+ // ew - better mechanism needed
+
+ switch(param_type)
+ {
+ case PARAMS_FLEXIBLE:
+ return (size == 16);
+ case PARAMS_LIGHT:
+ return (size == 16);
+ case PARAMS_SCULPT:
+ return (size == 17);
+ case PARAMS_LIGHT_IMAGE:
+ return (size == 28);
case PARAMS_EXTENDED_MESH:
return (size == 4);
case PARAMS_RENDER_MATERIAL:
return (size > 1);
case PARAMS_REFLECTION_PROBE:
return (size == 9);
- }
-
- return FALSE;
+ }
+
+ return FALSE;
}
//============================================================================
LLLightParams::LLLightParams()
{
- mColor.setToWhite();
- mRadius = 10.f;
- mCutoff = 0.0f;
- mFalloff = 0.75f;
+ mColor.setToWhite();
+ mRadius = 10.f;
+ mCutoff = 0.0f;
+ mFalloff = 0.75f;
- mType = PARAMS_LIGHT;
+ mType = PARAMS_LIGHT;
}
BOOL LLLightParams::pack(LLDataPacker &dp) const
{
- LLColor4U color4u(mColor);
- dp.packColor4U(color4u, "color");
- dp.packF32(mRadius, "radius");
- dp.packF32(mCutoff, "cutoff");
- dp.packF32(mFalloff, "falloff");
- return TRUE;
+ LLColor4U color4u(mColor);
+ dp.packColor4U(color4u, "color");
+ dp.packF32(mRadius, "radius");
+ dp.packF32(mCutoff, "cutoff");
+ dp.packF32(mFalloff, "falloff");
+ return TRUE;
}
BOOL LLLightParams::unpack(LLDataPacker &dp)
{
- LLColor4U color;
- dp.unpackColor4U(color, "color");
- setLinearColor(LLColor4(color));
+ LLColor4U color;
+ dp.unpackColor4U(color, "color");
+ setLinearColor(LLColor4(color));
- F32 radius;
- dp.unpackF32(radius, "radius");
- setRadius(radius);
+ F32 radius;
+ dp.unpackF32(radius, "radius");
+ setRadius(radius);
- F32 cutoff;
- dp.unpackF32(cutoff, "cutoff");
- setCutoff(cutoff);
+ F32 cutoff;
+ dp.unpackF32(cutoff, "cutoff");
+ setCutoff(cutoff);
- F32 falloff;
- dp.unpackF32(falloff, "falloff");
- setFalloff(falloff);
-
- return TRUE;
+ F32 falloff;
+ dp.unpackF32(falloff, "falloff");
+ setFalloff(falloff);
+
+ return TRUE;
}
bool LLLightParams::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_LIGHT)
- {
- return false;
- }
- const LLLightParams *param = (const LLLightParams*)&data;
- if (param->mColor != mColor ||
- param->mRadius != mRadius ||
- param->mCutoff != mCutoff ||
- param->mFalloff != mFalloff)
- {
- return false;
- }
- return true;
+ if (data.mType != PARAMS_LIGHT)
+ {
+ return false;
+ }
+ const LLLightParams *param = (const LLLightParams*)&data;
+ if (param->mColor != mColor ||
+ param->mRadius != mRadius ||
+ param->mCutoff != mCutoff ||
+ param->mFalloff != mFalloff)
+ {
+ return false;
+ }
+ return true;
}
void LLLightParams::copy(const LLNetworkData& data)
{
- const LLLightParams *param = (LLLightParams*)&data;
- mType = param->mType;
- mColor = param->mColor;
- mRadius = param->mRadius;
- mCutoff = param->mCutoff;
- mFalloff = param->mFalloff;
+ const LLLightParams *param = (LLLightParams*)&data;
+ mType = param->mType;
+ mColor = param->mColor;
+ mRadius = param->mRadius;
+ mCutoff = param->mCutoff;
+ mFalloff = param->mFalloff;
}
LLSD LLLightParams::asLLSD() const
{
- LLSD sd;
-
- sd["color"] = ll_sd_from_color4(getLinearColor());
- sd["radius"] = getRadius();
- sd["falloff"] = getFalloff();
- sd["cutoff"] = getCutoff();
-
- return sd;
+ LLSD sd;
+
+ sd["color"] = ll_sd_from_color4(getLinearColor());
+ sd["radius"] = getRadius();
+ sd["falloff"] = getFalloff();
+ sd["cutoff"] = getCutoff();
+
+ return sd;
}
bool LLLightParams::fromLLSD(LLSD& sd)
{
- const char *w;
- w = "color";
- if (sd.has(w))
- {
- setLinearColor( ll_color4_from_sd(sd["color"]) );
- } else goto fail;
- w = "radius";
- if (sd.has(w))
- {
- setRadius( (F32)sd[w].asReal() );
- } else goto fail;
- w = "falloff";
- if (sd.has(w))
- {
- setFalloff( (F32)sd[w].asReal() );
- } else goto fail;
- w = "cutoff";
- if (sd.has(w))
- {
- setCutoff( (F32)sd[w].asReal() );
- } else goto fail;
-
- return true;
+ const char *w;
+ w = "color";
+ if (sd.has(w))
+ {
+ setLinearColor( ll_color4_from_sd(sd["color"]) );
+ } else goto fail;
+ w = "radius";
+ if (sd.has(w))
+ {
+ setRadius( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "falloff";
+ if (sd.has(w))
+ {
+ setFalloff( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "cutoff";
+ if (sd.has(w))
+ {
+ setCutoff( (F32)sd[w].asReal() );
+ } else goto fail;
+
+ return true;
fail:
- return false;
+ return false;
}
//============================================================================
@@ -1832,39 +1832,39 @@ LLReflectionProbeParams::LLReflectionProbeParams()
BOOL LLReflectionProbeParams::pack(LLDataPacker &dp) const
{
- dp.packF32(mAmbiance, "ambiance");
+ dp.packF32(mAmbiance, "ambiance");
dp.packF32(mClipDistance, "clip_distance");
dp.packU8(mFlags, "flags");
- return TRUE;
+ return TRUE;
}
BOOL LLReflectionProbeParams::unpack(LLDataPacker &dp)
{
- F32 ambiance;
+ F32 ambiance;
F32 clip_distance;
- dp.unpackF32(ambiance, "ambiance");
- setAmbiance(ambiance);
-
+ dp.unpackF32(ambiance, "ambiance");
+ setAmbiance(ambiance);
+
dp.unpackF32(clip_distance, "clip_distance");
- setClipDistance(clip_distance);
-
+ setClipDistance(clip_distance);
+
dp.unpackU8(mFlags, "flags");
-
- return TRUE;
+
+ return TRUE;
}
bool LLReflectionProbeParams::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_REFLECTION_PROBE)
- {
- return false;
- }
- const LLReflectionProbeParams *param = (const LLReflectionProbeParams*)&data;
- if (param->mAmbiance != mAmbiance)
- {
- return false;
- }
+ if (data.mType != PARAMS_REFLECTION_PROBE)
+ {
+ return false;
+ }
+ const LLReflectionProbeParams *param = (const LLReflectionProbeParams*)&data;
+ if (param->mAmbiance != mAmbiance)
+ {
+ return false;
+ }
if (param->mClipDistance != mClipDistance)
{
return false;
@@ -1873,25 +1873,25 @@ bool LLReflectionProbeParams::operator==(const LLNetworkData& data) const
{
return false;
}
- return true;
+ return true;
}
void LLReflectionProbeParams::copy(const LLNetworkData& data)
{
- const LLReflectionProbeParams *param = (LLReflectionProbeParams*)&data;
- mType = param->mType;
- mAmbiance = param->mAmbiance;
+ const LLReflectionProbeParams *param = (LLReflectionProbeParams*)&data;
+ mType = param->mType;
+ mAmbiance = param->mAmbiance;
mClipDistance = param->mClipDistance;
mFlags = param->mFlags;
}
LLSD LLReflectionProbeParams::asLLSD() const
{
- LLSD sd;
- sd["ambiance"] = getAmbiance();
+ LLSD sd;
+ sd["ambiance"] = getAmbiance();
sd["clip_distance"] = getClipDistance();
sd["flags"] = mFlags;
- return sd;
+ return sd;
}
bool LLReflectionProbeParams::fromLLSD(LLSD& sd)
@@ -1903,10 +1903,10 @@ bool LLReflectionProbeParams::fromLLSD(LLSD& sd)
return false;
}
- setAmbiance((F32)sd["ambiance"].asReal());
+ setAmbiance((F32)sd["ambiance"].asReal());
setClipDistance((F32)sd["clip_distance"].asReal());
mFlags = (U8) sd["flags"].asInteger();
-
+
return true;
}
@@ -1950,312 +1950,312 @@ void LLReflectionProbeParams::setIsMirror(bool is_mirror)
//============================================================================
LLFlexibleObjectData::LLFlexibleObjectData()
{
- mSimulateLOD = FLEXIBLE_OBJECT_DEFAULT_NUM_SECTIONS;
- mGravity = FLEXIBLE_OBJECT_DEFAULT_GRAVITY;
- mAirFriction = FLEXIBLE_OBJECT_DEFAULT_AIR_FRICTION;
- mWindSensitivity = FLEXIBLE_OBJECT_DEFAULT_WIND_SENSITIVITY;
- mTension = FLEXIBLE_OBJECT_DEFAULT_TENSION;
- //mUsingCollisionSphere = FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE;
- //mRenderingCollisionSphere = FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE;
- mUserForce = LLVector3(0.f, 0.f, 0.f);
+ mSimulateLOD = FLEXIBLE_OBJECT_DEFAULT_NUM_SECTIONS;
+ mGravity = FLEXIBLE_OBJECT_DEFAULT_GRAVITY;
+ mAirFriction = FLEXIBLE_OBJECT_DEFAULT_AIR_FRICTION;
+ mWindSensitivity = FLEXIBLE_OBJECT_DEFAULT_WIND_SENSITIVITY;
+ mTension = FLEXIBLE_OBJECT_DEFAULT_TENSION;
+ //mUsingCollisionSphere = FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE;
+ //mRenderingCollisionSphere = FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE;
+ mUserForce = LLVector3(0.f, 0.f, 0.f);
- mType = PARAMS_FLEXIBLE;
+ mType = PARAMS_FLEXIBLE;
}
BOOL LLFlexibleObjectData::pack(LLDataPacker &dp) const
{
- // Custom, uber-svelte pack "softness" in upper bits of tension & drag
- U8 bit1 = (mSimulateLOD & 2) << 6;
- U8 bit2 = (mSimulateLOD & 1) << 7;
- dp.packU8((U8)(mTension*10.01f) + bit1, "tension");
- dp.packU8((U8)(mAirFriction*10.01f) + bit2, "drag");
- dp.packU8((U8)((mGravity+10.f)*10.01f), "gravity");
- dp.packU8((U8)(mWindSensitivity*10.01f), "wind");
- dp.packVector3(mUserForce, "userforce");
- return TRUE;
+ // Custom, uber-svelte pack "softness" in upper bits of tension & drag
+ U8 bit1 = (mSimulateLOD & 2) << 6;
+ U8 bit2 = (mSimulateLOD & 1) << 7;
+ dp.packU8((U8)(mTension*10.01f) + bit1, "tension");
+ dp.packU8((U8)(mAirFriction*10.01f) + bit2, "drag");
+ dp.packU8((U8)((mGravity+10.f)*10.01f), "gravity");
+ dp.packU8((U8)(mWindSensitivity*10.01f), "wind");
+ dp.packVector3(mUserForce, "userforce");
+ return TRUE;
}
BOOL LLFlexibleObjectData::unpack(LLDataPacker &dp)
{
- U8 tension, friction, gravity, wind;
- U8 bit1, bit2;
- dp.unpackU8(tension, "tension"); bit1 = (tension >> 6) & 2;
- mTension = ((F32)(tension&0x7f))/10.f;
- dp.unpackU8(friction, "drag"); bit2 = (friction >> 7) & 1;
- mAirFriction = ((F32)(friction&0x7f))/10.f;
- mSimulateLOD = bit1 | bit2;
- dp.unpackU8(gravity, "gravity"); mGravity = ((F32)gravity)/10.f - 10.f;
- dp.unpackU8(wind, "wind"); mWindSensitivity = ((F32)wind)/10.f;
- if (dp.hasNext())
- {
- dp.unpackVector3(mUserForce, "userforce");
- }
- else
- {
- mUserForce.setVec(0.f, 0.f, 0.f);
- }
- return TRUE;
+ U8 tension, friction, gravity, wind;
+ U8 bit1, bit2;
+ dp.unpackU8(tension, "tension"); bit1 = (tension >> 6) & 2;
+ mTension = ((F32)(tension&0x7f))/10.f;
+ dp.unpackU8(friction, "drag"); bit2 = (friction >> 7) & 1;
+ mAirFriction = ((F32)(friction&0x7f))/10.f;
+ mSimulateLOD = bit1 | bit2;
+ dp.unpackU8(gravity, "gravity"); mGravity = ((F32)gravity)/10.f - 10.f;
+ dp.unpackU8(wind, "wind"); mWindSensitivity = ((F32)wind)/10.f;
+ if (dp.hasNext())
+ {
+ dp.unpackVector3(mUserForce, "userforce");
+ }
+ else
+ {
+ mUserForce.setVec(0.f, 0.f, 0.f);
+ }
+ return TRUE;
}
bool LLFlexibleObjectData::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_FLEXIBLE)
- {
- return false;
- }
- LLFlexibleObjectData *flex_data = (LLFlexibleObjectData*)&data;
- return (mSimulateLOD == flex_data->mSimulateLOD &&
- mGravity == flex_data->mGravity &&
- mAirFriction == flex_data->mAirFriction &&
- mWindSensitivity == flex_data->mWindSensitivity &&
- mTension == flex_data->mTension &&
- mUserForce == flex_data->mUserForce);
- //mUsingCollisionSphere == flex_data->mUsingCollisionSphere &&
- //mRenderingCollisionSphere == flex_data->mRenderingCollisionSphere
+ if (data.mType != PARAMS_FLEXIBLE)
+ {
+ return false;
+ }
+ LLFlexibleObjectData *flex_data = (LLFlexibleObjectData*)&data;
+ return (mSimulateLOD == flex_data->mSimulateLOD &&
+ mGravity == flex_data->mGravity &&
+ mAirFriction == flex_data->mAirFriction &&
+ mWindSensitivity == flex_data->mWindSensitivity &&
+ mTension == flex_data->mTension &&
+ mUserForce == flex_data->mUserForce);
+ //mUsingCollisionSphere == flex_data->mUsingCollisionSphere &&
+ //mRenderingCollisionSphere == flex_data->mRenderingCollisionSphere
}
void LLFlexibleObjectData::copy(const LLNetworkData& data)
{
- const LLFlexibleObjectData *flex_data = (LLFlexibleObjectData*)&data;
- mSimulateLOD = flex_data->mSimulateLOD;
- mGravity = flex_data->mGravity;
- mAirFriction = flex_data->mAirFriction;
- mWindSensitivity = flex_data->mWindSensitivity;
- mTension = flex_data->mTension;
- mUserForce = flex_data->mUserForce;
- //mUsingCollisionSphere = flex_data->mUsingCollisionSphere;
- //mRenderingCollisionSphere = flex_data->mRenderingCollisionSphere;
+ const LLFlexibleObjectData *flex_data = (LLFlexibleObjectData*)&data;
+ mSimulateLOD = flex_data->mSimulateLOD;
+ mGravity = flex_data->mGravity;
+ mAirFriction = flex_data->mAirFriction;
+ mWindSensitivity = flex_data->mWindSensitivity;
+ mTension = flex_data->mTension;
+ mUserForce = flex_data->mUserForce;
+ //mUsingCollisionSphere = flex_data->mUsingCollisionSphere;
+ //mRenderingCollisionSphere = flex_data->mRenderingCollisionSphere;
}
LLSD LLFlexibleObjectData::asLLSD() const
{
- LLSD sd;
+ LLSD sd;
- sd["air_friction"] = getAirFriction();
- sd["gravity"] = getGravity();
- sd["simulate_lod"] = getSimulateLOD();
- sd["tension"] = getTension();
- sd["user_force"] = getUserForce().getValue();
- sd["wind_sensitivity"] = getWindSensitivity();
-
- return sd;
+ sd["air_friction"] = getAirFriction();
+ sd["gravity"] = getGravity();
+ sd["simulate_lod"] = getSimulateLOD();
+ sd["tension"] = getTension();
+ sd["user_force"] = getUserForce().getValue();
+ sd["wind_sensitivity"] = getWindSensitivity();
+
+ return sd;
}
bool LLFlexibleObjectData::fromLLSD(LLSD& sd)
{
- const char *w;
- w = "air_friction";
- if (sd.has(w))
- {
- setAirFriction( (F32)sd[w].asReal() );
- } else goto fail;
- w = "gravity";
- if (sd.has(w))
- {
- setGravity( (F32)sd[w].asReal() );
- } else goto fail;
- w = "simulate_lod";
- if (sd.has(w))
- {
- setSimulateLOD( sd[w].asInteger() );
- } else goto fail;
- w = "tension";
- if (sd.has(w))
- {
- setTension( (F32)sd[w].asReal() );
- } else goto fail;
- w = "user_force";
- if (sd.has(w))
- {
- LLVector3 user_force = ll_vector3_from_sd(sd[w], 0);
- setUserForce( user_force );
- } else goto fail;
- w = "wind_sensitivity";
- if (sd.has(w))
- {
- setWindSensitivity( (F32)sd[w].asReal() );
- } else goto fail;
-
- return true;
+ const char *w;
+ w = "air_friction";
+ if (sd.has(w))
+ {
+ setAirFriction( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "gravity";
+ if (sd.has(w))
+ {
+ setGravity( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "simulate_lod";
+ if (sd.has(w))
+ {
+ setSimulateLOD( sd[w].asInteger() );
+ } else goto fail;
+ w = "tension";
+ if (sd.has(w))
+ {
+ setTension( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "user_force";
+ if (sd.has(w))
+ {
+ LLVector3 user_force = ll_vector3_from_sd(sd[w], 0);
+ setUserForce( user_force );
+ } else goto fail;
+ w = "wind_sensitivity";
+ if (sd.has(w))
+ {
+ setWindSensitivity( (F32)sd[w].asReal() );
+ } else goto fail;
+
+ return true;
fail:
- return false;
+ return false;
}
//============================================================================
LLSculptParams::LLSculptParams()
{
- mType = PARAMS_SCULPT;
- mSculptTexture.set(SCULPT_DEFAULT_TEXTURE);
- mSculptType = LL_SCULPT_TYPE_SPHERE;
+ mType = PARAMS_SCULPT;
+ mSculptTexture.set(SCULPT_DEFAULT_TEXTURE);
+ mSculptType = LL_SCULPT_TYPE_SPHERE;
}
BOOL LLSculptParams::pack(LLDataPacker &dp) const
{
- dp.packUUID(mSculptTexture, "texture");
- dp.packU8(mSculptType, "type");
-
- return TRUE;
+ dp.packUUID(mSculptTexture, "texture");
+ dp.packU8(mSculptType, "type");
+
+ return TRUE;
}
BOOL LLSculptParams::unpack(LLDataPacker &dp)
{
- U8 type;
- LLUUID id;
- dp.unpackUUID(id, "texture");
- dp.unpackU8(type, "type");
+ U8 type;
+ LLUUID id;
+ dp.unpackUUID(id, "texture");
+ dp.unpackU8(type, "type");
- setSculptTexture(id, type);
- return TRUE;
+ setSculptTexture(id, type);
+ return TRUE;
}
bool LLSculptParams::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_SCULPT)
- {
- return false;
- }
-
- const LLSculptParams *param = (const LLSculptParams*)&data;
- if ( (param->mSculptTexture != mSculptTexture) ||
- (param->mSculptType != mSculptType) )
-
- {
- return false;
- }
-
- return true;
+ if (data.mType != PARAMS_SCULPT)
+ {
+ return false;
+ }
+
+ const LLSculptParams *param = (const LLSculptParams*)&data;
+ if ( (param->mSculptTexture != mSculptTexture) ||
+ (param->mSculptType != mSculptType) )
+
+ {
+ return false;
+ }
+
+ return true;
}
void LLSculptParams::copy(const LLNetworkData& data)
{
- const LLSculptParams *param = (LLSculptParams*)&data;
- setSculptTexture(param->mSculptTexture, param->mSculptType);
+ const LLSculptParams *param = (LLSculptParams*)&data;
+ setSculptTexture(param->mSculptTexture, param->mSculptType);
}
LLSD LLSculptParams::asLLSD() const
{
- LLSD sd;
-
- sd["texture"] = mSculptTexture;
- sd["type"] = mSculptType;
-
- return sd;
+ LLSD sd;
+
+ sd["texture"] = mSculptTexture;
+ sd["type"] = mSculptType;
+
+ return sd;
}
bool LLSculptParams::fromLLSD(LLSD& sd)
{
- const char *w;
- U8 type;
- w = "type";
- if (sd.has(w))
- {
- type = sd[w].asInteger();
- }
- else return false;
+ const char *w;
+ U8 type;
+ w = "type";
+ if (sd.has(w))
+ {
+ type = sd[w].asInteger();
+ }
+ else return false;
- w = "texture";
- if (sd.has(w))
- {
- setSculptTexture(sd[w], type);
- }
- else return false;
+ w = "texture";
+ if (sd.has(w))
+ {
+ setSculptTexture(sd[w], type);
+ }
+ else return false;
- return true;
+ return true;
}
void LLSculptParams::setSculptTexture(const LLUUID& texture_id, U8 sculpt_type)
{
- U8 type = sculpt_type & LL_SCULPT_TYPE_MASK;
- U8 flags = sculpt_type & LL_SCULPT_FLAG_MASK;
- if (sculpt_type != (type | flags) || type > LL_SCULPT_TYPE_MAX)
- {
- mSculptTexture.set(SCULPT_DEFAULT_TEXTURE);
- mSculptType = LL_SCULPT_TYPE_SPHERE;
- }
- else
- {
- mSculptTexture = texture_id;
- mSculptType = sculpt_type;
- }
+ U8 type = sculpt_type & LL_SCULPT_TYPE_MASK;
+ U8 flags = sculpt_type & LL_SCULPT_FLAG_MASK;
+ if (sculpt_type != (type | flags) || type > LL_SCULPT_TYPE_MAX)
+ {
+ mSculptTexture.set(SCULPT_DEFAULT_TEXTURE);
+ mSculptType = LL_SCULPT_TYPE_SPHERE;
+ }
+ else
+ {
+ mSculptTexture = texture_id;
+ mSculptType = sculpt_type;
+ }
}
//============================================================================
LLLightImageParams::LLLightImageParams()
{
- mType = PARAMS_LIGHT_IMAGE;
- mParams.setVec(F_PI*0.5f, 0.f, 0.f);
+ mType = PARAMS_LIGHT_IMAGE;
+ mParams.setVec(F_PI*0.5f, 0.f, 0.f);
}
BOOL LLLightImageParams::pack(LLDataPacker &dp) const
{
- dp.packUUID(mLightTexture, "texture");
- dp.packVector3(mParams, "params");
+ dp.packUUID(mLightTexture, "texture");
+ dp.packVector3(mParams, "params");
- return TRUE;
+ return TRUE;
}
BOOL LLLightImageParams::unpack(LLDataPacker &dp)
{
- dp.unpackUUID(mLightTexture, "texture");
- dp.unpackVector3(mParams, "params");
-
- return TRUE;
+ dp.unpackUUID(mLightTexture, "texture");
+ dp.unpackVector3(mParams, "params");
+
+ return TRUE;
}
bool LLLightImageParams::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_LIGHT_IMAGE)
- {
- return false;
- }
-
- const LLLightImageParams *param = (const LLLightImageParams*)&data;
- if ( (param->mLightTexture != mLightTexture) )
- {
- return false;
- }
-
- if ( (param->mParams != mParams ) )
- {
- return false;
- }
-
- return true;
+ if (data.mType != PARAMS_LIGHT_IMAGE)
+ {
+ return false;
+ }
+
+ const LLLightImageParams *param = (const LLLightImageParams*)&data;
+ if ( (param->mLightTexture != mLightTexture) )
+ {
+ return false;
+ }
+
+ if ( (param->mParams != mParams ) )
+ {
+ return false;
+ }
+
+ return true;
}
void LLLightImageParams::copy(const LLNetworkData& data)
{
- const LLLightImageParams *param = (LLLightImageParams*)&data;
- mLightTexture = param->mLightTexture;
- mParams = param->mParams;
+ const LLLightImageParams *param = (LLLightImageParams*)&data;
+ mLightTexture = param->mLightTexture;
+ mParams = param->mParams;
}
LLSD LLLightImageParams::asLLSD() const
{
- LLSD sd;
-
- sd["texture"] = mLightTexture;
- sd["params"] = mParams.getValue();
-
- return sd;
+ LLSD sd;
+
+ sd["texture"] = mLightTexture;
+ sd["params"] = mParams.getValue();
+
+ return sd;
}
bool LLLightImageParams::fromLLSD(LLSD& sd)
{
- if (sd.has("texture"))
- {
- setLightTexture( sd["texture"] );
- setParams( LLVector3( sd["params"] ) );
- return true;
- }
-
- return false;
+ if (sd.has("texture"))
+ {
+ setLightTexture( sd["texture"] );
+ setParams( LLVector3( sd["params"] ) );
+ return true;
+ }
+
+ return false;
}
//============================================================================
@@ -2263,63 +2263,63 @@ bool LLLightImageParams::fromLLSD(LLSD& sd)
LLExtendedMeshParams::LLExtendedMeshParams()
{
mType = PARAMS_EXTENDED_MESH;
- mFlags = 0;
+ mFlags = 0;
}
BOOL LLExtendedMeshParams::pack(LLDataPacker &dp) const
{
- dp.packU32(mFlags, "flags");
+ dp.packU32(mFlags, "flags");
- return TRUE;
+ return TRUE;
}
BOOL LLExtendedMeshParams::unpack(LLDataPacker &dp)
{
- dp.unpackU32(mFlags, "flags");
-
- return TRUE;
+ dp.unpackU32(mFlags, "flags");
+
+ return TRUE;
}
bool LLExtendedMeshParams::operator==(const LLNetworkData& data) const
{
- if (data.mType != PARAMS_EXTENDED_MESH)
- {
- return false;
- }
-
- const LLExtendedMeshParams *param = (const LLExtendedMeshParams*)&data;
- if ( (param->mFlags != mFlags) )
- {
- return false;
- }
+ if (data.mType != PARAMS_EXTENDED_MESH)
+ {
+ return false;
+ }
- return true;
+ const LLExtendedMeshParams *param = (const LLExtendedMeshParams*)&data;
+ if ( (param->mFlags != mFlags) )
+ {
+ return false;
+ }
+
+ return true;
}
void LLExtendedMeshParams::copy(const LLNetworkData& data)
{
- const LLExtendedMeshParams *param = (LLExtendedMeshParams*)&data;
- mFlags = param->mFlags;
+ const LLExtendedMeshParams *param = (LLExtendedMeshParams*)&data;
+ mFlags = param->mFlags;
}
LLSD LLExtendedMeshParams::asLLSD() const
{
- LLSD sd;
-
- sd["flags"] = LLSD::Integer(mFlags);
-
- return sd;
+ LLSD sd;
+
+ sd["flags"] = LLSD::Integer(mFlags);
+
+ return sd;
}
bool LLExtendedMeshParams::fromLLSD(LLSD& sd)
{
- if (sd.has("flags"))
- {
- setFlags( sd["flags"].asInteger());
- return true;
- }
-
- return false;
+ if (sd.has("flags"))
+ {
+ setFlags( sd["flags"].asInteger());
+ return true;
+ }
+
+ return false;
}
//============================================================================
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 5622483861..6078abf67e 100644
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llprimitive.h
* @brief LLPrimitive base class
*
* $LicenseInfo:firstyear=2001&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$
*/
@@ -49,14 +49,14 @@ class LLVolumeMgr;
enum LLGeomType // NOTE: same vals as GL Ids
{
- LLInvalid = 0,
- LLLineLoop = 2,
- LLLineStrip = 3,
- LLTriangles = 4,
- LLTriStrip = 5,
- LLTriFan = 6,
- LLQuads = 7,
- LLQuadStrip = 8
+ LLInvalid = 0,
+ LLLineLoop = 2,
+ LLLineStrip = 3,
+ LLTriangles = 4,
+ LLTriStrip = 5,
+ LLTriFan = 6,
+ LLQuads = 7,
+ LLQuadStrip = 8
};
class LLVolume;
@@ -97,28 +97,28 @@ extern const char *SCULPT_DEFAULT_TEXTURE;
class LLNetworkData
{
public:
- // Extra parameter IDs
- enum
- {
- PARAMS_FLEXIBLE = 0x10,
- PARAMS_LIGHT = 0x20,
- PARAMS_SCULPT = 0x30,
- PARAMS_LIGHT_IMAGE = 0x40,
- PARAMS_RESERVED = 0x50, // Used on server-side
- PARAMS_MESH = 0x60,
+ // Extra parameter IDs
+ enum
+ {
+ PARAMS_FLEXIBLE = 0x10,
+ PARAMS_LIGHT = 0x20,
+ PARAMS_SCULPT = 0x30,
+ PARAMS_LIGHT_IMAGE = 0x40,
+ PARAMS_RESERVED = 0x50, // Used on server-side
+ PARAMS_MESH = 0x60,
PARAMS_EXTENDED_MESH = 0x70,
PARAMS_RENDER_MATERIAL = 0x80,
PARAMS_REFLECTION_PROBE = 0x90,
- };
-
+ };
+
public:
- U16 mType;
- virtual ~LLNetworkData() {};
- virtual BOOL pack(LLDataPacker &dp) const = 0;
- virtual BOOL unpack(LLDataPacker &dp) = 0;
- virtual bool operator==(const LLNetworkData& data) const = 0;
- virtual void copy(const LLNetworkData& data) = 0;
- static BOOL isValid(U16 param_type, U32 size);
+ U16 mType;
+ virtual ~LLNetworkData() {};
+ virtual BOOL pack(LLDataPacker &dp) const = 0;
+ virtual BOOL unpack(LLDataPacker &dp) = 0;
+ virtual bool operator==(const LLNetworkData& data) const = 0;
+ virtual void copy(const LLNetworkData& data) = 0;
+ static BOOL isValid(U16 param_type, U32 size);
};
extern const F32 LIGHT_MIN_RADIUS;
@@ -134,22 +134,22 @@ extern const F32 LIGHT_MAX_CUTOFF;
class LLLightParams : public LLNetworkData
{
private:
- LLColor4 mColor; // linear color (not gamma corrected), alpha = intensity
- F32 mRadius;
- F32 mFalloff;
- F32 mCutoff;
+ LLColor4 mColor; // linear color (not gamma corrected), alpha = intensity
+ F32 mRadius;
+ F32 mFalloff;
+ F32 mCutoff;
public:
- LLLightParams();
- /*virtual*/ BOOL pack(LLDataPacker &dp) const;
- /*virtual*/ BOOL unpack(LLDataPacker &dp);
- /*virtual*/ bool operator==(const LLNetworkData& data) const;
- /*virtual*/ void copy(const LLNetworkData& data);
- // LLSD implementations here are provided by Eddy Stryker.
- // NOTE: there are currently unused in protocols
- LLSD asLLSD() const;
- operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
+ LLLightParams();
+ /*virtual*/ BOOL pack(LLDataPacker &dp) const;
+ /*virtual*/ BOOL unpack(LLDataPacker &dp);
+ /*virtual*/ bool operator==(const LLNetworkData& data) const;
+ /*virtual*/ void copy(const LLNetworkData& data);
+ // LLSD implementations here are provided by Eddy Stryker.
+ // NOTE: there are currently unused in protocols
+ LLSD asLLSD() const;
+ operator LLSD() const { return asLLSD(); }
+ bool fromLLSD(LLSD& sd);
// set the color by gamma corrected color value
// color - gamma corrected color value (directly taken from an on-screen color swatch)
@@ -157,19 +157,19 @@ public:
// set the color by linear color value
// color - linear color value (value as it appears in shaders)
- void setLinearColor(const LLColor4& color) { mColor = color; mColor.clamp(); }
- void setRadius(F32 radius) { mRadius = llclamp(radius, LIGHT_MIN_RADIUS, LIGHT_MAX_RADIUS); }
- void setFalloff(F32 falloff) { mFalloff = llclamp(falloff, LIGHT_MIN_FALLOFF, LIGHT_MAX_FALLOFF); }
- void setCutoff(F32 cutoff) { mCutoff = llclamp(cutoff, LIGHT_MIN_CUTOFF, LIGHT_MAX_CUTOFF); }
+ void setLinearColor(const LLColor4& color) { mColor = color; mColor.clamp(); }
+ void setRadius(F32 radius) { mRadius = llclamp(radius, LIGHT_MIN_RADIUS, LIGHT_MAX_RADIUS); }
+ void setFalloff(F32 falloff) { mFalloff = llclamp(falloff, LIGHT_MIN_FALLOFF, LIGHT_MAX_FALLOFF); }
+ void setCutoff(F32 cutoff) { mCutoff = llclamp(cutoff, LIGHT_MIN_CUTOFF, LIGHT_MAX_CUTOFF); }
// get the linear space color of this light. This value can be fed directly to shaders
- LLColor4 getLinearColor() const { return mColor; }
+ LLColor4 getLinearColor() const { return mColor; }
// get the sRGB (gamma corrected) color of this light, this is the value that should be displayed in the UI
- LLColor4 getSRGBColor() const { return srgbColor4(mColor); }
-
- F32 getRadius() const { return mRadius; }
- F32 getFalloff() const { return mFalloff; }
- F32 getCutoff() const { return mCutoff; }
+ LLColor4 getSRGBColor() const { return srgbColor4(mColor); }
+
+ F32 getRadius() const { return mRadius; }
+ F32 getFalloff() const { return mFalloff; }
+ F32 getCutoff() const { return mCutoff; }
};
extern const F32 REFLECTION_PROBE_MIN_AMBIANCE;
@@ -186,7 +186,7 @@ public:
{
FLAG_BOX_VOLUME = 0x01, // use a box influence volume
FLAG_DYNAMIC = 0x02, // render dynamic objects (avatars) into this Reflection Probe
- FLAG_MIRROR = 0x04, // This probe is used for reflections on realtime mirrors.
+ FLAG_MIRROR = 0x04, // This probe is used for reflections on realtime mirrors.
};
protected:
@@ -220,7 +220,7 @@ public:
};
//-------------------------------------------------
-// This structure is also used in the part of the
+// This structure is also used in the part of the
// code that creates new flexible objects.
//-------------------------------------------------
@@ -228,11 +228,11 @@ public:
// array bounds.
enum EFlexibleObjectConst
{
- // "Softness" => [0,3], increments of 1
- // Represents powers of 2: 0 -> 1, 3 -> 8
- FLEXIBLE_OBJECT_MIN_SECTIONS = 0,
- FLEXIBLE_OBJECT_DEFAULT_NUM_SECTIONS = 2,
- FLEXIBLE_OBJECT_MAX_SECTIONS = 3
+ // "Softness" => [0,3], increments of 1
+ // Represents powers of 2: 0 -> 1, 3 -> 8
+ FLEXIBLE_OBJECT_MIN_SECTIONS = 0,
+ FLEXIBLE_OBJECT_DEFAULT_NUM_SECTIONS = 2,
+ FLEXIBLE_OBJECT_MAX_SECTIONS = 3
};
// "Tension" => [0,10], increments of 0.1
@@ -265,39 +265,39 @@ extern const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE;
class LLFlexibleObjectData : public LLNetworkData
{
protected:
- S32 mSimulateLOD; // 2^n = number of simulated sections
- F32 mGravity;
- F32 mAirFriction; // higher is more stable, but too much looks like it's underwater
- F32 mWindSensitivity; // interacts with tension, air friction, and gravity
- F32 mTension; //interacts in complex ways with other parameters
- LLVector3 mUserForce; // custom user-defined force vector
- //BOOL mUsingCollisionSphere;
- //BOOL mRenderingCollisionSphere;
+ S32 mSimulateLOD; // 2^n = number of simulated sections
+ F32 mGravity;
+ F32 mAirFriction; // higher is more stable, but too much looks like it's underwater
+ F32 mWindSensitivity; // interacts with tension, air friction, and gravity
+ F32 mTension; //interacts in complex ways with other parameters
+ LLVector3 mUserForce; // custom user-defined force vector
+ //BOOL mUsingCollisionSphere;
+ //BOOL mRenderingCollisionSphere;
public:
- void setSimulateLOD(S32 lod) { mSimulateLOD = llclamp(lod, (S32)FLEXIBLE_OBJECT_MIN_SECTIONS, (S32)FLEXIBLE_OBJECT_MAX_SECTIONS); }
- void setGravity(F32 gravity) { mGravity = llclamp(gravity, FLEXIBLE_OBJECT_MIN_GRAVITY, FLEXIBLE_OBJECT_MAX_GRAVITY); }
- void setAirFriction(F32 friction) { mAirFriction = llclamp(friction, FLEXIBLE_OBJECT_MIN_AIR_FRICTION, FLEXIBLE_OBJECT_MAX_AIR_FRICTION); }
- void setWindSensitivity(F32 wind) { mWindSensitivity = llclamp(wind, FLEXIBLE_OBJECT_MIN_WIND_SENSITIVITY, FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY); }
- void setTension(F32 tension) { mTension = llclamp(tension, FLEXIBLE_OBJECT_MIN_TENSION, FLEXIBLE_OBJECT_MAX_TENSION); }
- void setUserForce(LLVector3 &force) { mUserForce = force; }
-
- S32 getSimulateLOD() const { return mSimulateLOD; }
- F32 getGravity() const { return mGravity; }
- F32 getAirFriction() const { return mAirFriction; }
- F32 getWindSensitivity() const { return mWindSensitivity; }
- F32 getTension() const { return mTension; }
- LLVector3 getUserForce() const { return mUserForce; }
-
- //------ the constructor for the structure ------------
- LLFlexibleObjectData();
- BOOL pack(LLDataPacker &dp) const;
- BOOL unpack(LLDataPacker &dp);
- bool operator==(const LLNetworkData& data) const;
- void copy(const LLNetworkData& data);
- LLSD asLLSD() const;
- operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
+ void setSimulateLOD(S32 lod) { mSimulateLOD = llclamp(lod, (S32)FLEXIBLE_OBJECT_MIN_SECTIONS, (S32)FLEXIBLE_OBJECT_MAX_SECTIONS); }
+ void setGravity(F32 gravity) { mGravity = llclamp(gravity, FLEXIBLE_OBJECT_MIN_GRAVITY, FLEXIBLE_OBJECT_MAX_GRAVITY); }
+ void setAirFriction(F32 friction) { mAirFriction = llclamp(friction, FLEXIBLE_OBJECT_MIN_AIR_FRICTION, FLEXIBLE_OBJECT_MAX_AIR_FRICTION); }
+ void setWindSensitivity(F32 wind) { mWindSensitivity = llclamp(wind, FLEXIBLE_OBJECT_MIN_WIND_SENSITIVITY, FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY); }
+ void setTension(F32 tension) { mTension = llclamp(tension, FLEXIBLE_OBJECT_MIN_TENSION, FLEXIBLE_OBJECT_MAX_TENSION); }
+ void setUserForce(LLVector3 &force) { mUserForce = force; }
+
+ S32 getSimulateLOD() const { return mSimulateLOD; }
+ F32 getGravity() const { return mGravity; }
+ F32 getAirFriction() const { return mAirFriction; }
+ F32 getWindSensitivity() const { return mWindSensitivity; }
+ F32 getTension() const { return mTension; }
+ LLVector3 getUserForce() const { return mUserForce; }
+
+ //------ the constructor for the structure ------------
+ LLFlexibleObjectData();
+ BOOL pack(LLDataPacker &dp) const;
+ BOOL unpack(LLDataPacker &dp);
+ bool operator==(const LLNetworkData& data) const;
+ void copy(const LLNetworkData& data);
+ LLSD asLLSD() const;
+ operator LLSD() const { return asLLSD(); }
+ bool fromLLSD(LLSD& sd);
};// end of attributes structure
@@ -305,68 +305,68 @@ public:
class LLSculptParams : public LLNetworkData
{
protected:
- LLUUID mSculptTexture;
- U8 mSculptType;
-
+ LLUUID mSculptTexture;
+ U8 mSculptType;
+
public:
- LLSculptParams();
- /*virtual*/ BOOL pack(LLDataPacker &dp) const;
- /*virtual*/ BOOL unpack(LLDataPacker &dp);
- /*virtual*/ bool operator==(const LLNetworkData& data) const;
- /*virtual*/ void copy(const LLNetworkData& data);
- LLSD asLLSD() const;
- operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
-
- void setSculptTexture(const LLUUID& texture_id, U8 sculpt_type);
- LLUUID getSculptTexture() const { return mSculptTexture; }
- U8 getSculptType() const { return mSculptType; }
+ LLSculptParams();
+ /*virtual*/ BOOL pack(LLDataPacker &dp) const;
+ /*virtual*/ BOOL unpack(LLDataPacker &dp);
+ /*virtual*/ bool operator==(const LLNetworkData& data) const;
+ /*virtual*/ void copy(const LLNetworkData& data);
+ LLSD asLLSD() const;
+ operator LLSD() const { return asLLSD(); }
+ bool fromLLSD(LLSD& sd);
+
+ void setSculptTexture(const LLUUID& texture_id, U8 sculpt_type);
+ LLUUID getSculptTexture() const { return mSculptTexture; }
+ U8 getSculptType() const { return mSculptType; }
};
class LLLightImageParams : public LLNetworkData
{
protected:
- LLUUID mLightTexture;
- LLVector3 mParams;
-
+ LLUUID mLightTexture;
+ LLVector3 mParams;
+
public:
- LLLightImageParams();
- /*virtual*/ BOOL pack(LLDataPacker &dp) const;
- /*virtual*/ BOOL unpack(LLDataPacker &dp);
- /*virtual*/ bool operator==(const LLNetworkData& data) const;
- /*virtual*/ void copy(const LLNetworkData& data);
- LLSD asLLSD() const;
- operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
-
- void setLightTexture(const LLUUID& id) { mLightTexture = id; }
- LLUUID getLightTexture() const { return mLightTexture; }
- bool isLightSpotlight() const { return mLightTexture.notNull(); }
- void setParams(const LLVector3& params) { mParams = params; }
- LLVector3 getParams() const { return mParams; }
-
+ LLLightImageParams();
+ /*virtual*/ BOOL pack(LLDataPacker &dp) const;
+ /*virtual*/ BOOL unpack(LLDataPacker &dp);
+ /*virtual*/ bool operator==(const LLNetworkData& data) const;
+ /*virtual*/ void copy(const LLNetworkData& data);
+ LLSD asLLSD() const;
+ operator LLSD() const { return asLLSD(); }
+ bool fromLLSD(LLSD& sd);
+
+ void setLightTexture(const LLUUID& id) { mLightTexture = id; }
+ LLUUID getLightTexture() const { return mLightTexture; }
+ bool isLightSpotlight() const { return mLightTexture.notNull(); }
+ void setParams(const LLVector3& params) { mParams = params; }
+ LLVector3 getParams() const { return mParams; }
+
};
class LLExtendedMeshParams : public LLNetworkData
{
protected:
- U32 mFlags;
-
+ U32 mFlags;
+
public:
- static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0;
-
- LLExtendedMeshParams();
- /*virtual*/ BOOL pack(LLDataPacker &dp) const;
- /*virtual*/ BOOL unpack(LLDataPacker &dp);
- /*virtual*/ bool operator==(const LLNetworkData& data) const;
- /*virtual*/ void copy(const LLNetworkData& data);
- LLSD asLLSD() const;
- operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
-
- void setFlags(const U32& flags) { mFlags = flags; }
+ static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0;
+
+ LLExtendedMeshParams();
+ /*virtual*/ BOOL pack(LLDataPacker &dp) const;
+ /*virtual*/ BOOL unpack(LLDataPacker &dp);
+ /*virtual*/ bool operator==(const LLNetworkData& data) const;
+ /*virtual*/ void copy(const LLNetworkData& data);
+ LLSD asLLSD() const;
+ operator LLSD() const { return asLLSD(); }
+ bool fromLLSD(LLSD& sd);
+
+ void setFlags(const U32& flags) { mFlags = flags; }
U32 getFlags() const { return mFlags; }
-
+
};
class LLRenderMaterialParams : public LLNetworkData
@@ -385,7 +385,7 @@ public:
BOOL unpack(LLDataPacker& dp) override;
bool operator==(const LLNetworkData& data) const override;
void copy(const LLNetworkData& data) override;
-
+
void setMaterial(U8 te_idx, const LLUUID& id);
const LLUUID& getMaterial(U8 te_idx) const;
@@ -395,249 +395,249 @@ public:
// 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;
+// BOOL packTEMessage(LLDataPacker &dp) const;
// more obvious. This should be refactored to remove the duplication, at which
// point we can fix the names as well.
// - Vir
struct LLTEContents
{
- static const U32 MAX_TES = 45;
+ static const U32 MAX_TES = 45;
LLUUID image_data[MAX_TES];
LLColor4U colors[MAX_TES];
- F32 scale_s[MAX_TES];
- F32 scale_t[MAX_TES];
- S16 offset_s[MAX_TES];
- S16 offset_t[MAX_TES];
- S16 image_rot[MAX_TES];
- U8 bump[MAX_TES];
- U8 media_flags[MAX_TES];
+ F32 scale_s[MAX_TES];
+ F32 scale_t[MAX_TES];
+ S16 offset_s[MAX_TES];
+ S16 offset_t[MAX_TES];
+ S16 image_rot[MAX_TES];
+ U8 bump[MAX_TES];
+ U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
- LLMaterialID material_ids[MAX_TES];
+ LLMaterialID material_ids[MAX_TES];
- static const U32 MAX_TE_BUFFER = 4096;
- U8 packed_buffer[MAX_TE_BUFFER];
+ static const U32 MAX_TE_BUFFER = 4096;
+ U8 packed_buffer[MAX_TE_BUFFER];
- U32 size;
- U32 face_count;
+ U32 size;
+ U32 face_count;
};
class LLPrimitive : public LLXform
{
public:
- // HACK for removing LLPrimitive's dependency on gVolumeMgr global.
- // If a different LLVolumeManager is instantiated and set early enough
- // then the LLPrimitive class will use it instead of gVolumeMgr.
- static LLVolumeMgr* getVolumeManager() { return sVolumeManager; }
- static void setVolumeManager( LLVolumeMgr* volume_manager);
- static bool cleanupVolumeManager();
-
- // these flags influence how the RigidBody representation is built
- static const U32 PRIM_FLAG_PHANTOM = 0x1 << 0;
- static const U32 PRIM_FLAG_VOLUME_DETECT = 0x1 << 1;
- static const U32 PRIM_FLAG_DYNAMIC = 0x1 << 2;
- static const U32 PRIM_FLAG_AVATAR = 0x1 << 3;
- static const U32 PRIM_FLAG_SCULPT = 0x1 << 4;
- // not used yet, but soon
- static const U32 PRIM_FLAG_COLLISION_CALLBACK = 0x1 << 5;
- static const U32 PRIM_FLAG_CONVEX = 0x1 << 6;
- static const U32 PRIM_FLAG_DEFAULT_VOLUME = 0x1 << 7;
- static const U32 PRIM_FLAG_SITTING = 0x1 << 8;
- static const U32 PRIM_FLAG_SITTING_ON_GROUND = 0x1 << 9; // Set along with PRIM_FLAG_SITTING
-
- LLPrimitive();
- virtual ~LLPrimitive();
-
- void clearTextureList();
-
- static LLPrimitive *createPrimitive(LLPCode p_code);
- void init_primitive(LLPCode p_code);
-
- void setPCode(const LLPCode pcode);
- const LLVolume *getVolumeConst() const { return mVolumep; } // HACK for Windoze confusion about ostream operator in LLVolume
- LLVolume *getVolume() const { return mVolumep; }
- virtual BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
-
- // Modify texture entry properties
- inline BOOL validTE(const U8 te_num) const;
- LLTextureEntry* getTE(const U8 te_num) const;
-
- virtual void setNumTEs(const U8 num_tes);
- virtual void setAllTESelected(bool sel);
- virtual void setAllTETextures(const LLUUID &tex_id);
- virtual void setTE(const U8 index, const LLTextureEntry& te);
- virtual S32 setTEColor(const U8 te, const LLColor4 &color);
- virtual S32 setTEColor(const U8 te, const LLColor3 &color);
- virtual S32 setTEAlpha(const U8 te, const F32 alpha);
- virtual S32 setTETexture(const U8 te, const LLUUID &tex_id);
- virtual S32 setTEScale (const U8 te, const F32 s, const F32 t);
- virtual S32 setTEScaleS(const U8 te, const F32 s);
- virtual S32 setTEScaleT(const U8 te, const F32 t);
- virtual S32 setTEOffset (const U8 te, const F32 s, const F32 t);
- virtual S32 setTEOffsetS(const U8 te, const F32 s);
- virtual S32 setTEOffsetT(const U8 te, const F32 t);
- virtual S32 setTERotation(const U8 te, const F32 r);
- virtual S32 setTEBumpShinyFullbright(const U8 te, const U8 bump);
- virtual S32 setTEBumpShiny(const U8 te, const U8 bump);
- virtual S32 setTEMediaTexGen(const U8 te, const U8 media);
- virtual S32 setTEBumpmap(const U8 te, const U8 bump);
- virtual S32 setTETexGen(const U8 te, const U8 texgen);
- virtual S32 setTEShiny(const U8 te, const U8 shiny);
- virtual S32 setTEFullbright(const U8 te, const U8 fullbright);
- virtual S32 setTEMediaFlags(const U8 te, const U8 flags);
- virtual S32 setTEGlow(const U8 te, const F32 glow);
- virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
+ // HACK for removing LLPrimitive's dependency on gVolumeMgr global.
+ // If a different LLVolumeManager is instantiated and set early enough
+ // then the LLPrimitive class will use it instead of gVolumeMgr.
+ static LLVolumeMgr* getVolumeManager() { return sVolumeManager; }
+ static void setVolumeManager( LLVolumeMgr* volume_manager);
+ static bool cleanupVolumeManager();
+
+ // these flags influence how the RigidBody representation is built
+ static const U32 PRIM_FLAG_PHANTOM = 0x1 << 0;
+ static const U32 PRIM_FLAG_VOLUME_DETECT = 0x1 << 1;
+ static const U32 PRIM_FLAG_DYNAMIC = 0x1 << 2;
+ static const U32 PRIM_FLAG_AVATAR = 0x1 << 3;
+ static const U32 PRIM_FLAG_SCULPT = 0x1 << 4;
+ // not used yet, but soon
+ static const U32 PRIM_FLAG_COLLISION_CALLBACK = 0x1 << 5;
+ static const U32 PRIM_FLAG_CONVEX = 0x1 << 6;
+ static const U32 PRIM_FLAG_DEFAULT_VOLUME = 0x1 << 7;
+ static const U32 PRIM_FLAG_SITTING = 0x1 << 8;
+ static const U32 PRIM_FLAG_SITTING_ON_GROUND = 0x1 << 9; // Set along with PRIM_FLAG_SITTING
+
+ LLPrimitive();
+ virtual ~LLPrimitive();
+
+ void clearTextureList();
+
+ static LLPrimitive *createPrimitive(LLPCode p_code);
+ void init_primitive(LLPCode p_code);
+
+ void setPCode(const LLPCode pcode);
+ const LLVolume *getVolumeConst() const { return mVolumep; } // HACK for Windoze confusion about ostream operator in LLVolume
+ LLVolume *getVolume() const { return mVolumep; }
+ virtual BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
+
+ // Modify texture entry properties
+ inline BOOL validTE(const U8 te_num) const;
+ LLTextureEntry* getTE(const U8 te_num) const;
+
+ virtual void setNumTEs(const U8 num_tes);
+ virtual void setAllTESelected(bool sel);
+ virtual void setAllTETextures(const LLUUID &tex_id);
+ virtual void setTE(const U8 index, const LLTextureEntry& te);
+ virtual S32 setTEColor(const U8 te, const LLColor4 &color);
+ virtual S32 setTEColor(const U8 te, const LLColor3 &color);
+ virtual S32 setTEAlpha(const U8 te, const F32 alpha);
+ virtual S32 setTETexture(const U8 te, const LLUUID &tex_id);
+ virtual S32 setTEScale (const U8 te, const F32 s, const F32 t);
+ virtual S32 setTEScaleS(const U8 te, const F32 s);
+ virtual S32 setTEScaleT(const U8 te, const F32 t);
+ virtual S32 setTEOffset (const U8 te, const F32 s, const F32 t);
+ virtual S32 setTEOffsetS(const U8 te, const F32 s);
+ virtual S32 setTEOffsetT(const U8 te, const F32 t);
+ virtual S32 setTERotation(const U8 te, const F32 r);
+ virtual S32 setTEBumpShinyFullbright(const U8 te, const U8 bump);
+ virtual S32 setTEBumpShiny(const U8 te, const U8 bump);
+ virtual S32 setTEMediaTexGen(const U8 te, const U8 media);
+ virtual S32 setTEBumpmap(const U8 te, const U8 bump);
+ virtual S32 setTETexGen(const U8 te, const U8 texgen);
+ virtual S32 setTEShiny(const U8 te, const U8 shiny);
+ virtual S32 setTEFullbright(const U8 te, const U8 fullbright);
+ virtual S32 setTEMediaFlags(const U8 te, const U8 flags);
+ virtual S32 setTEGlow(const U8 te, const F32 glow);
+ virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
- virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
- virtual void setTESelected(const U8 te, bool sel);
-
- LLMaterialPtr getTEMaterialParams(const U8 index);
-
- void copyTEs(const LLPrimitive *primitive);
- S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
- BOOL packTEMessage(LLMessageSystem *mesgsys) const;
- BOOL packTEMessage(LLDataPacker &dp) const;
- S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks
- BOOL unpackTEMessage(LLDataPacker &dp);
- S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec);
- S32 applyParsedTEMessage(LLTEContents& tec);
-
+ virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
+ virtual void setTESelected(const U8 te, bool sel);
+
+ LLMaterialPtr getTEMaterialParams(const U8 index);
+
+ void copyTEs(const LLPrimitive *primitive);
+ S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
+ BOOL packTEMessage(LLMessageSystem *mesgsys) const;
+ BOOL packTEMessage(LLDataPacker &dp) const;
+ S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks
+ BOOL unpackTEMessage(LLDataPacker &dp);
+ S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec);
+ S32 applyParsedTEMessage(LLTEContents& tec);
+
#ifdef CHECK_FOR_FINITE
- inline void setPosition(const LLVector3& pos);
- inline void setPosition(const F32 x, const F32 y, const F32 z);
- inline void addPosition(const LLVector3& pos);
-
- inline void setAngularVelocity(const LLVector3& avel);
- inline void setAngularVelocity(const F32 x, const F32 y, const F32 z);
- inline void setVelocity(const LLVector3& vel);
- inline void setVelocity(const F32 x, const F32 y, const F32 z);
- inline void setVelocityX(const F32 x);
- inline void setVelocityY(const F32 y);
- inline void setVelocityZ(const F32 z);
- inline void addVelocity(const LLVector3& vel);
- inline void setAcceleration(const LLVector3& accel);
- inline void setAcceleration(const F32 x, const F32 y, const F32 z);
+ inline void setPosition(const LLVector3& pos);
+ inline void setPosition(const F32 x, const F32 y, const F32 z);
+ inline void addPosition(const LLVector3& pos);
+
+ inline void setAngularVelocity(const LLVector3& avel);
+ inline void setAngularVelocity(const F32 x, const F32 y, const F32 z);
+ inline void setVelocity(const LLVector3& vel);
+ inline void setVelocity(const F32 x, const F32 y, const F32 z);
+ inline void setVelocityX(const F32 x);
+ inline void setVelocityY(const F32 y);
+ inline void setVelocityZ(const F32 z);
+ inline void addVelocity(const LLVector3& vel);
+ inline void setAcceleration(const LLVector3& accel);
+ inline void setAcceleration(const F32 x, const F32 y, const F32 z);
#else
- // Don't override the base LLXForm operators.
- // Special case for setPosition. If not check-for-finite, fall through to LLXform method.
- // void setPosition(F32 x, F32 y, F32 z)
- // void setPosition(LLVector3)
-
- void setAngularVelocity(const LLVector3& avel) { mAngularVelocity = avel; }
- void setAngularVelocity(const F32 x, const F32 y, const F32 z) { mAngularVelocity.setVec(x,y,z); }
- void setVelocity(const LLVector3& vel) { mVelocity = vel; }
- void setVelocity(const F32 x, const F32 y, const F32 z) { mVelocity.setVec(x,y,z); }
- void setVelocityX(const F32 x) { mVelocity.mV[VX] = x; }
- void setVelocityY(const F32 y) { mVelocity.mV[VY] = y; }
- void setVelocityZ(const F32 z) { mVelocity.mV[VZ] = z; }
- void addVelocity(const LLVector3& vel) { mVelocity += vel; }
- void setAcceleration(const LLVector3& accel) { mAcceleration = accel; }
- void setAcceleration(const F32 x, const F32 y, const F32 z) { mAcceleration.setVec(x,y,z); }
+ // Don't override the base LLXForm operators.
+ // Special case for setPosition. If not check-for-finite, fall through to LLXform method.
+ // void setPosition(F32 x, F32 y, F32 z)
+ // void setPosition(LLVector3)
+
+ void setAngularVelocity(const LLVector3& avel) { mAngularVelocity = avel; }
+ void setAngularVelocity(const F32 x, const F32 y, const F32 z) { mAngularVelocity.setVec(x,y,z); }
+ void setVelocity(const LLVector3& vel) { mVelocity = vel; }
+ void setVelocity(const F32 x, const F32 y, const F32 z) { mVelocity.setVec(x,y,z); }
+ void setVelocityX(const F32 x) { mVelocity.mV[VX] = x; }
+ void setVelocityY(const F32 y) { mVelocity.mV[VY] = y; }
+ void setVelocityZ(const F32 z) { mVelocity.mV[VZ] = z; }
+ void addVelocity(const LLVector3& vel) { mVelocity += vel; }
+ void setAcceleration(const LLVector3& accel) { mAcceleration = accel; }
+ void setAcceleration(const F32 x, const F32 y, const F32 z) { mAcceleration.setVec(x,y,z); }
#endif
-
- LLPCode getPCode() const { return mPrimitiveCode; }
- std::string getPCodeString() const { return pCodeToString(mPrimitiveCode); }
- const LLVector3& getAngularVelocity() const { return mAngularVelocity; }
- const LLVector3& getVelocity() const { return mVelocity; }
- const LLVector3& getAcceleration() const { return mAcceleration; }
- U8 getNumTEs() const { return mTextureList.size(); }
- U8 getExpectedNumTEs() const;
-
- U8 getMaterial() const { return mMaterial; }
-
- void setVolumeType(const U8 code);
- U8 getVolumeType();
-
- // clears existing textures
- // copies the contents of other_list into mEntryList
- void copyTextureList(const LLPrimTextureList& other_list);
-
- // clears existing textures
- // takes the contents of other_list and clears other_list
- void takeTextureList(LLPrimTextureList& other_list);
-
- inline BOOL isAvatar() const;
- inline BOOL isSittingAvatar() const;
- inline BOOL isSittingAvatarOnGround() const;
- inline bool hasBumpmap() const { return mNumBumpmapTEs > 0;}
-
- void setFlags(U32 flags) { mMiscFlags = flags; }
- void addFlags(U32 flags) { mMiscFlags |= flags; }
- void removeFlags(U32 flags) { mMiscFlags &= ~flags; }
- U32 getFlags() const { return mMiscFlags; }
-
- static std::string pCodeToString(const LLPCode pcode);
- static LLPCode legacyToPCode(const U8 legacy);
- static U8 pCodeToLegacy(const LLPCode pcode);
- static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis);
+
+ LLPCode getPCode() const { return mPrimitiveCode; }
+ std::string getPCodeString() const { return pCodeToString(mPrimitiveCode); }
+ const LLVector3& getAngularVelocity() const { return mAngularVelocity; }
+ const LLVector3& getVelocity() const { return mVelocity; }
+ const LLVector3& getAcceleration() const { return mAcceleration; }
+ U8 getNumTEs() const { return mTextureList.size(); }
+ U8 getExpectedNumTEs() const;
+
+ U8 getMaterial() const { return mMaterial; }
+
+ void setVolumeType(const U8 code);
+ U8 getVolumeType();
+
+ // clears existing textures
+ // copies the contents of other_list into mEntryList
+ void copyTextureList(const LLPrimTextureList& other_list);
+
+ // clears existing textures
+ // takes the contents of other_list and clears other_list
+ void takeTextureList(LLPrimTextureList& other_list);
+
+ inline BOOL isAvatar() const;
+ inline BOOL isSittingAvatar() const;
+ inline BOOL isSittingAvatarOnGround() const;
+ inline bool hasBumpmap() const { return mNumBumpmapTEs > 0;}
+
+ void setFlags(U32 flags) { mMiscFlags = flags; }
+ void addFlags(U32 flags) { mMiscFlags |= flags; }
+ void removeFlags(U32 flags) { mMiscFlags &= ~flags; }
+ U32 getFlags() const { return mMiscFlags; }
+
+ static std::string pCodeToString(const LLPCode pcode);
+ static LLPCode legacyToPCode(const U8 legacy);
+ static U8 pCodeToLegacy(const LLPCode pcode);
+ static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis);
BOOL hasRenderMaterialParams() const;
-
- inline static BOOL isPrimitive(const LLPCode pcode);
- inline static BOOL isApp(const LLPCode pcode);
+
+ inline static BOOL isPrimitive(const LLPCode pcode);
+ inline static BOOL isApp(const LLPCode pcode);
private:
- void updateNumBumpmap(const U8 index, const U8 bump);
+ void updateNumBumpmap(const U8 index, const U8 bump);
protected:
- LLPCode mPrimitiveCode; // Primitive code
- LLVector3 mVelocity; // how fast are we moving?
- LLVector3 mAcceleration; // are we under constant acceleration?
- LLVector3 mAngularVelocity; // angular velocity
- LLPointer<LLVolume> mVolumep;
- LLPrimTextureList mTextureList; // list of texture GUIDs, scales, offsets
- U8 mMaterial; // Material code
- U8 mNumTEs; // # of faces on the primitve
- U8 mNumBumpmapTEs; // number of bumpmap TEs.
- U32 mMiscFlags; // home for misc bools
+ LLPCode mPrimitiveCode; // Primitive code
+ LLVector3 mVelocity; // how fast are we moving?
+ LLVector3 mAcceleration; // are we under constant acceleration?
+ LLVector3 mAngularVelocity; // angular velocity
+ LLPointer<LLVolume> mVolumep;
+ LLPrimTextureList mTextureList; // list of texture GUIDs, scales, offsets
+ U8 mMaterial; // Material code
+ U8 mNumTEs; // # of faces on the primitve
+ U8 mNumBumpmapTEs; // number of bumpmap TEs.
+ U32 mMiscFlags; // home for misc bools
public:
- static LLVolumeMgr* sVolumeManager;
+ static LLVolumeMgr* sVolumeManager;
- enum
- {
- NO_LOD = -1
- };
+ enum
+ {
+ NO_LOD = -1
+ };
};
inline BOOL LLPrimitive::isAvatar() const
{
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? TRUE : FALSE;
+ return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? TRUE : FALSE;
}
inline BOOL LLPrimitive::isSittingAvatar() const
{
- // this is only used server-side
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
- && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? TRUE : FALSE;
+ // this is only used server-side
+ return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
+ && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? TRUE : FALSE;
}
inline BOOL LLPrimitive::isSittingAvatarOnGround() const
{
- // this is only used server-side
- return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
- && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? TRUE : FALSE;
+ // this is only used server-side
+ return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode
+ && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? TRUE : FALSE;
}
// static
inline BOOL LLPrimitive::isPrimitive(const LLPCode pcode)
{
- LLPCode base_type = pcode & LL_PCODE_BASE_MASK;
+ LLPCode base_type = pcode & LL_PCODE_BASE_MASK;
- if (base_type && (base_type < LL_PCODE_APP))
- {
- return TRUE;
- }
- return FALSE;
+ if (base_type && (base_type < LL_PCODE_APP))
+ {
+ return TRUE;
+ }
+ return FALSE;
}
// static
inline BOOL LLPrimitive::isApp(const LLPCode pcode)
{
- LLPCode base_type = pcode & LL_PCODE_BASE_MASK;
+ LLPCode base_type = pcode & LL_PCODE_BASE_MASK;
- return (base_type == LL_PCODE_APP);
+ return (base_type == LL_PCODE_APP);
}
@@ -645,153 +645,153 @@ inline BOOL LLPrimitive::isApp(const LLPCode pcode)
// Special case for setPosition. If not check-for-finite, fall through to LLXform method.
void LLPrimitive::setPosition(const F32 x, const F32 y, const F32 z)
{
- if (llfinite(x) && llfinite(y) && llfinite(z))
- {
- LLXform::setPosition(x, y, z);
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+ if (llfinite(x) && llfinite(y) && llfinite(z))
+ {
+ LLXform::setPosition(x, y, z);
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
// Special case for setPosition. If not check-for-finite, fall through to LLXform method.
void LLPrimitive::setPosition(const LLVector3& pos)
{
- if (pos.isFinite())
- {
- LLXform::setPosition(pos);
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+ if (pos.isFinite())
+ {
+ LLXform::setPosition(pos);
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
void LLPrimitive::setAngularVelocity(const LLVector3& avel)
-{
- if (avel.isFinite())
- {
- mAngularVelocity = avel;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
- }
+{
+ if (avel.isFinite())
+ {
+ mAngularVelocity = avel;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
+ }
}
-void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z)
-{
- if (llfinite(x) && llfinite(y) && llfinite(z))
- {
- mAngularVelocity.setVec(x,y,z);
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
- }
+void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z)
+{
+ if (llfinite(x) && llfinite(y) && llfinite(z))
+ {
+ mAngularVelocity.setVec(x,y,z);
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
+ }
}
-void LLPrimitive::setVelocity(const LLVector3& vel)
-{
- if (vel.isFinite())
- {
- mVelocity = vel;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+void LLPrimitive::setVelocity(const LLVector3& vel)
+{
+ if (vel.isFinite())
+ {
+ mVelocity = vel;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
-void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z)
-{
- if (llfinite(x) && llfinite(y) && llfinite(z))
- {
- mVelocity.setVec(x,y,z);
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z)
+{
+ if (llfinite(x) && llfinite(y) && llfinite(z))
+ {
+ mVelocity.setVec(x,y,z);
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
-void LLPrimitive::setVelocityX(const F32 x)
-{
- if (llfinite(x))
- {
- mVelocity.mV[VX] = x;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setVelocityX" << LL_ENDL;
- }
+void LLPrimitive::setVelocityX(const F32 x)
+{
+ if (llfinite(x))
+ {
+ mVelocity.mV[VX] = x;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setVelocityX" << LL_ENDL;
+ }
}
-void LLPrimitive::setVelocityY(const F32 y)
-{
- if (llfinite(y))
- {
- mVelocity.mV[VY] = y;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setVelocityY" << LL_ENDL;
- }
+void LLPrimitive::setVelocityY(const F32 y)
+{
+ if (llfinite(y))
+ {
+ mVelocity.mV[VY] = y;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setVelocityY" << LL_ENDL;
+ }
}
-void LLPrimitive::setVelocityZ(const F32 z)
-{
- if (llfinite(z))
- {
- mVelocity.mV[VZ] = z;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setVelocityZ" << LL_ENDL;
- }
+void LLPrimitive::setVelocityZ(const F32 z)
+{
+ if (llfinite(z))
+ {
+ mVelocity.mV[VZ] = z;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setVelocityZ" << LL_ENDL;
+ }
}
-void LLPrimitive::addVelocity(const LLVector3& vel)
-{
- if (vel.isFinite())
- {
- mVelocity += vel;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::addVelocity" << LL_ENDL;
- }
+void LLPrimitive::addVelocity(const LLVector3& vel)
+{
+ if (vel.isFinite())
+ {
+ mVelocity += vel;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::addVelocity" << LL_ENDL;
+ }
}
-void LLPrimitive::setAcceleration(const LLVector3& accel)
-{
- if (accel.isFinite())
- {
- mAcceleration = accel;
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+void LLPrimitive::setAcceleration(const LLVector3& accel)
+{
+ if (accel.isFinite())
+ {
+ mAcceleration = accel;
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
-void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z)
-{
- if (llfinite(x) && llfinite(y) && llfinite(z))
- {
- mAcceleration.setVec(x,y,z);
- }
- else
- {
- LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- }
+void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z)
+{
+ if (llfinite(x) && llfinite(y) && llfinite(z))
+ {
+ mAcceleration.setVec(x,y,z);
+ }
+ else
+ {
+ LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ }
}
#endif // CHECK_FOR_FINITE
inline BOOL LLPrimitive::validTE(const U8 te_num) const
{
- return (mNumTEs && te_num < mNumTEs);
+ return (mNumTEs && te_num < mNumTEs);
}
#endif
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index ee2a4c769a..2ed8f8c044 100644
--- a/indra/llprimitive/lltextureentry.cpp
+++ b/indra/llprimitive/lltextureentry.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureentry.cpp
* @brief LLTextureEntry base class
*
* $LicenseInfo:firstyear=2001&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$
*/
@@ -52,10 +52,10 @@ const LLTextureEntry LLTextureEntry::null;
static const std::string MEDIA_VERSION_STRING_PREFIX = "x-mv:";
-// static
+// static
LLTextureEntry* LLTextureEntry::newTextureEntry()
{
- return new LLTextureEntry();
+ return new LLTextureEntry();
}
//===============================================================
@@ -64,7 +64,7 @@ LLTextureEntry::LLTextureEntry()
, mSelected(false)
, mMaterialUpdatePending(false)
{
- init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
+ init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
@@ -72,7 +72,7 @@ LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
, mSelected(false)
, mMaterialUpdatePending(false)
{
- init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
+ init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
@@ -85,30 +85,30 @@ LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
{
- if (this != &rhs)
- {
- mID = rhs.mID;
- mScaleS = rhs.mScaleS;
- mScaleT = rhs.mScaleT;
- mOffsetS = rhs.mOffsetS;
- mOffsetT = rhs.mOffsetT;
- mRotation = rhs.mRotation;
- mColor = rhs.mColor;
- mBump = rhs.mBump;
- mMediaFlags = rhs.mMediaFlags;
- mGlow = rhs.mGlow;
- mMaterialID = rhs.mMaterialID;
- mMaterial = rhs.mMaterial;
- if (mMediaEntry != NULL) {
- delete mMediaEntry;
- }
- if (rhs.mMediaEntry != NULL) {
- // Make a copy
- mMediaEntry = new LLMediaEntry(*rhs.mMediaEntry);
- }
- else {
- mMediaEntry = NULL;
- }
+ if (this != &rhs)
+ {
+ mID = rhs.mID;
+ mScaleS = rhs.mScaleS;
+ mScaleT = rhs.mScaleT;
+ mOffsetS = rhs.mOffsetS;
+ mOffsetT = rhs.mOffsetT;
+ mRotation = rhs.mRotation;
+ mColor = rhs.mColor;
+ mBump = rhs.mBump;
+ mMediaFlags = rhs.mMediaFlags;
+ mGlow = rhs.mGlow;
+ mMaterialID = rhs.mMaterialID;
+ mMaterial = rhs.mMaterial;
+ if (mMediaEntry != NULL) {
+ delete mMediaEntry;
+ }
+ if (rhs.mMediaEntry != NULL) {
+ // Make a copy
+ mMediaEntry = new LLMediaEntry(*rhs.mMediaEntry);
+ }
+ else {
+ mMediaEntry = NULL;
+ }
mMaterialID = rhs.mMaterialID;
@@ -121,7 +121,7 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
{
mGLTFMaterial->addTextureEntry(this);
}
-
+
if (rhs.mGLTFMaterialOverrides.notNull())
{
mGLTFMaterialOverrides = new LLGLTFMaterial(*rhs.mGLTFMaterialOverrides);
@@ -130,39 +130,39 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
{
mGLTFMaterialOverrides = nullptr;
}
- }
+ }
- return *this;
+ return *this;
}
void LLTextureEntry::init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump)
{
- setID(tex_id);
+ setID(tex_id);
- mScaleS = scale_s;
- mScaleT = scale_t;
- mOffsetS = offset_s;
- mOffsetT = offset_t;
- mRotation = rotation;
- mBump = bump;
- mMediaFlags = 0x0;
+ mScaleS = scale_s;
+ mScaleT = scale_t;
+ mOffsetS = offset_s;
+ mOffsetT = offset_t;
+ mRotation = rotation;
+ mBump = bump;
+ mMediaFlags = 0x0;
mGlow = 0;
- mMaterialID.clear();
-
- setColor(LLColor4(1.f, 1.f, 1.f, 1.f));
- if (mMediaEntry != NULL) {
- delete mMediaEntry;
- }
- mMediaEntry = NULL;
+ mMaterialID.clear();
+
+ setColor(LLColor4(1.f, 1.f, 1.f, 1.f));
+ if (mMediaEntry != NULL) {
+ delete mMediaEntry;
+ }
+ mMediaEntry = NULL;
}
LLTextureEntry::~LLTextureEntry()
{
- if(mMediaEntry)
- {
- delete mMediaEntry;
- mMediaEntry = NULL;
- }
+ if(mMediaEntry)
+ {
+ delete mMediaEntry;
+ mMediaEntry = NULL;
+ }
if (mGLTFMaterial)
{
@@ -173,64 +173,64 @@ LLTextureEntry::~LLTextureEntry()
bool LLTextureEntry::operator!=(const LLTextureEntry &rhs) const
{
- if (mID != rhs.mID) return(true);
- if (mScaleS != rhs.mScaleS) return(true);
- if (mScaleT != rhs.mScaleT) return(true);
- if (mOffsetS != rhs.mOffsetS) return(true);
- if (mOffsetT != rhs.mOffsetT) return(true);
- if (mRotation != rhs.mRotation) return(true);
- if (mColor != rhs.mColor) return (true);
- if (mBump != rhs.mBump) return (true);
- if (mMediaFlags != rhs.mMediaFlags) return (true);
- if (mGlow != rhs.mGlow) return (true);
- if (mMaterialID != rhs.mMaterialID) return (true);
- return(false);
+ if (mID != rhs.mID) return(true);
+ if (mScaleS != rhs.mScaleS) return(true);
+ if (mScaleT != rhs.mScaleT) return(true);
+ if (mOffsetS != rhs.mOffsetS) return(true);
+ if (mOffsetT != rhs.mOffsetT) return(true);
+ if (mRotation != rhs.mRotation) return(true);
+ if (mColor != rhs.mColor) return (true);
+ if (mBump != rhs.mBump) return (true);
+ if (mMediaFlags != rhs.mMediaFlags) return (true);
+ if (mGlow != rhs.mGlow) return (true);
+ if (mMaterialID != rhs.mMaterialID) return (true);
+ return(false);
}
bool LLTextureEntry::operator==(const LLTextureEntry &rhs) const
{
- if (mID != rhs.mID) return(false);
- if (mScaleS != rhs.mScaleS) return(false);
- if (mScaleT != rhs.mScaleT) return(false);
- if (mOffsetS != rhs.mOffsetS) return(false);
- if (mOffsetT != rhs.mOffsetT) return(false);
- if (mRotation != rhs.mRotation) return(false);
- if (mColor != rhs.mColor) return (false);
- if (mBump != rhs.mBump) return (false);
- if (mMediaFlags != rhs.mMediaFlags) return false;
- if (mGlow != rhs.mGlow) return false;
- if (mMaterialID != rhs.mMaterialID) return (false);
- return(true);
+ if (mID != rhs.mID) return(false);
+ if (mScaleS != rhs.mScaleS) return(false);
+ if (mScaleT != rhs.mScaleT) return(false);
+ if (mOffsetS != rhs.mOffsetS) return(false);
+ if (mOffsetT != rhs.mOffsetT) return(false);
+ if (mRotation != rhs.mRotation) return(false);
+ if (mColor != rhs.mColor) return (false);
+ if (mBump != rhs.mBump) return (false);
+ if (mMediaFlags != rhs.mMediaFlags) return false;
+ if (mGlow != rhs.mGlow) return false;
+ if (mMaterialID != rhs.mMaterialID) return (false);
+ return(true);
}
LLSD LLTextureEntry::asLLSD() const
{
- LLSD sd;
- asLLSD(sd);
- return sd;
+ LLSD sd;
+ asLLSD(sd);
+ return sd;
}
void LLTextureEntry::asLLSD(LLSD& sd) const
{
LL_PROFILE_ZONE_SCOPED;
- sd["imageid"] = mID;
- sd["colors"] = ll_sd_from_color4(mColor);
- sd["scales"] = mScaleS;
- sd["scalet"] = mScaleT;
- sd["offsets"] = mOffsetS;
- sd["offsett"] = mOffsetT;
- sd["imagerot"] = mRotation;
- sd["bump"] = getBumpShiny();
- sd["fullbright"] = getFullbright();
- sd["media_flags"] = mMediaFlags;
- if (hasMedia()) {
- LLSD mediaData;
+ sd["imageid"] = mID;
+ sd["colors"] = ll_sd_from_color4(mColor);
+ sd["scales"] = mScaleS;
+ sd["scalet"] = mScaleT;
+ sd["offsets"] = mOffsetS;
+ sd["offsett"] = mOffsetT;
+ sd["imagerot"] = mRotation;
+ sd["bump"] = getBumpShiny();
+ sd["fullbright"] = getFullbright();
+ sd["media_flags"] = mMediaFlags;
+ if (hasMedia()) {
+ LLSD mediaData;
if (NULL != getMediaData()) {
getMediaData()->asLLSD(mediaData);
}
- sd[TEXTURE_MEDIA_DATA_KEY] = mediaData;
- }
- sd["glow"] = mGlow;
+ sd[TEXTURE_MEDIA_DATA_KEY] = mediaData;
+ }
+ sd["glow"] = mGlow;
if (mGLTFMaterialOverrides.notNull())
{
@@ -241,65 +241,65 @@ void LLTextureEntry::asLLSD(LLSD& sd) const
bool LLTextureEntry::fromLLSD(const LLSD& sd)
{
LL_PROFILE_ZONE_SCOPED;
- const char *w, *x;
- w = "imageid";
- if (sd.has(w))
- {
- setID( sd[w] );
- } else goto fail;
- w = "colors";
- if (sd.has(w))
- {
- setColor( ll_color4_from_sd(sd["colors"]) );
- } else goto fail;
- w = "scales";
- x = "scalet";
- if (sd.has(w) && sd.has(x))
- {
- setScale( (F32)sd[w].asReal(), (F32)sd[x].asReal() );
- } else goto fail;
- w = "offsets";
- x = "offsett";
- if (sd.has(w) && sd.has(x))
- {
- setOffset( (F32)sd[w].asReal(), (F32)sd[x].asReal() );
- } else goto fail;
- w = "imagerot";
- if (sd.has(w))
- {
- setRotation( (F32)sd[w].asReal() );
- } else goto fail;
- w = "bump";
- if (sd.has(w))
- {
- setBumpShiny( sd[w].asInteger() );
- } else goto fail;
- w = "fullbright";
- if (sd.has(w))
- {
- setFullbright( sd[w].asInteger() );
- } else goto fail;
- w = "media_flags";
- if (sd.has(w))
- {
- setMediaTexGen( sd[w].asInteger() );
- } else goto fail;
- // If the "has media" flag doesn't match the fact that
- // media data exists, updateMediaData will "fix" it
- // by either clearing or setting the flag
- w = TEXTURE_MEDIA_DATA_KEY;
- if (hasMedia() != sd.has(w))
- {
- LL_WARNS() << "LLTextureEntry::fromLLSD: media_flags (" << hasMedia() <<
- ") does not match presence of media_data (" << sd.has(w) << "). Fixing." << LL_ENDL;
- }
- updateMediaData(sd[w]);
-
- w = "glow";
- if (sd.has(w))
- {
- setGlow((F32)sd[w].asReal() );
- }
+ const char *w, *x;
+ w = "imageid";
+ if (sd.has(w))
+ {
+ setID( sd[w] );
+ } else goto fail;
+ w = "colors";
+ if (sd.has(w))
+ {
+ setColor( ll_color4_from_sd(sd["colors"]) );
+ } else goto fail;
+ w = "scales";
+ x = "scalet";
+ if (sd.has(w) && sd.has(x))
+ {
+ setScale( (F32)sd[w].asReal(), (F32)sd[x].asReal() );
+ } else goto fail;
+ w = "offsets";
+ x = "offsett";
+ if (sd.has(w) && sd.has(x))
+ {
+ setOffset( (F32)sd[w].asReal(), (F32)sd[x].asReal() );
+ } else goto fail;
+ w = "imagerot";
+ if (sd.has(w))
+ {
+ setRotation( (F32)sd[w].asReal() );
+ } else goto fail;
+ w = "bump";
+ if (sd.has(w))
+ {
+ setBumpShiny( sd[w].asInteger() );
+ } else goto fail;
+ w = "fullbright";
+ if (sd.has(w))
+ {
+ setFullbright( sd[w].asInteger() );
+ } else goto fail;
+ w = "media_flags";
+ if (sd.has(w))
+ {
+ setMediaTexGen( sd[w].asInteger() );
+ } else goto fail;
+ // If the "has media" flag doesn't match the fact that
+ // media data exists, updateMediaData will "fix" it
+ // by either clearing or setting the flag
+ w = TEXTURE_MEDIA_DATA_KEY;
+ if (hasMedia() != sd.has(w))
+ {
+ LL_WARNS() << "LLTextureEntry::fromLLSD: media_flags (" << hasMedia() <<
+ ") does not match presence of media_data (" << sd.has(w) << "). Fixing." << LL_ENDL;
+ }
+ updateMediaData(sd[w]);
+
+ w = "glow";
+ if (sd.has(w))
+ {
+ setGlow((F32)sd[w].asReal() );
+ }
w = "gltf_override";
if (sd.has(w))
@@ -319,217 +319,217 @@ bool LLTextureEntry::fromLLSD(const LLSD& sd)
}
}
- return true;
+ return true;
fail:
- return false;
+ return false;
}
-// virtual
+// virtual
// override this method for each derived class
LLTextureEntry* LLTextureEntry::newBlank() const
{
- return new LLTextureEntry();
+ return new LLTextureEntry();
}
-// virtual
+// virtual
LLTextureEntry* LLTextureEntry::newCopy() const
{
- return new LLTextureEntry(*this);
+ return new LLTextureEntry(*this);
}
S32 LLTextureEntry::setID(const LLUUID &tex_id)
{
- if (mID != tex_id)
- {
- mID = tex_id;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ if (mID != tex_id)
+ {
+ mID = tex_id;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setScale(F32 s, F32 t)
{
- S32 retval = 0;
+ S32 retval = 0;
- if ( (mScaleS != s)
- ||(mScaleT != t))
- {
- mScaleS = s;
- mScaleT = t;
+ if ( (mScaleS != s)
+ ||(mScaleT != t))
+ {
+ mScaleS = s;
+ mScaleT = t;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setScaleS(F32 s)
{
- S32 retval = TEM_CHANGE_NONE;
- if (mScaleS != s)
- {
- mScaleS = s;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ S32 retval = TEM_CHANGE_NONE;
+ if (mScaleS != s)
+ {
+ mScaleS = s;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setScaleT(F32 t)
{
- S32 retval = TEM_CHANGE_NONE;
- if (mScaleT != t)
- {
- mScaleT = t;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ S32 retval = TEM_CHANGE_NONE;
+ if (mScaleT != t)
+ {
+ mScaleT = t;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setColor(const LLColor4 &color)
{
- if (mColor != color)
- {
- mColor = color;
- return TEM_CHANGE_COLOR;
- }
- return TEM_CHANGE_NONE;
+ if (mColor != color)
+ {
+ mColor = color;
+ return TEM_CHANGE_COLOR;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setColor(const LLColor3 &color)
{
- if (mColor != color)
- {
- // This preserves alpha.
- mColor.setVec(color);
- return TEM_CHANGE_COLOR;
- }
- return TEM_CHANGE_NONE;
+ if (mColor != color)
+ {
+ // This preserves alpha.
+ mColor.setVec(color);
+ return TEM_CHANGE_COLOR;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setAlpha(const F32 alpha)
{
- if (mColor.mV[VW] != alpha)
- {
- mColor.mV[VW] = alpha;
- return TEM_CHANGE_COLOR;
- }
- return TEM_CHANGE_NONE;
+ if (mColor.mV[VW] != alpha)
+ {
+ mColor.mV[VW] = alpha;
+ return TEM_CHANGE_COLOR;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setOffset(F32 s, F32 t)
{
- S32 retval = 0;
+ S32 retval = 0;
- if ( (mOffsetS != s)
- ||(mOffsetT != t))
- {
- mOffsetS = s;
- mOffsetT = t;
+ if ( (mOffsetS != s)
+ ||(mOffsetT != t))
+ {
+ mOffsetS = s;
+ mOffsetT = t;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setOffsetS(F32 s)
{
- S32 retval = 0;
- if (mOffsetS != s)
- {
- mOffsetS = s;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ S32 retval = 0;
+ if (mOffsetS != s)
+ {
+ mOffsetS = s;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setOffsetT(F32 t)
{
- S32 retval = 0;
- if (mOffsetT != t)
- {
- mOffsetT = t;
- retval = TEM_CHANGE_TEXTURE;
- }
- return retval;
+ S32 retval = 0;
+ if (mOffsetT != t)
+ {
+ mOffsetT = t;
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ return retval;
}
S32 LLTextureEntry::setRotation(F32 theta)
{
- if (mRotation != theta && llfinite(theta))
- {
- mRotation = theta;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ if (mRotation != theta && llfinite(theta))
+ {
+ mRotation = theta;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setBumpShinyFullbright(U8 bump)
{
- if (mBump != bump)
- {
- mBump = bump;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ if (mBump != bump)
+ {
+ mBump = bump;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setMediaTexGen(U8 media)
{
- S32 result = TEM_CHANGE_NONE;
- result |= setTexGen(media & TEM_TEX_GEN_MASK);
- result |= setMediaFlags(media & TEM_MEDIA_MASK);
- return result;
+ S32 result = TEM_CHANGE_NONE;
+ result |= setTexGen(media & TEM_TEX_GEN_MASK);
+ result |= setMediaFlags(media & TEM_MEDIA_MASK);
+ return result;
}
S32 LLTextureEntry::setBumpmap(U8 bump)
{
- bump &= TEM_BUMP_MASK;
- if (getBumpmap() != bump)
- {
- mBump &= ~TEM_BUMP_MASK;
- mBump |= bump;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ bump &= TEM_BUMP_MASK;
+ if (getBumpmap() != bump)
+ {
+ mBump &= ~TEM_BUMP_MASK;
+ mBump |= bump;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setFullbright(U8 fullbright)
{
- fullbright &= TEM_FULLBRIGHT_MASK;
- if (getFullbright() != fullbright)
- {
- mBump &= ~(TEM_FULLBRIGHT_MASK<<TEM_FULLBRIGHT_SHIFT);
- mBump |= fullbright << TEM_FULLBRIGHT_SHIFT;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ fullbright &= TEM_FULLBRIGHT_MASK;
+ if (getFullbright() != fullbright)
+ {
+ mBump &= ~(TEM_FULLBRIGHT_MASK<<TEM_FULLBRIGHT_SHIFT);
+ mBump |= fullbright << TEM_FULLBRIGHT_SHIFT;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setShiny(U8 shiny)
{
- shiny &= TEM_SHINY_MASK;
- if (getShiny() != shiny)
- {
- mBump &= ~(TEM_SHINY_MASK<<TEM_SHINY_SHIFT);
- mBump |= shiny << TEM_SHINY_SHIFT;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ shiny &= TEM_SHINY_MASK;
+ if (getShiny() != shiny)
+ {
+ mBump &= ~(TEM_SHINY_MASK<<TEM_SHINY_SHIFT);
+ mBump |= shiny << TEM_SHINY_SHIFT;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setBumpShiny(U8 bump_shiny)
{
- bump_shiny &= TEM_BUMP_SHINY_MASK;
- if (getBumpShiny() != bump_shiny)
- {
- mBump &= ~TEM_BUMP_SHINY_MASK;
- mBump |= bump_shiny;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ bump_shiny &= TEM_BUMP_SHINY_MASK;
+ if (getBumpShiny() != bump_shiny)
+ {
+ mBump &= ~TEM_BUMP_SHINY_MASK;
+ mBump |= bump_shiny;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
void LLTextureEntry::setGLTFMaterial(LLGLTFMaterial* material, bool local_origin)
-{
+{
if (material != getGLTFMaterial())
{
// assert on precondtion:
@@ -560,7 +560,7 @@ void LLTextureEntry::setGLTFMaterial(LLGLTFMaterial* material, bool local_origin
}
S32 LLTextureEntry::setGLTFMaterialOverride(LLGLTFMaterial* mat)
-{
+{
llassert(mat == nullptr || getGLTFMaterial() != nullptr); // if override is not null, base material must not be null
if (mat == mGLTFMaterialOverrides)
{
@@ -594,12 +594,12 @@ S32 LLTextureEntry::setBaseMaterial()
}
LLGLTFMaterial* LLTextureEntry::getGLTFRenderMaterial() const
-{
+{
if (mGLTFRenderMaterial.notNull())
{
return mGLTFRenderMaterial;
}
-
+
llassert(getGLTFMaterialOverride() == nullptr || getGLTFMaterialOverride()->isClearedForBaseMaterial());
return getGLTFMaterial();
}
@@ -616,77 +616,77 @@ S32 LLTextureEntry::setGLTFRenderMaterial(LLGLTFMaterial* mat)
S32 LLTextureEntry::setMediaFlags(U8 media_flags)
{
- media_flags &= TEM_MEDIA_MASK;
- if (getMediaFlags() != media_flags)
- {
- mMediaFlags &= ~TEM_MEDIA_MASK;
- mMediaFlags |= media_flags;
-
- // Special code for media handling
- if( hasMedia() && mMediaEntry == NULL)
- {
- mMediaEntry = new LLMediaEntry;
- }
+ media_flags &= TEM_MEDIA_MASK;
+ if (getMediaFlags() != media_flags)
+ {
+ mMediaFlags &= ~TEM_MEDIA_MASK;
+ mMediaFlags |= media_flags;
+
+ // Special code for media handling
+ if( hasMedia() && mMediaEntry == NULL)
+ {
+ mMediaEntry = new LLMediaEntry;
+ }
else if ( ! hasMedia() && mMediaEntry != NULL)
{
delete mMediaEntry;
mMediaEntry = NULL;
}
-
- return TEM_CHANGE_MEDIA;
- }
- return TEM_CHANGE_NONE;
+
+ return TEM_CHANGE_MEDIA;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setTexGen(U8 tex_gen)
{
- tex_gen &= TEM_TEX_GEN_MASK;
- if (getTexGen() != tex_gen)
- {
- mMediaFlags &= ~TEM_TEX_GEN_MASK;
- mMediaFlags |= tex_gen;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ tex_gen &= TEM_TEX_GEN_MASK;
+ if (getTexGen() != tex_gen)
+ {
+ mMediaFlags &= ~TEM_TEX_GEN_MASK;
+ mMediaFlags |= tex_gen;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setGlow(F32 glow)
{
- if (mGlow != glow)
- {
- mGlow = glow;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ if (mGlow != glow)
+ {
+ mGlow = glow;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID)
{
- if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) )
- {
- if (mSelected)
- {
- mMaterialUpdatePending = true;
- mMaterialID = pMaterialID;
- return TEM_CHANGE_TEXTURE;
- }
+ if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) )
+ {
+ if (mSelected)
+ {
+ mMaterialUpdatePending = true;
+ mMaterialID = pMaterialID;
+ return TEM_CHANGE_TEXTURE;
+ }
- mMaterialUpdatePending = false;
- mMaterialID = pMaterialID;
- return TEM_CHANGE_TEXTURE;
- }
- return TEM_CHANGE_NONE;
+ mMaterialUpdatePending = false;
+ mMaterialID = pMaterialID;
+ return TEM_CHANGE_TEXTURE;
+ }
+ return TEM_CHANGE_NONE;
}
S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
{
- if (mSelected)
- {
- mMaterialUpdatePending = true;
- }
- mMaterial = pMaterialParams;
-
- return TEM_CHANGE_TEXTURE;
+ if (mSelected)
+ {
+ mMaterialUpdatePending = true;
+ }
+ mMaterial = pMaterialParams;
+
+ return TEM_CHANGE_TEXTURE;
}
void LLTextureEntry::setMediaData(const LLMediaEntry &media_entry)
@@ -701,23 +701,23 @@ void LLTextureEntry::setMediaData(const LLMediaEntry &media_entry)
bool LLTextureEntry::updateMediaData(const LLSD& media_data)
{
- if (media_data.isUndefined())
- {
- // clear the media data
+ if (media_data.isUndefined())
+ {
+ // clear the media data
clearMediaData();
- return false;
- }
- else {
- mMediaFlags |= MF_HAS_MEDIA;
- if (mMediaEntry == NULL)
- {
- mMediaEntry = new LLMediaEntry;
- }
- // *NOTE: this will *clobber* all of the fields in mMediaEntry
+ return false;
+ }
+ else {
+ mMediaFlags |= MF_HAS_MEDIA;
+ if (mMediaEntry == NULL)
+ {
+ mMediaEntry = new LLMediaEntry;
+ }
+ // *NOTE: this will *clobber* all of the fields in mMediaEntry
// with whatever fields are present (or not present) in media_data!
- mMediaEntry->fromLLSD(media_data);
- return true;
- }
+ mMediaEntry->fromLLSD(media_data);
+ return true;
+ }
}
void LLTextureEntry::clearMediaData()
@@ -727,7 +727,7 @@ void LLTextureEntry::clearMediaData()
delete mMediaEntry;
}
mMediaEntry = NULL;
-}
+}
void LLTextureEntry::mergeIntoMediaData(const LLSD& media_fields)
{
@@ -760,10 +760,10 @@ std::string LLTextureEntry::touchMediaVersionString(const std::string &in_versio
U32 LLTextureEntry::getVersionFromMediaVersionString(const std::string &version_string)
{
U32 version = 0;
- if (!version_string.empty())
+ if (!version_string.empty())
{
size_t found = version_string.find(MEDIA_VERSION_STRING_PREFIX);
- if (found != std::string::npos)
+ if (found != std::string::npos)
{
found = version_string.find_first_of("/", found);
std::string v = version_string.substr(MEDIA_VERSION_STRING_PREFIX.length(), found);
@@ -777,13 +777,13 @@ U32 LLTextureEntry::getVersionFromMediaVersionString(const std::string &version_
LLUUID LLTextureEntry::getAgentIDFromMediaVersionString(const std::string &version_string)
{
LLUUID id;
- if (!version_string.empty())
+ if (!version_string.empty())
{
size_t found = version_string.find(MEDIA_VERSION_STRING_PREFIX);
- if (found != std::string::npos)
+ if (found != std::string::npos)
{
found = version_string.find_first_of("/", found);
- if (found != std::string::npos)
+ if (found != std::string::npos)
{
std::string v = version_string.substr(found + 1);
id.set(v);
@@ -796,5 +796,5 @@ LLUUID LLTextureEntry::getAgentIDFromMediaVersionString(const std::string &versi
//static
bool LLTextureEntry::isMediaVersionString(const std::string &version_string)
{
- return std::string::npos != version_string.find(MEDIA_VERSION_STRING_PREFIX);
+ return std::string::npos != version_string.find(MEDIA_VERSION_STRING_PREFIX);
}