diff options
author | Don Kjer <don@lindenlab.com> | 2007-05-01 21:39:25 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2007-05-01 21:39:25 +0000 |
commit | 4ecb9cb63e4993b3b4bc65d73ed255139b5c3f75 (patch) | |
tree | 48d9bb9a1ae468ecdbd53cf21a598d66ee8eced3 /indra/llprimitive | |
parent | f5e9ce7e47694e349a4eb28b052016b11e1bdf81 (diff) |
svn merge -r 59163:61099 svn+ssh://svn/svn/linden/branches/release-candidate into release
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llprimitive.cpp | 48 | ||||
-rw-r--r-- | indra/llprimitive/llvolumemessage.cpp | 96 |
2 files changed, 74 insertions, 70 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 366ecc7d6f..fa0b4747e6 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1260,8 +1260,8 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const U8 image_ids[MAX_TES*16]; U8 colors[MAX_TES*4]; - S16 scale_s[MAX_TES]; - S16 scale_t[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]; @@ -1296,8 +1296,8 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const colors[4*face_index + 3] = 255 - coloru.mV[3]; const LLTextureEntry* te = getTE(face_index); - scale_s[face_index] = (S16) llround(((llclamp(te->mScaleS,-LL_MAX_SCALE_S, LL_MAX_SCALE_S)-1.0f)/(LL_MAX_SCALE_S+1.f) * (F32)0x7FFF)); - scale_t[face_index] = (S16) llround(((llclamp(te->mScaleT,-LL_MAX_SCALE_T, LL_MAX_SCALE_T)-1.0f)/(LL_MAX_SCALE_T+1.f) * (F32)0x7FFF)); + scale_s[face_index] = (F32) te->mScaleS; + scale_t[face_index] = (F32) te->mScaleT; offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); @@ -1310,9 +1310,9 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const *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, 2 ,last_face_index, MVT_S16Array); + 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, 2 ,last_face_index, MVT_S16Array); + 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; @@ -1336,8 +1336,8 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const U8 image_ids[MAX_TES*16]; U8 colors[MAX_TES*4]; - S16 scale_s[MAX_TES]; - S16 scale_t[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]; @@ -1372,8 +1372,8 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const colors[4*face_index + 3] = 255 - coloru.mV[3]; const LLTextureEntry* te = getTE(face_index); - scale_s[face_index] = (S16) llround(((llclamp(te->mScaleS,-LL_MAX_SCALE_S, LL_MAX_SCALE_S)-1.0f)/(LL_MAX_SCALE_S+1.f) * (F32)0x7FFF)); - scale_t[face_index] = (S16) llround(((llclamp(te->mScaleT,-LL_MAX_SCALE_T, LL_MAX_SCALE_T)-1.0f)/(LL_MAX_SCALE_T+1.f) * (F32)0x7FFF)); + scale_s[face_index] = (F32) te->mScaleS; + scale_t[face_index] = (F32) te->mScaleT; offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); @@ -1387,9 +1387,9 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const *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, 2 ,last_face_index, MVT_S16Array); + 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, 2 ,last_face_index, MVT_S16Array); + 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; @@ -1421,8 +1421,8 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con U8 image_data[MAX_TES*16]; U8 colors[MAX_TES*4]; - S16 scale_s[MAX_TES]; - S16 scale_t[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]; @@ -1465,9 +1465,9 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)colors, 4, face_count, MVT_U8); cur_ptr++; - cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_s, 2, face_count, MVT_S16Array); + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_s, 4, face_count, MVT_F32); cur_ptr++; - cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_t, 2, face_count, MVT_S16Array); + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_t, 4, face_count, MVT_F32); cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)offset_s, 2, face_count, MVT_S16Array); cur_ptr++; @@ -1484,9 +1484,7 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con for (U32 i = 0; i < face_count; i++) { retval |= setTETexture(i, ((LLUUID*)image_data)[i]); - retval |= setTEScale(i, - floor((1.0f + ((((F32)scale_s[i] / (F32)0x7FFF)) * (LL_MAX_SCALE_S+1.f))) * 100.f + 0.5f) / 100.f, - floor((1.0f + ((((F32)scale_t[i] / (F32)0x7FFF)) * (LL_MAX_SCALE_T+1.f))) * 100.f + 0.5f) / 100.f); + 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]/ (F32)0x7FFF) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); @@ -1518,8 +1516,8 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) U8 image_data[MAX_TES*16]; U8 colors[MAX_TES*4]; - S16 scale_s[MAX_TES]; - S16 scale_t[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]; @@ -1552,9 +1550,9 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)colors, 4, face_count, MVT_U8); cur_ptr++; - cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_s, 2, face_count, MVT_S16Array); + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_s, 4, face_count, MVT_F32); cur_ptr++; - cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_t, 2, face_count, MVT_S16Array); + cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_t, 4, face_count, MVT_F32); cur_ptr++; cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)offset_s, 2, face_count, MVT_S16Array); cur_ptr++; @@ -1577,9 +1575,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) for (i = 0; i < face_count; i++) { retval |= setTETexture(i, image_ids[i]); - retval |= setTEScale(i, - floor((1.0f + ((((F32)scale_s[i] / (F32)0x7FFF)) * (LL_MAX_SCALE_S+1.f))) * 100.f + 0.5f) / 100.f, - floor((1.0f + ((((F32)scale_t[i] / (F32)0x7FFF)) * (LL_MAX_SCALE_T+1.f))) * 100.f + 0.5f) / 100.f); + 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]/ (F32)0x7FFF) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp index a43aa19cab..60c6bae34a 100644 --- a/indra/llprimitive/llvolumemessage.cpp +++ b/indra/llprimitive/llvolumemessage.cpp @@ -23,23 +23,25 @@ bool LLVolumeMessage::packProfileParams( LLMessageSystem *mesgsys) { // Default to cylinder - static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U8(0), U8(0), U8(0)); + static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0)); if (!params) params = &defaultparams; U8 tempU8; + U16 tempU16; + tempU8 = params->getCurveType(); mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8); - tempU8 = (U8) llround( params->getBegin() / CUT_QUANTA); - mesgsys->addU8Fast(_PREHASH_ProfileBegin, tempU8); + tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA); + mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16); - tempU8 = 200 - (U8) llround(params->getEnd() / CUT_QUANTA); - mesgsys->addU8Fast(_PREHASH_ProfileEnd, tempU8); + tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA); + mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16); - tempU8 = (S8) llround(params->getHollow() / SHEAR_QUANTA); - mesgsys->addU8Fast(_PREHASH_ProfileHollow, tempU8); + tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA); + mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16); return true; } @@ -49,23 +51,25 @@ bool LLVolumeMessage::packProfileParams( LLDataPacker &dp) { // Default to cylinder - static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U8(0), U8(0), U8(0)); + static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0)); if (!params) params = &defaultparams; U8 tempU8; + U16 tempU16; + tempU8 = params->getCurveType(); dp.packU8(tempU8, "Curve"); - tempU8 = (U8) llround( params->getBegin() / CUT_QUANTA); - dp.packU8(tempU8, "Begin"); + tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA); + dp.packU16(tempU16, "Begin"); - tempU8 = 200 - (U8) llround(params->getEnd() / CUT_QUANTA); - dp.packU8(tempU8, "End"); + tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA); + dp.packU16(tempU16, "End"); - tempU8 = (S8) llround(params->getHollow() / SHEAR_QUANTA); - dp.packU8(tempU8, "Hollow"); + tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA); + dp.packU16(tempU16, "Hollow"); return true; } @@ -77,13 +81,14 @@ bool LLVolumeMessage::unpackProfileParams( { bool ok = true; U8 temp_u8; + U16 temp_u16; F32 temp_f32; mesgsys->getU8Fast(block_name, _PREHASH_ProfileCurve, temp_u8, block_num); params->setCurveType(temp_u8); - mesgsys->getU8Fast(block_name, _PREHASH_ProfileBegin, temp_u8, block_num); - temp_f32 = temp_u8 * CUT_QUANTA; + mesgsys->getU16Fast(block_name, _PREHASH_ProfileBegin, temp_u16, block_num); + temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile begin out of range: " << temp_f32 @@ -93,8 +98,8 @@ bool LLVolumeMessage::unpackProfileParams( } params->setBegin(temp_f32); - mesgsys->getU8Fast(block_name, _PREHASH_ProfileEnd, temp_u8, block_num); - temp_f32 = temp_u8 * CUT_QUANTA; + mesgsys->getU16Fast(block_name, _PREHASH_ProfileEnd, temp_u16, block_num); + temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile end out of range: " << 1.f - temp_f32 @@ -104,8 +109,8 @@ bool LLVolumeMessage::unpackProfileParams( } params->setEnd(1.f - temp_f32); - mesgsys->getU8Fast(block_name, _PREHASH_ProfileHollow, temp_u8, block_num); - temp_f32 = temp_u8 * SCALE_QUANTA; + mesgsys->getU16Fast(block_name, _PREHASH_ProfileHollow, temp_u16, block_num); + temp_f32 = temp_u16 * HOLLOW_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile hollow out of range: " << temp_f32 @@ -132,13 +137,14 @@ bool LLVolumeMessage::unpackProfileParams( { bool ok = true; U8 temp_u8; + U16 temp_u16; F32 temp_f32; dp.unpackU8(temp_u8, "Curve"); params->setCurveType(temp_u8); - dp.unpackU8(temp_u8, "Begin"); - temp_f32 = temp_u8 * CUT_QUANTA; + dp.unpackU16(temp_u16, "Begin"); + temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile begin out of range: " << temp_f32 << llendl; @@ -148,8 +154,8 @@ bool LLVolumeMessage::unpackProfileParams( } params->setBegin(temp_f32); - dp.unpackU8(temp_u8, "End"); - temp_f32 = temp_u8 * CUT_QUANTA; + dp.unpackU16(temp_u16, "End"); + temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile end out of range: " << 1.f - temp_f32 << llendl; @@ -159,8 +165,8 @@ bool LLVolumeMessage::unpackProfileParams( } params->setEnd(1.f - temp_f32); - dp.unpackU8(temp_u8, "Hollow"); - temp_f32 = temp_u8 * SCALE_QUANTA; + dp.unpackU16(temp_u16, "Hollow"); + temp_f32 = temp_u16 * HOLLOW_QUANTA; if (temp_f32 > 1.f) { llwarns << "Profile hollow out of range: " << temp_f32 << llendl; @@ -193,11 +199,11 @@ bool LLVolumeMessage::packPathParams( U8 curve = params->getCurveType(); mesgsys->addU8Fast(_PREHASH_PathCurve, curve); - U8 begin = (U8) llround(params->getBegin() / SCALE_QUANTA); - mesgsys->addU8Fast(_PREHASH_PathBegin, begin); + U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA); + mesgsys->addU16Fast(_PREHASH_PathBegin, begin); - U8 end = 100 - (U8) llround(params->getEnd() / SCALE_QUANTA); - mesgsys->addU8Fast(_PREHASH_PathEnd, end); + U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA); + mesgsys->addU16Fast(_PREHASH_PathEnd, end); // Avoid truncation problem with direct F32->U8 cast. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. @@ -250,11 +256,11 @@ bool LLVolumeMessage::packPathParams( U8 curve = params->getCurveType(); dp.packU8(curve, "Curve"); - U8 begin = (U8) llround(params->getBegin() / SCALE_QUANTA); - dp.packU8(begin, "Begin"); + U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA); + dp.packU16(begin, "Begin"); - U8 end = 100 - (U8) llround(params->getEnd() / SCALE_QUANTA); - dp.packU8(end, "End"); + U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA); + dp.packU16(end, "End"); // Avoid truncation problem with direct F32->U8 cast. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. @@ -305,13 +311,13 @@ bool LLVolumeMessage::unpackPathParams( mesgsys->getU8Fast(block_name, _PREHASH_PathCurve, curve, block_num); params->setCurveType(curve); - U8 begin; - mesgsys->getU8Fast(block_name, _PREHASH_PathBegin, begin, block_num); - params->setBegin((F32)(begin * SCALE_QUANTA)); + U16 begin; + mesgsys->getU16Fast(block_name, _PREHASH_PathBegin, begin, block_num); + params->setBegin((F32)(begin * CUT_QUANTA)); - U8 end; - mesgsys->getU8Fast(block_name, _PREHASH_PathEnd, end, block_num); - params->setEnd((F32)((100 - end) * SCALE_QUANTA)); + U16 end; + mesgsys->getU16Fast(block_name, _PREHASH_PathEnd, end, block_num); + params->setEnd((F32)((50000 - end) * CUT_QUANTA)); U8 pack_scale_x, pack_scale_y; mesgsys->getU8Fast(block_name, _PREHASH_PathScaleX, pack_scale_x, block_num); @@ -371,14 +377,16 @@ bool LLVolumeMessage::unpackPathParams(LLPathParams* params, LLDataPacker &dp) { U8 value; S8 svalue; + U16 temp_u16; + dp.unpackU8(value, "Curve"); params->setCurveType( value ); - dp.unpackU8(value, "Begin"); - params->setBegin((F32)(value * SCALE_QUANTA)); + dp.unpackU16(temp_u16, "Begin"); + params->setBegin((F32)(temp_u16 * CUT_QUANTA)); - dp.unpackU8(value, "End"); - params->setEnd((F32)((100 - value) * SCALE_QUANTA)); + dp.unpackU16(temp_u16, "End"); + params->setEnd((F32)((50000 - temp_u16) * CUT_QUANTA)); dp.unpackU8(value, "ScaleX"); F32 x = (F32) (200 - value) * SCALE_QUANTA; |