examples/RenderStack/example.Sandbox/Store/AmbientOcclusion.cs
/// <summary>
/// Updates ambient occlusion for all models in receivers group
/// </summary>
Updates ambient occlusion for all models in receivers group
Updates ambient occlusion for all models in receivers group
public void UpdateAmbientOcclusion(Group receivers, Group occluders)
        {
            if(RenderStack.Graphics.Configuration.GL3)
            {
                string mapName = "point_normals_for_ambient_occlusion";
                for(int i = 0; i < receivers.Models.Count; ++i)
                {
                    Model model = receivers.Models[i];
                    GeometryMesh mesh = model.Batch.MeshSource as GeometryMesh;
                    if(mesh != null)
                    {
                        Geometry geometry = mesh.Geometry;
                        geometry.ComputePointNormals(mapName);
                    }
                }
                for(int i = 0; i < receivers.Models.Count; ++i)
                {
                    Model model = receivers.Models[i];
                    UpdateAmbientOcclusion(model, occluders);
                }
            }
        }
public void UpdateAmbientOcclusion ( Group receivers , Group occluders ) { if ( RenderStack . Graphics . Configuration . GL3 ) { string mapName = " " ; for ( int i = 0 ; i < receivers . Models . Count ; ++ i ) { Model model = receivers . Models [ i ] ; GeometryMesh mesh = model . Batch . MeshSource as GeometryMesh ; if ( mesh != null ) { Geometry geometry = mesh . Geometry ; geometry . ComputePointNormals ( mapName ) ; } } for ( int i = 0 ; i < receivers . Models . Count ; ++ i ) { Model model = receivers . Models [ i ] ; UpdateAmbientOcclusion ( model , occluders ) ; } } }
Updates ambient occlusion for all models in receivers group
Updates ambient occlusion for all models in receivers group
//updateMsg = "ComputePointNormals for " + i + " / " + receivers.Models.Count; //OnRenderFrame(null); //renderer.PartialGLStateResetToDefaults(); //aoHemicubeRenderer.ProgramOverride = renderer.Programs["LightOccluder"]; //updateMsg = "UpdateAmbientOcclusion for " + i + " / " + receivers.Models.Count; //OnRenderFrame(null); //updateMsg = "";
receivers
Group
occluders
Group