Example #1
0
        /// <summary>
        /// Builds the custom swatches
        /// </summary>
        /// <param name="_CustomSwatchSamplingLocations">In UV space. XY=Top Left corner, ZW=Bottom Right corner</param>
        public void BuildCustomSwatches( ImageUtility.float4[] _CustomSwatchSamplingLocations )
        {
            if ( m_Texture == null )
                throw new Exception( "Cannot build custom swatched because no texture was captured!" );
            if ( _CustomSwatchSamplingLocations == null )
                throw new Exception( "Invalid swatch parameters!" );
            if ( m_SwatchWidth <= 0 || m_SwatchHeight <= 0 )
                throw new Exception( "Invalid swatch size! Must be > 0!" );

            m_CustomSwatches = new CustomSwatch[_CustomSwatchSamplingLocations.Length];
            for ( int CustomSwatchIndex=0; CustomSwatchIndex < m_CustomSwatches.Length; CustomSwatchIndex++ )
            {
                CustomSwatch	S = new CustomSwatch();
                m_CustomSwatches[CustomSwatchIndex] = S;

                S.Location = _CustomSwatchSamplingLocations[CustomSwatchIndex];
                S.xyY = ComputeAverageSwatchColor( new ImageUtility.float2( S.Location.x, S.Location.y ), new ImageUtility.float2( S.Location.z, S.Location.w ) );
                S.Texture = BuildSwatch( m_SwatchWidth, m_SwatchHeight, S.xyY );
            }
        }
Example #2
0
        public Form1()
        {
            m_AppKey = Registry.CurrentUser.CreateSubKey( @"Software\GodComplex\StandardizedDiffuseAlbedoMaps" );
            m_ApplicationPath = System.IO.Path.GetDirectoryName( Application.ExecutablePath );

            InitializeComponent();

            // Initialize color swatches
            m_SwatchMin = new Swatch() { m_Owner = this, m_Panel = panelSwatchMin };
            m_SwatchMax = new Swatch() { m_Owner = this, m_Panel = panelSwatchMax };
            m_SwatchAvg = new Swatch() { m_Owner = this, m_Panel = panelSwatchAverage };
            m_CustomSwatches[0] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch0, m_Panel = panelCustomSwatch0 };
            m_CustomSwatches[1] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch1, m_Panel = panelCustomSwatch1 };
            m_CustomSwatches[2] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch2, m_Panel = panelCustomSwatch2 };
            m_CustomSwatches[3] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch3, m_Panel = panelCustomSwatch3 };
            m_CustomSwatches[4] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch4, m_Panel = panelCustomSwatch4 };
            m_CustomSwatches[5] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch5, m_Panel = panelCustomSwatch5 };
            m_CustomSwatches[6] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch6, m_Panel = panelCustomSwatch6 };
            m_CustomSwatches[7] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch7, m_Panel = panelCustomSwatch7 };
            m_CustomSwatches[8] = new CustomSwatch() { m_Owner = this, m_CheckBox = checkBoxCustomSwatch8, m_Panel = panelCustomSwatch8 };
        }