public static void Inputs(TexelLitProperties properties, MaterialEditor materialEditor, Material material) { DoMetallicSpecularArea(properties, materialEditor, material); BaseShaderGUI.DrawNormalArea(materialEditor, properties.bumpMapProp, properties.bumpScaleProp); if (properties.occlusionMap != null) { materialEditor.TexturePropertySingleLine(Styles.OcclusionText, properties.occlusionMap, properties.occlusionMap.textureValue != null ? properties.occlusionStrength : null); } if (properties.posterizationStepCount != null) { materialEditor.VectorProperty( properties.posterizationStepCount, Styles.PosterizationColorText); } if (properties.lightPosterizationStepCount != null) { materialEditor.VectorProperty( properties.lightPosterizationStepCount, Styles.PosterizationLightText); } }
private static void DoSmoothness(TexelLitProperties properties, Material material, string[] smoothnessChannelNames) { var opaque = ((BaseShaderGUI.SurfaceType)material.GetFloat(Surface) == BaseShaderGUI.SurfaceType.Opaque); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = properties.smoothness.hasMixedValue; var smoothness = EditorGUILayout.Slider(Styles.SmoothnessText, properties.smoothness.floatValue, 0f, 1f); if (EditorGUI.EndChangeCheck()) { properties.smoothness.floatValue = smoothness; } EditorGUI.showMixedValue = false; if (properties.smoothnessMapChannel != null) // smoothness channel { EditorGUI.indentLevel++; EditorGUI.BeginDisabledGroup(!opaque); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = properties.smoothnessMapChannel.hasMixedValue; var smoothnessSource = (int)properties.smoothnessMapChannel.floatValue; if (opaque) { smoothnessSource = EditorGUILayout.Popup(Styles.SmoothnessMapChannelText, smoothnessSource, smoothnessChannelNames); } else { EditorGUILayout.Popup(Styles.SmoothnessMapChannelText, 0, smoothnessChannelNames); } if (EditorGUI.EndChangeCheck()) { properties.smoothnessMapChannel.floatValue = smoothnessSource; } EditorGUI.showMixedValue = false; EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; }
private static void DoMetallicSpecularArea(TexelLitProperties properties, MaterialEditor materialEditor, Material material) { string[] smoothnessChannelNames; bool hasGlossMap; if (properties.workflowMode == null || (WorkflowMode)properties.workflowMode.floatValue == WorkflowMode.Metallic) { hasGlossMap = properties.metallicGlossMap.textureValue != null; smoothnessChannelNames = Styles.MetallicSmoothnessChannelNames; materialEditor.TexturePropertySingleLine(Styles.MetallicMapText, properties.metallicGlossMap, hasGlossMap ? null : properties.metallic); } else { hasGlossMap = properties.specGlossMap.textureValue != null; smoothnessChannelNames = Styles.SpecularSmoothnessChannelNames; BaseShaderGUI.TextureColorProps(materialEditor, Styles.SpecularMapText, properties.specGlossMap, hasGlossMap ? null : properties.specColor); } EditorGUI.indentLevel++; DoSmoothness(properties, material, smoothnessChannelNames); EditorGUI.indentLevel--; }