示例#1
0
    public static RAKTerrainObjectSaveData createSaveData(RAKTerrainObject terrainObject)
    {
        RAKTerrainObjectSaveData saveData = new RAKTerrainObjectSaveData();

        saveData.prefabObjectIndex = RAKUtilities.GetNonTerrainObjectIndex(terrainObject.prefabObjectName);
        Vector3 position = terrainObject.transform.position;

        saveData.position = new RAKTerrainMaster.RAKTerrainSavedData.RAKVector3(position);
        Quaternion rotation = terrainObject.transform.rotation;

        saveData.rotationEulers = new RAKTerrainMaster.RAKTerrainSavedData.RAKVector3(rotation);
        return(saveData);
    }
示例#2
0
        public RAKTerrainSavedData(float[,,] alphaMap, float[,] heightMap, SplatPrototype[] splatPrototypes, TreePrototype[] treePrototypes, TreeInstance[] trees
                                   , RAKTerrainObject[] nonTerrainObjects, Vector3 terraindDataSize)
        {
            this.alphaMapFlat = new float[alphaMap.Length];
            this.tdSize       = new RAKVector3(terraindDataSize);
            int flatCount = 0;

            for (int x = 0; x < alphaMap.GetLength(0); x++)
            {
                for (int y = 0; y < alphaMap.GetLength(1); y++)
                {
                    for (int z = 0; z < alphaMap.GetLength(2); z++)
                    {
                        this.alphaMapFlat[flatCount] = alphaMap[x, y, z];
                        flatCount++;
                    }
                }
            }
            this.heightMapFlat = new float[heightMap.Length];
            flatCount          = 0;
            for (int x = 0; x < heightMap.GetLength(0); x++)
            {
                for (int y = 0; y < heightMap.GetLength(1); y++)
                {
                    heightMapFlat[flatCount] = heightMap[x, y];
                    flatCount++;
                }
            }

            this.splatPrototypes = new RAKSplatPrototype[splatPrototypes.Length];
            this.treeProtoTypes  = new RAKTreeProtoType[treePrototypes.Length];
            this.trees           = new RAKTreeInstance[trees.Length];
            for (int count = 0; count < splatPrototypes.Length; count++)
            {
                this.splatPrototypes[count] = new RAKSplatPrototype(splatPrototypes[count].texture.name, splatPrototypes[count].tileSize);
            }
            for (int count = 0; count < treeProtoTypes.Length; count++)
            {
                this.treeProtoTypes[count] = new RAKTreeProtoType(treePrototypes[count]);
            }
            for (int count = 0; count < trees.Length; count++)
            {
                this.trees[count] = new RAKTreeInstance(trees[count]);
            }
            this.nonTerrainObjectsSaveData = new RAKTerrainObjectSaveData[nonTerrainObjects.Length];
            for (int count = 0; count < nonTerrainObjects.Length; count++)
            {
                this.nonTerrainObjectsSaveData[count] = RAKTerrainObjectSaveData.createSaveData(nonTerrainObjects[count]);
            }
        }