protected override void BuildData()
        {
            VertexList.AddRange(new Vector3[]
            {
                new Vector3(.5f, -.5f, 0), new Vector3(-.5f, -.5f, 0), new Vector3(-.5f, .5f, 0), new Vector3(.5f, .5f, 0),
            });

            NormalList.AddRange(new Vector3[]
            {
                Vector3.Backward, Vector3.Backward, Vector3.Backward, Vector3.Backward,
            });

            TexCoordList.AddRange(new Vector2[]
            {
                new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0),
            });

            ColorList.AddRange(new Color[]
            {
                Color.White, Color.White, Color.White, Color.White,
            });


            IndexList.AddRange(new int[]
            {
                0, 1, 2, 2, 3, 0, // Front
            });

            CalculateTangents();
        }
        public static void Main()
        {
            var normalList = new NormalList <int>();
            var bucketList = new BucketList <int>();

            for (int i = 0; i < 1000000; i++)
            {
                normalList.Add(i);
                bucketList.Add(i);
            }

            MeasureTime(() =>
            {
                for (int i = 0; i < 400000; i++)
                {
                    normalList.Remove(0);
                }
            }, "normal list removing");

            MeasureTime(() =>
            {
                for (int i = 0; i < 400000; i++)
                {
                    bucketList.Remove(0);
                }
            }, "bucket list removing");
        }
Exemple #3
0
        protected override void BuildData()
        {
            VertexList.AddRange(new Vector3[]
            {
                new Vector3(.5f, -.5f, .5f), new Vector3(-.5f, -.5f, .5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0),
                new Vector3(.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0),
                new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0),
                new Vector3(.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, .5f), new Vector3(.5f, -.5f, .5f),
                new Vector3(-.5f, -.5f, .5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0),
                new Vector3(.5f, -.5f, .5f), new Vector3(.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0)
            });

            NormalList.AddRange(new Vector3[]
            {
                Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up,
                Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up,
                Vector3.Up, Vector3.Up, Vector3.Up, Vector3.Up,
                Vector3.Down, Vector3.Down, Vector3.Down, Vector3.Down,
                Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up,
                Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up,
            });


            TexCoordList.AddRange(new Vector2[]
            {
                new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0),
                new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0),
                new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0),
                new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0),
                new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0),
                new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0),
                new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0),
            });

            ColorList.AddRange(new Color[]
            {
                Color.White, Color.White, Color.White, Color.White,
                Color.White, Color.White, Color.White, Color.White,
                Color.White, Color.White, Color.White, Color.White,
                Color.White, Color.White, Color.White, Color.White,
                Color.White, Color.White, Color.White, Color.White,
                Color.White, Color.White, Color.White, Color.White,
            });


            IndexList.AddRange(new int[]
            {
                0, 1, 2, 2, 3, 0,       // Front
                4, 7, 6, 6, 5, 4,       // Back
                8, 11, 10, 10, 9, 8,    // Top
                12, 13, 14, 14, 15, 12, // Bottom
                16, 17, 18, 18, 19, 16, // Left
                20, 23, 22, 22, 21, 20, // Right
            });

            CalculateTangents();
        }
        protected override void BuildData()
        {
            VertexList.AddRange(new Vector3[] { new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.4045088f, -1f, -0.2938928f), new Vector3(-0.2938928f, -1f, -0.4045087f), new Vector3(-0.1545086f, -1f, -0.4755285f), new Vector3(0f, -1f, -0.5000002f), new Vector3(0.1545086f, -1f, -0.4755285f), new Vector3(0.2938927f, -1f, -0.4045087f), new Vector3(0.4045086f, -1f, -0.2938927f), new Vector3(0.4755284f, -1f, -0.1545085f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.4755284f, -1f, 0.1545085f), new Vector3(0.4045086f, -1f, 0.2938927f), new Vector3(0.2938927f, -1f, 0.4045086f), new Vector3(0.1545085f, -1f, 0.4755283f), new Vector3(1.490116E-08f, -1f, 0.5000001f), new Vector3(-0.1545085f, -1f, 0.4755283f), new Vector3(-0.2938926f, -1f, 0.4045085f), new Vector3(-0.4045085f, -1f, 0.2938927f), new Vector3(-0.4755283f, -1f, 0.1545085f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4045088f, 1f, -0.2938928f), new Vector3(-0.2938928f, 1f, -0.4045087f), new Vector3(-0.1545086f, 1f, -0.4755285f), new Vector3(0f, 1f, -0.5000002f), new Vector3(0.1545086f, 1f, -0.4755285f), new Vector3(0.2938927f, 1f, -0.4045087f), new Vector3(0.4045086f, 1f, -0.2938927f), new Vector3(0.4755284f, 1f, -0.1545085f), new Vector3(0.5000001f, 1f, 0f), new Vector3(0.4755284f, 1f, 0.1545085f), new Vector3(0.4045086f, 1f, 0.2938927f), new Vector3(0.2938927f, 1f, 0.4045086f), new Vector3(0.1545085f, 1f, 0.4755283f), new Vector3(1.490116E-08f, 1f, 0.5000001f), new Vector3(-0.1545085f, 1f, 0.4755283f), new Vector3(-0.2938926f, 1f, 0.4045085f), new Vector3(-0.4045085f, 1f, 0.2938927f), new Vector3(-0.4755283f, 1f, 0.1545085f), new Vector3(-0.5f, 1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.5000001f, 1f, 0f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.5f, 1f, 0f), new Vector3(-0.4045088f, -1f, -0.2938928f), new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.2938928f, -1f, -0.4045087f), new Vector3(-0.1545086f, -1f, -0.4755285f), new Vector3(0f, -1f, -0.5000002f), new Vector3(0.1545086f, -1f, -0.4755285f), new Vector3(0.2938927f, -1f, -0.4045087f), new Vector3(0.4045086f, -1f, -0.2938927f), new Vector3(0.4755284f, -1f, -0.1545085f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.4755284f, -1f, 0.1545085f), new Vector3(0.4045086f, -1f, 0.2938927f), new Vector3(0.2938927f, -1f, 0.4045086f), new Vector3(0.1545085f, -1f, 0.4755283f), new Vector3(1.490116E-08f, -1f, 0.5000001f), new Vector3(-0.1545085f, -1f, 0.4755283f), new Vector3(-0.2938926f, -1f, 0.4045085f), new Vector3(-0.4045085f, -1f, 0.2938927f), new Vector3(-0.4755283f, -1f, 0.1545085f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4045088f, 1f, -0.2938928f), new Vector3(-0.2938928f, 1f, -0.4045087f), new Vector3(-0.1545086f, 1f, -0.4755285f), new Vector3(0f, 1f, -0.5000002f), new Vector3(0.1545086f, 1f, -0.4755285f), new Vector3(0.2938927f, 1f, -0.4045087f), new Vector3(0.4045086f, 1f, -0.2938927f), new Vector3(0.4755284f, 1f, -0.1545085f), new Vector3(0.5000001f, 1f, 0f), new Vector3(0.4755284f, 1f, 0.1545085f), new Vector3(0.4045086f, 1f, 0.2938927f), new Vector3(0.2938927f, 1f, 0.4045086f), new Vector3(0.1545085f, 1f, 0.4755283f), new Vector3(1.490116E-08f, 1f, 0.5000001f), new Vector3(-0.1545085f, 1f, 0.4755283f), new Vector3(-0.2938926f, 1f, 0.4045085f), new Vector3(-0.4045085f, 1f, 0.2938927f), new Vector3(-0.4755283f, 1f, 0.1545085f), new Vector3(-0.5f, 1f, 0f), });
            NormalList.AddRange(new Vector3[] { new Vector3(-0.9334423f, 0f, -0.3587276f), new Vector3(-0.776903f, 0f, -0.6296204f), new Vector3(-0.5443152f, 0f, -0.8388808f), new Vector3(-0.258446f, 0f, -0.9660257f), new Vector3(0.05272146f, 0f, -0.9986092f), new Vector3(0.3587284f, 0f, -0.933442f), new Vector3(0.6296204f, 0f, -0.7769028f), new Vector3(0.8388808f, 0f, -0.5443152f), new Vector3(0.9660257f, 0f, -0.2584461f), new Vector3(0.9986093f, 0f, 0.05272135f), new Vector3(0.933442f, 0f, 0.3587283f), new Vector3(0.7769029f, 0f, 0.6296204f), new Vector3(0.5443153f, 0f, 0.8388808f), new Vector3(0.2584461f, 0f, 0.9660256f), new Vector3(-0.05272149f, 0f, 0.9986092f), new Vector3(-0.3587283f, 0f, 0.933442f), new Vector3(-0.6296203f, 0f, 0.776903f), new Vector3(-0.8388807f, 0f, 0.5443153f), new Vector3(-0.9660256f, 0f, 0.2584462f), new Vector3(-0.9986093f, 0f, -0.05272005f), new Vector3(-0.9660261f, 0f, -0.2584449f), new Vector3(-0.8388807f, 0f, -0.5443153f), new Vector3(-0.6296201f, 0f, -0.7769031f), new Vector3(-0.3587281f, 0f, -0.9334421f), new Vector3(-0.05272127f, 0f, -0.9986093f), new Vector3(0.2584463f, 0f, -0.9660256f), new Vector3(0.5443155f, 0f, -0.8388806f), new Vector3(0.7769032f, 0f, -0.6296201f), new Vector3(0.9334421f, 0f, -0.3587282f), new Vector3(0.9986093f, 0f, -0.05272135f), new Vector3(0.9660256f, 0f, 0.2584462f), new Vector3(0.8388806f, 0f, 0.5443155f), new Vector3(0.6296202f, 0f, 0.7769031f), new Vector3(0.3587282f, 0f, 0.9334421f), new Vector3(0.05272129f, 0f, 0.9986093f), new Vector3(-0.2584463f, 0f, 0.9660256f), new Vector3(-0.5443153f, 0f, 0.8388807f), new Vector3(-0.776903f, 0f, 0.6296203f), new Vector3(-0.9334421f, 0f, 0.3587282f), new Vector3(-0.9986092f, 0f, 0.05272201f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0.9986093f, 0f, 0.05272135f), new Vector3(0.9986093f, 0f, -0.05272135f), new Vector3(-0.9986093f, 0f, -0.05272005f), new Vector3(-0.9660261f, 0f, -0.2584449f), new Vector3(-0.9334423f, 0f, -0.3587276f), new Vector3(-0.9986092f, 0f, 0.05272201f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), });
            for (int v = 0; v < VertexList.Count; v++)
            {
                ColorList.Add(Color.White);
            }

            TexCoordList.AddRange(new Vector2[] { new Vector2(0.1005999f, 0.0004537381f), new Vector2(0.2005054f, 0.0004537381f), new Vector2(0.300411f, 0.0004537381f), new Vector2(0.4003165f, 0.0004537381f), new Vector2(0.500222f, 0.0004537381f), new Vector2(0.6001273f, 0.0004537381f), new Vector2(0.7000327f, 0.0004537381f), new Vector2(0.799938f, 0.0004537381f), new Vector2(0.8998432f, 0.0004537381f), new Vector2(0.999749f, 0.0004537381f), new Vector2(0.1005993f, 0.0004537381f), new Vector2(0.200505f, 0.0004537381f), new Vector2(0.3004106f, 0.0004537381f), new Vector2(0.400316f, 0.0004537381f), new Vector2(0.5002215f, 0.0004537381f), new Vector2(0.6001268f, 0.0004537381f), new Vector2(0.7000322f, 0.0004537381f), new Vector2(0.7999375f, 0.0004537381f), new Vector2(0.8998428f, 0.0004537381f), new Vector2(0.9997481f, 0.0004537381f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.2005053f, 0.9994308f), new Vector2(0.300411f, 0.9994308f), new Vector2(0.4003165f, 0.9994308f), new Vector2(0.500222f, 0.9994308f), new Vector2(0.6001273f, 0.9994308f), new Vector2(0.7000328f, 0.9994308f), new Vector2(0.7999381f, 0.9994308f), new Vector2(0.8998435f, 0.9994308f), new Vector2(0.9997491f, 0.9994308f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.2005051f, 0.9994308f), new Vector2(0.3004106f, 0.9994308f), new Vector2(0.400316f, 0.9994308f), new Vector2(0.5002215f, 0.9994308f), new Vector2(0.6001268f, 0.9994308f), new Vector2(0.7000321f, 0.9994308f), new Vector2(0.7999371f, 0.9994308f), new Vector2(0.8998424f, 0.9994308f), new Vector2(0.9997478f, 0.9994308f), new Vector2(0.5002239f, 0.4999443f), new Vector2(0.5002245f, 0.4999442f), new Vector2(0.0006936856f, 0.0004537381f), new Vector2(0.0006940446f, 0.9994308f), new Vector2(0.00069427f, 0.0004537381f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.1005999f, 0.0004537381f), new Vector2(0.0006939089f, 0.9994308f), new Vector2(0.0988569f, 0.7915539f), new Vector2(0.02838877f, 0.6532523f), new Vector2(0.2086136f, 0.9013107f), new Vector2(0.3469154f, 0.971779f), new Vector2(0.500224f, 0.9960608f), new Vector2(0.6535327f, 0.971779f), new Vector2(0.7918344f, 0.9013106f), new Vector2(0.901591f, 0.7915536f), new Vector2(0.9720588f, 0.6532521f), new Vector2(0.9963405f, 0.4999437f), new Vector2(0.9720586f, 0.3466355f), new Vector2(0.9015904f, 0.2083341f), new Vector2(0.7918337f, 0.09857755f), new Vector2(0.653532f, 0.02810944f), new Vector2(0.5002234f, 0.003827875f), new Vector2(0.346915f, 0.02810972f), new Vector2(0.2086136f, 0.09857795f), new Vector2(0.09885708f, 0.2083347f), new Vector2(0.02838913f, 0.3466361f), new Vector2(0.004107505f, 0.4999442f), new Vector2(0.9720596f, 0.6532523f), new Vector2(0.9015915f, 0.7915539f), new Vector2(0.7918347f, 0.9013107f), new Vector2(0.653533f, 0.971779f), new Vector2(0.5002243f, 0.9960608f), new Vector2(0.3469157f, 0.971779f), new Vector2(0.2086142f, 0.9013106f), new Vector2(0.0988576f, 0.7915537f), new Vector2(0.0283896f, 0.6532522f), new Vector2(0.004108027f, 0.4999439f), new Vector2(0.02838971f, 0.3466356f), new Vector2(0.09885782f, 0.2083341f), new Vector2(0.2086144f, 0.09857755f), new Vector2(0.3469159f, 0.02810938f), new Vector2(0.5002242f, 0.003827723f), new Vector2(0.6535327f, 0.02810941f), new Vector2(0.7918344f, 0.09857755f), new Vector2(0.901591f, 0.2083343f), new Vector2(0.9720591f, 0.3466357f), new Vector2(0.9963408f, 0.4999439f), });

            IndexList.AddRange(new int[] { 0, 21, 1, 0, 20, 21, 1, 21, 22, 1, 22, 2, 2, 22, 23, 2, 23, 3, 3, 23, 24, 3, 24, 4, 4, 24, 25, 4, 25, 5, 5, 25, 26, 5, 26, 6, 6, 26, 27, 6, 27, 7, 7, 27, 28, 7, 28, 8, 8, 28, 29, 8, 29, 9, 42, 30, 10, 42, 43, 30, 10, 30, 31, 10, 31, 11, 11, 31, 32, 11, 32, 12, 12, 32, 33, 12, 33, 13, 13, 33, 34, 13, 34, 14, 14, 34, 35, 14, 35, 15, 15, 35, 36, 15, 36, 16, 16, 36, 37, 16, 37, 17, 17, 37, 38, 17, 38, 18, 18, 38, 39, 18, 39, 19, 44, 45, 46, 44, 47, 45, 48, 40, 49, 50, 40, 48, 51, 40, 50, 52, 40, 51, 53, 40, 52, 54, 40, 53, 55, 40, 54, 56, 40, 55, 57, 40, 56, 58, 40, 57, 59, 40, 58, 60, 40, 59, 61, 40, 60, 62, 40, 61, 63, 40, 62, 64, 40, 63, 65, 40, 64, 66, 40, 65, 67, 40, 66, 49, 40, 67, 68, 41, 69, 69, 41, 70, 70, 41, 71, 71, 41, 72, 72, 41, 73, 73, 41, 74, 74, 41, 75, 75, 41, 76, 76, 41, 77, 77, 41, 78, 78, 41, 79, 79, 41, 80, 80, 41, 81, 81, 41, 82, 82, 41, 83, 83, 41, 84, 84, 41, 85, 85, 41, 86, 86, 41, 87, 87, 41, 68, });
            IndexList.Reverse();

            CalculateTangents();
        }
        protected override void BuildData()
        {
            int SquareSize = 10;

            int[]   index  = new int[(SquareSize - 1) * (SquareSize - 1) * 6];
            Vector2 uv     = Vector2.Zero;
            Vector3 center = new Vector3(SquareSize, 0, SquareSize) * .5f;

            for (int x = 0; x < SquareSize; x++)
            {
                for (int y = 0; y < SquareSize; y++)
                {
                    uv = new Vector2(x, y) / (float)(SquareSize - 1);
                    VertexList.Add(new Vector3(x, 0, y) - center);
                    NormalList.Add(Vector3.Up);
                    TexCoordList.Add(uv);
                    ColorList.Add(Color.White);
                }
            }

            for (int x = 0; x < SquareSize - 1; x++)
            {
                for (int y = 0; y < SquareSize - 1; y++)
                {
                    index[(x + y * (SquareSize - 1)) * 6]     = ((x + 1) + (y + 1) * SquareSize);
                    index[(x + y * (SquareSize - 1)) * 6 + 1] = ((x + 1) + y * SquareSize);
                    index[(x + y * (SquareSize - 1)) * 6 + 2] = (x + y * SquareSize);

                    index[(x + y * (SquareSize - 1)) * 6 + 3] = ((x + 1) + (y + 1) * SquareSize);
                    index[(x + y * (SquareSize - 1)) * 6 + 4] = (x + y * SquareSize);
                    index[(x + y * (SquareSize - 1)) * 6 + 5] = (x + (y + 1) * SquareSize);
                }
            }

            IndexList.AddRange(index);

            CalculateTangents();
        }
        public static void AddSkinnedModelWithAnimations(ref Skin SkinChunk, ref SkeletonCTTR SkeletonChunk, ref Shader[] ShaderChunks)//, ref Animation[] AnimChunks)
        {
            List <uint> IndexList = new List <uint>();

            cachedGeoms.geometry = new geometry[SkinChunk.NumPrimGroups];
            for (int primgroups = 0; primgroups < SkinChunk.NumPrimGroups; primgroups++)
            {
                cachedGeoms.geometry[primgroups]      = new geometry();
                cachedGeoms.geometry[primgroups].id   = "geometry" + primgroups;
                cachedGeoms.geometry[primgroups].name = "geometry" + primgroups;
                mesh newMesh = new Collada141.mesh();

                newMesh.vertices                   = new vertices();
                newMesh.vertices.id                = "geometry" + primgroups + "-vertices";
                newMesh.vertices.name              = "geometry" + primgroups + "-vertices";
                newMesh.vertices.input             = new InputLocal[1];
                newMesh.vertices.input[0]          = new InputLocal();
                newMesh.vertices.input[0].semantic = "POSITION";
                newMesh.vertices.input[0].source   = "#geometry" + primgroups + "-positions";
                //newMesh.vertices.input[1] = new InputLocal();
                //newMesh.vertices.input[1].semantic = "TEXCOORD";
                //newMesh.vertices.input[1].source = "#geometry" + primgroups + "-texcoords";
                //newMesh.vertices.input[2].semantic = "COLOR";
                //newMesh.vertices.input[2].source = "#geometry0-colors";

                newMesh.source = new source[3];

                newMesh.source[0]    = new source();
                newMesh.source[0].id = "geometry" + primgroups + "-positions";
                float_array geom_positions = new float_array();
                geom_positions.id = "geometry" + primgroups + "-positions-array";
                PositionList posList = SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <PositionList>()[0];
                geom_positions.count  = (ulong)posList.Positions.Length * 3;
                geom_positions.Values = new double[geom_positions.count];
                for (ulong i = 0; i < geom_positions.count / 3; i++)
                {
                    if (i % 3 == 0)
                    {
                        geom_positions.Values[i] = posList.Positions[i / 3].X;
                    }
                    else if (i % 3 == 1)
                    {
                        geom_positions.Values[i] = posList.Positions[i / 3].Y;
                    }
                    else
                    {
                        geom_positions.Values[i] = posList.Positions[i / 3].Z;
                    }
                }

                newMesh.source[0].Item                             = geom_positions;
                newMesh.source[0].technique_common                 = new sourceTechnique_common();
                newMesh.source[0].technique_common.accessor        = new accessor();
                newMesh.source[0].technique_common.accessor.source = "#" + geom_positions.id;
                newMesh.source[0].technique_common.accessor.count  = geom_positions.count / 3;
                newMesh.source[0].technique_common.accessor.stride = 3;
                newMesh.source[0].technique_common.accessor.param  = new param[3] {
                    new param(), new param(), new param(),
                };
                newMesh.source[0].technique_common.accessor.param[0].name = "X";
                newMesh.source[0].technique_common.accessor.param[0].type = "float";
                newMesh.source[0].technique_common.accessor.param[1].name = "Y";
                newMesh.source[0].technique_common.accessor.param[1].type = "float";
                newMesh.source[0].technique_common.accessor.param[2].name = "Z";
                newMesh.source[0].technique_common.accessor.param[2].type = "float";

                newMesh.source[1]    = new source();
                newMesh.source[1].id = "geometry" + primgroups + "-mesh-normals";
                float_array geom_normals = new float_array();
                geom_normals.id = "geometry" + primgroups + "-mesh-map-array";
                NormalList normals = SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <NormalList>()[0];
                geom_normals.count  = (ulong)normals.Normals.Length * 3;
                geom_normals.Values = new double[geom_normals.count];
                for (ulong i = 0; i < geom_normals.count; i++)
                {
                    if (i % 3 == 0)
                    {
                        geom_normals.Values[i] = normals.Normals[i / 3].X;
                    }
                    else if (i % 3 == 1)
                    {
                        geom_normals.Values[i] = normals.Normals[i / 3].Y;
                    }
                    else
                    {
                        geom_normals.Values[i] = normals.Normals[i / 3].Z;
                    }
                }

                newMesh.source[1].Item                             = geom_normals;
                newMesh.source[1].technique_common                 = new sourceTechnique_common();
                newMesh.source[1].technique_common.accessor        = new accessor();
                newMesh.source[1].technique_common.accessor.source = "#" + geom_normals.id;
                newMesh.source[1].technique_common.accessor.count  = geom_positions.count / 3;
                newMesh.source[1].technique_common.accessor.stride = 3;
                newMesh.source[1].technique_common.accessor.param  = new param[3] {
                    new param(), new param(), new param(),
                };
                newMesh.source[1].technique_common.accessor.param[0].name = "X";
                newMesh.source[1].technique_common.accessor.param[0].type = "float";
                newMesh.source[1].technique_common.accessor.param[1].name = "Y";
                newMesh.source[1].technique_common.accessor.param[1].type = "float";
                newMesh.source[1].technique_common.accessor.param[2].name = "Z";
                newMesh.source[1].technique_common.accessor.param[2].type = "float";

                newMesh.source[2]    = new source();
                newMesh.source[2].id = "geometry" + primgroups + "-mesh-map-0";
                float_array geom_texcoords = new float_array();
                geom_texcoords.id = "geometry" + primgroups + "-mesh-map-array";
                UVList UV = SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <UVList>()[0];
                geom_texcoords.count  = (ulong)UV.UVs.Length * 2;
                geom_texcoords.Values = new double[geom_texcoords.count];
                for (ulong i = 0; i < geom_texcoords.count; i++)
                {
                    ulong pos = i / 2;
                    geom_texcoords.Values[i] = UV.UVs[pos].X;
                    i++;
                    geom_texcoords.Values[i] = UV.UVs[pos].Y;
                }

                newMesh.source[2].Item                             = geom_texcoords;
                newMesh.source[2].technique_common                 = new sourceTechnique_common();
                newMesh.source[2].technique_common.accessor        = new accessor();
                newMesh.source[2].technique_common.accessor.source = "#" + geom_texcoords.id;
                newMesh.source[2].technique_common.accessor.count  = geom_texcoords.count / 2;
                newMesh.source[2].technique_common.accessor.stride = 2;
                newMesh.source[2].technique_common.accessor.param  = new param[2] {
                    new param(), new param(),
                };
                newMesh.source[2].technique_common.accessor.param[0].name = "S";
                newMesh.source[2].technique_common.accessor.param[0].type = "float";
                newMesh.source[2].technique_common.accessor.param[1].name = "T";
                newMesh.source[2].technique_common.accessor.param[1].type = "float";

                /*
                 * newMesh.source[3].id = "geometry" + primgroups + "-colors-Col";
                 * float_array geom_colors = new float_array();
                 * geom_colors.id = "geometry" + primgroups + "-colors-Col-array";
                 * ColourList colors = SkinChunk.GetChildren<PrimitiveGroupCTTR>()[primgroups].GetChildren<ColourList>()[0];
                 * geom_colors.count = (ulong)colors.Colours.Length * 3;
                 * geom_colors.Values = new double[geom_colors.count];
                 * for (ulong i = 0; i < geom_colors.count / 3; i++)
                 * {
                 *  if (i % 3 == 0)
                 *  {
                 *      geom_colors.Values[i] = colors.Colours[i];
                 *  }
                 *  else if (i % 3 == 1)
                 *  {
                 *      geom_colors.Values[i] = colors.Colours[i / 3];
                 *  }
                 *  else
                 *  {
                 *      geom_colors.Values[i] = colors.Colours[i / 3];
                 *  }
                 * }
                 *
                 * newMesh.source[3].Item = geom_colors;
                 * newMesh.source[3].technique_common = new sourceTechnique_common();
                 * newMesh.source[3].technique_common.accessor = new accessor();
                 * newMesh.source[3].technique_common.accessor.source = geom_colors.id;
                 * newMesh.source[3].technique_common.accessor.count = geom_colors.count / 3;
                 * newMesh.source[3].technique_common.accessor.stride = 3;
                 * newMesh.source[3].technique_common.accessor.param = new param[3];
                 * newMesh.source[3].technique_common.accessor.param[0].name = "R";
                 * newMesh.source[3].technique_common.accessor.param[0].type = "float";
                 * newMesh.source[3].technique_common.accessor.param[1].name = "G";
                 * newMesh.source[3].technique_common.accessor.param[1].type = "float";
                 * newMesh.source[3].technique_common.accessor.param[2].name = "B";
                 * newMesh.source[3].technique_common.accessor.param[2].type = "float";
                 */

                polylist meshTriangles = new polylist();
                meshTriangles.material          = "";
                meshTriangles.count             = (ulong)SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices.Length / 4;
                meshTriangles.input             = new InputLocalOffset[3];
                meshTriangles.input[0]          = new InputLocalOffset();
                meshTriangles.input[0].semantic = "VERTEX";
                meshTriangles.input[0].source   = "#" + newMesh.vertices.id;
                meshTriangles.input[0].offset   = 0;
                meshTriangles.input[1]          = new InputLocalOffset();
                meshTriangles.input[1].semantic = "NORMAL";
                meshTriangles.input[1].source   = "#" + "geometry" + primgroups + "-mesh-normals";
                meshTriangles.input[1].offset   = 1;
                meshTriangles.input[2]          = new InputLocalOffset();
                meshTriangles.input[2].semantic = "TEXCOORD";
                meshTriangles.input[2].source   = "#" + "geometry" + primgroups + "-mesh-map-0";
                meshTriangles.input[2].offset   = 2;
                meshTriangles.input[2].set      = 0;
                string packed_primitives = "";
                for (int i = 0; i < SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices.Length; i++)
                {
                    packed_primitives += SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices[i];
                    packed_primitives += " ";
                }
                string packed_vcount = "";
                for (int i = 0; i < SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices.Length / 3; i++)
                {
                    packed_vcount += "3 ";
                }
                meshTriangles.vcount = packed_vcount;

                meshTriangles.p = packed_primitives;

                newMesh.Items    = new object[1];
                newMesh.Items[0] = meshTriangles;

                cachedGeoms.geometry[primgroups].Item = newMesh;

                for (int i = 0; i < SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices.Length; i++)
                {
                    IndexList.Add(SkinChunk.GetChildren <PrimitiveGroupCTTR>()[primgroups].GetChildren <IndexList>()[0].Indices[i]);
                }
            }

            cachedMats.material = new material[ShaderChunks.Length];
            List <string> shader_tex = new List <string>();

            for (int mat = 0; mat < ShaderChunks.Length; mat++)
            {
                cachedMats.material[mat]                     = new material();
                cachedMats.material[mat].id                  = "mat" + ShaderChunks[mat].Name;
                cachedMats.material[mat].name                = ShaderChunks[mat].Name;
                cachedMats.material[mat].instance_effect     = new instance_effect();
                cachedMats.material[mat].instance_effect.url = "#" + ShaderChunks[mat].Name; //effect name
                if (ShaderChunks[mat].GetChildren <ShaderTextureParam>().Length > 0)
                {
                    if (!shader_tex.Contains(ShaderChunks[mat].GetChildren <ShaderTextureParam>()[0].Value))
                    {
                        shader_tex.Add(ShaderChunks[mat].GetChildren <ShaderTextureParam>()[0].Value);
                    }
                }
            }

            cachedImages.image = new image[shader_tex.Count];
            for (int i = 0; i < cachedImages.image.Length; i++)
            {
                cachedImages.image[i]    = new image();
                cachedImages.image[i].id = "image" + shader_tex[i];
                //fx_surface_init_from_common init_from = new fx_surface_init_from_common();
                //init_from.Value = shader_tex[i];
                //cachedImages.image[i].Item = init_from;
            }

            cachedEffects.effect = new effect[ShaderChunks.Length];
            for (int mat = 0; mat < ShaderChunks.Length; mat++)
            {
                cachedEffects.effect[mat]                                        = new effect();
                cachedEffects.effect[mat].id                                     = ShaderChunks[mat].Name;
                cachedEffects.effect[mat].name                                   = ShaderChunks[mat].Name;
                cachedEffects.effect[mat].newparam                               = new fx_newparam_common[2];
                cachedEffects.effect[mat].newparam[0]                            = new fx_newparam_common();
                cachedEffects.effect[mat].newparam[0].sid                        = "Image-surface";
                cachedEffects.effect[mat].newparam[0].surface                    = new fx_surface_common();
                cachedEffects.effect[mat].newparam[0].surface.type               = fx_surface_type_enum.Item2D;
                cachedEffects.effect[mat].newparam[0].surface.init_from          = new fx_surface_init_from_common[1];
                cachedEffects.effect[mat].newparam[0].surface.init_from[0]       = new fx_surface_init_from_common();
                cachedEffects.effect[mat].newparam[0].surface.init_from[0].Value = ShaderChunks[mat].Name;
                cachedEffects.effect[mat].newparam[0].surface.format             = "A8R8G8B8";

                cachedEffects.effect[mat].newparam[1]                     = new fx_newparam_common();
                cachedEffects.effect[mat].newparam[1].sid                 = "Image-sampler";
                cachedEffects.effect[mat].newparam[1].sampler2D           = new fx_sampler2D_common();
                cachedEffects.effect[mat].newparam[1].sampler2D.source    = "Image-surface";
                cachedEffects.effect[mat].newparam[1].sampler2D.wrap_s    = fx_sampler_wrap_common.CLAMP;
                cachedEffects.effect[mat].newparam[1].sampler2D.wrap_t    = fx_sampler_wrap_common.CLAMP;
                cachedEffects.effect[mat].newparam[1].sampler2D.minfilter = fx_sampler_filter_common.NEAREST;
                cachedEffects.effect[mat].newparam[1].sampler2D.magfilter = fx_sampler_filter_common.NEAREST;
                cachedEffects.effect[mat].newparam[1].sampler2D.mipfilter = fx_sampler_filter_common.NEAREST;

                cachedEffects.effect[mat].Items                  = new effectFx_profile_abstractProfile_COMMON[1];
                cachedEffects.effect[mat].Items[0]               = new effectFx_profile_abstractProfile_COMMON();
                cachedEffects.effect[mat].Items[0].technique     = new effectFx_profile_abstractProfile_COMMONTechnique();
                cachedEffects.effect[mat].Items[0].technique.sid = "common";
                effectFx_profile_abstractProfile_COMMONTechniquePhong common_phong = new effectFx_profile_abstractProfile_COMMONTechniquePhong();
                common_color_or_texture_typeTexture textureType = new common_color_or_texture_typeTexture();
                textureType.texture           = "Image-sampler";
                textureType.texcoord          = "tc";
                common_phong.diffuse          = new common_color_or_texture_type();
                common_phong.diffuse.Item     = textureType;
                common_phong.transparent      = new common_transparent_type();
                common_phong.transparent.Item = textureType;

                cachedEffects.effect[mat].Items[0].technique.Item = common_phong;
            }

            cachedControllers.controller = new controller[SkinChunk.NumPrimGroups];

            for (int a = 0; a < SkinChunk.NumPrimGroups; a++)
            {
                cachedControllers.controller[a]      = new controller();
                cachedControllers.controller[a].id   = SkinChunk.Name + a;
                cachedControllers.controller[a].name = SkinChunk.Name + a;

                skin ControllerSkin = new skin();

                ControllerSkin.source1 = "#geometry" + a;
                ControllerSkin.source  = new source[3];

                ControllerSkin.source[0]    = new source();
                ControllerSkin.source[0].id = "controller" + a + "-joints";
                Name_array Joints_Names = new Name_array();
                Joints_Names.id     = "controller" + a + "-joints-array";
                Joints_Names.count  = (ulong)SkeletonChunk.GetChildren <SkeletonJointCTTR>().Length;
                Joints_Names.Values = new string[Joints_Names.count];
                for (ulong i = 0; i < Joints_Names.count; i++)
                {
                    Joints_Names.Values[i] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].Name;
                }

                ControllerSkin.source[0].Item                             = Joints_Names;
                ControllerSkin.source[0].technique_common                 = new sourceTechnique_common();
                ControllerSkin.source[0].technique_common.accessor        = new accessor();
                ControllerSkin.source[0].technique_common.accessor.source = "#" + Joints_Names.id;
                ControllerSkin.source[0].technique_common.accessor.count  = Joints_Names.count;
                ControllerSkin.source[0].technique_common.accessor.param  = new param[1] {
                    new param()
                };
                ControllerSkin.source[0].technique_common.accessor.param[0].name = "JOINT";
                ControllerSkin.source[0].technique_common.accessor.param[0].type = "Name";

                ControllerSkin.source[1]    = new source();
                ControllerSkin.source[1].id = "controller" + a + "-bind_poses";
                float_array Bind_Poses = new float_array();
                Bind_Poses.id     = "controller" + a + "-bind_poses-array";
                Bind_Poses.count  = (ulong)SkeletonChunk.GetChildren <SkeletonJointCTTR>().Length * 16;
                Bind_Poses.Values = new double[Bind_Poses.count];
                int bind_pose_pos = 0;
                for (ulong i = 0; i < Joints_Names.count; i++)
                {
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M11;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M12;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M13;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M14;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M21;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M22;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M23;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M24;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M31;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M32;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M33;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M34;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M41;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M42;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M43;
                    bind_pose_pos++;
                    Bind_Poses.Values[bind_pose_pos] = SkeletonChunk.GetChildren <SkeletonJointCTTR>()[i].RestPose.M44;
                    bind_pose_pos++;
                }

                ControllerSkin.source[1].Item                             = Bind_Poses;
                ControllerSkin.source[1].technique_common                 = new sourceTechnique_common();
                ControllerSkin.source[1].technique_common.accessor        = new accessor();
                ControllerSkin.source[1].technique_common.accessor.source = "#" + Bind_Poses.id;
                ControllerSkin.source[1].technique_common.accessor.count  = Bind_Poses.count;
                ControllerSkin.source[1].technique_common.accessor.param  = new param[1] {
                    new param()
                };
                ControllerSkin.source[1].technique_common.accessor.param[0].name = "TRANSFORM";
                ControllerSkin.source[1].technique_common.accessor.param[0].type = "float4x4";

                ControllerSkin.source[2]    = new source();
                ControllerSkin.source[2].id = "controller" + a + "-weights";
                float_array Weights_Array = new float_array();
                Weights_Array.id     = "controller" + a + "-weights-array";
                Weights_Array.count  = Joints_Names.count;
                Weights_Array.Values = new double[Joints_Names.count];
                for (int i = 0; i < Weights_Array.Values.Length; i++)
                {
                    Weights_Array.Values[i] = 1;
                }

                ControllerSkin.source[2].Item                             = Weights_Array;
                ControllerSkin.source[2].technique_common                 = new sourceTechnique_common();
                ControllerSkin.source[2].technique_common.accessor        = new accessor();
                ControllerSkin.source[2].technique_common.accessor.source = "#" + Weights_Array.id;
                ControllerSkin.source[2].technique_common.accessor.count  = Weights_Array.count;
                ControllerSkin.source[2].technique_common.accessor.param  = new param[1] {
                    new param()
                };
                ControllerSkin.source[2].technique_common.accessor.param[0].name = "WEIGHT";
                ControllerSkin.source[2].technique_common.accessor.param[0].type = "float";

                ControllerSkin.joints       = new skinJoints();
                ControllerSkin.joints.input = new InputLocal[2] {
                    new InputLocal(), new InputLocal()
                };
                ControllerSkin.joints.input[0].semantic = "JOINT";
                ControllerSkin.joints.input[0].source   = "#" + ControllerSkin.source[0].id;
                ControllerSkin.joints.input[1].semantic = "INV_BIND_MATRIX";
                ControllerSkin.joints.input[1].source   = "#" + ControllerSkin.source[1].id;

                ControllerSkin.vertex_weights       = new skinVertex_weights();
                ControllerSkin.vertex_weights.count = (ulong)IndexList.Count;
                ControllerSkin.vertex_weights.input = new InputLocalOffset[2] {
                    new InputLocalOffset(), new InputLocalOffset()
                };
                ControllerSkin.vertex_weights.input[0].semantic = "JOINT";
                ControllerSkin.vertex_weights.input[0].source   = "#" + ControllerSkin.source[0].id;
                ControllerSkin.vertex_weights.input[0].offset   = 0;
                ControllerSkin.vertex_weights.input[1].semantic = "WEIGHT";
                ControllerSkin.vertex_weights.input[1].source   = "#" + ControllerSkin.source[2].id;
                ControllerSkin.vertex_weights.input[1].offset   = 1;
                string vertex_vcount = "";
                for (int i = 0; i < IndexList.Count; i++)
                {
                    vertex_vcount += "1 ";
                }
                ControllerSkin.vertex_weights.vcount = vertex_vcount;

                string index_list_str = "";
                for (int i = 0; i < IndexList.Count; i++)
                {
                    index_list_str += IndexList[i] + " ";
                }

                ControllerSkin.vertex_weights.v = index_list_str;

                cachedControllers.controller[a].Item = ControllerSkin;
            }

            cachedVscenes.visual_scene = new visual_scene[1] {
                new visual_scene()
            };
            cachedVscenes.visual_scene[0].id      = "Scene0";
            cachedVscenes.visual_scene[0].name    = "Scene0";
            cachedVscenes.visual_scene[0].node    = new node[SkinChunk.NumPrimGroups + 1];
            cachedVscenes.visual_scene[0].node[0] = new node();
            //cachedVscenes.visual_scene[0].node[0].Items = new object[1];
            //cachedVscenes.visual_scene[0].node[0].Items[0] = new matrix();

            for (int i = 0; i < SkeletonChunk.Children.Count; i++)
            {
                SkeletonJointCTTR joint = (SkeletonJointCTTR)SkeletonChunk.Children[i];
                if (joint.SkeletonParent == 0)
                {
                    //cachedVscenes.visual_scene[0].node[0].node1 = new node[10];
                }
            }

            cachedVscenes.visual_scene[0].node[0].id   = SkeletonChunk.Name;
            cachedVscenes.visual_scene[0].node[0].type = NodeType.JOINT;

            //todo: joints node tree
            // SkeletonParent - 0 means root, the rest is chunk child index
            // SkeletonJointCTTR.BindPose matrix as transform matrix?

            for (int i = 1; i < SkinChunk.NumPrimGroups + 1; i++)
            {
                cachedVscenes.visual_scene[0].node[i] = new node();

                cachedVscenes.visual_scene[0].node[i].id   = "node" + i;
                cachedVscenes.visual_scene[0].node[i].name = "polygon" + i;
                cachedVscenes.visual_scene[0].node[i].type = NodeType.NODE;
                cachedVscenes.visual_scene[0].node[i].instance_controller = new instance_controller[1] {
                    new instance_controller()
                };
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].url      = "#" + cachedControllers.controller[i - 1].id;
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].skeleton = new string[1] {
                    "#" + cachedVscenes.visual_scene[0].node[0].id
                };
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material = new bind_material();
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common = new instance_material[1] {
                    new instance_material()
                };
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common[0].symbol            = "#" + cachedMats.material[0].id;
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common[0].target            = "#" + cachedMats.material[0].id;
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common[0].bind_vertex_input = new instance_materialBind_vertex_input[1] {
                    new instance_materialBind_vertex_input()
                };
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common[0].bind_vertex_input[0].semantic       = "tc";
                cachedVscenes.visual_scene[0].node[i].instance_controller[0].bind_material.technique_common[0].bind_vertex_input[0].input_semantic = "TEXCOORD";
            }



            //not working:
            // - vertex weights error out
            // - mesh comes out wrong

            //animclips
            //anims
        }