From 8cd72beb86d2a563bdaf88b20aa76d9bafa6b971 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 28 Dec 2007 08:34:38 +0000 Subject: * 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 --- OpenSim/Region/Environment/Scenes/Scene.cs | 65 +++++++++++----------- OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 4 +- .../Region/Examples/SimpleApp/CpuCounterObject.cs | 2 +- .../Region/Examples/SimpleApp/FileSystemObject.cs | 2 +- .../OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | 4 +- .../MonoSqliteDataStore.cs | 4 +- 6 files changed, 41 insertions(+), 40 deletions(-) (limited to 'OpenSim/Region') 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 // It's wrong many times though. LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); - - - if (PermissionsMngr.CanRezObject(ownerID, pos)) { - - // rez ON the ground, not IN the ground + // rez ON the ground, not IN the ground pos.Z += 0.25F; - - - SceneObjectGroup sceneOb = - new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); - AddEntity(sceneOb); - SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); - // if grass or tree, make phantom - //rootPart.ApplySanePermissions(); - if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) - { - rootPart.AddFlag(LLObject.ObjectFlags.Phantom); - //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; - } - // if not phantom, add to physics - bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); - if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) - { - rootPart.PhysActor = - PhysicsScene.AddPrimShape( - rootPart.Name, - rootPart.Shape, - new PhysicsVector(pos.X, pos.Y, pos.Z), - new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), - new Quaternion(), UsePhysics); - // subscribe to physics events. - rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); - } + + AddNewPrim(ownerID, pos, rot, shape); + } + } + + public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) + { + SceneObjectGroup sceneOb = + new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); + + AddEntity(sceneOb); + SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); + // if grass or tree, make phantom + //rootPart.ApplySanePermissions(); + if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) + { + rootPart.AddFlag(LLObject.ObjectFlags.Phantom); + //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; + } + // if not phantom, add to physics + bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); + if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) + { + rootPart.PhysActor = + PhysicsScene.AddPrimShape( + rootPart.Name, + rootPart.Shape, + new PhysicsVector(pos.X, pos.Y, pos.Z), + new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), + new Quaternion(), UsePhysics); + // subscribe to physics events. + rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); } } 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 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) : base( - regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition + regionHandle, parent, ownerID, localID, PrimitiveBaseShape.CreateCylinder(0.5f, 0.2f), groupPosition, offsetPosition ) { m_rotationDirection = rotationDirection; @@ -64,7 +64,7 @@ namespace SimpleApp public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) - : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default) + : base(scene, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default) { m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); 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 private PerformanceCounter m_counter; public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) - : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default) + : base(world, regionHandle, ownerID, localID, pos, PrimitiveBaseShape.Default) { String objectName = "Processor"; 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 public class FileSystemObject : SceneObjectGroup { public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) - : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) + : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, PrimitiveBaseShape.Default) { //float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5; // 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 { MainLog.Instance.Notice( "No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; + prim.Shape = PrimitiveBaseShape.Default; } group.AddPart(prim); group.RootPart = prim; @@ -219,7 +219,7 @@ namespace OpenSim.DataStore.MSSQL { MainLog.Instance.Notice( "No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; + prim.Shape = PrimitiveBaseShape.Default; } createdObjects[new LLUUID(objID)].AddPart(prim); } 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 { MainLog.Instance.Notice( "No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; + prim.Shape = PrimitiveBaseShape.Default; } group.AddPart(prim); group.RootPart = prim; @@ -285,7 +285,7 @@ namespace OpenSim.DataStore.MonoSqlite { MainLog.Instance.Notice( "No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; + prim.Shape = PrimitiveBaseShape.Default; } createdObjects[new LLUUID(objID)].AddPart(prim); } -- cgit v1.1