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]); } }
public RAKTreeInstance(TreeInstance tree) { color[0] = tree.color.a; color[1] = tree.color.b; color[2] = tree.color.g; color[3] = tree.color.r; lightingColor[0] = tree.lightmapColor.a; lightingColor[1] = tree.lightmapColor.b; lightingColor[2] = tree.lightmapColor.g; lightingColor[3] = tree.lightmapColor.r; this.heightScale = tree.heightScale; this.widthScale = tree.widthScale; this.position = new RAKVector3(tree.position.x, tree.position.y, tree.position.z); this.protoypeIndex = tree.prototypeIndex; }
public RAKSplatPrototype(string textureName, Vector2 tileSize) { this.textureName = textureName; this.tileSize = new RAKVector3(tileSize.x, tileSize.y, 0); }