コード例 #1
0
        private void buttonComputeFilling_Click(object sender, EventArgs e)
        {
            try
            {
                m_Probe.ComputeFloodFill(
                    integerTrackbarControlK.Value,
                    integerTrackbarControlLightSamples.Value,
                    floatTrackbarControlPosition.Value,
                    floatTrackbarControlNormal.Value,
                    floatTrackbarControlAlbedo.Value,
                    floatTrackbarControlLambda.Value);
            }
            catch (Exception _e)
            {
                MessageBox("An error occurred while encoding probe: " + _e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            //////////////////////////////////////////////////////////////////////////
            // Refresh UI
            //
            textBoxResults.Text  = m_Probe.m_EmissiveSets.Length + " emissive sets generated\r\n";
            textBoxResults.Text += m_Probe.m_Sets.Length + " sets generated:\r\n\r\n";
            for (int SetIndex = 0; SetIndex < m_Probe.m_Sets.Length; SetIndex++)
            {
                Probe.Set S = m_Probe.m_Sets[SetIndex];
                textBoxResults.Text += SetIndex + ") " + S.SetPixels.Count + " pixels (" + (100.0f * S.SetPixels.Count / m_Probe.m_ScenePixels.Count).ToString("G4") + "%)\r\n"
                                       + "Albedo = (" + S.Albedo.x.ToString("G4") + ", " + S.Albedo.y.ToString("G4") + ", " + S.Albedo.z.ToString("G4") + ")\r\n\r\n";
            }

            integerTrackbarControlSetIsolation.RangeMax        = m_Probe.m_Sets.Length - 1;
            integerTrackbarControlSetIsolation.VisibleRangeMax = integerTrackbarControlSetIsolation.RangeMax;

            // Send to output panel for visual debugging
            outputPanel1.SHStatic    = m_Probe.m_StaticSH;
            outputPanel1.SHOcclusion = m_Probe.m_OcclusionSH;
            outputPanel1.SHDynamic   = m_Probe.m_SHSumDynamic;
            outputPanel1.SHEmissive  = m_Probe.m_SHSumEmissive;

//			radioButtonSetIndex.Checked = true;
            outputPanel1.UpdateBitmap();

            // We can now save the results
            saveResultsToolStripMenuItem.Enabled = true;
        }