diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2007-05-23 21:17:34 +0000 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2007-05-23 21:17:34 +0000 |
commit | 029130bf9c76139fa836117987b60e801ac7ec7c (patch) | |
tree | ee320f7737ad3edc74a2401b5bd20a027b670487 /indra/llprimitive | |
parent | 0aac2f674e4bd2fc73025ec8b649739cf7be3e4c (diff) |
svn merge svn+ssh://svn.lindenlab.com/svn/linden/release@62339 svn+ssh://svn.lindenlab.com/svn/linden/branches/release-candidate62341 -> release
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llprimitive.cpp | 97 | ||||
-rw-r--r-- | indra/llprimitive/llprimitive.h | 28 | ||||
-rw-r--r-- | indra/llprimitive/lltextureentry.cpp | 15 | ||||
-rw-r--r-- | indra/llprimitive/lltextureentry.h | 8 |
4 files changed, 136 insertions, 12 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 13719d0a62..7e44d15db2 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -87,6 +87,9 @@ const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = FALSE; 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"; + + //=============================================================== LLPrimitive::LLPrimitive() { @@ -491,6 +494,18 @@ S32 LLPrimitive::setTEMediaFlags(const U8 te, const U8 media_flags) return mTextureList[te].setMediaFlags( media_flags ); } +S32 LLPrimitive::setTEGlow(const U8 te, const F32 glow) +{ + // if we're asking for a non-existent face, return null + if (te >= mNumTEs) + { + llwarns << "setting non-existent te " << te << llendl + return 0; + } + + return mTextureList[te].setGlow( glow ); +} + LLPCode LLPrimitive::legacyToPCode(const U8 legacy) { @@ -1272,7 +1287,8 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const S16 image_rot[MAX_TES]; U8 bump[MAX_TES]; U8 media_flags[MAX_TES]; - + U8 glow[MAX_TES]; + const U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; U8 *cur_ptr = packed_buffer; @@ -1308,7 +1324,7 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); -// llinfos << "BUMP pack [" << (S32)face_index << "]=" << (S32) bump[face_index] << llendl; + glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); } cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID); @@ -1328,6 +1344,8 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const 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); } mesgsys->addBinaryDataFast(_PREHASH_TextureEntry, packed_buffer, (S32)(cur_ptr - packed_buffer)); @@ -1348,7 +1366,8 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const S16 image_rot[MAX_TES]; U8 bump[MAX_TES]; U8 media_flags[MAX_TES]; - + U8 glow[MAX_TES]; + const U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; U8 *cur_ptr = packed_buffer; @@ -1384,8 +1403,7 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); - -// llinfos << "BUMP pack (Datapacker) [" << (S32)face_index << "]=" << (S32) bump[face_index] << llendl; + glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); } cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID); @@ -1405,6 +1423,8 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const 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); } dp.packBinaryData(packed_buffer, (S32)(cur_ptr - packed_buffer), "TextureEntry"); @@ -1433,7 +1453,8 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con S16 image_rot[MAX_TES]; U8 bump[MAX_TES]; U8 media_flags[MAX_TES]; - + U8 glow[MAX_TES]; + const U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; U8 *cur_ptr = packed_buffer; @@ -1483,7 +1504,9 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)bump, 1, face_count, MVT_U8); cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)media_flags, 1, face_count, MVT_U8); - + cur_ptr++; + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)glow, 1, face_count, MVT_U8); + LLColor4 color; LLColor4U coloru; for (U32 i = 0; i < face_count; i++) @@ -1494,6 +1517,7 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con retval |= setTERotation(i, ((F32)image_rot[i]/ (F32)0x7FFF) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); retval |= setTEMediaTexGen(i, media_flags[i]); + retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF); coloru = LLColor4U(colors + 4*i); // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f) @@ -1528,6 +1552,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) S16 image_rot[MAX_TES]; U8 bump[MAX_TES]; U8 media_flags[MAX_TES]; + U8 glow[MAX_TES]; const U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; @@ -1568,10 +1593,11 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)bump, 1, face_count, MVT_U8); cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)media_flags, 1, face_count, MVT_U8); + cur_ptr++; + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)glow, 1, face_count, MVT_U8); for (i = 0; i < face_count; i++) { -// llinfos << "BUMP unpack (Datapacker) [" << i << "]=" << S32(bump[i]) <<llendl; memcpy(image_ids[i].mData,&image_data[i*16],16); /* Flawfinder: ignore */ } @@ -1585,6 +1611,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) retval |= setTERotation(i, ((F32)image_rot[i]/ (F32)0x7FFF) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); retval |= setTEMediaTexGen(i, media_flags[i]); + retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF); coloru = LLColor4U(colors + 4*i); // Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f) @@ -1621,6 +1648,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 16); case PARAMS_LIGHT: return (size == 16); + case PARAMS_SCULPT: + return (size == 17); } return FALSE; @@ -1776,3 +1805,55 @@ void LLFlexibleObjectData::copy(const LLNetworkData& data) //mUsingCollisionSphere = flex_data->mUsingCollisionSphere; //mRenderingCollisionSphere = flex_data->mRenderingCollisionSphere; } + + +//============================================================================ + +LLSculptParams::LLSculptParams() +{ + 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; +} + +BOOL LLSculptParams::unpack(LLDataPacker &dp) +{ + dp.unpackUUID(mSculptTexture, "texture"); + dp.unpackU8(mSculptType, "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; +} + +void LLSculptParams::copy(const LLNetworkData& data) +{ + const LLSculptParams *param = (LLSculptParams*)&data; + mSculptTexture = param->mSculptTexture; + mSculptType = param->mSculptType; +} + diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 90871fd319..ab1fc4f719 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -68,6 +68,7 @@ extern const F32 OBJECT_REV_MIN; extern const F32 OBJECT_REV_MAX; extern const F32 OBJECT_REV_INC; +extern const char *SCULPT_DEFAULT_TEXTURE; //============================================================================ @@ -79,7 +80,8 @@ public: enum { PARAMS_FLEXIBLE = 0x10, - PARAMS_LIGHT = 0x20 + PARAMS_LIGHT = 0x20, + PARAMS_SCULPT = 0x30 }; public: @@ -206,6 +208,29 @@ public: void copy(const LLNetworkData& data); };// end of attributes structure + + +class LLSculptParams : public LLNetworkData +{ +protected: + 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); + + void setSculptTexture(const LLUUID& id) { mSculptTexture = id; } + LLUUID getSculptTexture() { return mSculptTexture; } + void setSculptType(U8 type) { mSculptType = type; } + U8 getSculptType() { return mSculptType; } +}; + + + class LLPrimitive : public LLXform { public: @@ -246,6 +271,7 @@ public: 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 BOOL setMaterial(const U8 material); // returns TRUE if material changed void setTEArrays(const U8 size, diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 86952dfdb5..85ff779ba2 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -37,6 +37,7 @@ LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs) mColor = rhs.mColor; mBump = rhs.mBump; mMediaFlags = rhs.mMediaFlags; + mGlow = rhs.mGlow; } LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs) @@ -52,6 +53,7 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs) mColor = rhs.mColor; mBump = rhs.mBump; mMediaFlags = rhs.mMediaFlags; + mGlow = rhs.mGlow; } return *this; @@ -68,7 +70,8 @@ void LLTextureEntry::init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 of mRotation = rotation; mBump = bump; mMediaFlags = 0x0; - + mGlow = 0; + setColor(LLColor4(1.f, 1.f, 1.f, 1.f)); } @@ -346,3 +349,13 @@ S32 LLTextureEntry::setTexGen(U8 tex_gen) return 0; } +S32 LLTextureEntry::setGlow(F32 glow) +{ + if (mGlow != glow) + { + mGlow = glow; + return TEM_CHANGE_TEXTURE; + } + return 0; +} + diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h index b9558a159a..f8cdd3bee1 100644 --- a/indra/llprimitive/lltextureentry.h +++ b/indra/llprimitive/lltextureentry.h @@ -87,7 +87,8 @@ public: S32 setMediaFlags(U8 media_flags); S32 setTexGen(U8 texGen); S32 setMediaTexGen(U8 media); - + S32 setGlow(F32 glow); + const LLUUID &getID() const { return mID; } const LLColor4 &getColor() const { return mColor; } void getScale(F32 *s, F32 *t) const { *s = mScaleS; *t = mScaleT; } @@ -104,7 +105,8 @@ public: U8 getMediaFlags() const { return mMediaFlags & TEM_MEDIA_MASK; } U8 getTexGen() const { return mMediaFlags & TEM_TEX_GEN_MASK; } U8 getMediaTexGen() const { return mMediaFlags; } - + F32 getGlow() const { return mGlow; } + // Media flags enum { MF_NONE = 0x0, MF_WEB_PAGE = 0x1 }; @@ -121,6 +123,8 @@ protected: LLColor4 mColor; U8 mBump; // Bump map, shiny, and fullbright U8 mMediaFlags; // replace with web page, movie, etc. + F32 mGlow; + }; #endif |