Ejemplo n.º 1
0
    void DoRedraw(TerrainRendererRedraw r)
    {
        idsCount = 0;
        Chunk c = r.c;

        if (c.rendered.ids != null)
        {
            for (int i = 0; i < c.rendered.idsCount; i++)
            {
                int loadedSubmesh = c.rendered.ids[i];
                game.d_Batcher.Remove(loadedSubmesh);
            }
        }
        for (int i = 0; i < r.dataCount; i++)
        {
            VerticesIndicesToLoad submesh = r.data[i];
            if (submesh.modelData.GetIndicesCount() != 0)
            {
                float centerVecX = submesh.positionX + chunksize / 2;
                float centerVecY = submesh.positionZ + chunksize / 2;
                float centerVecZ = submesh.positionY + chunksize / 2;
                float radius     = sqrt3half * chunksize;
                ids[idsCount++] = game.d_Batcher.Add(submesh.modelData, submesh.transparent, submesh.texture, centerVecX, centerVecY, centerVecZ, radius);
            }
        }
        int[] idsarr = new int[idsCount];
        for (int i = 0; i < idsCount; i++)
        {
            idsarr[i] = ids[i];
        }
        c.rendered.ids      = idsarr;
        c.rendered.idsCount = idsCount;
    }
Ejemplo n.º 2
0
    VerticesIndicesToLoad VerticesIndicesToLoadClone(VerticesIndicesToLoad source)
    {
        VerticesIndicesToLoad dest = new VerticesIndicesToLoad();

        dest.modelData   = ModelDataClone(source.modelData);
        dest.positionX   = source.positionX;
        dest.positionY   = source.positionY;
        dest.positionZ   = source.positionZ;
        dest.texture     = source.texture;
        dest.transparent = source.transparent;
        return(dest);
    }
 public VerticesIndicesToLoad GetVerticesIndices(ModelData m, int x, int y, int z, int texture, bool transparent)
 {
     VerticesIndicesToLoad v = new VerticesIndicesToLoad();
     v.modelData = m;
     v.positionX = x * chunksize;
     v.positionY = y * chunksize;
     v.positionZ = z * chunksize;
     v.texture = texture;
     v.transparent = transparent;
     return v;
 }
    public VerticesIndicesToLoad[] GetFinalVerticesIndices(int x, int y, int z, IntRef retCount)
    {
        VerticesIndicesToLoad[] ret = new VerticesIndicesToLoad[toreturnatlas1dLength + toreturnatlas1dLength];
        retCount.value = 0;
        for (int i = 0; i < toreturnatlas1dLength; i++)
        {
            if (toreturnatlas1d[i].indicesCount > 0)
            {
                ret[retCount.value++] = GetVerticesIndices(toreturnatlas1d[i], x, y, z, game.d_TerrainTextures.terrainTextures1d()[i % game.d_TerrainTextures.terrainTexturesPerAtlas()], false);
            }
        }
        for (int i = 0; i < toreturnatlas1dLength; i++)
        {
            if (toreturnatlas1dtransparent[i].indicesCount > 0)
            {
                ret[retCount.value++] = GetVerticesIndices(toreturnatlas1dtransparent[i], x, y, z, game.d_TerrainTextures.terrainTextures1d()[i % game.d_TerrainTextures.terrainTexturesPerAtlas()], true);
            }
        }

        return ret;
    }
Ejemplo n.º 5
0
 VerticesIndicesToLoad VerticesIndicesToLoadClone(VerticesIndicesToLoad source)
 {
     VerticesIndicesToLoad dest = new VerticesIndicesToLoad();
     dest.modelData = ModelDataClone(source.modelData);
     dest.positionX = source.positionX;
     dest.positionY = source.positionY;
     dest.positionZ = source.positionZ;
     dest.texture = source.texture;
     dest.transparent = source.transparent;
     return dest;
 }