Exemplo n.º 1
0
        void DrawProjector()
        {
            ProjectorLight l = target as ProjectorLight;

            GUILayout.Label("Shape");
            GUILayout.BeginVertical("box");
            float NearClipPlane = EditorGUILayout.FloatField("Near Clip Plane", l.iFPipelineProjector.nearClipPlane);

            if (NearClipPlane > 0 && NearClipPlane < l.iFPipelineProjector.farClipPlane + 0.01f)
            {
                l.iFPipelineProjector.nearClipPlane = NearClipPlane;
            }

            float FarClipPlane = EditorGUILayout.FloatField("Far Clip Plane", l.iFPipelineProjector.farClipPlane);

            if (FarClipPlane > 0 && FarClipPlane > l.iFPipelineProjector.nearClipPlane + 0.01f)
            {
                l.iFPipelineProjector.farClipPlane = FarClipPlane;
            }

            l.iFPipelineProjector.fieldOfView = EditorGUILayout.FloatField("Field Of View", l.iFPipelineProjector.fieldOfView);
            l.iFPipelineProjector.aspectRatio = EditorGUILayout.FloatField("Aspect Ratio", l.iFPipelineProjector.aspectRatio);

            l.iFPipelineProjector.orthographic     = EditorGUILayout.Toggle("Orthographic", l.iFPipelineProjector.orthographic);
            l.iFPipelineProjector.orthoGraphicSize = EditorGUILayout.FloatField("Orthographic Size", l.iFPipelineProjector.orthoGraphicSize);

            GUILayout.EndVertical();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        public static bool ExtractProjectorLightMatrix(ref ProjectorLight projectorLight, ref LightData_Shadow shadowData,
                                                       out Matrix4x4 shadowMatrix)
        {
            ShadowSplitData splitData = new ShadowSplitData();

            splitData.cullingSphere.Set(0.0f, 0.0f, 0.0f, float.NegativeInfinity);
            splitData.cullingPlaneCount = 0;
            //for (int i = 0; i < 6; ++i)
            //{
            //    var splane = shadowData.planes[i];
            //    Plane plane = new Plane(splane.normal, splane.distance);
            //    splitData.SetCullingPlane(i, plane);
            //}
            shadowMatrix = GetShadowTransform(shadowData.projMatrix, shadowData.viewMatrix);
            return(true);
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        override public void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            ProjectorLight l = target as ProjectorLight;

            if (l.spritesAtlas == null)
            {
                return;
            }
            Texture2D tex = l.spritesAtlas.texture as Texture2D;

            if (tex == null)
            {
                return;
            }
            //GUILayout.Label("Preview");
            //GUILayout.BeginVertical("box");
            SpriteData sd = l.spritesAtlas.GetSprite(l.mprojSpriteName);

            IFPipelineEditorTools.DrawSprite(tex, rect, sd, Color.white);
            //GUILayout.EndVertical();
        }