private static void RegisterGrid(CullGrid grid) { if (grid) { CullGrid.grid = new CullGrid.CullGridRuntime(grid); CullGrid.has_grid = true; } }
public CullGridRuntime(CullGrid cullGrid) : base(cullGrid.setup) { this.cullGrid = cullGrid; this.transform = cullGrid.transform; this.halfCellTall = (double)this.cellsTall / 2; this.halfCellWide = (double)this.cellsWide / 2; this.twoMinusOddTall = 2 - (this.cellsTall & 1); this.twoMinusOddWide = 2 - (this.cellsWide & 1); this.halfTwoMinusOddTall = (double)this.twoMinusOddTall / 2; this.halfTwoMinusOddWide = this.halfTwoMinusOddWide / 2; this.halfCellTallMinusHalfTwoMinusOddTall = this.halfCellTall - this.halfTwoMinusOddTall; this.halfCellWideMinusHalfTwoMinusOddWide = this.halfCellWide - this.halfTwoMinusOddWide; Vector3 vector3 = this.transform.forward; Vector3 vector31 = this.transform.right; Vector3 vector32 = this.transform.position; this.fx = (double)vector3.x; this.fy = (double)vector3.y; this.fz = (double)vector3.z; double num = Math.Sqrt(this.fx * this.fx + this.fy * this.fy + this.fz * this.fz); CullGrid.CullGridRuntime cullGridRuntime = this; cullGridRuntime.fx = cullGridRuntime.fx / num; CullGrid.CullGridRuntime cullGridRuntime1 = this; cullGridRuntime1.fy = cullGridRuntime1.fy / num; CullGrid.CullGridRuntime cullGridRuntime2 = this; cullGridRuntime2.fz = cullGridRuntime2.fz / num; this.rx = (double)vector31.x; this.ry = (double)vector31.y; this.rz = (double)vector31.z; num = Math.Sqrt(this.rx * this.rx + this.ry * this.ry + this.rz * this.rz); CullGrid.CullGridRuntime cullGridRuntime3 = this; cullGridRuntime3.rx = cullGridRuntime3.rx / num; CullGrid.CullGridRuntime cullGridRuntime4 = this; cullGridRuntime4.ry = cullGridRuntime4.ry / num; CullGrid.CullGridRuntime cullGridRuntime5 = this; cullGridRuntime5.rz = cullGridRuntime5.rz / num; this.px = (double)vector32.x; this.py = (double)vector32.y; this.pz = (double)vector32.z; this.flat_wide_ofs = (double)this.cellSquareDimension * (this.halfCellWide - (double)(1 - (this.cellsWide & 1)) / 2); this.flat_tall_ofs = (double)this.cellSquareDimension * (this.halfCellTall - (double)(1 - (this.cellsTall & 1)) / 2); this.cellTallLast = (ushort)(this.cellsTall - 1); this.cellWideLast = (ushort)(this.cellsWide - 1); this.cellTallLastTimesSquareDimension = (double)this.cellTallLast * (double)this.cellSquareDimension; this.cellWideLastTimesSquareDimension = (double)this.cellWideLast * (double)this.cellSquareDimension; this.numCells = this.cellsTall * this.cellsWide; this.groupEnd = this.groupBegin + this.numCells; }