private void AllocateContents() { m_dataCellsCount = Size >> MyVoxelConstants.DATA_CELL_SIZE_IN_VOXELS_BITS; var cellsSize = m_dataCellsCount.Size(); m_contentCells = new MyVoxelContentCell[cellsSize]; m_materialCells = new MaterialCell[cellsSize]; var defaultMaterial = MyDefinitionManager.Static.GetDefaultVoxelMaterialDefinition(); for (int i = 0; i < cellsSize; ++i) { m_materialCells[i] = new MaterialCell(defaultMaterial); } }
public void Resize(ref Vector3I size3D) { m_size3d = size3D; int size = size3D.Size(); m_sY = size3D.X * m_sX; m_sZ = size3D.Y * m_sY; m_sizeLinear = size * StepLinear; if (m_data == null || m_data.Length < m_sizeLinear) { int pow2Size = MathHelper.GetNearestBiggerPowerOfTwo(m_sizeLinear); Debug.Assert((pow2Size - m_sizeLinear) < m_sizeLinear); m_data = new byte[pow2Size]; } }