private void OnPreCull() { if (((Terrain.activeTerrain != null) && (Terrain.activeTerrain.terrainData != null)) && ((this._enabled && grass.on) && FPGrass.anyEnabled)) { Terrain activeTerrain = Terrain.activeTerrain; this.UpdateDisplacement(grass.displacement); if (activeTerrain != null) { FPGrass.RenderArguments arguments; Camera camera = base.camera; this._frustum = GeometryUtility.CalculateFrustumPlanes(camera); arguments.frustum = this._frustum; arguments.camera = camera; arguments.immediate = false; arguments.terrain = activeTerrain; arguments.center = camera.transform.position; FPGrass.DrawAllGrass(ref arguments); } } }
private void OnPreCull() { FPGrass.RenderArguments renderArgument = new FPGrass.RenderArguments(); if (!Terrain.activeTerrain || !Terrain.activeTerrain.terrainData) { return; } if (this._enabled && grass.on && FPGrass.anyEnabled) { Terrain terrain = Terrain.activeTerrain; this.UpdateDisplacement(grass.displacement); if (terrain) { Camera camera = base.camera; this._frustum = GeometryUtility.CalculateFrustumPlanes(camera); renderArgument.frustum = this._frustum; renderArgument.camera = camera; renderArgument.immediate = false; renderArgument.terrain = terrain; renderArgument.center = camera.transform.position; FPGrass.DrawAllGrass(ref renderArgument); } } }