Example #1
0
 public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position,
                                           Vector3 size, Quaternion rotation, bool isPhysical)
 {
     PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical);
     if (ret != null) ret.LocalID = localID;
     return ret;
 }
Example #2
0
    public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                       OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
            : base(parent_scene, localID, primName, "BSPrim")
    {
        // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
        _physicsActorType = (int)ActorTypes.Prim;
        RawPosition = pos;
        _size = size;
        Scale = size;   // prims are the size the user wants them to be (different for BSCharactes).
        RawOrientation = rotation;
        _buoyancy = 0f;
        RawVelocity = OMV.Vector3.Zero;
        _rotationalVelocity = OMV.Vector3.Zero;
        BaseShape = pbs;
        _isPhysical = pisPhysical;
        _isVolumeDetect = false;

        _mass = CalculateMass();

        DetailLog("{0},BSPrim.constructor,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(pbs));
        // DetailLog("{0},BSPrim.constructor,call", LocalID);
        // do the actual object creation at taint time
        PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate()
        {
            // Make sure the object is being created with some sanity.
            ExtremeSanityCheck(true /* inTaintTime */);

            CreateGeomAndObject(true);

            CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);

            IsInitialized = true;
        });
    }
        private static bool CanUsePhysXPrimitive(OpenSim.Framework.PrimitiveBaseShape pbs)
        {
            //mesh nor sculpts should ever go through here.
            if (pbs.SculptEntry)
            {
                return(false);
            }

            //physx handles sphere and box
            if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)

                || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 &&
                    pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)
                )
            {
                if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 &&
                    pbs.ProfileHollow == 0 &&
                    pbs.PathTwist == 0 && pbs.PathTwistBegin == 0 &&
                    pbs.PathBegin == 0 && pbs.PathEnd == 0 &&
                    pbs.PathTaperX == 0 && pbs.PathTaperY == 0 &&
                    pbs.PathScaleX == 100 && pbs.PathScaleY == 100 &&
                    pbs.PathShearX == 0 && pbs.PathShearY == 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #4
0
        public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
        {
            // Remove the reference to the encoded JPEG2000 data so it can be GCed
            primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;

            return null;
        }
Example #5
0
        public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, out List<List<Vector3>> hulls, out List<Vector3> boundHull)
        {
            // Remove the reference to the encoded JPEG2000 data so it can be GCed
            primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
            hulls = null;
            boundHull = new List<Vector3>();

            return null;
        }
Example #6
0
        public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                                  Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
        {
            BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
            prim.IsPhysical = isPhysical;

            _prims.Add(prim);

            return prim;
        }
Example #7
0
//        private PrimitiveBaseShape _shape;

        public BasicPhysicsPrim(
            string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
        {
            Name = name;
            LocalID = localId;
            Position = position;
            Size = size;
            Orientation = orientation;
            Shape = shape;
        }
Example #8
0
        public static ShapeType FindBestShape(PrimitiveBaseShape baseShape, bool isDynamic)
        {
            if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.None)
            {
                return ShapeType.Null;
            }

            if (CanUseLowDetailShape(baseShape, isDynamic))
            {
                return ShapeType.PrimitiveBox;
            }

            if (CanUsePhysXPrimitive(baseShape))
            {
                if (baseShape.ProfileShape == ProfileShape.Square)
                {
                    //best fix is a box
                    return ShapeType.PrimitiveBox;
                }
                else
                {
                    //best fit is a sphere
                    return ShapeType.PrimitiveSphere;
                }
            }

            if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.Prim)
            {
                if (isDynamic)
                {
                    if (NeedsPlainConvexWorkaround(baseShape, isDynamic))
                    {
                        return ShapeType.SingleConvex;
                    }
                    else
                    {
                        //for dynamics, the best fit for a mesh shape is a collection of hulls
                        return ShapeType.DecomposedConvexHulls;
                    }
                }
                else
                {
                    return ShapeType.TriMesh;
                }
            }
            else if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.ConvexHull)
            {
                return ShapeType.SingleConvex;
            }
            else
            {
                // throw new InvalidOperationException(String.Format("Preferred physics shape {0} is not meshable", baseShape.PreferredPhysicsShape));
                return ShapeType.Null;
            }
        }
Example #9
0
    public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                       OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
        : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
    {
        Linkset = BSLinkset.Factory(PhysScene, this);

        PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
        {
            Linkset.Refresh(this);
        });
    }
Example #10
0
    public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                       OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
        : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
    {
        // Default linkset implementation for this prim
        LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation;

        Linkset = BSLinkset.Factory(PhysScene, this);

        Linkset.Refresh(this);
    }
Example #11
0
        internal bool TryGetCachedShape(ulong meshHash, OpenSim.Framework.PrimitiveBaseShape shape, bool isDynamic, out PhysicsShape phyShape)
        {
            ShapeCache cache = FindCorrespondingCache(ShapeDeterminer.FindBestShape(shape, isDynamic));

            if (cache != null)
            {
                return(cache.TryGetShape(meshHash, out phyShape));
            }

            phyShape = null;
            return(false);
        }
Example #12
0
        public ISceneEntity AddTree (
            UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
        {
            PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
            treeShape.PathCurve = 16;
            treeShape.PathEnd = 49900;
            treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
            treeShape.Scale = scale;
            treeShape.State = (byte)treeType;

            return m_scene.SceneGraph.AddNewPrim(uuid, groupID, position, rotation, treeShape);
        }
        public static AcdAlgorithm FindBestAcdAlgorithm(OpenSim.Framework.PrimitiveBaseShape baseShape)
        {
            //spheres and torii use ratcliff
            if ((baseShape.ProfileShape == ProfileShape.Circle ||
                 baseShape.ProfileShape == ProfileShape.HalfCircle) &&
                baseShape.PathCurve == (byte)Extrusion.Curve1)
            {
                return(AcdAlgorithm.RATCLIFF);
            }


            return(AcdAlgorithm.HACD);
        }
Example #14
0
        internal void QueueForMeshing(string primName, OpenSim.Framework.PrimitiveBaseShape pbs, OpenMetaverse.Vector3 size, float lod,
                                      bool isDynamic, byte[] serializedShapes, bool fromCrossing, MeshingCompleteDelegate completedDelegate)
        {
            lock (_meshWaitingQueue)
            {
                _meshWaitingQueue.Enqueue(
                    new MeshingQueueItem
                {
                    PrimName          = primName,
                    Shape             = pbs,
                    Size              = size,
                    LOD               = lod,
                    IsDynamic         = isDynamic,
                    SerializedShapes  = serializedShapes,
                    CompletedDelegate = completedDelegate,
                    FromCrossing      = fromCrossing
                });

                Monitor.Pulse(_meshWaitingQueue);
            }
        }
 public SceneObjectGroup CreateEntity(
     UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
 {
     if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
     {
         m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
         return null;
     }
     
     SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
     SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
     
     // if grass or tree, make phantom
     //rootPart.TrimPermissions();
     rootPart.AddFlag(PrimFlags.Phantom);
     if (rootPart.Shape.PCode != (byte)PCode.Grass)
         AdaptTree(ref shape);
     
     m_scene.AddNewSceneObject(sceneObject, true);
     sceneObject.SetGroup(groupID, null);
     
     return sceneObject;
 }
Example #16
0
        public void SculptTextureCallback(UUID textureID, AssetBase texture)
        {
            if (m_shape.SculptEntry)
            {
                // commented out for sculpt map caching test - null could mean a cached sculpt map has been found
                //if (texture != null)
                {
                    if (texture != null)
                        m_shape.SculptData = texture.Data;

                    if (PhysActor != null)
                    {
                        // Tricks physics engine into thinking we've changed the part shape.
                        PrimitiveBaseShape m_newshape = m_shape.Copy();
                        PhysActor.Shape = m_newshape;
                        m_shape = m_newshape;

                        m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
                    }
                }
            }
        }
Example #17
0
 public abstract PhysicsObject AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                            Vector3 size, Quaternion rotation); //To be removed
Example #18
0
        /// <summary>
        /// Create a completely new SceneObjectPart (prim).  This will need to be added separately to a SceneObjectGroup
        /// </summary>
        /// <param name="ownerID"></param>
        /// <param name="shape"></param>
        /// <param name="position"></param>
        /// <param name="rotationOffset"></param>
        /// <param name="offsetPosition"></param>
        public SceneObjectPart(
            UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 
            Quaternion rotationOffset, Vector3 offsetPosition) : this()
        {
            m_name = "Primitive";

            CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
            LastOwnerID = CreatorID = OwnerID = ownerID;
            UUID = UUID.Random();
            Shape = shape;
            OwnershipCost = 0;
            ObjectSaleType = 0;
            SalePrice = 0;
            Category = 0;
            GroupPosition = groupPosition;
            OffsetPosition = offsetPosition;
            RotationOffset = rotationOffset;
            Velocity = Vector3.Zero;
            AngularVelocity = Vector3.Zero;
            Acceleration = Vector3.Zero;
            Flags = 0;
            CreateSelected = true;

            TrimPermissions();
        }
Example #19
0
    public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                              Vector3 size, Quaternion rotation, bool isPhysical, uint localID)
    {
        // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName);

        if (!m_initialized) return null;

        // DetailLog("{0},BSScene.AddPrimShape,call", localID);

        BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical);
        lock (PhysObjects) PhysObjects.Add(localID, prim);
        return prim;
    }
Example #20
0
 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                           Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
Example #21
0
        public virtual SceneObjectGroup AddNewPrim(
            UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            //m_log.DebugFormat(
            //    "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);

            SceneObjectGroup sceneObject = null;
            
            // If an entity creator has been registered for this prim type then use that
            if (m_entityCreators.ContainsKey((PCode)shape.PCode))
            {
                sceneObject = m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape);
            }
            else
            {
                // Otherwise, use this default creation code;
                sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
                AddNewSceneObject(sceneObject, true);
                sceneObject.SetGroup(groupID, null);
            }

            if (UserManagementModule != null)
                sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);

            sceneObject.ScheduleGroupForFullUpdate();

            return sceneObject;
        }
Example #22
0
        public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID)
        {
            PrimitiveBaseShape shape = new PrimitiveBaseShape();

            shape._pathScaleX = 100;
            shape._pathScaleY = 100;

            if (numberOfFaces <= 0) // oops ?
            {
                numberOfFaces = 1;
            }

            switch (numberOfFaces)
            {
            case 1:     // torus
                shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
                shape.PathCurve    = (byte)Extrusion.Curve1;
                shape._pathScaleY  = 150;
                break;

            case 2:     // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere)
                shape.ProfileCurve  = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
                shape.PathCurve     = (byte)Extrusion.Curve1;
                shape.ProfileHollow = 27500;
                shape._pathScaleY   = 150;
                break;

            case 3:     // cylinder
                shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
                shape.PathCurve    = (byte)Extrusion.Straight;
                break;

            case 4:     // cylinder with hollow
                shape.ProfileCurve  = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
                shape.PathCurve     = (byte)Extrusion.Straight;
                shape.ProfileHollow = 27500;
                break;

            case 5:     // prism
                shape.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle;
                shape.PathCurve    = (byte)Extrusion.Straight;
                break;

            case 6:     // box
                shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
                shape.PathCurve    = (byte)Extrusion.Straight;
                break;

            case 7:     // box with hollow
                shape.ProfileCurve  = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
                shape.PathCurve     = (byte)Extrusion.Straight;
                shape.ProfileHollow = 27500;
                break;

            default:     // 8 faces  box with cut
                shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
                shape.PathCurve    = (byte)Extrusion.Straight;
                shape.ProfileBegin = 9375;
                break;
            }

            shape.SculptEntry   = true;
            shape.SculptType    = (byte)OpenMetaverse.SculptType.Mesh;
            shape.SculptTexture = meshAssetID;

            return(shape);
        }
Example #23
0
        public void T013_DatabasePersistency()
        {
            // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
            // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
            // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
            UUID creator,uuid = new UUID();
            creator = UUID.Random();
            uint iserial = (uint)random.Next();
            TaskInventoryDictionary dic = new TaskInventoryDictionary();
            uint objf = (uint) random.Next();
            uuid = prim4;
            uint localid = localID+1;
            localID = localID + 1;
            string name = "Adam  West";
            byte material = (byte) random.Next(127);
            ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next();
            int pin = random.Next();
            Byte[] partsys = new byte[8];
            Byte[] textani = new byte[8];
            random.NextBytes(textani);
            random.NextBytes(partsys);
            DateTime expires = new DateTime(2008, 12, 20);
            DateTime rezzed = new DateTime(2009, 07, 15);
            Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
            Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
            Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
            string description = name;
            Color color = Color.FromArgb(255, 165, 50, 100);
            string text = "All Your Base Are Belong to Us";
            string sitname = "SitName";
            string touchname = "TouchName";
            int linknum = random.Next();
            byte clickaction = (byte) random.Next(127);
            PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
            pbshap = PrimitiveBaseShape.Default;
            pbshap.PathBegin = ushort.MaxValue;
            pbshap.PathEnd = ushort.MaxValue;
            pbshap.ProfileBegin = ushort.MaxValue;
            pbshap.ProfileEnd = ushort.MaxValue;
            pbshap.ProfileHollow = ushort.MaxValue;
            Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
            byte updatef = (byte) random.Next(127);

            RegionInfo regionInfo = new RegionInfo();
            regionInfo.RegionID = region3;
            regionInfo.RegionLocX = 0;
            regionInfo.RegionLocY = 0;

            Scene scene = new Scene(regionInfo);

            SceneObjectPart sop = new SceneObjectPart();
            sop.RegionHandle = regionh;
            sop.UUID = uuid;
            sop.LocalId = localid;
            sop.Shape = pbshap;
            sop.GroupPosition = groupos;
            sop.RotationOffset = rotoff;
            sop.CreatorID = creator;
            sop.InventorySerial = iserial;
            sop.TaskInventory = dic;
            sop.ObjectFlags = objf;
            sop.Name = name;
            sop.Material = material;
            sop.ScriptAccessPin = pin;
            sop.TextureAnimation = textani;
            sop.ParticleSystem = partsys;
            sop.Expires = expires;
            sop.Rezzed = rezzed;
            sop.OffsetPosition = offset;
            sop.Velocity = velocity;
            sop.AngularVelocity = angvelo;
            sop.Acceleration = accel;
            sop.Description = description;
            sop.Color = color;
            sop.Text = text;
            sop.SitName = sitname;
            sop.TouchName = touchname;
            sop.LinkNum = linknum;
            sop.ClickAction = clickaction;
            sop.Scale = scale;
            sop.UpdateFlag = updatef;

            //Tests if local part accepted the parameters:
            Assert.That(regionh,Is.EqualTo(sop.RegionHandle), "Assert.That(regionh,Is.EqualTo(sop.RegionHandle))");
            Assert.That(localid,Is.EqualTo(sop.LocalId), "Assert.That(localid,Is.EqualTo(sop.LocalId))");
            Assert.That(groupos,Is.EqualTo(sop.GroupPosition), "Assert.That(groupos,Is.EqualTo(sop.GroupPosition))");
            Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))");
            Assert.That(rotoff,Is.EqualTo(sop.RotationOffset), "Assert.That(rotoff,Is.EqualTo(sop.RotationOffset))");
            Assert.That(uuid,Is.EqualTo(sop.UUID), "Assert.That(uuid,Is.EqualTo(sop.UUID))");
            Assert.That(creator,Is.EqualTo(sop.CreatorID), "Assert.That(creator,Is.EqualTo(sop.CreatorID))");
            // Modified in-class
            // Assert.That(iserial,Is.EqualTo(sop.InventorySerial), "Assert.That(iserial,Is.EqualTo(sop.InventorySerial))");
            Assert.That(dic,Is.EqualTo(sop.TaskInventory), "Assert.That(dic,Is.EqualTo(sop.TaskInventory))");
            Assert.That(objf,Is.EqualTo(sop.ObjectFlags), "Assert.That(objf,Is.EqualTo(sop.ObjectFlags))");
            Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))");
            Assert.That(material,Is.EqualTo(sop.Material), "Assert.That(material,Is.EqualTo(sop.Material))");
            Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin))");
            Assert.That(textani,Is.EqualTo(sop.TextureAnimation), "Assert.That(textani,Is.EqualTo(sop.TextureAnimation))");
            Assert.That(partsys,Is.EqualTo(sop.ParticleSystem), "Assert.That(partsys,Is.EqualTo(sop.ParticleSystem))");
            Assert.That(expires,Is.EqualTo(sop.Expires), "Assert.That(expires,Is.EqualTo(sop.Expires))");
            Assert.That(rezzed,Is.EqualTo(sop.Rezzed), "Assert.That(rezzed,Is.EqualTo(sop.Rezzed))");
            Assert.That(offset,Is.EqualTo(sop.OffsetPosition), "Assert.That(offset,Is.EqualTo(sop.OffsetPosition))");
            Assert.That(velocity,Is.EqualTo(sop.Velocity), "Assert.That(velocity,Is.EqualTo(sop.Velocity))");
            Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity))");
            Assert.That(accel,Is.EqualTo(sop.Acceleration), "Assert.That(accel,Is.EqualTo(sop.Acceleration))");
            Assert.That(description,Is.EqualTo(sop.Description), "Assert.That(description,Is.EqualTo(sop.Description))");
            Assert.That(color,Is.EqualTo(sop.Color), "Assert.That(color,Is.EqualTo(sop.Color))");
            Assert.That(text,Is.EqualTo(sop.Text), "Assert.That(text,Is.EqualTo(sop.Text))");
            Assert.That(sitname,Is.EqualTo(sop.SitName), "Assert.That(sitname,Is.EqualTo(sop.SitName))");
            Assert.That(touchname,Is.EqualTo(sop.TouchName), "Assert.That(touchname,Is.EqualTo(sop.TouchName))");
            Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))");
            Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))");
            Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))");
            Assert.That(updatef,Is.EqualTo(sop.UpdateFlag), "Assert.That(updatef,Is.EqualTo(sop.UpdateFlag))");
            
            // This is necessary or object will not be inserted in DB
            sop.ObjectFlags = 0;

            SceneObjectGroup sog = new SceneObjectGroup(sop);
            
            // Inserts group in DB
            db.StoreObject(sog,region3);
            List<SceneObjectGroup> sogs = db.LoadObjects(region3);
            Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))");
            // Makes sure there are no double insertions:
            db.StoreObject(sog,region3);
            sogs = db.LoadObjects(region3);
            Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))");
                

            // Tests if the parameters were inserted correctly
            SceneObjectPart p = sogs[0].RootPart;
            Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))");
            //Assert.That(localid,Is.EqualTo(p.LocalId), "Assert.That(localid,Is.EqualTo(p.LocalId))");
            Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))");
            Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
            Assert.That(rotoff,Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))");
            Assert.That(uuid,Is.EqualTo(p.UUID), "Assert.That(uuid,Is.EqualTo(p.UUID))");
            Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))");
            //Assert.That(iserial,Is.EqualTo(p.InventorySerial), "Assert.That(iserial,Is.EqualTo(p.InventorySerial))");
            Assert.That(dic,Is.EqualTo(p.TaskInventory), "Assert.That(dic,Is.EqualTo(p.TaskInventory))");
            //Assert.That(objf,Is.EqualTo(p.ObjectFlags), "Assert.That(objf,Is.EqualTo(p.ObjectFlags))");
            Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
            Assert.That(material,Is.EqualTo(p.Material), "Assert.That(material,Is.EqualTo(p.Material))");
            Assert.That(pin,Is.EqualTo(p.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(p.ScriptAccessPin))");
            Assert.That(textani,Is.EqualTo(p.TextureAnimation), "Assert.That(textani,Is.EqualTo(p.TextureAnimation))");
            Assert.That(partsys,Is.EqualTo(p.ParticleSystem), "Assert.That(partsys,Is.EqualTo(p.ParticleSystem))");
            //Assert.That(expires,Is.EqualTo(p.Expires), "Assert.That(expires,Is.EqualTo(p.Expires))");
            //Assert.That(rezzed,Is.EqualTo(p.Rezzed), "Assert.That(rezzed,Is.EqualTo(p.Rezzed))");
            Assert.That(offset,Is.EqualTo(p.OffsetPosition), "Assert.That(offset,Is.EqualTo(p.OffsetPosition))");
            Assert.That(velocity,Is.EqualTo(p.Velocity), "Assert.That(velocity,Is.EqualTo(p.Velocity))");
            Assert.That(angvelo,Is.EqualTo(p.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(p.AngularVelocity))");
            Assert.That(accel,Is.EqualTo(p.Acceleration), "Assert.That(accel,Is.EqualTo(p.Acceleration))");
            Assert.That(description,Is.EqualTo(p.Description), "Assert.That(description,Is.EqualTo(p.Description))");
            Assert.That(color,Is.EqualTo(p.Color), "Assert.That(color,Is.EqualTo(p.Color))");
            Assert.That(text,Is.EqualTo(p.Text), "Assert.That(text,Is.EqualTo(p.Text))");
            Assert.That(sitname,Is.EqualTo(p.SitName), "Assert.That(sitname,Is.EqualTo(p.SitName))");
            Assert.That(touchname,Is.EqualTo(p.TouchName), "Assert.That(touchname,Is.EqualTo(p.TouchName))");
            //Assert.That(linknum,Is.EqualTo(p.LinkNum), "Assert.That(linknum,Is.EqualTo(p.LinkNum))");
            Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
            Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");

            //Assert.That(updatef,Is.EqualTo(p.UpdateFlag), "Assert.That(updatef,Is.EqualTo(p.UpdateFlag))");

            Assert.That(pbshap.PathBegin, Is.EqualTo(p.Shape.PathBegin), "Assert.That(pbshap.PathBegin, Is.EqualTo(p.Shape.PathBegin))");
            Assert.That(pbshap.PathEnd, Is.EqualTo(p.Shape.PathEnd), "Assert.That(pbshap.PathEnd, Is.EqualTo(p.Shape.PathEnd))");
            Assert.That(pbshap.ProfileBegin, Is.EqualTo(p.Shape.ProfileBegin), "Assert.That(pbshap.ProfileBegin, Is.EqualTo(p.Shape.ProfileBegin))");
            Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))");
            Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))");
        }
Example #24
0
        public static PrimitiveBaseShape Create()
        {
            PrimitiveBaseShape shape = new PrimitiveBaseShape();

            return(shape);
        }
Example #25
0
        /*
         *          public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
         *          {
         *              m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
         *              return PhysicsActor.Null;
         *          }
         */

        public override PhysicsObject AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                                   Vector3 size, Quaternion rotation) //To be removed
        {
            return(AddPrimShape(primName, pbs, position, size, rotation, false));
        }
Example #26
0
                                            Vector3 size, Quaternion rotation); //To be removed
 public abstract PhysicsObject AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                            Vector3 size, Quaternion rotation, bool isPhysical);
Example #27
0
        /// <summary>
        /// Create a completely new SceneObjectPart (prim).  This will need to be added separately to a SceneObjectGroup
        /// </summary>
        /// <param name="ownerID"></param>
        /// <param name="shape"></param>
        /// <param name="position"></param>
        /// <param name="rotationOffset"></param>
        /// <param name="offsetPosition"></param>
        public SceneObjectPart(
            UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 
            Quaternion rotationOffset, Vector3 offsetPosition)
        {
            m_name = "Primitive";

            Rezzed = DateTime.UtcNow;
            _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
            _ownerID = ownerID;
            _creatorID = _ownerID;
            _lastOwnerID = UUID.Zero;
            UUID = UUID.Random();
            Shape = shape;
            // Todo: Add More Object Parameter from above!
            _ownershipCost = 0;
            _objectSaleType = 0;
            _salePrice = 0;
            _category = 0;
            _lastOwnerID = _creatorID;
            // End Todo: ///
            GroupPosition = groupPosition;
            OffsetPosition = offsetPosition;
            RotationOffset = rotationOffset;
            Velocity = Vector3.Zero;
            AngularVelocity = Vector3.Zero;
            Acceleration = Vector3.Zero;
            m_TextureAnimation = Utils.EmptyBytes;
            m_particleSystem = Utils.EmptyBytes;

            // Prims currently only contain a single folder (Contents).  From looking at the Second Life protocol,
            // this appears to have the same UUID (!) as the prim.  If this isn't the case, one can't drag items from
            // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log

            _flags = 0;
            _flags |= PrimFlags.CreateSelected;

            TrimPermissions();
            //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
            
            m_inventory = new SceneObjectPartInventory(this);
        }
Example #28
0
 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
 {
     shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
 }
Example #29
0
        /// <summary>
        /// Create a New SceneObjectGroup/Part by raycasting
        /// </summary>
        /// <param name="ownerID"></param>
        /// <param name="groupID"></param>
        /// <param name="RayEnd"></param>
        /// <param name="rot"></param>
        /// <param name="shape"></param>
        /// <param name="bypassRaycast"></param>
        /// <param name="RayStart"></param>
        /// <param name="RayTargetID"></param>
        /// <param name="RayEndIsIntersection"></param>
        public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape,
                                       byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
                                       byte RayEndIsIntersection)
        {
            Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false);

            if (Permissions.CanRezObject(1, ownerID, pos))
            {
                // rez ON the ground, not IN the ground
                // pos.Z += 0.25F; The rez point should now be correct so that its not in the ground

                AddNewPrim(ownerID, groupID, pos, rot, shape);
            }
            else
            {
                IClientAPI client = null;
                if (TryGetClient(ownerID, out client))
                    client.SendAlertMessage("You cannot create objects here.");
            }
        }
Example #30
0
 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
 {
     shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty);
 }
/*
        public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
        {
            m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
            return PhysicsActor.Null;
        }
*/

        public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                                  Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
        {
            m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
            return PhysicsActor.Null;
        }
Example #32
0
 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                           Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
 {
     return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
 }
Example #33
0
        /// <summary>
        /// Create a completely new SceneObjectPart (prim).  This will need to be added separately to a SceneObjectGroup
        /// </summary>
        /// <param name="ownerID"></param>
        /// <param name="shape"></param>
        /// <param name="position"></param>
        /// <param name="rotationOffset"></param>
        /// <param name="offsetPosition"></param>
        public SceneObjectPart(
            UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
            Quaternion rotationOffset, Vector3 offsetPosition, Scene scene)
        {
            m_name = scene.DefaultObjectName;
            m_initialScene = scene;

            Rezzed = DateTime.UtcNow;
            _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
            _ownerID = ownerID;
            _creatorID = _ownerID;
            _lastOwnerID = UUID.Zero;
            UUID = UUID.Random();
            Shape = shape;
            CRC = 0;
            _ownershipCost = 0;
            _flags = 0;
            _groupID = UUID.Zero;
            _objectSaleType = 0;
            _salePrice = 0;
            _category = 0;
            _lastOwnerID = _creatorID;
            m_groupPosition=groupPosition;
            m_offsetPosition = offsetPosition;
            RotationOffset = rotationOffset;
            Velocity = Vector3.Zero;
            AngularVelocity = Vector3.Zero;
            Acceleration = Vector3.Zero;

            // Prims currently only contain a single folder (Contents).  From looking at the Second Life protocol,
            // this appears to have the same UUID (!) as the prim.  If this isn't the case, one can't drag items from
            // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log

            Flags = 0;
            CreateSelected = true;

            TrimPermissions();
            //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
            
            m_inventory = new SceneObjectPartInventory(this);
        }
Example #34
0
        /// <summary>
        /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces 
        /// </summary>
        /// <param name="primType"></param>
        /// <param name="shape"></param>
        /// <param name="hasCut"></param>
        /// <param name="hasHollow"></param>
        /// <param name="hasDimple"></param>
        /// <param name="hasProfileCut"></param>
        protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
            out bool hasDimple, out bool hasProfileCut)
        {
            if (primType == PrimType.BOX
                ||
                primType == PrimType.CYLINDER
                ||
                primType == PrimType.PRISM)

                hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
            else
                hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);

            hasHollow = shape.ProfileHollow > 0;
            hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
            hasProfileCut = hasDimple; // is it the same thing?
        }
Example #35
0
 public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                    OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
 {
     // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
     _localID = localID;
     _avName = primName;
     _scene = parent_scene;
     _position = pos;
     _size = size;
     _scale = new OMV.Vector3(1f, 1f, 1f);   // the scale will be set by CreateGeom depending on object type
     _orientation = rotation;
     _buoyancy = 1f;
     _velocity = OMV.Vector3.Zero;
     _rotationalVelocity = OMV.Vector3.Zero;
     _angularVelocity = OMV.Vector3.Zero;
     _hullKey = 0;
     _meshKey = 0;
     _pbs = pbs;
     _isPhysical = pisPhysical;
     _isVolumeDetect = false;
     _subscribedEventsMs = 0;
     _friction = _scene.Params.defaultFriction; // TODO: compute based on object material
     _density = _scene.Params.defaultDensity; // TODO: compute based on object material
     _restitution = _scene.Params.defaultRestitution;
     _parentPrim = null;     // not a child or a parent
     _vehicle = new BSDynamics(this);    // add vehicleness
     _childrenPrims = new List<BSPrim>();
     if (_isPhysical)
         _mass = CalculateMass();
     else
         _mass = 0f;
     // do the actual object creation at taint time
     _scene.TaintedObject(delegate()
     {
         RecreateGeomAndObject();
     });
 }
 /// <summary>
 /// Constructor.  This object is added to the scene later via AttachToScene()
 /// </summary>
 public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape, Scene scene) : this(scene)
 {
     SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero, scene));
 }
Example #37
0
 public override PhysicsObject AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                            Vector3 size, Quaternion rotation, bool isPhysical)
 {
     m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
     return(new NullObjectPhysicsActor());
 }
Example #38
0
        public void T014_UpdateObject()
        {
            string text1 = "object1 text";
            SceneObjectGroup sog = FindSOG("object1", region1);
            sog.RootPart.Text = text1;
            db.StoreObject(sog, region1);

            sog = FindSOG("object1", region1);
            Assert.That(text1, Is.EqualTo(sog.RootPart.Text), "Assert.That(text1, Is.EqualTo(sog.RootPart.Text))");

            // Creates random values
            UUID creator = new UUID();
            creator = UUID.Random();
            TaskInventoryDictionary dic = new TaskInventoryDictionary();
            localID = localID + 1;
            string name = "West  Adam";
            byte material = (byte) random.Next(127);
            ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next();
            int pin = random.Next();
            Byte[] partsys = new byte[8];
            Byte[] textani = new byte[8];
            random.NextBytes(textani);
            random.NextBytes(partsys);
            DateTime expires = new DateTime(2010, 12, 20);
            DateTime rezzed = new DateTime(2005, 07, 15);
            Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
            Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
            Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
            Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
            string description = name;
            Color color = Color.FromArgb(255, 255, 255, 0);
            string text = "What You Say?{]\vz~";
            string sitname = RandomName();
            string touchname = RandomName();
            int linknum = random.Next();
            byte clickaction = (byte) random.Next(127);
            PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
            pbshap = PrimitiveBaseShape.Default;
            Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
            byte updatef = (byte) random.Next(127);
            
            // Updates the region with new values
            SceneObjectGroup sog2 = FindSOG("Adam  West", region3);
            Assert.That(sog2,Is.Not.Null);
            sog2.RootPart.RegionHandle = regionh;
            sog2.RootPart.Shape = pbshap;
            sog2.RootPart.GroupPosition = groupos;
            sog2.RootPart.RotationOffset = rotoff;
            sog2.RootPart.CreatorID = creator;
            sog2.RootPart.TaskInventory = dic;
            sog2.RootPart.Name = name;
            sog2.RootPart.Material = material;
            sog2.RootPart.ScriptAccessPin = pin;
            sog2.RootPart.TextureAnimation = textani;
            sog2.RootPart.ParticleSystem = partsys;
            sog2.RootPart.Expires = expires;
            sog2.RootPart.Rezzed = rezzed;
            sog2.RootPart.OffsetPosition = offset;
            sog2.RootPart.Velocity = velocity;
            sog2.RootPart.AngularVelocity = angvelo;
            sog2.RootPart.Acceleration = accel;
            sog2.RootPart.Description = description;
            sog2.RootPart.Color = color;
            sog2.RootPart.Text = text;
            sog2.RootPart.SitName = sitname;
            sog2.RootPart.TouchName = touchname;
            sog2.RootPart.LinkNum = linknum;
            sog2.RootPart.ClickAction = clickaction;
            sog2.RootPart.Scale = scale;
            sog2.RootPart.UpdateFlag = updatef;
            
            db.StoreObject(sog2, region3);
            List<SceneObjectGroup> sogs = db.LoadObjects(region3);
            Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))");
            
            SceneObjectGroup retsog = FindSOG("West  Adam", region3);
            Assert.That(retsog,Is.Not.Null);
            SceneObjectPart p = retsog.RootPart;
            Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))");
            Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))");
            Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
            Assert.That(rotoff,Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))");
            Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))");
            Assert.That(dic,Is.EqualTo(p.TaskInventory), "Assert.That(dic,Is.EqualTo(p.TaskInventory))");
            Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
            Assert.That(material,Is.EqualTo(p.Material), "Assert.That(material,Is.EqualTo(p.Material))");
            Assert.That(pin,Is.EqualTo(p.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(p.ScriptAccessPin))");
            Assert.That(textani,Is.EqualTo(p.TextureAnimation), "Assert.That(textani,Is.EqualTo(p.TextureAnimation))");
            Assert.That(partsys,Is.EqualTo(p.ParticleSystem), "Assert.That(partsys,Is.EqualTo(p.ParticleSystem))");
            Assert.That(offset,Is.EqualTo(p.OffsetPosition), "Assert.That(offset,Is.EqualTo(p.OffsetPosition))");
            Assert.That(velocity,Is.EqualTo(p.Velocity), "Assert.That(velocity,Is.EqualTo(p.Velocity))");
            Assert.That(angvelo,Is.EqualTo(p.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(p.AngularVelocity))");
            Assert.That(accel,Is.EqualTo(p.Acceleration), "Assert.That(accel,Is.EqualTo(p.Acceleration))");
            Assert.That(description,Is.EqualTo(p.Description), "Assert.That(description,Is.EqualTo(p.Description))");
            Assert.That(color,Is.EqualTo(p.Color), "Assert.That(color,Is.EqualTo(p.Color))");
            Assert.That(text,Is.EqualTo(p.Text), "Assert.That(text,Is.EqualTo(p.Text))");
            Assert.That(sitname,Is.EqualTo(p.SitName), "Assert.That(sitname,Is.EqualTo(p.SitName))");
            Assert.That(touchname,Is.EqualTo(p.TouchName), "Assert.That(touchname,Is.EqualTo(p.TouchName))");
            Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
            Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");
        }
Example #39
0
 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
 {
     shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
 }