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); }
/// <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); }