aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PrimitiveBaseShape.cs
diff options
context:
space:
mode:
authorSean Dague2008-07-16 14:41:49 +0000
committerSean Dague2008-07-16 14:41:49 +0000
commitc6b1a190bc7fb513ae63a694cf11ad4d5493355d (patch)
treed518e53b158076bfc89869a94f7158249aa4822b /OpenSim/Framework/PrimitiveBaseShape.cs
parentwork in progress on nhibernate (diff)
downloadopensim-SC_OLD-c6b1a190bc7fb513ae63a694cf11ad4d5493355d.zip
opensim-SC_OLD-c6b1a190bc7fb513ae63a694cf11ad4d5493355d.tar.gz
opensim-SC_OLD-c6b1a190bc7fb513ae63a694cf11ad4d5493355d.tar.bz2
opensim-SC_OLD-c6b1a190bc7fb513ae63a694cf11ad4d5493355d.tar.xz
refactoring primitive base shape to use properties
Diffstat (limited to 'OpenSim/Framework/PrimitiveBaseShape.cs')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs378
1 files changed, 302 insertions, 76 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 12ca688..2b023cd 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -78,23 +78,57 @@ namespace OpenSim.Framework
78 78
79 private byte[] m_textureEntry; 79 private byte[] m_textureEntry;
80 80
81 public ushort PathBegin; 81 public ushort _pathBegin;
82 public byte PathCurve; 82 public byte _pathCurve;
83 public ushort PathEnd; 83 public ushort _pathEnd;
84 public sbyte PathRadiusOffset; 84 public sbyte _pathRadiusOffset;
85 public byte PathRevolutions; 85 public byte _pathRevolutions;
86 public byte PathScaleX; 86 public byte _pathScaleX;
87 public byte PathScaleY; 87 public byte _pathScaleY;
88 public byte PathShearX; 88 public byte _pathShearX;
89 public byte PathShearY; 89 public byte _pathShearY;
90 public sbyte PathSkew; 90 public sbyte _pathSkew;
91 public sbyte PathTaperX; 91 public sbyte _pathTaperX;
92 public sbyte PathTaperY; 92 public sbyte _pathTaperY;
93 public sbyte PathTwist; 93 public sbyte _pathTwist;
94 public sbyte PathTwistBegin; 94 public sbyte _pathTwistBegin;
95 public byte PCode; 95 public byte _pCode;
96 public ushort ProfileBegin; 96 public ushort _profileBegin;
97 public ushort _profileEnd;
98 public ushort _profileHollow;
99 public LLVector3 _scale;
100 public byte _state;
101 public ProfileShape _profileShape;
102 public HollowShape _hollowShape;
97 103
104 // Sculpted
105 [XmlIgnore] public LLUUID _sculptTexture = LLUUID.Zero;
106 [XmlIgnore] public byte _sculptType = (byte)0;
107 [XmlIgnore] public byte[] _sculptData = new byte[0];
108
109 // Flexi
110 [XmlIgnore] public int FlexiSoftness = 0;
111 [XmlIgnore] public float FlexiTension = 0f;
112 [XmlIgnore] public float FlexiDrag = 0f;
113 [XmlIgnore] public float FlexiGravity = 0f;
114 [XmlIgnore] public float FlexiWind = 0f;
115 [XmlIgnore] public float FlexiForceX = 0f;
116 [XmlIgnore] public float FlexiForceY = 0f;
117 [XmlIgnore] public float FlexiForceZ = 0f;
118
119 //Bright n sparkly
120 [XmlIgnore] public float LightColorR = 0f;
121 [XmlIgnore] public float LightColorG = 0f;
122 [XmlIgnore] public float LightColorB = 0f;
123 [XmlIgnore] public float LightColorA = 1f;
124 [XmlIgnore] public float LightRadius = 0f;
125 [XmlIgnore] public float LightCutoff = 0f;
126 [XmlIgnore] public float LightFalloff = 0f;
127 [XmlIgnore] public float LightIntensity = 1f;
128 [XmlIgnore] public bool FlexiEntry = false;
129 [XmlIgnore] public bool LightEntry = false;
130 [XmlIgnore] public bool SculptEntry = false;
131
98 public byte ProfileCurve 132 public byte ProfileCurve
99 { 133 {
100 get { return (byte)((byte)HollowShape | (byte)ProfileShape); } 134 get { return (byte)((byte)HollowShape | (byte)ProfileShape); }
@@ -110,11 +144,11 @@ namespace OpenSim.Framework
110 "[SHAPE]: Attempt to set a ProfileCurve with a hollow shape value of {0}, which isn't a valid enum. Replacing with default shape.", 144 "[SHAPE]: Attempt to set a ProfileCurve with a hollow shape value of {0}, which isn't a valid enum. Replacing with default shape.",
111 hollowShapeByte); 145 hollowShapeByte);
112 146
113 this.HollowShape = HollowShape.Same; 147 this._hollowShape = HollowShape.Same;
114 } 148 }
115 else 149 else
116 { 150 {
117 this.HollowShape = (HollowShape)hollowShapeByte; 151 this._hollowShape = (HollowShape)hollowShapeByte;
118 } 152 }
119 153
120 // Handle profile shape component 154 // Handle profile shape component
@@ -126,47 +160,16 @@ namespace OpenSim.Framework
126 "[SHAPE]: Attempt to set a ProfileCurve with a profile shape value of {0}, which isn't a valid enum. Replacing with square.", 160 "[SHAPE]: Attempt to set a ProfileCurve with a profile shape value of {0}, which isn't a valid enum. Replacing with square.",
127 profileShapeByte); 161 profileShapeByte);
128 162
129 this.ProfileShape = ProfileShape.Square; 163 this._profileShape = ProfileShape.Square;
130 } 164 }
131 else 165 else
132 { 166 {
133 this.ProfileShape = (ProfileShape)profileShapeByte; 167 this._profileShape = (ProfileShape)profileShapeByte;
134 } 168 }
135 } 169 }
136 } 170 }
137 171
138 public ushort ProfileEnd;
139 public ushort ProfileHollow;
140 public LLVector3 Scale;
141 public byte State;
142 172
143 // Sculpted
144 [XmlIgnore] public LLUUID SculptTexture = LLUUID.Zero;
145 [XmlIgnore] public byte SculptType = (byte)0;
146 [XmlIgnore] public byte[] SculptData = new byte[0];
147
148 // Flexi
149 [XmlIgnore] public int FlexiSoftness = 0;
150 [XmlIgnore] public float FlexiTension = 0f;
151 [XmlIgnore] public float FlexiDrag = 0f;
152 [XmlIgnore] public float FlexiGravity = 0f;
153 [XmlIgnore] public float FlexiWind = 0f;
154 [XmlIgnore] public float FlexiForceX = 0f;
155 [XmlIgnore] public float FlexiForceY = 0f;
156 [XmlIgnore] public float FlexiForceZ = 0f;
157
158 //Bright n sparkly
159 [XmlIgnore] public float LightColorR = 0f;
160 [XmlIgnore] public float LightColorG = 0f;
161 [XmlIgnore] public float LightColorB = 0f;
162 [XmlIgnore] public float LightColorA = 1f;
163 [XmlIgnore] public float LightRadius = 0f;
164 [XmlIgnore] public float LightCutoff = 0f;
165 [XmlIgnore] public float LightFalloff = 0f;
166 [XmlIgnore] public float LightIntensity = 1f;
167 [XmlIgnore] public bool FlexiEntry = false;
168 [XmlIgnore] public bool LightEntry = false;
169 [XmlIgnore] public bool SculptEntry = false;
170 173
171 174
172 static PrimitiveBaseShape() 175 static PrimitiveBaseShape()
@@ -197,9 +200,7 @@ namespace OpenSim.Framework
197 set { m_textureEntry = value; } 200 set { m_textureEntry = value; }
198 } 201 }
199 202
200 public ProfileShape ProfileShape;
201 203
202 public HollowShape HollowShape;
203 204
204 public static PrimitiveBaseShape Default 205 public static PrimitiveBaseShape Default
205 { 206 {
@@ -223,10 +224,10 @@ namespace OpenSim.Framework
223 { 224 {
224 PrimitiveBaseShape shape = Create(); 225 PrimitiveBaseShape shape = Create();
225 226
226 shape.PathCurve = (byte) Extrusion.Straight; 227 shape._pathCurve = (byte) Extrusion.Straight;
227 shape.ProfileShape = ProfileShape.Square; 228 shape._profileShape = ProfileShape.Square;
228 shape.PathScaleX = 100; 229 shape._pathScaleX = 100;
229 shape.PathScaleY = 100; 230 shape._pathScaleY = 100;
230 231
231 return shape; 232 return shape;
232 } 233 }
@@ -235,28 +236,28 @@ namespace OpenSim.Framework
235 { 236 {
236 PrimitiveBaseShape shape = Create(); 237 PrimitiveBaseShape shape = Create();
237 238
238 shape.PathCurve = (byte) Extrusion.Curve1; 239 shape._pathCurve = (byte) Extrusion.Curve1;
239 shape.ProfileShape = ProfileShape.Square; 240 shape._profileShape = ProfileShape.Square;
240 241
241 shape.PathScaleX = 100; 242 shape._pathScaleX = 100;
242 shape.PathScaleY = 100; 243 shape._pathScaleY = 100;
243 244
244 return shape; 245 return shape;
245 } 246 }
246 247
247 public void SetScale(float side) 248 public void SetScale(float side)
248 { 249 {
249 Scale = new LLVector3(side, side, side); 250 _scale = new LLVector3(side, side, side);
250 } 251 }
251 252
252 public void SetHeigth(float heigth) 253 public void SetHeigth(float heigth)
253 { 254 {
254 Scale.Z = heigth; 255 _scale.Z = heigth;
255 } 256 }
256 257
257 public void SetRadius(float radius) 258 public void SetRadius(float radius)
258 { 259 {
259 Scale.X = Scale.Y = radius * 2f; 260 _scale.X = _scale.Y = radius * 2f;
260 } 261 }
261 262
262 // TODO: void returns need to change of course 263 // TODO: void returns need to change of course
@@ -281,20 +282,20 @@ namespace OpenSim.Framework
281 282
282 public void SetPathRange(LLVector3 pathRange) 283 public void SetPathRange(LLVector3 pathRange)
283 { 284 {
284 PathBegin = LLObject.PackBeginCut(pathRange.X); 285 _pathBegin = LLObject.PackBeginCut(pathRange.X);
285 PathEnd = LLObject.PackEndCut(pathRange.Y); 286 _pathEnd = LLObject.PackEndCut(pathRange.Y);
286 } 287 }
287 288
288 public void SetSculptData(byte sculptType, LLUUID SculptTextureUUID) 289 public void SetSculptData(byte sculptType, LLUUID SculptTextureUUID)
289 { 290 {
290 SculptType = sculptType; 291 _sculptType = sculptType;
291 SculptTexture = SculptTextureUUID; 292 _sculptTexture = SculptTextureUUID;
292 } 293 }
293 294
294 public void SetProfileRange(LLVector3 profileRange) 295 public void SetProfileRange(LLVector3 profileRange)
295 { 296 {
296 ProfileBegin = LLObject.PackBeginCut(profileRange.X); 297 _profileBegin = LLObject.PackBeginCut(profileRange.X);
297 ProfileEnd = LLObject.PackEndCut(profileRange.Y); 298 _profileEnd = LLObject.PackEndCut(profileRange.Y);
298 } 299 }
299 300
300 public byte[] ExtraParams 301 public byte[] ExtraParams
@@ -309,6 +310,231 @@ namespace OpenSim.Framework
309 } 310 }
310 } 311 }
311 312
313 public ushort PathBegin {
314 get {
315 return _pathBegin;
316 }
317 set {
318 _pathBegin = value;
319 }
320 }
321
322 public byte PathCurve {
323 get {
324 return _pathCurve;
325 }
326 set {
327 _pathCurve = value;
328 }
329 }
330
331 public ushort PathEnd {
332 get {
333 return _pathEnd;
334 }
335 set {
336 _pathEnd = value;
337 }
338 }
339
340 public sbyte PathRadiusOffset {
341 get {
342 return _pathRadiusOffset;
343 }
344 set {
345 _pathRadiusOffset = value;
346 }
347 }
348
349 public byte PathRevolutions {
350 get {
351 return _pathRevolutions;
352 }
353 set {
354 _pathRevolutions = value;
355 }
356 }
357
358 public byte PathScaleX {
359 get {
360 return _pathScaleX;
361 }
362 set {
363 _pathScaleX = value;
364 }
365 }
366
367 public byte PathScaleY {
368 get {
369 return _pathScaleY;
370 }
371 set {
372 _pathScaleY = value;
373 }
374 }
375
376 public byte PathShearX {
377 get {
378 return _pathShearX;
379 }
380 set {
381 _pathShearX = value;
382 }
383 }
384
385 public byte PathShearY {
386 get {
387 return _pathShearY;
388 }
389 set {
390 _pathShearY = value;
391 }
392 }
393
394 public sbyte PathSkew {
395 get {
396 return _pathSkew;
397 }
398 set {
399 _pathSkew = value;
400 }
401 }
402
403 public sbyte PathTaperX {
404 get {
405 return _pathTaperX;
406 }
407 set {
408 _pathTaperX = value;
409 }
410 }
411
412 public sbyte PathTaperY {
413 get {
414 return _pathTaperY;
415 }
416 set {
417 _pathTaperY = value;
418 }
419 }
420
421 public sbyte PathTwist {
422 get {
423 return _pathTwist;
424 }
425 set {
426 _pathTwist = value;
427 }
428 }
429
430 public sbyte PathTwistBegin {
431 get {
432 return _pathTwistBegin;
433 }
434 set {
435 _pathTwistBegin = value;
436 }
437 }
438
439 public byte PCode {
440 get {
441 return _pCode;
442 }
443 set {
444 _pCode = value;
445 }
446 }
447
448 public ushort ProfileBegin {
449 get {
450 return _profileBegin;
451 }
452 set {
453 _profileBegin = value;
454 }
455 }
456
457 public ushort ProfileEnd {
458 get {
459 return _profileEnd;
460 }
461 set {
462 _profileEnd = value;
463 }
464 }
465
466 public ushort ProfileHollow {
467 get {
468 return _profileHollow;
469 }
470 set {
471 _profileHollow = value;
472 }
473 }
474
475 public LLVector3 Scale {
476 get {
477 return _scale;
478 }
479 set {
480 _scale = value;
481 }
482 }
483
484 public byte State {
485 get {
486 return _state;
487 }
488 set {
489 _state = value;
490 }
491 }
492
493 public ProfileShape ProfileShape {
494 get {
495 return _profileShape;
496 }
497 set {
498 _profileShape = value;
499 }
500 }
501
502 public HollowShape HollowShape {
503 get {
504 return _hollowShape;
505 }
506 set {
507 _hollowShape = value;
508 }
509 }
510
511 public LLUUID SculptTexture {
512 get {
513 return _sculptTexture;
514 }
515 set {
516 _sculptTexture = value;
517 }
518 }
519
520 public byte SculptType {
521 get {
522 return _sculptType;
523 }
524 set {
525 _sculptType = value;
526 }
527 }
528
529 public byte[] SculptData {
530 get {
531 return _sculptData;
532 }
533 set {
534 _sculptData = value;
535 }
536 }
537
312 public byte[] ExtraParamsToBytes() 538 public byte[] ExtraParamsToBytes()
313 { 539 {
314 ushort FlexiEP = 0x10; 540 ushort FlexiEP = 0x10;
@@ -519,11 +745,11 @@ namespace OpenSim.Framework
519 745
520 if (SculptEntry) 746 if (SculptEntry)
521 { 747 {
522 if (SculptType != (byte)1 && SculptType != (byte)2 && SculptType != (byte)3 && SculptType != (byte)4) 748 if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
523 SculptType = 4; 749 _sculptType = 4;
524 } 750 }
525 SculptTexture = SculptUUID; 751 _sculptTexture = SculptUUID;
526 SculptType = SculptTypel; 752 _sculptType = SculptTypel;
527 //m_log.Info("[SCULPT]:" + SculptUUID.ToString()); 753 //m_log.Info("[SCULPT]:" + SculptUUID.ToString());
528 } 754 }
529 755
@@ -531,8 +757,8 @@ namespace OpenSim.Framework
531 { 757 {
532 byte[] data = new byte[17]; 758 byte[] data = new byte[17];
533 759
534 SculptTexture.GetBytes().CopyTo(data, 0); 760 _sculptTexture.GetBytes().CopyTo(data, 0);
535 data[16] = (byte)SculptType; 761 data[16] = (byte)_sculptType;
536 762
537 return data; 763 return data;
538 } 764 }