/// <summary> /// Modifies the mesh. /// </summary> public override void ModifyMesh(VertexHelper vh) { if (!isActiveAndEnabled) { return; } UIVertex vt; vh.GetUIVertexStream(tempVerts); //================================ // Effect modify original vertices. //================================ { // Pack some effect factors to 1 float. Vector2 factor = new Vector2( m_CustomEffect ? Packer.ToFloat(m_CustomFactor) : Packer.ToFloat(toneLevel, 0, blur, 0), Packer.ToFloat(effectColor.r, effectColor.g, effectColor.b, effectColor.a) ); for (int i = 0; i < tempVerts.Count; i++) { vt = tempVerts[i]; // Set UIEffect prameters to vertex. vt.uv1 = factor; tempVerts[i] = vt; } } //================================ // Append shadow vertices. //================================ { var inputVertCount = tempVerts.Count; var start = 0; var end = inputVertCount; // Additional Shadows. for (int i = additionalShadows.Count - 1; 0 <= i; i--) { AdditionalShadow shadow = additionalShadows[i]; _ApplyShadow(tempVerts, ref start, ref end, shadow.shadowMode, toneLevel, shadow.shadowBlur, shadow.effectDistance, shadow.shadowColor, shadow.useGraphicAlpha); } // Shadow. _ApplyShadow(tempVerts, ref start, ref end, shadowStyle, toneLevel, shadowBlur, effectDistance, shadowColor, useGraphicAlpha); } vh.Clear(); vh.AddUIVertexTriangleStream(tempVerts); tempVerts.Clear(); }
/// <summary> /// Modifies the mesh. /// </summary> public virtual void ModifyMesh(VertexHelper vh) { if (!isActiveAndEnabled) { return; } UIVertex vt; vh.GetUIVertexStream(s_Verts); //================================ // Effect modify original vertices. //================================ { // Pack some effect factors to 1 float. Vector2 factor = new Vector2( PackToFloat(toneLevel, 0, blur / graphic.mainTexture.width * 4), PackToFloat(effectColor.r, effectColor.g, effectColor.b, effectColor.a) ); for (int i = 0; i < s_Verts.Count; i++) { vt = s_Verts[i]; // Set UIEffect prameters to vertex. vt.uv1 = factor; s_Verts[i] = vt; } } //================================ // Append shadow vertices. //================================ { var inputVertCount = s_Verts.Count; var start = 0; var end = inputVertCount; // Additional Shadows. for (int i = additionalShadows.Count - 1; 0 <= i; i--) { AdditionalShadow shadow = additionalShadows[i]; ApplyShadow(s_Verts, ref start, ref end, shadow.shadowMode, toneLevel, shadow.shadowBlur / graphic.mainTexture.width * 4, shadow.effectDistance, shadow.shadowColor, shadow.useGraphicAlpha); } // Shadow. ApplyShadow(s_Verts, ref start, ref end, shadowMode, toneLevel, shadowBlur / graphic.mainTexture.width * 4, effectDistance, shadowColor, useGraphicAlpha); } vh.Clear(); vh.AddUIVertexTriangleStream(s_Verts); s_Verts.Clear(); }
/// <summary> /// Modifies the mesh. /// </summary> public override void ModifyMesh(VertexHelper vh) { if (!isActiveAndEnabled || vh.currentVertCount <= 0) { return; } vh.GetUIVertexStream(s_Verts); //================================ // Append shadow vertices. //================================ { _uiEffect = GetComponent <UIEffect>(); var inputVertCount = s_Verts.Count; var start = 0; var end = inputVertCount; var toneLevel = _uiEffect && _uiEffect.isActiveAndEnabled ? _uiEffect.toneLevel : 0; // Additional Shadows. for (int i = additionalShadows.Count - 1; 0 <= i; i--) { AdditionalShadow shadow = additionalShadows[i]; UpdateFactor(toneLevel, shadow.blur, shadow.effectColor); _ApplyShadow(s_Verts, shadow.effectColor, ref start, ref end, shadow.effectDistance, shadow.style, shadow.useGraphicAlpha); } // Shadow. UpdateFactor(toneLevel, blur, effectColor); _ApplyShadow(s_Verts, effectColor, ref start, ref end, effectDistance, style, useGraphicAlpha); } vh.Clear(); vh.AddUIVertexTriangleStream(s_Verts); s_Verts.Clear(); }