public new void Read(BinaryStream bs) { base.Read(bs); Version = bs.Read.UInt(); Timestamp = bs.Read.ULong(); NumLods = bs.Read.UInt(); LodNodes = new LodNode[NumLods]; for (int i = 0; i < NumLods; i++) { var lodNode = new LodNode(); lodNode.Read(bs); LodNodes[i] = lodNode; } }
public LodNode(LodNode parent, LodProperties lodProperties, int lodLevel, Vector3 origin, Vector3 forward, Vector3 right) { this.parent = parent; this.lodProperties = lodProperties; this.lodLevel = lodLevel; this.origin = origin; this.forward = forward; this.right = right; this.children = null; this.gameObject = new GameObject("Chunk " + lodLevel); this.gameObject.transform.SetParent(lodProperties.gameObject.transform, false); this.meshFilter = this.gameObject.AddComponent <MeshFilter>(); this.meshRenderer = this.gameObject.AddComponent <MeshRenderer>(); this.plane = new LodFace(LodNode.CHUNK_RESOLUTION, lodProperties.heightGenerator, origin, lodProperties.up, forward, right).GenerateMesh(); this.meshRenderer.sharedMaterial = lodProperties.material; this.meshFilter.mesh = this.plane; }