示例#1
0
        /// <summary>
        /// Returns a Material reference to the default blit material for the given NoiseSettings object.
        /// </summary>
        /// <remarks>
        /// Internally, this uses noise.domainSettings.fractalTypeName to get it's FractalType
        /// </remarks>
        /// <returns> A reference to the default blit Material for the specified NoiseSettings instance </returns>
        public static Material GetDefaultBlitMaterial(NoiseSettings noise)
        {
            IFractalType fractal = NoiseLib.GetFractalTypeInstance(noise.domainSettings.fractalTypeName);

            if (fractal == null)
            {
                return(null);
            }

            return(GetDefaultBlitMaterial(fractal.GetType()));
        }
示例#2
0
        private void DomainSettingsGUI()
        {
            noiseTypeName.stringValue = NoiseLib.NoiseTypePopup(Styles.noiseType, noiseTypeName.stringValue);
            INoiseType noiseType = NoiseLib.GetNoiseTypeInstance(noiseTypeName.stringValue);

            noiseTypeParams.stringValue = noiseType?.DoGUI(noiseTypeParams.stringValue);

            fractalTypeName.stringValue = NoiseLib.FractalTypePopup(Styles.fractalType, fractalTypeName.stringValue);
            IFractalType fractalType = NoiseLib.GetFractalTypeInstance(fractalTypeName.stringValue);

            fractalTypeParams.stringValue = fractalType?.DoGUI(fractalTypeParams.stringValue);
        }
示例#3
0
        /// <summary>
        /// Sets up the provided Material to be used with this NoiseSettings instance. Some assumptions are made
        /// here as far as definitions and variable declarations in the Material's Shader go.
        /// float4 _NoiseTranslation, float4 _NoiseRotation, float4 _NoiseScale, and float4x4 _NoiseTransform are
        /// assumed to be declared. Sets up the Material using the NoiseType and FractalType SetupMaterial
        /// functions.
        /// </summary>
        /// <param name="mat"> The Material to set up for use with this NoiseSettings instance </param>
        public void SetupMaterial(Material mat)
        {
            INoiseType   noiseType   = NoiseLib.GetNoiseTypeInstance(domainSettings.noiseTypeName);
            IFractalType fractalType = NoiseLib.GetFractalTypeInstance(domainSettings.fractalTypeName);

            // set individual transform info
            mat.SetVector(ShaderStrings.translation, transformSettings.translation);
            mat.SetVector(ShaderStrings.rotation, transformSettings.rotation);
            mat.SetVector(ShaderStrings.scale, transformSettings.scale);

            // set full transform matrix
            mat.SetMatrix(ShaderStrings.transform, trs);

            noiseType?.SetupMaterial(mat, domainSettings.noiseTypeParams);
            fractalType?.SetupMaterial(mat, domainSettings.fractalTypeParams);
        }