private void Awake() { cellsPerRow = Mathf.ClosestPowerOfTwo(cellsPerRow); trunk = new Trunk(cellsPerRow, cellSize); meshFilter = GetComponent <MeshFilter>(); InitGridValue(1f); UpdateMesh(); }
public void TestBaseMeshReconImpl() { var meshFilter = InitMeshFilter(); var mesh = meshFilter.mesh; Trunk trunk = new Trunk(1, 1); trunk.grid[0, 0] = (baseMeshReconCaseIndex & 1) * 255; trunk.grid[0, 1] = (baseMeshReconCaseIndex >> 1 & 1) * 255; trunk.grid[1, 1] = (baseMeshReconCaseIndex >> 2 & 1) * 255; trunk.grid[1, 0] = (baseMeshReconCaseIndex >> 3 & 1) * 255; trunk.RecalculateTrunkMesh(mesh); meshFilter.mesh = mesh; }
public void TestCompositeMeshReconImpl() { var meshFilter = InitMeshFilter(); var mesh = meshFilter.mesh; Trunk trunk = new Trunk(4, 1); int v = compositeReconValue; trunk.grid = new int[, ] { { v, v, v, v, v }, { v, 0, 0, 0, v }, { v, 0, 0, v, v }, { v, 0, 0, 0, v }, { v, v, v, v, v }, }; trunk.RecalculateTrunkMesh(mesh); meshFilter.mesh = mesh; }