aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PrimitiveBaseShape.cs
diff options
context:
space:
mode:
authorSean Dague2008-07-16 14:41:53 +0000
committerSean Dague2008-07-16 14:41:53 +0000
commite2d02cbf6528d03ced9ba9a0c1cb52e7bb84cc04 (patch)
tree5b9fb6fc5a9b4c5fa8d1de1a4df03428cba7c0ee /OpenSim/Framework/PrimitiveBaseShape.cs
parentrefactoring primitive base shape to use properties (diff)
downloadopensim-SC_OLD-e2d02cbf6528d03ced9ba9a0c1cb52e7bb84cc04.zip
opensim-SC_OLD-e2d02cbf6528d03ced9ba9a0c1cb52e7bb84cc04.tar.gz
opensim-SC_OLD-e2d02cbf6528d03ced9ba9a0c1cb52e7bb84cc04.tar.bz2
opensim-SC_OLD-e2d02cbf6528d03ced9ba9a0c1cb52e7bb84cc04.tar.xz
further property refactoring of PrimitiveBaseShape
Diffstat (limited to 'OpenSim/Framework/PrimitiveBaseShape.cs')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs337
1 files changed, 254 insertions, 83 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 2b023cd..2811615 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -107,27 +107,27 @@ namespace OpenSim.Framework
107 [XmlIgnore] public byte[] _sculptData = new byte[0]; 107 [XmlIgnore] public byte[] _sculptData = new byte[0];
108 108
109 // Flexi 109 // Flexi
110 [XmlIgnore] public int FlexiSoftness = 0; 110 [XmlIgnore] public int _flexiSoftness = 0;
111 [XmlIgnore] public float FlexiTension = 0f; 111 [XmlIgnore] public float _flexiTension = 0f;
112 [XmlIgnore] public float FlexiDrag = 0f; 112 [XmlIgnore] public float _flexiDrag = 0f;
113 [XmlIgnore] public float FlexiGravity = 0f; 113 [XmlIgnore] public float _flexiGravity = 0f;
114 [XmlIgnore] public float FlexiWind = 0f; 114 [XmlIgnore] public float _flexiWind = 0f;
115 [XmlIgnore] public float FlexiForceX = 0f; 115 [XmlIgnore] public float _flexiForceX = 0f;
116 [XmlIgnore] public float FlexiForceY = 0f; 116 [XmlIgnore] public float _flexiForceY = 0f;
117 [XmlIgnore] public float FlexiForceZ = 0f; 117 [XmlIgnore] public float _flexiForceZ = 0f;
118 118
119 //Bright n sparkly 119 //Bright n sparkly
120 [XmlIgnore] public float LightColorR = 0f; 120 [XmlIgnore] public float _lightColorR = 0f;
121 [XmlIgnore] public float LightColorG = 0f; 121 [XmlIgnore] public float _lightColorG = 0f;
122 [XmlIgnore] public float LightColorB = 0f; 122 [XmlIgnore] public float _lightColorB = 0f;
123 [XmlIgnore] public float LightColorA = 1f; 123 [XmlIgnore] public float _lightColorA = 1f;
124 [XmlIgnore] public float LightRadius = 0f; 124 [XmlIgnore] public float _lightRadius = 0f;
125 [XmlIgnore] public float LightCutoff = 0f; 125 [XmlIgnore] public float _lightCutoff = 0f;
126 [XmlIgnore] public float LightFalloff = 0f; 126 [XmlIgnore] public float _lightFalloff = 0f;
127 [XmlIgnore] public float LightIntensity = 1f; 127 [XmlIgnore] public float _lightIntensity = 1f;
128 [XmlIgnore] public bool FlexiEntry = false; 128 [XmlIgnore] public bool _flexiEntry = false;
129 [XmlIgnore] public bool LightEntry = false; 129 [XmlIgnore] public bool _lightEntry = false;
130 [XmlIgnore] public bool SculptEntry = false; 130 [XmlIgnore] public bool _sculptEntry = false;
131 131
132 public byte ProfileCurve 132 public byte ProfileCurve
133 { 133 {
@@ -535,6 +535,177 @@ namespace OpenSim.Framework
535 } 535 }
536 } 536 }
537 537
538 public int FlexiSoftness {
539 get {
540 return _flexiSoftness;
541 }
542 set {
543 _flexiSoftness = value;
544 }
545 }
546
547 public float FlexiTension {
548 get {
549 return _flexiTension;
550 }
551 set {
552 _flexiTension = value;
553 }
554 }
555
556 public float FlexiDrag {
557 get {
558 return _flexiDrag;
559 }
560 set {
561 _flexiDrag = value;
562 }
563 }
564
565 public float FlexiGravity {
566 get {
567 return _flexiGravity;
568 }
569 set {
570 _flexiGravity = value;
571 }
572 }
573
574 public float FlexiWind {
575 get {
576 return _flexiWind;
577 }
578 set {
579 _flexiWind = value;
580 }
581 }
582
583 public float FlexiForceX {
584 get {
585 return _flexiForceX;
586 }
587 set {
588 _flexiForceX = value;
589 }
590 }
591
592 public float FlexiForceY {
593 get {
594 return _flexiForceY;
595 }
596 set {
597 _flexiForceY = value;
598 }
599 }
600
601 public float FlexiForceZ {
602 get {
603 return _flexiForceZ;
604 }
605 set {
606 _flexiForceZ = value;
607 }
608 }
609
610 public float LightColorR {
611 get {
612 return _lightColorR;
613 }
614 set {
615 _lightColorR = value;
616 }
617 }
618
619 public float LightColorG {
620 get {
621 return _lightColorG;
622 }
623 set {
624 _lightColorG = value;
625 }
626 }
627
628 public float LightColorB {
629 get {
630 return _lightColorB;
631 }
632 set {
633 _lightColorB = value;
634 }
635 }
636
637 public float LightColorA {
638 get {
639 return _lightColorA;
640 }
641 set {
642 _lightColorA = value;
643 }
644 }
645
646 public float LightRadius {
647 get {
648 return _lightRadius;
649 }
650 set {
651 _lightRadius = value;
652 }
653 }
654
655 public float LightCutoff {
656 get {
657 return _lightCutoff;
658 }
659 set {
660 _lightCutoff = value;
661 }
662 }
663
664 public float LightFalloff {
665 get {
666 return _lightFalloff;
667 }
668 set {
669 _lightFalloff = value;
670 }
671 }
672
673 public float LightIntensity {
674 get {
675 return _lightIntensity;
676 }
677 set {
678 _lightIntensity = value;
679 }
680 }
681
682 public bool FlexiEntry {
683 get {
684 return _flexiEntry;
685 }
686 set {
687 _flexiEntry = value;
688 }
689 }
690
691 public bool LightEntry {
692 get {
693 return _lightEntry;
694 }
695 set {
696 _lightEntry = value;
697 }
698 }
699
700 public bool SculptEntry {
701 get {
702 return _sculptEntry;
703 }
704 set {
705 _sculptEntry = value;
706 }
707 }
708
538 public byte[] ExtraParamsToBytes() 709 public byte[] ExtraParamsToBytes()
539 { 710 {
540 ushort FlexiEP = 0x10; 711 ushort FlexiEP = 0x10;
@@ -545,19 +716,19 @@ namespace OpenSim.Framework
545 uint TotalBytesLength = 1; // ExtraParamsNum 716 uint TotalBytesLength = 1; // ExtraParamsNum
546 717
547 uint ExtraParamsNum = 0; 718 uint ExtraParamsNum = 0;
548 if (FlexiEntry) 719 if (_flexiEntry)
549 { 720 {
550 ExtraParamsNum++; 721 ExtraParamsNum++;
551 TotalBytesLength += 16;// data 722 TotalBytesLength += 16;// data
552 TotalBytesLength += 2 + 4; // type 723 TotalBytesLength += 2 + 4; // type
553 } 724 }
554 if (LightEntry) 725 if (_lightEntry)
555 { 726 {
556 ExtraParamsNum++; 727 ExtraParamsNum++;
557 TotalBytesLength += 16;// data 728 TotalBytesLength += 16;// data
558 TotalBytesLength += 2 + 4; // type 729 TotalBytesLength += 2 + 4; // type
559 } 730 }
560 if (SculptEntry) 731 if (_sculptEntry)
561 { 732 {
562 ExtraParamsNum++; 733 ExtraParamsNum++;
563 TotalBytesLength += 17;// data 734 TotalBytesLength += 17;// data
@@ -572,7 +743,7 @@ namespace OpenSim.Framework
572 // Stick in the number of parameters 743 // Stick in the number of parameters
573 returnbytes[i++] = (byte)ExtraParamsNum; 744 returnbytes[i++] = (byte)ExtraParamsNum;
574 745
575 if (FlexiEntry) 746 if (_flexiEntry)
576 { 747 {
577 byte[] FlexiData = GetFlexiBytes(); 748 byte[] FlexiData = GetFlexiBytes();
578 749
@@ -586,7 +757,7 @@ namespace OpenSim.Framework
586 Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length); 757 Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length);
587 i += FlexiData.Length; 758 i += FlexiData.Length;
588 } 759 }
589 if (LightEntry) 760 if (_lightEntry)
590 { 761 {
591 byte[] LightData = GetLightBytes(); 762 byte[] LightData = GetLightBytes();
592 763
@@ -600,7 +771,7 @@ namespace OpenSim.Framework
600 Array.Copy(LightData, 0, returnbytes, i, LightData.Length); 771 Array.Copy(LightData, 0, returnbytes, i, LightData.Length);
601 i += LightData.Length; 772 i += LightData.Length;
602 } 773 }
603 if (SculptEntry) 774 if (_sculptEntry)
604 { 775 {
605 byte[] SculptData = GetSculptBytes(); 776 byte[] SculptData = GetSculptBytes();
606 777
@@ -615,7 +786,7 @@ namespace OpenSim.Framework
615 i += SculptData.Length; 786 i += SculptData.Length;
616 } 787 }
617 788
618 if (!FlexiEntry && !LightEntry && !SculptEntry) 789 if (!_flexiEntry && !_lightEntry && !_sculptEntry)
619 { 790 {
620 byte[] returnbyte = new byte[1]; 791 byte[] returnbyte = new byte[1];
621 returnbyte[0] = 0; 792 returnbyte[0] = 0;
@@ -639,7 +810,7 @@ namespace OpenSim.Framework
639 case FlexiEP: 810 case FlexiEP:
640 if (!inUse) 811 if (!inUse)
641 { 812 {
642 FlexiEntry = false; 813 _flexiEntry = false;
643 return; 814 return;
644 } 815 }
645 ReadFlexiData(data, 0); 816 ReadFlexiData(data, 0);
@@ -648,7 +819,7 @@ namespace OpenSim.Framework
648 case LightEP: 819 case LightEP:
649 if (!inUse) 820 if (!inUse)
650 { 821 {
651 LightEntry = false; 822 _lightEntry = false;
652 return; 823 return;
653 } 824 }
654 ReadLightData(data, 0); 825 ReadLightData(data, 0);
@@ -657,7 +828,7 @@ namespace OpenSim.Framework
657 case SculptEP: 828 case SculptEP:
658 if (!inUse) 829 if (!inUse)
659 { 830 {
660 SculptEntry = false; 831 _sculptEntry = false;
661 return; 832 return;
662 } 833 }
663 ReadSculptData(data, 0); 834 ReadSculptData(data, 0);
@@ -714,11 +885,11 @@ namespace OpenSim.Framework
714 } 885 }
715 886
716 if (!lGotFlexi) 887 if (!lGotFlexi)
717 FlexiEntry = false; 888 _flexiEntry = false;
718 if (!lGotLight) 889 if (!lGotLight)
719 LightEntry = false; 890 _lightEntry = false;
720 if (!lGotSculpt) 891 if (!lGotSculpt)
721 SculptEntry = false; 892 _sculptEntry = false;
722 893
723 } 894 }
724 895
@@ -730,7 +901,7 @@ namespace OpenSim.Framework
730 901
731 if (data.Length+pos >= 17) 902 if (data.Length+pos >= 17)
732 { 903 {
733 SculptEntry = true; 904 _sculptEntry = true;
734 SculptTextureUUID = new byte[16]; 905 SculptTextureUUID = new byte[16];
735 SculptTypel = data[16 + pos]; 906 SculptTypel = data[16 + pos];
736 Array.Copy(data, pos, SculptTextureUUID,0, 16); 907 Array.Copy(data, pos, SculptTextureUUID,0, 16);
@@ -738,12 +909,12 @@ namespace OpenSim.Framework
738 } 909 }
739 else 910 else
740 { 911 {
741 SculptEntry = false; 912 _sculptEntry = false;
742 SculptUUID = LLUUID.Zero; 913 SculptUUID = LLUUID.Zero;
743 SculptTypel = 0x00; 914 SculptTypel = 0x00;
744 } 915 }
745 916
746 if (SculptEntry) 917 if (_sculptEntry)
747 { 918 {
748 if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4) 919 if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
749 _sculptType = 4; 920 _sculptType = 4;
@@ -767,30 +938,30 @@ namespace OpenSim.Framework
767 { 938 {
768 if (data.Length-pos >= 16) 939 if (data.Length-pos >= 16)
769 { 940 {
770 FlexiEntry = true; 941 _flexiEntry = true;
771 FlexiSoftness = ((data[pos] & 0x80) >> 6) | ((data[pos + 1] & 0x80) >> 7); 942 _flexiSoftness = ((data[pos] & 0x80) >> 6) | ((data[pos + 1] & 0x80) >> 7);
772 943
773 FlexiTension = (float)(data[pos++] & 0x7F) / 10.0f; 944 _flexiTension = (float)(data[pos++] & 0x7F) / 10.0f;
774 FlexiDrag = (float)(data[pos++] & 0x7F) / 10.0f; 945 _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f;
775 FlexiGravity = (float)(data[pos++] / 10.0f) - 10.0f; 946 _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f;
776 FlexiWind = (float)data[pos++] / 10.0f; 947 _flexiWind = (float)data[pos++] / 10.0f;
777 LLVector3 lForce = new LLVector3(data, pos); 948 LLVector3 lForce = new LLVector3(data, pos);
778 FlexiForceX = lForce.X; 949 _flexiForceX = lForce.X;
779 FlexiForceY = lForce.Y; 950 _flexiForceY = lForce.Y;
780 FlexiForceZ = lForce.Z; 951 _flexiForceZ = lForce.Z;
781 } 952 }
782 else 953 else
783 { 954 {
784 FlexiEntry = false; 955 _flexiEntry = false;
785 FlexiSoftness = 0; 956 _flexiSoftness = 0;
786 957
787 FlexiTension = 0.0f; 958 _flexiTension = 0.0f;
788 FlexiDrag = 0.0f; 959 _flexiDrag = 0.0f;
789 FlexiGravity = 0.0f; 960 _flexiGravity = 0.0f;
790 FlexiWind = 0.0f; 961 _flexiWind = 0.0f;
791 FlexiForceX = 0f; 962 _flexiForceX = 0f;
792 FlexiForceY = 0f; 963 _flexiForceY = 0f;
793 FlexiForceZ = 0f; 964 _flexiForceZ = 0f;
794 } 965 }
795 } 966 }
796 967
@@ -800,14 +971,14 @@ namespace OpenSim.Framework
800 int i = 0; 971 int i = 0;
801 972
802 // Softness is packed in the upper bits of tension and drag 973 // Softness is packed in the upper bits of tension and drag
803 data[i] = (byte)((FlexiSoftness & 2) << 6); 974 data[i] = (byte)((_flexiSoftness & 2) << 6);
804 data[i + 1] = (byte)((FlexiSoftness & 1) << 7); 975 data[i + 1] = (byte)((_flexiSoftness & 1) << 7);
805 976
806 data[i++] |= (byte)((byte)(FlexiTension * 10.01f) & 0x7F); 977 data[i++] |= (byte)((byte)(_flexiTension * 10.01f) & 0x7F);
807 data[i++] |= (byte)((byte)(FlexiDrag * 10.01f) & 0x7F); 978 data[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F);
808 data[i++] = (byte)((FlexiGravity + 10.0f) * 10.01f); 979 data[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f);
809 data[i++] = (byte)(FlexiWind * 10.01f); 980 data[i++] = (byte)(_flexiWind * 10.01f);
810 LLVector3 lForce = new LLVector3(FlexiForceX, FlexiForceY, FlexiForceZ); 981 LLVector3 lForce = new LLVector3(_flexiForceX, _flexiForceY, _flexiForceZ);
811 lForce.GetBytes().CopyTo(data, i); 982 lForce.GetBytes().CopyTo(data, i);
812 983
813 return data; 984 return data;
@@ -817,29 +988,29 @@ namespace OpenSim.Framework
817 { 988 {
818 if (data.Length - pos >= 16) 989 if (data.Length - pos >= 16)
819 { 990 {
820 LightEntry = true; 991 _lightEntry = true;
821 LLColor lColor = new LLColor(data, pos, false); 992 LLColor lColor = new LLColor(data, pos, false);
822 LightIntensity = lColor.A; 993 _lightIntensity = lColor.A;
823 LightColorA = 1f; 994 _lightColorA = 1f;
824 LightColorR = lColor.R; 995 _lightColorR = lColor.R;
825 LightColorG = lColor.G; 996 _lightColorG = lColor.G;
826 LightColorB = lColor.B; 997 _lightColorB = lColor.B;
827 998
828 LightRadius = Helpers.BytesToFloat(data, pos + 4); 999 _lightRadius = Helpers.BytesToFloat(data, pos + 4);
829 LightCutoff = Helpers.BytesToFloat(data, pos + 8); 1000 _lightCutoff = Helpers.BytesToFloat(data, pos + 8);
830 LightFalloff = Helpers.BytesToFloat(data, pos + 12); 1001 _lightFalloff = Helpers.BytesToFloat(data, pos + 12);
831 } 1002 }
832 else 1003 else
833 { 1004 {
834 LightEntry = false; 1005 _lightEntry = false;
835 LightColorA = 1f; 1006 _lightColorA = 1f;
836 LightColorR = 0f; 1007 _lightColorR = 0f;
837 LightColorG = 0f; 1008 _lightColorG = 0f;
838 LightColorB = 0f; 1009 _lightColorB = 0f;
839 LightRadius = 0f; 1010 _lightRadius = 0f;
840 LightCutoff = 0f; 1011 _lightCutoff = 0f;
841 LightFalloff = 0f; 1012 _lightFalloff = 0f;
842 LightIntensity = 0f; 1013 _lightIntensity = 0f;
843 } 1014 }
844 } 1015 }
845 1016
@@ -848,12 +1019,12 @@ namespace OpenSim.Framework
848 byte[] data = new byte[16]; 1019 byte[] data = new byte[16];
849 1020
850 // Alpha channel in color is intensity 1021 // Alpha channel in color is intensity
851 LLColor tmpColor = new LLColor(LightColorR,LightColorG,LightColorB,LightIntensity); 1022 LLColor tmpColor = new LLColor(_lightColorR,_lightColorG,_lightColorB,_lightIntensity);
852 1023
853 tmpColor.GetBytes().CopyTo(data, 0); 1024 tmpColor.GetBytes().CopyTo(data, 0);
854 Helpers.FloatToBytes(LightRadius).CopyTo(data, 4); 1025 Helpers.FloatToBytes(_lightRadius).CopyTo(data, 4);
855 Helpers.FloatToBytes(LightCutoff).CopyTo(data, 8); 1026 Helpers.FloatToBytes(_lightCutoff).CopyTo(data, 8);
856 Helpers.FloatToBytes(LightFalloff).CopyTo(data, 12); 1027 Helpers.FloatToBytes(_lightFalloff).CopyTo(data, 12);
857 1028
858 return data; 1029 return data;
859 } 1030 }