예제 #1
0
        public Modell ToTransformed()
        {
            Modell new_modell = new Modell();

            new_modell.vertices = modell.vertices;
            for (int i = 0; i < this.modell.vertices.Length; i++)
            {
                new_modell.vertices[i] *= scale;
                new_modell.vertices[i] += position;
            }
            new_modell.uv     = this.modell.uv;
            new_modell.normal = this.modell.normal;
            return(new_modell);
        }
예제 #2
0
        public static Modell Combine(Modell[] modells)
        {
            Modell final_modell = new Modell();
            int    count        = 0;

            foreach (var item in modells)
            {
                count += item.vertices.Length;
            }
            final_modell.vertices = new Vector3[count];
            final_modell.uv       = new Vector2[count];
            final_modell.normal   = new Vector3[count];
            int pos = 0;

            foreach (Modell modell in modells)
            {
                for (int i = 0; i < modell.vertices.Length; i++)
                {
                    final_modell.vertices[i + pos] = modell.vertices[i];
                }
                pos += modell.vertices.Length;
            }
            pos = 0;
            foreach (Modell modell in modells)
            {
                for (int i = 0; i < modell.normal.Length; i++)
                {
                    final_modell.normal[i + pos] = modell.normal[i];
                }
                pos += modell.normal.Length;
            }
            pos = 0;
            foreach (Modell modell in modells)
            {
                for (int i = 0; i < modell.uv.Length; i++)
                {
                    final_modell.uv[i + pos] = modell.uv[i];
                }
                pos += modell.uv.Length;
            }
            return(final_modell);
        }
예제 #3
0
 public GameObject(string name, Vector3 position, Vector3 rotation, Vector3 scale, Modell modell)
 {
     this.name     = name;
     this.position = position;
     this.rotation = rotation;
     this.scale    = scale;
     this.modell   = modell;
 }