void DrawShadow() { //[HideInInspector] [SerializeField] public bool biasCustom = false; //[Range(0, 10)] [HideInInspector] [SerializeField] public float shadowBias = 1.0f; //[Range(0, 10)] [HideInInspector] [SerializeField] public float shadowNormalBias = 1.0f; //[Range(0.1f, 10)] [HideInInspector] [SerializeField] public float shadowNearPlane = 0.01f; //[HideInInspector] [SerializeField] public bool softShadow = false; ProjectorLight l = target as ProjectorLight; if (!l.lightParms_Shadow) { if (l.light.shadows != LightShadows.None) { l.light.shadows = LightShadows.None; } return; } GUILayout.Label("Shadow"); GUILayout.BeginVertical("box"); l.biasCustom = EditorGUILayout.Toggle("Custom Bias", l.biasCustom); if (l.biasCustom) { GUILayout.BeginVertical("box"); SerializedProperty sb1 = IFPipelineEditorTools.DrawProperty("Bias", serializedObject, "shadowBias", GUILayout.MinWidth(20f)); if (sb1.floatValue != l.shadowBias) { l.shadowBias = sb1.floatValue; l.light.shadowBias = sb1.floatValue; } sb1 = IFPipelineEditorTools.DrawProperty("Normal Bias", serializedObject, "shadowNormalBias", GUILayout.MinWidth(20f)); if (sb1.floatValue != l.shadowNormalBias) { l.shadowNormalBias = sb1.floatValue; l.light.shadowNormalBias = sb1.floatValue; } GUILayout.EndVertical(); } SerializedProperty sb = IFPipelineEditorTools.DrawProperty("Near Plane", serializedObject, "shadowNearPlane", GUILayout.MinWidth(20f)); if (sb.floatValue != l.shadowNearPlane) { l.shadowNearPlane = sb.floatValue; l.light.shadowNearPlane = sb.floatValue; } sb = IFPipelineEditorTools.DrawProperty("Soft Shadow", serializedObject, "softShadow", GUILayout.MinWidth(20f)); if (sb.boolValue != l.softShadow) { l.softShadow = sb.boolValue; l.light.shadows = LightShadows.Soft; } else { l.light.shadows = LightShadows.Hard; } GUILayout.EndVertical(); }
void DrawLightProperties() { EditorGUILayout.Space(); ProjectorLight l = target as ProjectorLight; GUILayout.Label("Properties"); GUILayout.BeginVertical("box"); { GUILayout.Label("Color"); GUILayout.BeginVertical("box"); SerializedProperty intensity = IFPipelineEditorTools.DrawProperty("Intensity", serializedObject, "intensity", GUILayout.MinWidth(20f)); if (intensity.floatValue != l.Intensity) { l.Intensity = intensity.floatValue; } SerializedProperty lightColor = IFPipelineEditorTools.DrawProperty("Color", serializedObject, "lightColor", GUILayout.MinWidth(20f)); if (lightColor.colorValue != l.LightColor) { l.LightColor = lightColor.colorValue; } bool useTemperature = EditorGUILayout.Toggle("Use Temperature", l.UseTemperature, GUILayout.MinWidth(20f)); if (l.UseTemperature) { l.Temperature = EditorGUILayout.FloatField("Temperature", l.Temperature, GUILayout.MinWidth(20f)); } if (useTemperature != l.UseTemperature) { l.UseTemperature = useTemperature; } l.specMultiplier = EditorGUILayout.FloatField("Specular Multiplier", l.specMultiplier, GUILayout.MinWidth(20f)); l.shadowBleedReduce = EditorGUILayout.FloatField("Shadow Bleed Reduce", l.shadowBleedReduce, GUILayout.MinWidth(20f)); GUILayout.EndVertical(); } { GUILayout.Label("Parameters"); GUILayout.BeginVertical("box"); l.lightParms_Shadow = EditorGUILayout.Toggle("Shadow", l.lightParms_Shadow, GUILayout.MinWidth(20f)); l.lightParms_Rect = EditorGUILayout.Toggle("Rect", l.lightParms_Rect, GUILayout.MinWidth(20f)); l.lightParms_Circle = EditorGUILayout.Toggle("Circle", l.lightParms_Circle, GUILayout.MinWidth(20f)); l.lightParms_SkipSkipModel = EditorGUILayout.Toggle("Not Skip", l.lightParms_SkipSkipModel, GUILayout.MinWidth(20f)); //l.lightParams_IsArea = EditorGUILayout.Toggle("Area", l.lightParams_IsArea, GUILayout.MinWidth(20f)); l.lightParams_NoDiffuse = EditorGUILayout.Toggle("No Diffuse", l.lightParams_NoDiffuse, GUILayout.MinWidth(20f)); l.area_width = EditorGUILayout.FloatField("Area Width", l.area_width, GUILayout.MinWidth(20f)); l.area_height = EditorGUILayout.FloatField("Area Height", l.area_height, GUILayout.MinWidth(20f)); l.area_falloff = EditorGUILayout.FloatField("Area Falloff", l.area_falloff, GUILayout.MinWidth(20f)); GUILayout.EndVertical(); } GUILayout.EndVertical(); }
void DrawAtlas() { EditorGUILayout.Space(); ProjectorLight l = target as ProjectorLight; GUILayout.Label("Sprite"); GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); if (IFPipelineEditorTools.DrawPrefixButton("Atlas")) { ComponentSelector.Show <SpritesAtlas>(OnSelectAtlas); } SerializedProperty atlas = IFPipelineEditorTools.DrawProperty("", serializedObject, "spritesAtlas", GUILayout.MinWidth(20f)); GUILayout.EndHorizontal(); if (atlas != null) { SpritesAtlas atl = atlas.objectReferenceValue as SpritesAtlas; if (atl != null && atl != l.spritesAtlas) { l.spritesAtlas = atl; } GUILayout.Label("Project Sprite"); GUILayout.BeginHorizontal(); SerializedProperty sp = serializedObject.FindProperty("mprojSpriteName"); IFPipelineEditorTools.DrawAdvancedSpriteField(atlas.objectReferenceValue as SpritesAtlas, sp.stringValue, SelectProjSprite, false); GUILayout.EndHorizontal(); GUILayout.Label("Falloff Sprite"); GUILayout.BeginHorizontal(); SerializedProperty spfalloff = serializedObject.FindProperty("mfalloffSpriteName"); IFPipelineEditorTools.DrawAdvancedSpriteField(atlas.objectReferenceValue as SpritesAtlas, spfalloff.stringValue, SelectFalloffSprite, false); GUILayout.EndHorizontal(); } else { l.mprojSpriteName = ""; l.mfalloffSpriteName = ""; l.falloffSpriteData = new SpriteData(); l.projSpriteData = new SpriteData(); Tools.SetDirty(serializedObject.targetObject); } GUILayout.EndVertical(); }