StandardizedDiffuseAlbedoMaps.CalibratedTexture.BuildCustomSwatches C# (CSharp) Method

BuildCustomSwatches() public method

Builds the custom swatches
public BuildCustomSwatches ( ImageUtility _CustomSwatchSamplingLocations ) : void
_CustomSwatchSamplingLocations ImageUtility In UV space. XY=Top Left corner, ZW=Bottom Right corner
return void
        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 );
            }
        }