//################################ // Internal Method. //################################ /// <summary> /// Append shadow vertices. /// * It is similar to Shadow component implementation. /// </summary> static void ApplyShadow(List <UIVertex> verts, ref int start, ref int end, ShadowMode mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha) { if (ShadowMode.None == mode) { return; } var factor = new Vector2( PackToFloat(toneLevel, 0, blur), PackToFloat(color.r, color.g, color.b, 1) ); // Append Shadow. ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha); // Append Outline. if (ShadowMode.Outline <= mode) { ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha); ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha); ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha); } // Append Outline8. if (ShadowMode.Outline8 <= mode) { ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, 0, factor, color, useGraphicAlpha); ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, -effectDistance.y, factor, color, useGraphicAlpha); ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha); ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, effectDistance.y, factor, color, useGraphicAlpha); } }
// Update is called once per frame void Update() { if (collider[0].transform.localPosition.x <= shadowRange && collider[0].transform.localPosition.x >= -shadowRange && collider[0].transform.localPosition.y >= -1.5f) { NowMode = ShadowMode.Plane; for (int i = 0; i < Solid.Length; i++) { if (Solid[i].CheckSolidRange(collider[0].transform.position)) { NowMode = ShadowMode.Solid; if (PrevMode != ShadowMode.Solid) { ChangeShadowPhase(0.7f, 0.1f, collider[0].gameObject); ChangeShadowPhase(0f, 0.1f, plane.gameObject); Solidps.Play(); PopShadow.popshadowSE(); StartCoroutine(Shadow_enable(true)); //Debug.Log("SolidRangeIn"); } break; } } if (NowMode == ShadowMode.Plane) { if (PrevMode == ShadowMode.Nothing) { ChangeShadowPhase(0.7f, 0.4f, plane.gameObject); } else if (PrevMode == ShadowMode.Solid) { ChangeShadowPhase(0f, 0.1f, collider[0].gameObject); ChangeShadowPhase(0.7f, 0.1f, plane.gameObject); StartCoroutine(Shadow_enable(false)); //Debug.Log("SolidRangeOut"); } } } else { NowMode = ShadowMode.Nothing; if (PrevMode == ShadowMode.Plane) { ChangeShadowPhase(0f, 0.4f, plane.gameObject); } else if (PrevMode == ShadowMode.Solid) { ChangeShadowPhase(0f, 0.1f, collider[0].gameObject); ChangeShadowPhase(0f, 0.1f, plane.gameObject); StartCoroutine(Shadow_enable(false)); } } PrevMode = NowMode; }
void UpdateSettings() { _cameraHasBeenUpdated = CameraHasBeenUpdated(); if (_cameraHasBeenUpdated) { if (_prevLightType != lightType) { CreateMaterials(); } pointLightRadius = Mathf.Max(0.001f, pointLightRadius); orthoSize = Mathf.Max(0.001f, orthoSize); cam.ResetProjectionMatrix(); cam.projectionMatrix = CalculateProjectionMatrix(); switch (lightType) { case LightTypes.Area: case LightTypes.Point: case LightTypes.Orthographic: cam.orthographic = true; break; case LightTypes.Spot: cam.orthographic = false; break; } if (shadowMode == ShadowMode.None || shadowMode == ShadowMode.Baked) { if (_depthTexture != null) { SafeDestroy(_depthTexture); } } } _prevSlices = slices; _prevFov = spotAngle; _prevNear = Mathf.Max(0.01f, spotNear); _prevFar = spotRange; _prevIsOrtho = cam.orthographic; _prevOrthoSize = orthoSize; _prevShadowMode = shadowMode; _prevLightType = lightType; _prevPointLightRadius = pointLightRadius; _prevRenderFullShadows = renderFullShadows; _prevOrtho = orthoSize; _prevOrthoAspect = aspect; if (!Application.isPlaying) { _prevBoundsCentreOffset = _boundsCentreOffset; } }
private void _itemSelected(SelectMenu menu) { if (menu == this.editMenu) { this.mode = (Mode)this.editMenu.SelectionIndex; } else if (menu == this.shadowsMenu) { this.shadowMode = (ShadowMode)this.shadowsMenu.SelectionIndex; _changeShadows(); } }
protected void DoShadows() { MaterialProperty shadowMode = FindProperty("_ShadowMode"); ShadowMode sMode = (ShadowMode)shadowMode.floatValue; EditorGUI.BeginChangeCheck(); sMode = (ShadowMode)EditorGUILayout.EnumPopup(MakeLabel("Shadow Mode"), sMode); if (EditorGUI.EndChangeCheck()) { RecordAction("Shadow Mode"); shadowMode.floatValue = (float)sMode; } EditorGUI.indentLevel += 2; switch (sMode) { case ShadowMode.Tint: DoShadowTint(); break; case ShadowMode.Toon: DoShadowToon(); break; case ShadowMode.Texture: DoShadowTexture(); break; case ShadowMode.Multiple: DoShadowMultiple(); break; case ShadowMode.Auto: DoShadowAuto(); break; case ShadowMode.None: default: break; } EditorGUI.indentLevel -= 2; }
public override void WriteJson(JsonWriter writer, object value) { if (value is ShadowMode) { ShadowMode shadow = (ShadowMode)value; switch (shadow) { case ShadowMode.None: writer.WriteValue(false); break; case ShadowMode.Sides: case ShadowMode.Frame: case ShadowMode.Drop: writer.WriteValue(shadow.ToString().ToLowerInvariant()); break; default: throw new ArgumentOutOfRangeException(); } } }
/// <summary> /// Specifies whether the floating component should be given a shadow. Set to true to automatically create an Ext.Shadow, or a string indicating the shadow's display Ext.Shadow.mode. Set to false to disable the shadow. (Defaults to 'sides'.) /// </summary> public virtual TBuilder ShadowMode(ShadowMode shadowMode) { this.ToComponent().ShadowMode = shadowMode; return(this as TBuilder); }
/// <summary> /// True or \"sides\" for the default effect, \"frame\" for 4-way shadow, and \"drop\" for bottom-right shadow (defaults to \"sides\") /// </summary> public virtual CommandMenu.Builder Shadow(ShadowMode shadow) { this.ToComponent().Shadow = shadow; return(this as CommandMenu.Builder); }
private void _itemSelected( SelectMenu menu ) { if ( menu == this.editMenu ) { this.mode = (Mode)this.editMenu.SelectionIndex; } else if ( menu == this.shadowsMenu ) { this.shadowMode = (ShadowMode)this.shadowsMenu.SelectionIndex; _changeShadows(); } }
public void UpdateSettings() { _cameraHasBeenUpdated = CameraHasBeenUpdated(); if (_cameraHasBeenUpdated) { switch (lightType) { case LightTypes.Point: renderer.sharedMaterial = _instancedPointMaterial; camera.isOrthoGraphic = true; #if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 camera.nearClipPlane = -pointLightRadius; camera.farClipPlane = pointLightRadius; #else camera.near = -pointLightRadius; camera.far = pointLightRadius; #endif camera.orthographicSize = pointLightRadius * 2.0f; break; case LightTypes.Spot: renderer.sharedMaterial = _instancedSpotMaterial; #if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 camera.farClipPlane = spotRange; camera.nearClipPlane = spotNear; camera.fieldOfView = spotAngle; #else camera.far = spotRange; camera.near = spotNear; camera.fov = spotAngle; #endif camera.isOrthoGraphic = false; break; } if (shadowMode == ShadowMode.None || shadowMode == ShadowMode.Baked) { if (_depthTexture != null) { SafeDestroy(_depthTexture); } } } _prevSlices = slices; #if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 _prevFov = camera.fieldOfView; _prevNear = camera.nearClipPlane; _prevFar = camera.farClipPlane; #else _prevFov = camera.fov; _prevNear = camera.near; _prevFar = camera.far; #endif _prevIsOrtho = camera.isOrthoGraphic; _prevOrthoSize = camera.orthographicSize; _prevMaterialSpot = spotMaterial; _prevMaterialPoint = pointMaterial; _prevShadowMode = shadowMode; _prevLightType = lightType; _prevPointLightRadius = pointLightRadius; }
public int GetKernel(ShadowMode shadow) { return(m_kern[(int)shadow]); }
/// <summary> /// \"sides\" for sides/bottom only, \"frame\" for 4-way shadow, and \"drop\" for bottom-right shadow (defaults to \"frame\") /// </summary> public virtual Editor.Builder Shadow(ShadowMode shadow) { this.ToComponent().Shadow = shadow; return(this as Editor.Builder); }