private unsafe void WriteRange <TOperator>(MyCellCoord cell, byte defaultData, ref TOperator source, MyStorageDataTypeEnum type, ref Vector3I readOffset, ref Vector3I min, ref Vector3I max) where TOperator : struct, IVoxelOperator { MyOctreeNode node; uint key = cell.PackId32(); if (!this.m_nodes.TryGetValue(key, out node)) { for (int i = 0; i < 8; i++) { &node.Data.FixedElementField[i] = defaultData; } } if (cell.Lod == 0) { Vector3I vectori = cell.CoordInLod << 1; for (int i = 0; i < 8; i++) { Vector3I vectori2; this.ComputeChildCoord(i, out vectori2); Vector3I position = (Vector3I)(vectori + vectori2); if (position.IsInsideInclusiveEnd(ref min, ref max)) { position = (Vector3I)((position - min) + readOffset); source.Op(ref position, type, ref (byte)ref (&node.Data.FixedElementField + i)); } } this.m_nodes[key] = node; } else { Vector3I vectori4 = cell.CoordInLod << 1; Vector3I vectori6 = (min >> cell.Lod) - vectori4; Vector3I vectori7 = (max >> cell.Lod) - vectori4; for (int i = 0; i < 8; i++) { Vector3I vectori5; this.ComputeChildCoord(i, out vectori5); if (vectori5.IsInsideInclusiveEnd(ref vectori6, ref vectori7)) { MyCellCoord coord = new MyCellCoord(cell.Lod - 1, (Vector3I)(vectori4 + vectori5)); this.WriteRange <TOperator>(coord, &node.Data.FixedElementField[i], ref source, type, ref readOffset, ref min, ref max); uint num5 = coord.PackId32(); MyOctreeNode node2 = this.m_nodes[num5]; if (node2.HasChildren || !MyOctreeNode.AllDataSame(&node2.Data.FixedElementField)) { node.SetChild(i, true); &node.Data.FixedElementField[i] = this.m_nodeFilter(&node2.Data.FixedElementField, cell.Lod); } else { node.SetChild(i, false); &node.Data.FixedElementField[i] = node2.Data.FixedElementField; this.m_nodes.Remove(num5); } } } this.m_nodes[key] = node; } }