aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llprimitive/llvolumemessage.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llprimitive/llvolumemessage.cpp
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/llprimitive/llvolumemessage.cpp')
-rw-r--r--linden/indra/llprimitive/llvolumemessage.cpp97
1 files changed, 53 insertions, 44 deletions
diff --git a/linden/indra/llprimitive/llvolumemessage.cpp b/linden/indra/llprimitive/llvolumemessage.cpp
index b00bbc5..650e0cd 100644
--- a/linden/indra/llprimitive/llvolumemessage.cpp
+++ b/linden/indra/llprimitive/llvolumemessage.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -42,23 +43,25 @@ bool LLVolumeMessage::packProfileParams(
42 LLMessageSystem *mesgsys) 43 LLMessageSystem *mesgsys)
43{ 44{
44 // Default to cylinder 45 // Default to cylinder
45 static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U8(0), U8(0), U8(0)); 46 static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0));
46 47
47 if (!params) 48 if (!params)
48 params = &defaultparams; 49 params = &defaultparams;
49 50
50 U8 tempU8; 51 U8 tempU8;
52 U16 tempU16;
53
51 tempU8 = params->getCurveType(); 54 tempU8 = params->getCurveType();
52 mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8); 55 mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8);
53 56
54 tempU8 = (U8) llround( params->getBegin() / CUT_QUANTA); 57 tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA);
55 mesgsys->addU8Fast(_PREHASH_ProfileBegin, tempU8); 58 mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16);
56 59
57 tempU8 = 200 - (U8) llround(params->getEnd() / CUT_QUANTA); 60 tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
58 mesgsys->addU8Fast(_PREHASH_ProfileEnd, tempU8); 61 mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16);
59 62
60 tempU8 = (S8) llround(params->getHollow() / SHEAR_QUANTA); 63 tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA);
61 mesgsys->addU8Fast(_PREHASH_ProfileHollow, tempU8); 64 mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16);
62 65
63 return true; 66 return true;
64} 67}
@@ -68,23 +71,25 @@ bool LLVolumeMessage::packProfileParams(
68 LLDataPacker &dp) 71 LLDataPacker &dp)
69{ 72{
70 // Default to cylinder 73 // Default to cylinder
71 static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U8(0), U8(0), U8(0)); 74 static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0));
72 75
73 if (!params) 76 if (!params)
74 params = &defaultparams; 77 params = &defaultparams;
75 78
76 U8 tempU8; 79 U8 tempU8;
80 U16 tempU16;
81
77 tempU8 = params->getCurveType(); 82 tempU8 = params->getCurveType();
78 dp.packU8(tempU8, "Curve"); 83 dp.packU8(tempU8, "Curve");
79 84
80 tempU8 = (U8) llround( params->getBegin() / CUT_QUANTA); 85 tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA);
81 dp.packU8(tempU8, "Begin"); 86 dp.packU16(tempU16, "Begin");
82 87
83 tempU8 = 200 - (U8) llround(params->getEnd() / CUT_QUANTA); 88 tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
84 dp.packU8(tempU8, "End"); 89 dp.packU16(tempU16, "End");
85 90
86 tempU8 = (S8) llround(params->getHollow() / SHEAR_QUANTA); 91 tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA);
87 dp.packU8(tempU8, "Hollow"); 92 dp.packU16(tempU16, "Hollow");
88 return true; 93 return true;
89} 94}
90 95
@@ -96,13 +101,14 @@ bool LLVolumeMessage::unpackProfileParams(
96{ 101{
97 bool ok = true; 102 bool ok = true;
98 U8 temp_u8; 103 U8 temp_u8;
104 U16 temp_u16;
99 F32 temp_f32; 105 F32 temp_f32;
100 106
101 mesgsys->getU8Fast(block_name, _PREHASH_ProfileCurve, temp_u8, block_num); 107 mesgsys->getU8Fast(block_name, _PREHASH_ProfileCurve, temp_u8, block_num);
102 params->setCurveType(temp_u8); 108 params->setCurveType(temp_u8);
103 109
104 mesgsys->getU8Fast(block_name, _PREHASH_ProfileBegin, temp_u8, block_num); 110 mesgsys->getU16Fast(block_name, _PREHASH_ProfileBegin, temp_u16, block_num);
105 temp_f32 = temp_u8 * CUT_QUANTA; 111 temp_f32 = temp_u16 * CUT_QUANTA;
106 if (temp_f32 > 1.f) 112 if (temp_f32 > 1.f)
107 { 113 {
108 llwarns << "Profile begin out of range: " << temp_f32 114 llwarns << "Profile begin out of range: " << temp_f32
@@ -112,8 +118,8 @@ bool LLVolumeMessage::unpackProfileParams(
112 } 118 }
113 params->setBegin(temp_f32); 119 params->setBegin(temp_f32);
114 120
115 mesgsys->getU8Fast(block_name, _PREHASH_ProfileEnd, temp_u8, block_num); 121 mesgsys->getU16Fast(block_name, _PREHASH_ProfileEnd, temp_u16, block_num);
116 temp_f32 = temp_u8 * CUT_QUANTA; 122 temp_f32 = temp_u16 * CUT_QUANTA;
117 if (temp_f32 > 1.f) 123 if (temp_f32 > 1.f)
118 { 124 {
119 llwarns << "Profile end out of range: " << 1.f - temp_f32 125 llwarns << "Profile end out of range: " << 1.f - temp_f32
@@ -123,8 +129,8 @@ bool LLVolumeMessage::unpackProfileParams(
123 } 129 }
124 params->setEnd(1.f - temp_f32); 130 params->setEnd(1.f - temp_f32);
125 131
126 mesgsys->getU8Fast(block_name, _PREHASH_ProfileHollow, temp_u8, block_num); 132 mesgsys->getU16Fast(block_name, _PREHASH_ProfileHollow, temp_u16, block_num);
127 temp_f32 = temp_u8 * SCALE_QUANTA; 133 temp_f32 = temp_u16 * HOLLOW_QUANTA;
128 if (temp_f32 > 1.f) 134 if (temp_f32 > 1.f)
129 { 135 {
130 llwarns << "Profile hollow out of range: " << temp_f32 136 llwarns << "Profile hollow out of range: " << temp_f32
@@ -151,13 +157,14 @@ bool LLVolumeMessage::unpackProfileParams(
151{ 157{
152 bool ok = true; 158 bool ok = true;
153 U8 temp_u8; 159 U8 temp_u8;
160 U16 temp_u16;
154 F32 temp_f32; 161 F32 temp_f32;
155 162
156 dp.unpackU8(temp_u8, "Curve"); 163 dp.unpackU8(temp_u8, "Curve");
157 params->setCurveType(temp_u8); 164 params->setCurveType(temp_u8);
158 165
159 dp.unpackU8(temp_u8, "Begin"); 166 dp.unpackU16(temp_u16, "Begin");
160 temp_f32 = temp_u8 * CUT_QUANTA; 167 temp_f32 = temp_u16 * CUT_QUANTA;
161 if (temp_f32 > 1.f) 168 if (temp_f32 > 1.f)
162 { 169 {
163 llwarns << "Profile begin out of range: " << temp_f32 << llendl; 170 llwarns << "Profile begin out of range: " << temp_f32 << llendl;
@@ -167,8 +174,8 @@ bool LLVolumeMessage::unpackProfileParams(
167 } 174 }
168 params->setBegin(temp_f32); 175 params->setBegin(temp_f32);
169 176
170 dp.unpackU8(temp_u8, "End"); 177 dp.unpackU16(temp_u16, "End");
171 temp_f32 = temp_u8 * CUT_QUANTA; 178 temp_f32 = temp_u16 * CUT_QUANTA;
172 if (temp_f32 > 1.f) 179 if (temp_f32 > 1.f)
173 { 180 {
174 llwarns << "Profile end out of range: " << 1.f - temp_f32 << llendl; 181 llwarns << "Profile end out of range: " << 1.f - temp_f32 << llendl;
@@ -178,8 +185,8 @@ bool LLVolumeMessage::unpackProfileParams(
178 } 185 }
179 params->setEnd(1.f - temp_f32); 186 params->setEnd(1.f - temp_f32);
180 187
181 dp.unpackU8(temp_u8, "Hollow"); 188 dp.unpackU16(temp_u16, "Hollow");
182 temp_f32 = temp_u8 * SCALE_QUANTA; 189 temp_f32 = temp_u16 * HOLLOW_QUANTA;
183 if (temp_f32 > 1.f) 190 if (temp_f32 > 1.f)
184 { 191 {
185 llwarns << "Profile hollow out of range: " << temp_f32 << llendl; 192 llwarns << "Profile hollow out of range: " << temp_f32 << llendl;
@@ -212,11 +219,11 @@ bool LLVolumeMessage::packPathParams(
212 U8 curve = params->getCurveType(); 219 U8 curve = params->getCurveType();
213 mesgsys->addU8Fast(_PREHASH_PathCurve, curve); 220 mesgsys->addU8Fast(_PREHASH_PathCurve, curve);
214 221
215 U8 begin = (U8) llround(params->getBegin() / SCALE_QUANTA); 222 U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA);
216 mesgsys->addU8Fast(_PREHASH_PathBegin, begin); 223 mesgsys->addU16Fast(_PREHASH_PathBegin, begin);
217 224
218 U8 end = 100 - (U8) llround(params->getEnd() / SCALE_QUANTA); 225 U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
219 mesgsys->addU8Fast(_PREHASH_PathEnd, end); 226 mesgsys->addU16Fast(_PREHASH_PathEnd, end);
220 227
221 // Avoid truncation problem with direct F32->U8 cast. 228 // Avoid truncation problem with direct F32->U8 cast.
222 // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. 229 // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
@@ -269,11 +276,11 @@ bool LLVolumeMessage::packPathParams(
269 U8 curve = params->getCurveType(); 276 U8 curve = params->getCurveType();
270 dp.packU8(curve, "Curve"); 277 dp.packU8(curve, "Curve");
271 278
272 U8 begin = (U8) llround(params->getBegin() / SCALE_QUANTA); 279 U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA);
273 dp.packU8(begin, "Begin"); 280 dp.packU16(begin, "Begin");
274 281
275 U8 end = 100 - (U8) llround(params->getEnd() / SCALE_QUANTA); 282 U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
276 dp.packU8(end, "End"); 283 dp.packU16(end, "End");
277 284
278 // Avoid truncation problem with direct F32->U8 cast. 285 // Avoid truncation problem with direct F32->U8 cast.
279 // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. 286 // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
@@ -324,13 +331,13 @@ bool LLVolumeMessage::unpackPathParams(
324 mesgsys->getU8Fast(block_name, _PREHASH_PathCurve, curve, block_num); 331 mesgsys->getU8Fast(block_name, _PREHASH_PathCurve, curve, block_num);
325 params->setCurveType(curve); 332 params->setCurveType(curve);
326 333
327 U8 begin; 334 U16 begin;
328 mesgsys->getU8Fast(block_name, _PREHASH_PathBegin, begin, block_num); 335 mesgsys->getU16Fast(block_name, _PREHASH_PathBegin, begin, block_num);
329 params->setBegin((F32)(begin * SCALE_QUANTA)); 336 params->setBegin((F32)(begin * CUT_QUANTA));
330 337
331 U8 end; 338 U16 end;
332 mesgsys->getU8Fast(block_name, _PREHASH_PathEnd, end, block_num); 339 mesgsys->getU16Fast(block_name, _PREHASH_PathEnd, end, block_num);
333 params->setEnd((F32)((100 - end) * SCALE_QUANTA)); 340 params->setEnd((F32)((50000 - end) * CUT_QUANTA));
334 341
335 U8 pack_scale_x, pack_scale_y; 342 U8 pack_scale_x, pack_scale_y;
336 mesgsys->getU8Fast(block_name, _PREHASH_PathScaleX, pack_scale_x, block_num); 343 mesgsys->getU8Fast(block_name, _PREHASH_PathScaleX, pack_scale_x, block_num);
@@ -390,14 +397,16 @@ bool LLVolumeMessage::unpackPathParams(LLPathParams* params, LLDataPacker &dp)
390{ 397{
391 U8 value; 398 U8 value;
392 S8 svalue; 399 S8 svalue;
400 U16 temp_u16;
401
393 dp.unpackU8(value, "Curve"); 402 dp.unpackU8(value, "Curve");
394 params->setCurveType( value ); 403 params->setCurveType( value );
395 404
396 dp.unpackU8(value, "Begin"); 405 dp.unpackU16(temp_u16, "Begin");
397 params->setBegin((F32)(value * SCALE_QUANTA)); 406 params->setBegin((F32)(temp_u16 * CUT_QUANTA));
398 407
399 dp.unpackU8(value, "End"); 408 dp.unpackU16(temp_u16, "End");
400 params->setEnd((F32)((100 - value) * SCALE_QUANTA)); 409 params->setEnd((F32)((50000 - temp_u16) * CUT_QUANTA));
401 410
402 dp.unpackU8(value, "ScaleX"); 411 dp.unpackU8(value, "ScaleX");
403 F32 x = (F32) (200 - value) * SCALE_QUANTA; 412 F32 x = (F32) (200 - value) * SCALE_QUANTA;