// Token: 0x060002B3 RID: 691 RVA: 0x0000E1EC File Offset: 0x0000C3EC
 internal void Render(ref global::FPGrass.RenderArguments renderArgs)
 {
     global::FPGrass.RenderArguments renderArguments = renderArgs;
     renderArguments.center = this.lastPosition;
     foreach (global::FPGrassPatch fpgrassPatch in this.children)
     {
         if (fpgrassPatch.enabled)
         {
             fpgrassPatch.Render(ref renderArguments);
         }
     }
 }
    // Token: 0x06000291 RID: 657 RVA: 0x0000D66C File Offset: 0x0000B86C
    internal static void DrawAllGrass(ref global::FPGrass.RenderArguments renderArgs)
    {
        List <global::FPGrass> allEnabledFPGrass = global::FPGrass.AllEnabledFPGrass;

        global::FPGrass.AllEnabledFPGrassInstancesSwap.AddRange(allEnabledFPGrass);
        global::FPGrass.AllEnabledFPGrass = global::FPGrass.AllEnabledFPGrassInstancesSwap;
        global::FPGrass.AllEnabledFPGrassInstancesSwap = allEnabledFPGrass;
        try
        {
            foreach (global::FPGrass fpgrass in global::FPGrass.AllEnabledFPGrassInstancesSwap)
            {
                fpgrass.Render(ref renderArgs);
            }
        }
        finally
        {
            global::FPGrass.AllEnabledFPGrassInstancesSwap.Clear();
        }
    }
 // Token: 0x06000292 RID: 658 RVA: 0x0000D71C File Offset: 0x0000B91C
 private void Render(ref global::FPGrass.RenderArguments renderArgs)
 {
     if (base.enabled)
     {
         foreach (global::FPGrassLevel fpgrassLevel in this.children)
         {
             if (fpgrassLevel.enabled)
             {
                 if (!renderArgs.immediate)
                 {
                     fpgrassLevel.UpdateLevel(renderArgs.center, renderArgs.terrain);
                 }
                 if (fpgrassLevel.enabled)
                 {
                     fpgrassLevel.Render(ref renderArgs);
                 }
             }
         }
     }
 }
 // Token: 0x060002B2 RID: 690 RVA: 0x0000E124 File Offset: 0x0000C324
 internal void Draw(global::FPGrassPatch patch, Mesh mesh, ref Vector3 renderPosition, ref global::FPGrass.RenderArguments renderArgs)
 {
     if (this.probabilityUpdateQueued || global::grass.forceredraw)
     {
         this.UpdateMapsNow(this.lastPosition);
         this.probabilityUpdateQueued = false;
     }
     if (global::grass.displacement)
     {
         Graphics.Blit(global::FPGrassDisplacementCamera.GetRT(), this.probabilityGenerator.probabilityTexture, global::FPGrassDisplacementCamera.GetBlitMat());
     }
     if (renderArgs.immediate)
     {
         GL.PushMatrix();
         this.levelMaterial.SetPass(0);
         Graphics.DrawMeshNow(mesh, renderPosition, global::FPGrassLevel.Constant.rotation, 0);
         GL.PopMatrix();
     }
     else
     {
         Graphics.DrawMesh(mesh, renderPosition, global::FPGrassLevel.Constant.rotation, this.levelMaterial, base.gameObject.layer, base.camera, 0, null, global::FPGrass.castShadows, global::FPGrass.receiveShadows);
     }
 }
Example #5
0
    // Token: 0x060002B8 RID: 696 RVA: 0x0000E2D4 File Offset: 0x0000C4D4
    internal void Render(ref global::FPGrass.RenderArguments renderArgs)
    {
        if (renderArgs.terrain == null)
        {
            return;
        }
        Vector3 vector = renderArgs.center + this.transform.position;
        Bounds  bounds;
        bool    flag;

        if (vector.x == this.lastRenderPosition.x && vector.y == this.lastRenderPosition.y && vector.z == this.lastRenderPosition.z)
        {
            bounds = this.lastBounds;
            flag   = false;
        }
        else
        {
            Vector3 vector2 = vector;
            Vector3 vector3 = vector2;
            Vector3 vector4 = vector2;
            Vector3 vector5 = vector2;
            float   num     = this.patchSize * 0.5f;
            vector2.x -= num;
            vector2.z += num;
            vector3.x -= num;
            vector3.z -= num;
            vector4.x += num;
            vector4.z += num;
            vector5.x += num;
            vector5.z -= num;
            float num2 = renderArgs.terrain.SampleHeight(vector2);
            float num3 = renderArgs.terrain.SampleHeight(vector3);
            float num4 = renderArgs.terrain.SampleHeight(vector4);
            float num5 = renderArgs.terrain.SampleHeight(vector5);
            float num6;
            float num7;
            if (num2 < num3)
            {
                num6 = num2;
                num7 = num3;
            }
            else
            {
                num6 = num3;
                num7 = num2;
            }
            float num8;
            float num9;
            if (num4 < num5)
            {
                num8 = num4;
                num9 = num5;
            }
            else
            {
                num8 = num5;
                num9 = num4;
            }
            float num10;
            if (num6 < num8)
            {
                num10 = num6;
            }
            else
            {
                num10 = num8;
            }
            float num11;
            if (num7 > num9)
            {
                num11 = num7;
            }
            else
            {
                num11 = num9;
            }
            vector3.y = num10 - 5f;
            vector4.y = num11 + 5f;
            bounds    = default(Bounds);
            bounds.SetMinMax(vector3, vector4);
            flag = (bounds != this.lastBounds);
        }
        if (!this.runtimeMesh)
        {
            this.runtimeMesh = this.mesh;
        }
        if (flag)
        {
            this.runtimeMesh.bounds = new Bounds(bounds.center - vector, bounds.size);
            this.lastBounds         = bounds;
        }
        if (GeometryUtility.TestPlanesAABB(renderArgs.frustum, bounds))
        {
            this.level.Draw(this, this.runtimeMesh, ref vector, ref renderArgs);
        }
    }