Пример #1
0
        public void TestTransaction()
        {
            var vertices = PEMockFactory.CreateVertices(new V2(0, 0), new V2(1, 0), new V2(0, 1), new V2(1, 1)).ToArray();

            var transaction = new CommandTransaction(new[]
            {
                new CommandApplyVertexEdit(vertices, Matrix.Translation(1, 0, 0)),
                new CommandApplyVertexEdit(vertices, Matrix.Translation(0, 1, 0)),
                new CommandApplyVertexEdit(vertices, Matrix.Translation(1, 1, 0))
            });

            transaction.Do();
            Assert.AreEqual(2, vertices[0].UV.X);
            Assert.AreEqual(2, vertices[0].UV.Y);
            Assert.AreEqual(3, vertices[1].UV.X);
            Assert.AreEqual(2, vertices[1].UV.Y);
            Assert.AreEqual(2, vertices[2].UV.X);
            Assert.AreEqual(3, vertices[2].UV.Y);
            Assert.AreEqual(3, vertices[3].UV.X);
            Assert.AreEqual(3, vertices[3].UV.Y);

            transaction.Undo();
            Assert.AreEqual(0, vertices[0].UV.X);
            Assert.AreEqual(0, vertices[0].UV.Y);
            Assert.AreEqual(1, vertices[1].UV.X);
            Assert.AreEqual(0, vertices[1].UV.Y);
            Assert.AreEqual(0, vertices[2].UV.X);
            Assert.AreEqual(1, vertices[2].UV.Y);
            Assert.AreEqual(1, vertices[3].UV.X);
            Assert.AreEqual(1, vertices[3].UV.Y);
        }
Пример #2
0
        public void TestMoveByMorph()
        {
            var vertices = PEMockFactory.CreateVertices(new V2(0, 0), new V2(1, 0), new V2(0, 1), new V2(1, 1)).ToArray();
            var offsets  = vertices.Select(v => PEMockFactory.Builder.UVMorphOffset(v, new V4(1, 1, 0, 0)));

            var cmd = new CommandMoveVerticesByMorph(offsets);

            cmd.Do();
            Assert.AreEqual(1, vertices[0].UV.X);
            Assert.AreEqual(1, vertices[0].UV.Y);
            Assert.AreEqual(2, vertices[1].UV.X);
            Assert.AreEqual(1, vertices[1].UV.Y);
            Assert.AreEqual(1, vertices[2].UV.X);
            Assert.AreEqual(2, vertices[2].UV.Y);
            Assert.AreEqual(2, vertices[3].UV.X);
            Assert.AreEqual(2, vertices[3].UV.Y);

            cmd.Undo();
            Assert.AreEqual(0, vertices[0].UV.X);
            Assert.AreEqual(0, vertices[0].UV.Y);
            Assert.AreEqual(1, vertices[1].UV.X);
            Assert.AreEqual(0, vertices[1].UV.Y);
            Assert.AreEqual(0, vertices[2].UV.X);
            Assert.AreEqual(1, vertices[2].UV.Y);
            Assert.AreEqual(1, vertices[3].UV.X);
            Assert.AreEqual(1, vertices[3].UV.Y);
        }
Пример #3
0
 public void TestCreateUVMorph()
 {
     var baseVertices = PEMockFactory.CreateVertices(new[]
     {
         new V2(0.0f, 0.0f),
         new V2(0.1f, 0.1f),
         new V2(0.2f, 0.2f),
     }).ToList();
     IPXPmx baseModel = PEMockFactory.CreateModel(baseVertices, new[] { (0, 1, 2) });
Пример #4
0
 public void TestUVMesh_SingleRange()
 {
     var model = PEMockFactory.CreateModel(
         new[] {
         new V2(0.1f, 0.1f),
         new V2(0.1f, 0.9f),
         new V2(0.9f, 0.1f),
         new V2(0.9f, 0.9f),
     },
         new[] {
Пример #5
0
        public static void Initialize(TestContext testContext)
        {
            // 具象型にして値を確定させないと呼ばれるたびにインスタンスを新規生成する
            var headVertices = PEMockFactory.CreateVertices(new V2(0, 1), new V2(-1, 0), new V2(1, -1)).ToArray();
            var tailVertices = PEMockFactory.CreateVertices(new V2(0, -2), new V2(-1.5f, -1.5f), new V2(-1.5f, 0), new V2(-2, -1), new V2(-2.5f, 0.5f)).ToArray();

            var args = PEMockFactory.CreateRunArgs(headVertices.Concat(tailVertices), (0, 1, 2), (1, 3, 2), (1, 3, 4), (5, 6, 7));

            Editor = new Editor(args, new IwUVEditor.StateContainer.EditorStates(), null);
            Editor.LoadModel();

            foreach (var key in headVertices)
            {
                Editor.Current.Material.IsSelected[key] = true;
            }
        }