aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PrimitiveBaseShape.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs108
1 files changed, 53 insertions, 55 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 91c589a..ff6b7f5 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -68,31 +68,46 @@ namespace OpenSim.Framework
68 public class PrimitiveBaseShape 68 public class PrimitiveBaseShape
69 { 69 {
70 private static readonly LLObject.TextureEntry m_defaultTexture; 70 private static readonly LLObject.TextureEntry m_defaultTexture;
71 public byte[] ExtraParams;
72 private byte[] m_textureEntry;
71 73
72 public byte State;
73 public byte PCode;
74 public ushort PathBegin; 74 public ushort PathBegin;
75 public byte PathCurve;
75 public ushort PathEnd; 76 public ushort PathEnd;
77 public sbyte PathRadiusOffset;
78 public byte PathRevolutions;
76 public byte PathScaleX; 79 public byte PathScaleX;
77 public byte PathScaleY; 80 public byte PathScaleY;
78 public byte PathShearX; 81 public byte PathShearX;
79 public byte PathShearY; 82 public byte PathShearY;
80 public sbyte PathSkew; 83 public sbyte PathSkew;
81 public ushort ProfileBegin;
82 public ushort ProfileEnd;
83 public LLVector3 Scale;
84 public byte PathCurve;
85
86 [XmlIgnore] // -- this one is re-constructed from ProfileShape and ProfileHollow
87 public byte ProfileCurve;
88
89 public ushort ProfileHollow;
90 public sbyte PathRadiusOffset;
91 public byte PathRevolutions;
92 public sbyte PathTaperX; 84 public sbyte PathTaperX;
93 public sbyte PathTaperY; 85 public sbyte PathTaperY;
94 public sbyte PathTwist; 86 public sbyte PathTwist;
95 public sbyte PathTwistBegin; 87 public sbyte PathTwistBegin;
88 public byte PCode;
89 public ushort ProfileBegin;
90
91 [XmlIgnore] // -- this one is re-constructed from ProfileShape and ProfileHollow
92 public byte ProfileCurve;
93
94 public ushort ProfileEnd;
95 public ushort ProfileHollow;
96 public LLVector3 Scale;
97 public byte State;
98
99 static PrimitiveBaseShape()
100 {
101 m_defaultTexture =
102 new LLObject.TextureEntry(new LLUUID("89556747-24cb-43ed-920b-47caed15465f"));
103 }
104
105 public PrimitiveBaseShape()
106 {
107 PCode = (byte) PCodeEnum.Primitive;
108 ExtraParams = new byte[1];
109 Textures = m_defaultTexture;
110 }
96 111
97 [XmlIgnore] 112 [XmlIgnore]
98 public LLObject.TextureEntry Textures 113 public LLObject.TextureEntry Textures
@@ -102,8 +117,6 @@ namespace OpenSim.Framework
102 set { m_textureEntry = value.ToBytes(); } 117 set { m_textureEntry = value.ToBytes(); }
103 } 118 }
104 119
105 private byte[] m_textureEntry;
106
107 public byte[] TextureEntry 120 public byte[] TextureEntry
108 { 121 {
109 get { return m_textureEntry; } 122 get { return m_textureEntry; }
@@ -111,25 +124,23 @@ namespace OpenSim.Framework
111 set { m_textureEntry = value; } 124 set { m_textureEntry = value; }
112 } 125 }
113 126
114 public byte[] ExtraParams;
115
116 public ProfileShape ProfileShape 127 public ProfileShape ProfileShape
117 { 128 {
118 get { return (ProfileShape)(ProfileCurve & 0xf); } 129 get { return (ProfileShape) (ProfileCurve & 0xf); }
119 set 130 set
120 { 131 {
121 byte oldValueMasked = (byte)(ProfileCurve & 0xf0); 132 byte oldValueMasked = (byte) (ProfileCurve & 0xf0);
122 ProfileCurve = (byte)(oldValueMasked | (byte)value); 133 ProfileCurve = (byte) (oldValueMasked | (byte) value);
123 } 134 }
124 } 135 }
125 136
126 public HollowShape HollowShape 137 public HollowShape HollowShape
127 { 138 {
128 get { return (HollowShape)(ProfileCurve & 0xf0); } 139 get { return (HollowShape) (ProfileCurve & 0xf0); }
129 set 140 set
130 { 141 {
131 byte oldValueMasked = (byte)(ProfileCurve & 0x0f); 142 byte oldValueMasked = (byte) (ProfileCurve & 0x0f);
132 ProfileCurve = (byte)(oldValueMasked | (byte)value); 143 ProfileCurve = (byte) (oldValueMasked | (byte) value);
133 } 144 }
134 } 145 }
135 146
@@ -138,20 +149,19 @@ namespace OpenSim.Framework
138 get { return Scale; } 149 get { return Scale; }
139 } 150 }
140 151
141 152 public static PrimitiveBaseShape Default
142 static PrimitiveBaseShape()
143 { 153 {
144 m_defaultTexture = 154 get
145 new LLObject.TextureEntry(new LLUUID("89556747-24cb-43ed-920b-47caed15465f")); 155 {
146 } 156 PrimitiveBaseShape boxShape = CreateBox();
147 157
148 public PrimitiveBaseShape() 158 boxShape.SetScale(0.5f);
149 { 159
150 PCode = (byte)PCodeEnum.Primitive; 160 return boxShape;
151 ExtraParams = new byte[1]; 161 }
152 Textures = m_defaultTexture;
153 } 162 }
154 163
164
155 public static PrimitiveBaseShape Create() 165 public static PrimitiveBaseShape Create()
156 { 166 {
157 PrimitiveBaseShape shape = new PrimitiveBaseShape(); 167 PrimitiveBaseShape shape = new PrimitiveBaseShape();
@@ -162,7 +172,7 @@ namespace OpenSim.Framework
162 { 172 {
163 PrimitiveBaseShape shape = Create(); 173 PrimitiveBaseShape shape = Create();
164 174
165 shape.PathCurve = (byte)Extrusion.Straight; 175 shape.PathCurve = (byte) Extrusion.Straight;
166 shape.ProfileShape = ProfileShape.Square; 176 shape.ProfileShape = ProfileShape.Square;
167 shape.PathScaleX = 100; 177 shape.PathScaleX = 100;
168 shape.PathScaleY = 100; 178 shape.PathScaleY = 100;
@@ -174,7 +184,7 @@ namespace OpenSim.Framework
174 { 184 {
175 PrimitiveBaseShape shape = Create(); 185 PrimitiveBaseShape shape = Create();
176 186
177 shape.PathCurve = (byte)Extrusion.Curve1; 187 shape.PathCurve = (byte) Extrusion.Curve1;
178 shape.ProfileShape = ProfileShape.Square; 188 shape.ProfileShape = ProfileShape.Square;
179 189
180 shape.PathScaleX = 100; 190 shape.PathScaleX = 100;
@@ -183,18 +193,6 @@ namespace OpenSim.Framework
183 return shape; 193 return shape;
184 } 194 }
185 195
186 public static PrimitiveBaseShape Default
187 {
188 get
189 {
190 PrimitiveBaseShape boxShape = CreateBox();
191
192 boxShape.SetScale(0.5f);
193
194 return boxShape;
195 }
196 }
197
198 public void SetScale(float side) 196 public void SetScale(float side)
199 { 197 {
200 Scale = new LLVector3(side, side, side); 198 Scale = new LLVector3(side, side, side);
@@ -207,7 +205,7 @@ namespace OpenSim.Framework
207 205
208 public void SetRadius(float radius) 206 public void SetRadius(float radius)
209 { 207 {
210 Scale.X = Scale.Y = radius * 2f; 208 Scale.X = Scale.Y = radius*2f;
211 } 209 }
212 210
213 //void returns need to change of course 211 //void returns need to change of course
@@ -217,29 +215,29 @@ namespace OpenSim.Framework
217 215
218 public PrimitiveBaseShape Copy() 216 public PrimitiveBaseShape Copy()
219 { 217 {
220 return (PrimitiveBaseShape)MemberwiseClone(); 218 return (PrimitiveBaseShape) MemberwiseClone();
221 } 219 }
222 220
223 public static PrimitiveBaseShape CreateCylinder(float radius, float heigth) 221 public static PrimitiveBaseShape CreateCylinder(float radius, float heigth)
224 { 222 {
225 PrimitiveBaseShape shape = CreateCylinder( ); 223 PrimitiveBaseShape shape = CreateCylinder();
226 224
227 shape.SetHeigth( heigth ); 225 shape.SetHeigth(heigth);
228 shape.SetRadius( radius ); 226 shape.SetRadius(radius);
229 227
230 return shape; 228 return shape;
231 } 229 }
232 230
233 public void SetPathRange( LLVector3 pathRange ) 231 public void SetPathRange(LLVector3 pathRange)
234 { 232 {
235 PathBegin = LLObject.PackBeginCut(pathRange.X); 233 PathBegin = LLObject.PackBeginCut(pathRange.X);
236 PathEnd = LLObject.PackEndCut(pathRange.Y); 234 PathEnd = LLObject.PackEndCut(pathRange.Y);
237 } 235 }
238 236
239 public void SetProfileRange( LLVector3 profileRange ) 237 public void SetProfileRange(LLVector3 profileRange)
240 { 238 {
241 ProfileBegin = LLObject.PackBeginCut(profileRange.X); 239 ProfileBegin = LLObject.PackBeginCut(profileRange.X);
242 ProfileEnd = LLObject.PackEndCut(profileRange.Y); 240 ProfileEnd = LLObject.PackEndCut(profileRange.Y);
243 } 241 }
244 } 242 }
245} 243} \ No newline at end of file