当前位置: 首页>>代码示例>>C#>>正文


C# SceneHelpers.GetSceneObjectGroup方法代码示例

本文整理汇总了C#中OpenSim.Tests.Common.SceneHelpers.GetSceneObjectGroup方法的典型用法代码示例。如果您正苦于以下问题:C# SceneHelpers.GetSceneObjectGroup方法的具体用法?C# SceneHelpers.GetSceneObjectGroup怎么用?C# SceneHelpers.GetSceneObjectGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Tests.Common.SceneHelpers的用法示例。


在下文中一共展示了SceneHelpers.GetSceneObjectGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestResizeSceneObjectPart

        public void TestResizeSceneObjectPart()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            Scene scene = new SceneHelpers().SetupScene();

            SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
            g1.RootPart.Scale = new Vector3(2, 3, 4);
            g1.Parts[1].Scale = new Vector3(5, 6, 7);

            scene.AddSceneObject(g1);

            SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);

            g1Post.Parts[1].Resize(new Vector3(8, 9, 10));

            SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);

            SceneObjectPart g1RootPart = g1PostPost.RootPart;
            SceneObjectPart g1ChildPart = g1PostPost.Parts[1];

            Assert.That(g1RootPart.Scale.X, Is.EqualTo(2));
            Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3));
            Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4));

            Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8));
            Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9));
            Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10));
        }
开发者ID:Gitlab11,项目名称:opensim,代码行数:30,代码来源:SceneObjectResizeTests.cs

示例2: TestResizeSceneObject

        public void TestResizeSceneObject()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            Scene scene = new SceneHelpers().SetupScene();
            SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);

            g1.GroupResize(new Vector3(2, 3, 4));

            SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);

            Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
            Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
            Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
        }
开发者ID:szielins,项目名称:opensim,代码行数:16,代码来源:SceneObjectResizeTests.cs

示例3: TestAddObjects

        private void TestAddObjects(int primsInEachObject, int objectsToAdd)
        {
            UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");

            // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage
            // collected when we teardown this test.  If it's done in a member variable, even if that is subsequently
            // nulled out, the garbage collect can be delayed.
            TestScene scene = new SceneHelpers().SetupScene();

//            Process process = Process.GetCurrentProcess();
//            long startProcessMemory = process.PrivateMemorySize64;
            long startGcMemory = GC.GetTotalMemory(true);
            DateTime start = DateTime.Now;

            for (int i = 1; i <= objectsToAdd; i++)
            {
                SceneObjectGroup so = SceneHelpers.CreateSceneObject(primsInEachObject, ownerId, "part_", i);
                Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i));
            }

            TimeSpan elapsed = DateTime.Now - start;
//            long processMemoryAlloc = process.PrivateMemorySize64 - startProcessMemory;
            long endGcMemory = GC.GetTotalMemory(false);

            for (int i = 1; i <= objectsToAdd; i++)
            {
                Assert.That(
                    scene.GetSceneObjectGroup(TestHelpers.ParseTail(i)),
                    Is.Not.Null,
                    string.Format("Object {0} could not be retrieved", i));
            }

            // When a scene object is added to a scene, it is placed in the update list for sending to viewers
            // (though in this case we have none).  When it is deleted, it is not removed from the update which is
            // fine since it will later be ignored.
            //
            // However, that means that we need to manually run an update here to clear out that list so that deleted
            // objects will be clean up by the garbage collector before the next stress test is run.
            scene.Update(1);

            Console.WriteLine(
                "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",
                Math.Round(elapsed.TotalMilliseconds),
                (endGcMemory - startGcMemory) / 1024 / 1024,
                endGcMemory / 1024 / 1024,
                startGcMemory / 1024 / 1024,
                objectsToAdd,
                primsInEachObject);

            scene.Close();
//            scene = null;
        }
开发者ID:JAllard,项目名称:opensim,代码行数:52,代码来源:ObjectTortureTests.cs

示例4: TestRezObjectFromInventoryItem

        public void TestRezObjectFromInventoryItem()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();
            
            Scene scene = new SceneHelpers().SetupScene();
            UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
            SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
            SceneObjectPart sop1 = sog1.RootPart;

            // Create an object embedded inside the first
            UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
            TaskInventoryItem taskSceneObjectItem
                = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);

            scene.AddSceneObject(sog1);

            Vector3 rezPos = new Vector3(10, 10, 10);
            Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
            Vector3 rezVel = new Vector3(2, 2, 2);

            scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);

            SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");

            Assert.That(rezzedObject, Is.Not.Null);
            Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));

            // Velocity doesn't get applied, probably because there is no physics in tests (yet)
//            Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
            Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));

            // Confusingly, this isn't the rezzedObject.Rotation
            Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
        }
开发者ID:Gitlab11,项目名称:opensim,代码行数:35,代码来源:TaskInventoryTests.cs

示例5: TestAddSceneObject

        public void TestAddSceneObject()
        {
            TestHelpers.InMethod();

            Scene scene = new SceneHelpers().SetupScene();
            int partsToTestCount = 3;

            SceneObjectGroup so
                = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
            SceneObjectPart[] parts = so.Parts;

            Assert.That(scene.AddNewSceneObject(so, false), Is.True);
            SceneObjectGroup retrievedSo = scene.GetSceneObjectGroup(so.UUID);
            SceneObjectPart[] retrievedParts = retrievedSo.Parts;
            
            //m_log.Debug("retrievedPart : {0}", retrievedPart);
            // If the parts have the same UUID then we will consider them as one and the same
            Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount));

            for (int i = 0; i < partsToTestCount; i++)
            {
                Assert.That(retrievedParts[i].Name, Is.EqualTo(parts[i].Name));
                Assert.That(retrievedParts[i].UUID, Is.EqualTo(parts[i].UUID));
            }
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:25,代码来源:SceneObjectBasicTests.cs


注:本文中的OpenSim.Tests.Common.SceneHelpers.GetSceneObjectGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。