aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/PrimitiveBaseShape.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/General/PrimitiveBaseShape.cs')
-rw-r--r--OpenSim/Framework/General/PrimitiveBaseShape.cs426
1 files changed, 213 insertions, 213 deletions
diff --git a/OpenSim/Framework/General/PrimitiveBaseShape.cs b/OpenSim/Framework/General/PrimitiveBaseShape.cs
index 2123ecb..5cdbfb2 100644
--- a/OpenSim/Framework/General/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/General/PrimitiveBaseShape.cs
@@ -1,214 +1,214 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Xml.Serialization; 29using System.Xml.Serialization;
30using libsecondlife; 30using libsecondlife;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 public enum ProfileShape : byte 34 public enum ProfileShape : byte
35 { 35 {
36 Circle = 0, 36 Circle = 0,
37 Square = 1, 37 Square = 1,
38 IsometricTriangle = 2, 38 IsometricTriangle = 2,
39 EquilateralTriangle = 3, 39 EquilateralTriangle = 3,
40 RightTriangle = 4, 40 RightTriangle = 4,
41 HalfCircle = 5 41 HalfCircle = 5
42 } 42 }
43 43
44 public enum HollowShape : byte 44 public enum HollowShape : byte
45 { 45 {
46 Same = 0, 46 Same = 0,
47 Circle = 16, 47 Circle = 16,
48 Square = 32, 48 Square = 32,
49 Triangle = 48 49 Triangle = 48
50 } 50 }
51 51
52 public enum PCodeEnum : byte 52 public enum PCodeEnum : byte
53 { 53 {
54 Primitive = 9, 54 Primitive = 9,
55 Avatar = 47 55 Avatar = 47
56 } 56 }
57 57
58 public enum Extrusion : byte 58 public enum Extrusion : byte
59 { 59 {
60 Straight = 16, 60 Straight = 16,
61 Curve1 = 32, 61 Curve1 = 32,
62 Curve2 = 48, 62 Curve2 = 48,
63 Flexible = 128 63 Flexible = 128
64 } 64 }
65 65
66 public class PrimitiveBaseShape 66 public class PrimitiveBaseShape
67 { 67 {
68 private static byte[] m_defaultTextureEntry; 68 private static byte[] m_defaultTextureEntry;
69 69
70 public byte PCode; 70 public byte PCode;
71 public ushort PathBegin; 71 public ushort PathBegin;
72 public ushort PathEnd; 72 public ushort PathEnd;
73 public byte PathScaleX; 73 public byte PathScaleX;
74 public byte PathScaleY; 74 public byte PathScaleY;
75 public byte PathShearX; 75 public byte PathShearX;
76 public byte PathShearY; 76 public byte PathShearY;
77 public sbyte PathSkew; 77 public sbyte PathSkew;
78 public ushort ProfileBegin; 78 public ushort ProfileBegin;
79 public ushort ProfileEnd; 79 public ushort ProfileEnd;
80 public LLVector3 Scale; 80 public LLVector3 Scale;
81 public byte PathCurve; 81 public byte PathCurve;
82 public byte ProfileCurve; 82 public byte ProfileCurve;
83 public ushort ProfileHollow; 83 public ushort ProfileHollow;
84 public sbyte PathRadiusOffset; 84 public sbyte PathRadiusOffset;
85 public byte PathRevolutions; 85 public byte PathRevolutions;
86 public sbyte PathTaperX; 86 public sbyte PathTaperX;
87 public sbyte PathTaperY; 87 public sbyte PathTaperY;
88 public sbyte PathTwist; 88 public sbyte PathTwist;
89 public sbyte PathTwistBegin; 89 public sbyte PathTwistBegin;
90 public byte[] TextureEntry; // a LL textureEntry in byte[] format 90 public byte[] TextureEntry; // a LL textureEntry in byte[] format
91 public byte[] ExtraParams; 91 public byte[] ExtraParams;
92 92
93 public ProfileShape ProfileShape 93 public ProfileShape ProfileShape
94 { 94 {
95 get { return (ProfileShape) (ProfileCurve & 0xf); } 95 get { return (ProfileShape) (ProfileCurve & 0xf); }
96 set 96 set
97 { 97 {
98 byte oldValueMasked = (byte) (ProfileCurve & 0xf0); 98 byte oldValueMasked = (byte) (ProfileCurve & 0xf0);
99 ProfileCurve = (byte) (oldValueMasked | (byte) value); 99 ProfileCurve = (byte) (oldValueMasked | (byte) value);
100 } 100 }
101 } 101 }
102 102
103 [XmlIgnore] 103 [XmlIgnore]
104 public HollowShape HollowShape 104 public HollowShape HollowShape
105 { 105 {
106 get { return (HollowShape) (ProfileHollow & 0xf0); } 106 get { return (HollowShape) (ProfileHollow & 0xf0); }
107 set 107 set
108 { 108 {
109 byte oldValueMasked = (byte) (ProfileHollow & 0xf0); 109 byte oldValueMasked = (byte) (ProfileHollow & 0xf0);
110 ProfileHollow = (byte) (oldValueMasked | (byte) value); 110 ProfileHollow = (byte) (oldValueMasked | (byte) value);
111 } 111 }
112 } 112 }
113 113
114 public LLVector3 PrimScale 114 public LLVector3 PrimScale
115 { 115 {
116 get { return Scale; } 116 get { return Scale; }
117 } 117 }
118 118
119 static PrimitiveBaseShape() 119 static PrimitiveBaseShape()
120 { 120 {
121 m_defaultTextureEntry = 121 m_defaultTextureEntry =
122 new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); 122 new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes();
123 } 123 }
124 124
125 public PrimitiveBaseShape() 125 public PrimitiveBaseShape()
126 { 126 {
127 PCode = (byte) PCodeEnum.Primitive; 127 PCode = (byte) PCodeEnum.Primitive;
128 ExtraParams = new byte[1]; 128 ExtraParams = new byte[1];
129 TextureEntry = m_defaultTextureEntry; 129 TextureEntry = m_defaultTextureEntry;
130 } 130 }
131 131
132 //void returns need to change of course 132 //void returns need to change of course
133 public virtual void GetMesh() 133 public virtual void GetMesh()
134 { 134 {
135 } 135 }
136 136
137 public PrimitiveBaseShape Copy() 137 public PrimitiveBaseShape Copy()
138 { 138 {
139 return (PrimitiveBaseShape) MemberwiseClone(); 139 return (PrimitiveBaseShape) MemberwiseClone();
140 } 140 }
141 } 141 }
142 142
143 public class GenericShape : PrimitiveBaseShape 143 public class GenericShape : PrimitiveBaseShape
144 { 144 {
145 public GenericShape() 145 public GenericShape()
146 : base() 146 : base()
147 { 147 {
148 } 148 }
149 } 149 }
150 150
151 public class BoxShape : PrimitiveBaseShape 151 public class BoxShape : PrimitiveBaseShape
152 { 152 {
153 public BoxShape() 153 public BoxShape()
154 : base() 154 : base()
155 { 155 {
156 PathCurve = (byte) Extrusion.Straight; 156 PathCurve = (byte) Extrusion.Straight;
157 ProfileShape = ProfileShape.Square; 157 ProfileShape = ProfileShape.Square;
158 PathScaleX = 100; 158 PathScaleX = 100;
159 PathScaleY = 100; 159 PathScaleY = 100;
160 } 160 }
161 161
162 public BoxShape(float side) 162 public BoxShape(float side)
163 : this() 163 : this()
164 { 164 {
165 SetSide(side); 165 SetSide(side);
166 } 166 }
167 167
168 public void SetSide(float side) 168 public void SetSide(float side)
169 { 169 {
170 Scale = new LLVector3(side, side, side); 170 Scale = new LLVector3(side, side, side);
171 } 171 }
172 172
173 public static BoxShape Default 173 public static BoxShape Default
174 { 174 {
175 get 175 get
176 { 176 {
177 BoxShape boxShape = new BoxShape(); 177 BoxShape boxShape = new BoxShape();
178 178
179 boxShape.SetSide(0.5f); 179 boxShape.SetSide(0.5f);
180 180
181 return boxShape; 181 return boxShape;
182 } 182 }
183 } 183 }
184 } 184 }
185 185
186 public class CylinderShape : PrimitiveBaseShape 186 public class CylinderShape : PrimitiveBaseShape
187 { 187 {
188 public CylinderShape() 188 public CylinderShape()
189 : base() 189 : base()
190 { 190 {
191 PathCurve = (byte) Extrusion.Straight; 191 PathCurve = (byte) Extrusion.Straight;
192 ProfileShape = ProfileShape.Circle; 192 ProfileShape = ProfileShape.Circle;
193 PathScaleX = 100; 193 PathScaleX = 100;
194 PathScaleY = 100; 194 PathScaleY = 100;
195 } 195 }
196 196
197 public CylinderShape(float radius, float heigth) 197 public CylinderShape(float radius, float heigth)
198 : this() 198 : this()
199 { 199 {
200 SetRadius(radius); 200 SetRadius(radius);
201 SetHeigth(heigth); 201 SetHeigth(heigth);
202 } 202 }
203 203
204 private void SetHeigth(float heigth) 204 private void SetHeigth(float heigth)
205 { 205 {
206 Scale.Z = heigth; 206 Scale.Z = heigth;
207 } 207 }
208 208
209 private void SetRadius(float radius) 209 private void SetRadius(float radius)
210 { 210 {
211 Scale.X = Scale.Y = radius*2f; 211 Scale.X = Scale.Y = radius*2f;
212 } 212 }
213 } 213 }
214} \ No newline at end of file 214} \ No newline at end of file