Exemplo n.º 1
0
    void LoadData()
    {
        if (!dataBeLoad)
        {
            LoadTextures();
            LoadPlanes();
            int len = _vertexes.Length;
            vertices = new Vector3[len];
            normals  = new Vector3[len];
            uvs      = new Vector2[len];
            uv2s     = new Vector2[len];
            colors   = new Color[len];

            for (int i = 0; i < len; i++)
            {
                BSPFileParser.Vertex v = _vertexes[i];
                // Notice: Convert Vertex from right hand coordinate into left coordinate
                vertices[i] = Right2Left(new Vector3(v.position[0], v.position[1], v.position[2]));
                // Notice: Convert Normal from right hand coordinate into left coordinate
                normals[i] = Right2Left(new Vector3(v.normal[0], v.normal[1], v.normal[2]));
                uvs[i]     = new Vector2(v.uv[0][0], v.uv[0][1]);
                uv2s[i]    = new Vector2(v.uv[1][0], v.uv[1][1]);
                colors[i]  = new Color(((float)v.color[0]) / 255, ((float)v.color[1]) / 255, ((float)v.color[2]) / 255);
            }
            LoadAllMeshAndObject(gameObject, _models[0], "HouseChild");
            dataBeLoad = true;
        }
    }
Exemplo n.º 2
0
    void LoadVertices()
    {
        int len = _vertexes.Length;

        vertices = new Vector3[len];
        normals  = new Vector3[len];
        uvs      = new Vector2[len];
        uv2s     = new Vector2[len];
        colors   = new Color[len];

        for (int i = 0; i < len; i++)
        {
            BSPFileParser.Vertex v = _vertexes[i];
            // Notice: Convert Vertex from right hand coordinate into left coordinate
            vertices[i] = Right2Left(new Vector3(v.position[0], v.position[1], v.position[2]));
            // Notice: Convert Normal from right hand coordinate into left coordinate
            normals[i] = Right2Left(new Vector3(v.normal[0], v.normal[1], v.normal[2]));
            uvs[i]     = new Vector2(v.uv[0][0], v.uv[0][1]);
            uv2s[i]    = new Vector2(v.uv[1][0], v.uv[1][1]);
            colors[i]  = new Color(((float)v.color[0]) / 255, ((float)v.color[1]) / 255, ((float)v.color[2]) / 255);
        }
    }