aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-12-28 08:34:38 +0000
committerlbsa712007-12-28 08:34:38 +0000
commit8cd72beb86d2a563bdaf88b20aa76d9bafa6b971 (patch)
tree8eaac3b70eb4b62db89cdfc7b854e85fa2430255
parent* Patch from Melanie. Thanks Melanie! (diff)
downloadopensim-SC-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.zip
opensim-SC-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.tar.gz
opensim-SC-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.tar.bz2
opensim-SC-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.tar.xz
* Moved PrimitiveBaseShape subclasses into factory methods - the subclassing scheme won't hold for serialization
* Extracted out the 'old' AddNewPrimitive that places an object at an exact pos, without the raytracing
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs4
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs106
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs65
-rw-r--r--OpenSim/Region/Examples/SimpleApp/ComplexObject.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs2
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs4
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs4
8 files changed, 91 insertions, 100 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index fcf8c6f..3c25533 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Framework.Data.MySQL
203 { 203 {
204 MainLog.Instance.Notice( 204 MainLog.Instance.Notice(
205 "No shape found for prim in storage, so setting default box shape"); 205 "No shape found for prim in storage, so setting default box shape");
206 prim.Shape = BoxShape.Default; 206 prim.Shape = PrimitiveBaseShape.Default;
207 } 207 }
208 group.AddPart(prim); 208 group.AddPart(prim);
209 group.RootPart = prim; 209 group.RootPart = prim;
@@ -223,7 +223,7 @@ namespace OpenSim.Framework.Data.MySQL
223 { 223 {
224 MainLog.Instance.Notice( 224 MainLog.Instance.Notice(
225 "No shape found for prim in storage, so setting default box shape"); 225 "No shape found for prim in storage, so setting default box shape");
226 prim.Shape = BoxShape.Default; 226 prim.Shape = PrimitiveBaseShape.Default;
227 } 227 }
228 createdObjects[new LLUUID(objID)].AddPart(prim); 228 createdObjects[new LLUUID(objID)].AddPart(prim);
229 } 229 }
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 66511e6..1424395 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -112,22 +112,22 @@ namespace OpenSim.Framework
112 112
113 public ProfileShape ProfileShape 113 public ProfileShape ProfileShape
114 { 114 {
115 get { return (ProfileShape) (ProfileCurve & 0xf); } 115 get { return (ProfileShape)(ProfileCurve & 0xf); }
116 set 116 set
117 { 117 {
118 byte oldValueMasked = (byte) (ProfileCurve & 0xf0); 118 byte oldValueMasked = (byte)(ProfileCurve & 0xf0);
119 ProfileCurve = (byte) (oldValueMasked | (byte) value); 119 ProfileCurve = (byte)(oldValueMasked | (byte)value);
120 } 120 }
121 } 121 }
122 122
123 [XmlIgnore] 123 [XmlIgnore]
124 public HollowShape HollowShape 124 public HollowShape HollowShape
125 { 125 {
126 get { return (HollowShape) (ProfileCurve & 0xf0); } 126 get { return (HollowShape)(ProfileCurve & 0xf0); }
127 set 127 set
128 { 128 {
129 byte oldValueMasked = (byte) (ProfileCurve & 0x0f); 129 byte oldValueMasked = (byte)(ProfileCurve & 0x0f);
130 ProfileCurve = (byte) (oldValueMasked | (byte) value); 130 ProfileCurve = (byte)(oldValueMasked | (byte)value);
131 } 131 }
132 } 132 }
133 133
@@ -145,7 +145,7 @@ namespace OpenSim.Framework
145 145
146 public PrimitiveBaseShape() 146 public PrimitiveBaseShape()
147 { 147 {
148 PCode = (byte) PCodeEnum.Primitive; 148 PCode = (byte)PCodeEnum.Primitive;
149 ExtraParams = new byte[1]; 149 ExtraParams = new byte[1];
150 Textures = m_defaultTexture; 150 Textures = m_defaultTexture;
151 } 151 }
@@ -156,86 +156,76 @@ namespace OpenSim.Framework
156 return shape; 156 return shape;
157 } 157 }
158 158
159 //void returns need to change of course 159 public static PrimitiveBaseShape CreateBox()
160 public virtual void GetMesh()
161 { 160 {
162 } 161 PrimitiveBaseShape shape = Create();
163 162
164 public PrimitiveBaseShape Copy() 163 shape.PathCurve = (byte)Extrusion.Straight;
165 { 164 shape.ProfileShape = ProfileShape.Square;
166 return (PrimitiveBaseShape) MemberwiseClone(); 165 shape.PathScaleX = 100;
167 } 166 shape.PathScaleY = 100;
168 }
169 167
170 public class GenericShape : PrimitiveBaseShape 168 return shape;
171 {
172 public GenericShape()
173 : base()
174 {
175 } 169 }
176 }
177 170
178 public class BoxShape : PrimitiveBaseShape 171 public static PrimitiveBaseShape CreateCylinder()
179 {
180 public BoxShape()
181 : base()
182 { 172 {
183 PathCurve = (byte) Extrusion.Straight; 173 PrimitiveBaseShape shape = Create();
184 ProfileShape = ProfileShape.Square;
185 PathScaleX = 100;
186 PathScaleY = 100;
187 }
188 174
189 public BoxShape(float side) 175 shape.PathCurve = (byte)Extrusion.Curve1;
190 : this() 176 shape.ProfileShape = ProfileShape.Square;
191 {
192 SetSide(side);
193 }
194 177
195 public void SetSide(float side) 178 shape.PathScaleX = 100;
196 { 179 shape.PathScaleY = 100;
197 Scale = new LLVector3(side, side, side); 180
181 return shape;
198 } 182 }
199 183
200 public static BoxShape Default 184 public static PrimitiveBaseShape Default
201 { 185 {
202 get 186 get
203 { 187 {
204 BoxShape boxShape = new BoxShape(); 188 PrimitiveBaseShape boxShape = CreateBox();
205 189
206 boxShape.SetSide(0.5f); 190 boxShape.SetScale(0.5f);
207 191
208 return boxShape; 192 return boxShape;
209 } 193 }
210 } 194 }
211 }
212 195
213 public class CylinderShape : PrimitiveBaseShape 196 public void SetScale(float side)
214 {
215 public CylinderShape()
216 : base()
217 { 197 {
218 PathCurve = (byte) Extrusion.Straight; 198 Scale = new LLVector3(side, side, side);
219 ProfileShape = ProfileShape.Circle;
220 PathScaleX = 100;
221 PathScaleY = 100;
222 } 199 }
223 200
224 public CylinderShape(float radius, float heigth) 201 public void SetHeigth(float heigth)
225 : this()
226 { 202 {
227 SetRadius(radius); 203 Scale.Z = heigth;
228 SetHeigth(heigth);
229 } 204 }
230 205
231 private void SetHeigth(float heigth) 206 public void SetRadius(float radius)
207 {
208 Scale.X = Scale.Y = radius * 2f;
209 }
210
211 //void returns need to change of course
212 public virtual void GetMesh()
232 { 213 {
233 Scale.Z = heigth;
234 } 214 }
235 215
236 private void SetRadius(float radius) 216 public PrimitiveBaseShape Copy()
237 { 217 {
238 Scale.X = Scale.Y = radius*2f; 218 return (PrimitiveBaseShape)MemberwiseClone();
219 }
220
221 public static PrimitiveBaseShape CreateCylinder(float radius, float heigth)
222 {
223 PrimitiveBaseShape shape = CreateCylinder( );
224
225 shape.SetHeigth( heigth );
226 shape.SetRadius( radius );
227
228 return shape;
239 } 229 }
240 } 230 }
241} 231}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 077157f..d8c5255 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1016,42 +1016,43 @@ namespace OpenSim.Region.Environment.Scenes
1016 // It's wrong many times though. 1016 // It's wrong many times though.
1017 1017
1018 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); 1018 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection);
1019
1020
1021
1022 1019
1023 if (PermissionsMngr.CanRezObject(ownerID, pos)) 1020 if (PermissionsMngr.CanRezObject(ownerID, pos))
1024 { 1021 {
1025 1022 // rez ON the ground, not IN the ground
1026 // rez ON the ground, not IN the ground
1027 pos.Z += 0.25F; 1023 pos.Z += 0.25F;
1028 1024
1029 1025 AddNewPrim(ownerID, pos, rot, shape);
1030 SceneObjectGroup sceneOb = 1026 }
1031 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); 1027 }
1032 AddEntity(sceneOb); 1028
1033 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 1029 public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
1034 // if grass or tree, make phantom 1030 {
1035 //rootPart.ApplySanePermissions(); 1031 SceneObjectGroup sceneOb =
1036 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) 1032 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
1037 { 1033
1038 rootPart.AddFlag(LLObject.ObjectFlags.Phantom); 1034 AddEntity(sceneOb);
1039 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 1035 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
1040 } 1036 // if grass or tree, make phantom
1041 // if not phantom, add to physics 1037 //rootPart.ApplySanePermissions();
1042 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 1038 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
1043 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 1039 {
1044 { 1040 rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
1045 rootPart.PhysActor = 1041 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
1046 PhysicsScene.AddPrimShape( 1042 }
1047 rootPart.Name, 1043 // if not phantom, add to physics
1048 rootPart.Shape, 1044 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
1049 new PhysicsVector(pos.X, pos.Y, pos.Z), 1045 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1050 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 1046 {
1051 new Quaternion(), UsePhysics); 1047 rootPart.PhysActor =
1052 // subscribe to physics events. 1048 PhysicsScene.AddPrimShape(
1053 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 1049 rootPart.Name,
1054 } 1050 rootPart.Shape,
1051 new PhysicsVector(pos.X, pos.Y, pos.Z),
1052 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
1053 new Quaternion(), UsePhysics);
1054 // subscribe to physics events.
1055 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1055 } 1056 }
1056 } 1057 }
1057 1058
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
index bfd9d06..06bcdec 100644
--- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
@@ -43,7 +43,7 @@ namespace SimpleApp
43 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, 43 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
44 LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) 44 LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection)
45 : base( 45 : base(
46 regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition 46 regionHandle, parent, ownerID, localID, PrimitiveBaseShape.CreateCylinder(0.5f, 0.2f), groupPosition, offsetPosition
47 ) 47 )
48 { 48 {
49 m_rotationDirection = rotationDirection; 49 m_rotationDirection = rotationDirection;
@@ -64,7 +64,7 @@ namespace SimpleApp
64 64
65 65
66 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) 66 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos)
67 : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default) 67 : base(scene, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default)
68 { 68 {
69 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); 69 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
70 70
diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
index cbc4dea..041050d 100644
--- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
@@ -39,7 +39,7 @@ namespace SimpleApp
39 private PerformanceCounter m_counter; 39 private PerformanceCounter m_counter;
40 40
41 public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) 41 public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos)
42 : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default) 42 : base(world, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default)
43 { 43 {
44 String objectName = "Processor"; 44 String objectName = "Processor";
45 String counterName = "% Processor Time"; 45 String counterName = "% Processor Time";
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
index 2d8441e..3fe15ff 100644
--- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
@@ -36,7 +36,7 @@ namespace SimpleApp
36 public class FileSystemObject : SceneObjectGroup 36 public class FileSystemObject : SceneObjectGroup
37 { 37 {
38 public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) 38 public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos)
39 : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) 39 : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, PrimitiveBaseShape.Default)
40 { 40 {
41 //float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5; 41 //float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5;
42 // rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); 42 // rootPrimitive.ResizeGoup(new LLVector3(size, size, size));
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
index 5818583..ac9b741 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
@@ -199,7 +199,7 @@ namespace OpenSim.DataStore.MSSQL
199 { 199 {
200 MainLog.Instance.Notice( 200 MainLog.Instance.Notice(
201 "No shape found for prim in storage, so setting default box shape"); 201 "No shape found for prim in storage, so setting default box shape");
202 prim.Shape = BoxShape.Default; 202 prim.Shape = PrimitiveBaseShape.Default;
203 } 203 }
204 group.AddPart(prim); 204 group.AddPart(prim);
205 group.RootPart = prim; 205 group.RootPart = prim;
@@ -219,7 +219,7 @@ namespace OpenSim.DataStore.MSSQL
219 { 219 {
220 MainLog.Instance.Notice( 220 MainLog.Instance.Notice(
221 "No shape found for prim in storage, so setting default box shape"); 221 "No shape found for prim in storage, so setting default box shape");
222 prim.Shape = BoxShape.Default; 222 prim.Shape = PrimitiveBaseShape.Default;
223 } 223 }
224 createdObjects[new LLUUID(objID)].AddPart(prim); 224 createdObjects[new LLUUID(objID)].AddPart(prim);
225 } 225 }
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 065d37d..b5a231e 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -265,7 +265,7 @@ namespace OpenSim.DataStore.MonoSqlite
265 { 265 {
266 MainLog.Instance.Notice( 266 MainLog.Instance.Notice(
267 "No shape found for prim in storage, so setting default box shape"); 267 "No shape found for prim in storage, so setting default box shape");
268 prim.Shape = BoxShape.Default; 268 prim.Shape = PrimitiveBaseShape.Default;
269 } 269 }
270 group.AddPart(prim); 270 group.AddPart(prim);
271 group.RootPart = prim; 271 group.RootPart = prim;
@@ -285,7 +285,7 @@ namespace OpenSim.DataStore.MonoSqlite
285 { 285 {
286 MainLog.Instance.Notice( 286 MainLog.Instance.Notice(
287 "No shape found for prim in storage, so setting default box shape"); 287 "No shape found for prim in storage, so setting default box shape");
288 prim.Shape = BoxShape.Default; 288 prim.Shape = PrimitiveBaseShape.Default;
289 } 289 }
290 createdObjects[new LLUUID(objID)].AddPart(prim); 290 createdObjects[new LLUUID(objID)].AddPart(prim);
291 } 291 }