diff options
author | lbsa71 | 2007-12-28 08:34:38 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-28 08:34:38 +0000 |
commit | 8cd72beb86d2a563bdaf88b20aa76d9bafa6b971 (patch) | |
tree | 8eaac3b70eb4b62db89cdfc7b854e85fa2430255 /OpenSim/Region | |
parent | * Patch from Melanie. Thanks Melanie! (diff) | |
download | opensim-SC_OLD-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.zip opensim-SC_OLD-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.tar.gz opensim-SC_OLD-8cd72beb86d2a563bdaf88b20aa76d9bafa6b971.tar.bz2 opensim-SC_OLD-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
Diffstat (limited to 'OpenSim/Region')
6 files changed, 41 insertions, 40 deletions
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 | } |