public override void ModifyMesh(VertexHelper helper) { if (!IsActive() || helper.currentVertCount == 0) return; List<UIVertex> vertices = new List<UIVertex>(); helper.GetUIVertexStream(vertices); float bottomY = vertices[0].position.y; float topY = vertices[0].position.y; for (int i = 1; i < vertices.Count; i++) { float y = vertices[i].position.y; if (y > topY) { topY = y; } else if (y < bottomY) { bottomY = y; } } float uiElementHeight = topY - bottomY; UIVertex v = new UIVertex(); for (int i = 0; i < helper.currentVertCount; i++) { helper.PopulateUIVertex(ref v, i); v.color = Color32.Lerp(bottomColor, topColor, (v.position.y - bottomY) / uiElementHeight); helper.SetUIVertex(v, i); } }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); UnityEngine.UI.VertexHelper o; if (argc == 1) { o = new UnityEngine.UI.VertexHelper(); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 2) { UnityEngine.Mesh a1; checkType(l, 2, out a1); o = new UnityEngine.UI.VertexHelper(a1); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Create an inflated mesh at a specified color and width. /// </summary> /// <param name="vh">The VertexHelpter from OnPopulateMesh().</param> /// <param name="lst">The line strip.</param> /// <param name="inf">The unit-inflation amount form line strip.</param> /// <param name="amt">The radius of how much to inflate the line strip.</param> /// <param name="c">The color of the inflated line mesh.</param> public static void CreateInflatedMesh(UnityEngine.UI.VertexHelper vh, List <Vector2> lst, List <Vector2> inf, float amt, Color c) { int ct = vh.currentVertCount; // Add the positive and the negative side - this inflates the line on both // side and makes the inflation amount a radius that's half the actual width. for (int i = 0; i < lst.Count; ++i) { UIVertex vt = new UIVertex(); vt.position = lst[i] + inf[i] * amt; vt.color = c; UIVertex vb = new UIVertex(); vb.position = lst[i] - inf[i] * amt; vb.color = c; vh.AddVert(vt); vh.AddVert(vb); } // Triangulate the vertices as quads. for (int i = 0; i < lst.Count - 1; ++i) { int t0 = ct + i * 2 + 0; int t1 = ct + i * 2 + 1; int t2 = ct + i * 2 + 2; int t3 = ct + i * 2 + 3; vh.AddTriangle(t0, t1, t2); vh.AddTriangle(t1, t3, t2); } }
/// <summary> /// Virtual function to create the UI mesh. /// </summary> protected override void OnPopulateMesh(UnityEngine.UI.VertexHelper vh) { //base.OnPopulateMesh(vh); vh.Clear(); // Weird things can happen since we're derived off a Graphic if (Application.isPlaying == false) { return; } // Combine the UI elements we're tracking into a line strip. List <Vector2> lineStrip = new List <Vector2>(); foreach (RectTransform rt in this.points) { lineStrip.Add(rt.anchoredPosition); } List <Vector2> infs = GetInflationVectors(lineStrip); // Create the inflated mesh at the width the user specified from the control. CreateInflatedMesh(vh, lineStrip, infs, this.width, new Color(1.0f, 0.5f, 0.25f)); // And then create an inflated line strip mesh on top that's just 1 radius thickness // that represents the unprocessed line. CreateInflatedMesh(vh, lineStrip, infs, 1.0f, Color.black); }
public override void ModifyMesh(VertexHelper vh) { if (!IsActive()) return; var verts = ListPool<UIVertex>.Get(); vh.GetUIVertexStream(verts); var neededCpacity = verts.Count * 5; if (verts.Capacity < neededCpacity) verts.Capacity = neededCpacity; var start = 0; var end = verts.Count; ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, effectDistance.y); start = end; end = verts.Count; ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, -effectDistance.y); start = end; end = verts.Count; ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, effectDistance.y); start = end; end = verts.Count; ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, -effectDistance.y); vh.Clear(); vh.AddUIVertexTriangleStream(verts); ListPool<UIVertex>.Release(verts); }
public override void ModifyMesh(VertexHelper vh) { if (!IsActive()) { return; } List<UIVertex> verts = new List<UIVertex>(); vh.GetUIVertexStream(verts); if (verts == null || verts.Count == 0) { return; } int start; int end = 0; for (float i = 0; i <= Mathf.PI * 2; i += Mathf.PI / (float)mDivideAmoumt) { start = end; end = verts.Count; ApplyShadow(verts, effectColor, start, end, effectDistance.x * Mathf.Cos(i), effectDistance.y * Mathf.Sin(i)); } vh.Clear(); vh.AddUIVertexTriangleStream(verts); }
static public int get_currentIndexCount(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); pushValue(l, true); pushValue(l, self.currentIndexCount); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public override void ModifyMesh(Mesh mesh) { if (this.IsActive() == false) { return; } var list = new List<UIVertex>(); using (var vertexHelper = new VertexHelper(mesh)) { vertexHelper.GetUIVertexStream(list); } this.ModifyVertices(list); // calls the old ModifyVertices which was used on pre 5.2 using (var vertexHelper = new VertexHelper()) { vertexHelper.AddUIVertexTriangleStream(list); vertexHelper.FillMesh(mesh); } }
static public int PopulateUIVertex(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex a1; checkValueType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.PopulateUIVertex(ref a1, a2); pushValue(l, true); pushValue(l, a1); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int AddVert__VertexHelper__Vector3__Color32__Vector2__Vector2__Vector2__Vector2__Vector3__Vector4(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Vector3 a2; checkType(l, 2, out a2); UnityEngine.Color32 a3; checkValueType(l, 3, out a3); UnityEngine.Vector2 a4; checkType(l, 4, out a4); UnityEngine.Vector2 a5; checkType(l, 5, out a5); UnityEngine.Vector2 a6; checkType(l, 6, out a6); UnityEngine.Vector2 a7; checkType(l, 7, out a7); UnityEngine.Vector3 a8; checkType(l, 8, out a8); UnityEngine.Vector4 a9; checkType(l, 9, out a9); self.AddVert(a2, a3, a4, a5, a6, a7, a8, a9); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
void EditMesh(VertexHelper vh) { vh.Clear(); int count = vertexInfoList.Count; if (count < 3) return;//3개서부터 보임 for (int n = 0; n < vertexInfoList.Count; n++) { vh.AddVert(getRadiusPosition(vertexInfoList[n], n), checkVertexColor(vertexInfoList[n].color) ,Vector2.zero); } if (!innerPolygon) { for (int n = 0; n < count - 2; n++) { vh.AddTriangle(0, n + 1, n + 2); } } else { for (int n = 0; n < count; n++) { vh.AddVert(getRadiusPosition(vertexInfoList[n], n, width), checkVertexColor(vertexInfoList[n].color), Vector2.zero); } for (int n = 0; n < count; n++) { vh.AddTriangle(n, (n + 1) % count, count + (1 + n) % count); vh.AddTriangle(n, n + count, count + (1 + n) % count); } } }
static int ModifyMesh(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <UnityEngine.Mesh>(L, 2)) { GradientEffect obj = (GradientEffect)ToLua.CheckObject <GradientEffect>(L, 1); UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.ToObject(L, 2); obj.ModifyMesh(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes <UnityEngine.UI.VertexHelper>(L, 2)) { GradientEffect obj = (GradientEffect)ToLua.CheckObject <GradientEffect>(L, 1); UnityEngine.UI.VertexHelper arg0 = (UnityEngine.UI.VertexHelper)ToLua.ToObject(L, 2); obj.ModifyMesh(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: GradientEffect.ModifyMesh")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ModifyMesh(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Outline), typeof(UnityEngine.Mesh))) { UnityEngine.UI.Outline obj = (UnityEngine.UI.Outline)ToLua.ToObject(L, 1); UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.ToObject(L, 2); obj.ModifyMesh(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Outline), typeof(UnityEngine.UI.VertexHelper))) { UnityEngine.UI.Outline obj = (UnityEngine.UI.Outline)ToLua.ToObject(L, 1); UnityEngine.UI.VertexHelper arg0 = (UnityEngine.UI.VertexHelper)ToLua.ToObject(L, 2); obj.ModifyMesh(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Outline.ModifyMesh")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
protected override void OnPopulateMesh(VertexHelper vh) { if (this.mesh == null) return; var color32 = this.color; vh.Clear(); var vs = this.mesh.vertices; for (int i = 0; i < vs.Length; ++i) { var v = vs[i]; vh.AddVert(new Vector3(v.x, v.y), color32, Vector2.zero); } var ts = this.mesh.triangles; for (int i = 0; i < ts.Length; i += 3) { var t1 = ts[i]; var t2 = ts[i + 1]; var t3 = ts[i + 2]; vh.AddTriangle(t1, t2, t3); } }
static void AddQuad(UnityEngine.UI.VertexHelper vertexHelper, Vector2 posMin, Vector2 posMax, Color32 color) { int startIndex = vertexHelper.currentVertCount; var v = UnityEngine.UIVertex.simpleVert; v.position = new Vector3(posMin.x, posMin.y, 0); v.color = color; vertexHelper.AddVert(v); v.position = new Vector3(posMin.x, posMax.y, 0); v.color = color; vertexHelper.AddVert(v); v.position = new Vector3(posMax.x, posMax.y, 0); v.color = color; vertexHelper.AddVert(v); v.position = new Vector3(posMax.x, posMin.y, 0); v.color = color; vertexHelper.AddVert(v); vertexHelper.AddTriangle(startIndex, startIndex + 1, startIndex + 2); vertexHelper.AddTriangle(startIndex + 2, startIndex + 3, startIndex); }
static public int GetUIVertexStream(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); System.Collections.Generic.List <UnityEngine.UIVertex> a1; checkType(l, 2, out a1); self.GetUIVertexStream(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public override void ModifyMesh(VertexHelper vh) { if (!this.IsActive()) return; List<UIVertex> list = ListPool<UIVertex>.Get(); vh.GetUIVertexStream(list); int num = list.Count * 5; if (list.Capacity < num) list.Capacity = num; int start1 = 0; int count1 = list.Count; this.ApplyShadowZeroAlloc(list, (Color32) this.effectColor, start1, list.Count, this.effectDistance.x, this.effectDistance.y); int start2 = count1; int count2 = list.Count; this.ApplyShadowZeroAlloc(list, (Color32) this.effectColor, start2, list.Count, this.effectDistance.x, -this.effectDistance.y); int start3 = count2; int count3 = list.Count; this.ApplyShadowZeroAlloc(list, (Color32) this.effectColor, start3, list.Count, -this.effectDistance.x, this.effectDistance.y); int start4 = count3; int count4 = list.Count; this.ApplyShadowZeroAlloc(list, (Color32) this.effectColor, start4, list.Count, -this.effectDistance.x, -this.effectDistance.y); vh.Clear(); vh.AddUIVertexTriangleStream(list); ListPool<UIVertex>.Release(list); }
protected override void OnPopulateMesh(Mesh toFill) { Texture mainTexture = this.mainTexture; if (mainTexture != null) { Vector4 zero = Vector4.zero; int num = Mathf.RoundToInt(mainTexture.width * this.uvRect.width); int num2 = Mathf.RoundToInt(mainTexture.height * this.uvRect.height); float num3 = ((num & 1) != 0) ? ((float) (num + 1)) : ((float) num); float num4 = ((num2 & 1) != 0) ? ((float) (num2 + 1)) : ((float) num2); zero.x = 0f; zero.y = 0f; zero.z = ((float) num) / num3; zero.w = ((float) num2) / num4; zero.x -= base.rectTransform.pivot.x; zero.y -= base.rectTransform.pivot.y; zero.z -= base.rectTransform.pivot.x; zero.w -= base.rectTransform.pivot.y; zero.x *= base.rectTransform.rect.width; zero.y *= base.rectTransform.rect.height; zero.z *= base.rectTransform.rect.width; zero.w *= base.rectTransform.rect.height; using (VertexHelper helper = new VertexHelper()) { Color color = base.color; helper.AddVert(new Vector3(zero.x, zero.y), color, new Vector2(this.m_UVRect.xMin, this.m_UVRect.yMin)); helper.AddVert(new Vector3(zero.x, zero.w), color, new Vector2(this.m_UVRect.xMin, this.m_UVRect.yMax)); helper.AddVert(new Vector3(zero.z, zero.w), color, new Vector2(this.m_UVRect.xMax, this.m_UVRect.yMax)); helper.AddVert(new Vector3(zero.z, zero.y), color, new Vector2(this.m_UVRect.xMax, this.m_UVRect.yMin)); helper.AddTriangle(0, 1, 2); helper.AddTriangle(2, 3, 0); helper.FillMesh(toFill); } } }
static int QPYX_ModifyMesh_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <UnityEngine.Mesh>(L_YXQP, 2)) { UnityEngine.UI.Shadow QPYX_obj_YXQP = (UnityEngine.UI.Shadow)ToLua.CheckObject <UnityEngine.UI.Shadow>(L_YXQP, 1); UnityEngine.Mesh QPYX_arg0_YXQP = (UnityEngine.Mesh)ToLua.ToObject(L_YXQP, 2); QPYX_obj_YXQP.ModifyMesh(QPYX_arg0_YXQP); return(0); } else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <UnityEngine.UI.VertexHelper>(L_YXQP, 2)) { UnityEngine.UI.Shadow QPYX_obj_YXQP = (UnityEngine.UI.Shadow)ToLua.CheckObject <UnityEngine.UI.Shadow>(L_YXQP, 1); UnityEngine.UI.VertexHelper QPYX_arg0_YXQP = (UnityEngine.UI.VertexHelper)ToLua.ToObject(L_YXQP, 2); QPYX_obj_YXQP.ModifyMesh(QPYX_arg0_YXQP); return(0); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.UI.Shadow.ModifyMesh")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
public override void ModifyMesh(Mesh mesh) { if (this.IsActive()) { List<UIVertex> stream = new List<UIVertex>(); using (VertexHelper helper = new VertexHelper(mesh)) { helper.GetUIVertexStream(stream); } int num = stream.Count * 5; if (stream.Capacity < num) { stream.Capacity = num; } int start = 0; int count = stream.Count; base.ApplyShadowZeroAlloc(stream, base.effectColor, start, stream.Count, base.effectDistance.x, base.effectDistance.y); start = count; count = stream.Count; base.ApplyShadowZeroAlloc(stream, base.effectColor, start, stream.Count, base.effectDistance.x, -base.effectDistance.y); start = count; count = stream.Count; base.ApplyShadowZeroAlloc(stream, base.effectColor, start, stream.Count, -base.effectDistance.x, base.effectDistance.y); start = count; count = stream.Count; base.ApplyShadowZeroAlloc(stream, base.effectColor, start, stream.Count, -base.effectDistance.x, -base.effectDistance.y); using (VertexHelper helper2 = new VertexHelper()) { helper2.AddUIVertexTriangleStream(stream); helper2.FillMesh(mesh); } } }
/// <summary> /// /// <para> /// See:IMeshModifier. /// </para> /// /// </summary> /// <param name="mesh"/> public virtual void ModifyMesh(Mesh mesh) { using (VertexHelper vh = new VertexHelper(mesh)) { this.ModifyMesh(vh); vh.FillMesh(mesh); } }
public override void ModifyMesh(VertexHelper vertexHelper) { List<UIVertex> vertexList = new List<UIVertex>(); vertexHelper.GetUIVertexStream(vertexList); ModifyVertices(vertexList); vertexHelper.Clear(); vertexHelper.AddUIVertexTriangleStream(vertexList); }
/// <summary> /// <para>See:IMeshModifier.</para> /// </summary> /// <param name="mesh"></param> public virtual void ModifyMesh(Mesh mesh) { using (VertexHelper helper = new VertexHelper(mesh)) { this.ModifyMesh(helper); helper.FillMesh(mesh); } }
public void ModifyMesh(Mesh mesh) { using (var vh = new VertexHelper(mesh)) { EditMesh(vh); vh.FillMesh(mesh); } }
public override void ModifyMesh(UnityEngine.UI.VertexHelper helper) { if (!IsActive()) { return; } #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif List <UIVertex> verts = ListPool <UIVertex> .Get(); helper.GetUIVertexStream(verts); CreateMeshRenderer(); m_mesh.Clear(); m_meshRenderer.material = GetComponent <Text> ().font.material; m_meshFilter.mesh = m_mesh; m_meshRenderer.enabled = false; GetArray(ref vertices, verts.Count); GetArray(ref triangles, verts.Count); GetArray(ref colors, verts.Count); GetArray(ref uvs, verts.Count); for (int i = 0; i < verts.Count; ++i) { var vert = verts [i]; vertices [i] = vert.position; if (i % 6 == 0 || i % 6 == 5) { vertices[i] = vert.position + new Vector3(-m_expand, m_expand); } else if (i % 6 == 1) { vertices[i] = vert.position + new Vector3(m_expand, m_expand); } else if (i % 6 == 2 || i % 6 == 3) { vertices[i] = vert.position + new Vector3(m_expand, -m_expand); } else { vertices[i] = vert.position + new Vector3(-m_expand, -m_expand); } uvs [i] = verts [i].uv0; triangles [i] = i; colors [i] = m_glowColor; } m_mesh.vertices = vertices; m_mesh.uv = uvs; m_mesh.triangles = triangles; m_mesh.colors = colors; verts.ReleaseToPool(); m_spriteChanged = true; }
private static void AddQuad(VertexHelper vh, Vector3[] quadPositions, Color32 color, Vector3[] quadUVs) { int currentVertCount = vh.currentVertCount; for (int i = 0; i < 4; i++) { vh.AddVert(quadPositions[i], color, quadUVs[i]); } vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount); }
public override void ModifyMesh(VertexHelper vh) { UIVertex vertex = new UIVertex(); for (int i = 0; i < vh.currentVertCount; i++) { vh.PopulateUIVertex(ref vertex, i); vertex.uv1 = new Vector2(vertex.position.x, vertex.position.y); vh.SetUIVertex(vertex, i); } }
private static void AddQuad(VertexHelper vh, Vector2 posMin, Vector2 posMax, Color32 color, Vector2 uvMin, Vector2 uvMax) { int currentVertCount = vh.currentVertCount; vh.AddVert(new Vector3(posMin.x, posMin.y, 0f), color, new Vector2(uvMin.x, uvMin.y)); vh.AddVert(new Vector3(posMin.x, posMax.y, 0f), color, new Vector2(uvMin.x, uvMax.y)); vh.AddVert(new Vector3(posMax.x, posMax.y, 0f), color, new Vector2(uvMax.x, uvMax.y)); vh.AddVert(new Vector3(posMax.x, posMin.y, 0f), color, new Vector2(uvMax.x, uvMin.y)); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount); }
public void ModifyMesh(VertexHelper helper) { var list = new List<UIVertex>(); helper.GetUIVertexStream(list); this.ModifyVertices(list); // calls the old ModifyVertices which was used on pre 5.2 helper.AddUIVertexTriangleStream(list); }
static public int get_currentIndexCount(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); pushValue(l, self.currentIndexCount); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int Dispose(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); self.Dispose(); return(0); } catch (Exception e) { return(error(l, e)); } }
public override void ModifyMesh(Mesh mesh) { if (!this.IsActive()) return; using (var vh = new VertexHelper(mesh)) { ModifyMesh(vh); vh.FillMesh(mesh); } }
public override void ModifyMesh(VertexHelper vertexHelper) { if (!this.IsActive()) return; List<UIVertex> list = new List<UIVertex>(); vertexHelper.GetUIVertexStream(list); ModifyVertices(list); vertexHelper.AddUIVertexTriangleStream(list); }
static public int AddVert(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex a1; checkValueType(l, 2, out a1); self.AddVert(a1); pushValue(l, true); return(1); } else if (argc == 4) { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); UnityEngine.Color32 a2; checkValueType(l, 3, out a2); UnityEngine.Vector2 a3; checkType(l, 4, out a3); self.AddVert(a1, a2, a3); pushValue(l, true); return(1); } else if (argc == 7) { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); UnityEngine.Color32 a2; checkValueType(l, 3, out a2); UnityEngine.Vector2 a3; checkType(l, 4, out a3); UnityEngine.Vector2 a4; checkType(l, 5, out a4); UnityEngine.Vector3 a5; checkType(l, 6, out a5); UnityEngine.Vector4 a6; checkType(l, 7, out a6); self.AddVert(a1, a2, a3, a4, a5, a6); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int Clear(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); self.Clear(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public override void ModifyMesh(VertexHelper vh) { if (this.IsActive()) { List<UIVertex> stream = ListPool<UIVertex>.Get(); vh.GetUIVertexStream(stream); this.ApplyShadow(stream, this.effectColor, 0, stream.Count, this.effectDistance.x, this.effectDistance.y); vh.Clear(); vh.AddUIVertexTriangleStream(stream); ListPool<UIVertex>.Release(stream); } }
protected override void OnPopulateMesh(Mesh toFill) { float outer = -rectTransform.pivot.x * rectTransform.rect.width; float inner = -rectTransform.pivot.x * rectTransform.rect.width + this.thickness; toFill.Clear(); var vbo = new VertexHelper(toFill); UIVertex vert = UIVertex.simpleVert; Vector2 prevX = Vector2.zero; Vector2 prevY = Vector2.zero; Vector2 uv0 = new Vector2(0, 0); Vector2 uv1 = new Vector2(0, 1); Vector2 uv2 = new Vector2(1, 1); Vector2 uv3 = new Vector2(1, 0); Vector2 pos0; Vector2 pos1; Vector2 pos2; Vector2 pos3; float f = (this.fillPercent / 100f); float degrees = 360f / segments; int fa = (int)((segments + 1) * f); for (int i = -1 -(fa/2); i < fa/2 + 1; i++) { float rad = Mathf.Deg2Rad * (i * degrees); float c = Mathf.Cos(rad); float s = Mathf.Sin(rad); float x = outer * c; float y = inner * c; uv0 = new Vector2(0, 1); uv1 = new Vector2(1, 1); uv2 = new Vector2(1, 0); uv3 = new Vector2(0, 0); pos0 = prevX; pos1 = new Vector2(outer * c, outer * s); if (fill) { pos2 = Vector2.zero; pos3 = Vector2.zero; } else { pos2 = new Vector2(inner * c, inner * s); pos3 = prevY; } prevX = pos1; prevY = pos2; vbo.AddUIVertexQuad(SetVbo(new[] { pos0, pos1, pos2, pos3 }, new[] { uv0, uv1, uv2, uv3 })); } if (vbo.currentVertCount > 3) { vbo.FillMesh(toFill); } }
static public int GetUIVertexStream(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); System.Collections.Generic.List <UnityEngine.UIVertex> a1; checkType(l, 2, out a1); self.GetUIVertexStream(a1); return(0); } catch (Exception e) { return(error(l, e)); } }
static public int FillMesh(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Mesh a1; checkType(l, 2, out a1); self.FillMesh(a1); return(0); } catch (Exception e) { return(error(l, e)); } }
// // ------------------------------------------------------------------>>>>>> TO HERE!! public override void ModifyMesh(VertexHelper vh) { if (!this.IsActive()) return; List<UIVertex> vertexList = new List<UIVertex>(); vh.GetUIVertexStream(vertexList); ModifyVertices(vertexList); vh.Clear(); vh.AddUIVertexTriangleStream(vertexList); }
public override void ModifyMesh(VertexHelper vh) { List<UIVertex> list = new List<UIVertex>(); vh.GetUIVertexStream(list); vh.Clear(); for (int i = 0; i < list.Count; i++) { var v = list[i]; v.uv1 = AlphaUV[IndexMap[i]]; list[i] = v; } vh.AddUIVertexTriangleStream(list); }
static public int AddUIVertexQuad(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex[] a1; checkType(l, 2, out a1); self.AddUIVertexQuad(a1); return(0); } catch (Exception e) { return(error(l, e)); } }
public void ModifyMesh(VertexHelper vertexHelper) { if (!this.enabled) return; List<UIVertex> list = new List<UIVertex>(); vertexHelper.GetUIVertexStream(list); ModifyVertices(list); // calls the old ModifyVertices which was used on pre 5.2 vertexHelper.Clear(); vertexHelper.AddUIVertexTriangleStream(list); }
static public int ctor_s(IntPtr l) { try { UnityEngine.UI.VertexHelper o; o = new UnityEngine.UI.VertexHelper(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
protected override void OnPopulateMesh(Mesh m) { Vector2 corner1 = new Vector2(0f, 0f); Vector2 corner2 = new Vector2(1f, 1f); corner1.x -= rectTransform.pivot.x; corner1.y -= rectTransform.pivot.y; corner2.x -= rectTransform.pivot.x; corner2.y -= rectTransform.pivot.y; corner1.x *= rectTransform.rect.width; corner1.y *= rectTransform.rect.height; corner2.x *= rectTransform.rect.width; corner2.y *= rectTransform.rect.height; Vector2 dc=corner2-corner1; Vector4 uv = sprite == null ? Vector4.zero : DataUtility.GetOuterUV(sprite); Vector2 uvz=new Vector2(uv.x, uv.y); Vector2 duv=new Vector2(uv.z, uv.w)-uvz; using (var vh = new VertexHelper()) { float dx=1.0f/(float)(numdef); int numer=0; for(int yy=0;yy<numdef;yy++) for(int xx=0;xx<numdef;xx++) { Vector2 c1 = corner1+new Vector2(xx*dc.x*dx, yy*dc.y*dx); Vector2 c2 = corner1+new Vector2((xx+1)*dc.x,(yy+1)*dc.y)*dx; float rx1=dx*xx; float rx2=dx*(xx+1); float ry1=dx*yy; float ry2=dx*(yy+1); rx1*=rx1; rx2*=rx2; ry1=Mathf.Sqrt(ry1); ry2=Mathf.Sqrt(ry2); Vector2 uv0 =uvz+new Vector2(rx1*duv.x,ry1*duv.y); Vector2 uv1 =uvz+new Vector2(rx2*duv.x,ry2*duv.y); vh.AddVert(new Vector3(c1.x, c1.y), color, uv0); vh.AddVert(new Vector3(c1.x, c2.y), color, new Vector2(uv0.x, uv1.y)); vh.AddVert(new Vector3(c2.x, c2.y), color, uv1); vh.AddVert(new Vector3(c2.x, c1.y), color, new Vector2(uv1.x, uv0.y)); vh.AddTriangle(0+numer*4, 1+numer*4, 2+numer*4); vh.AddTriangle(2+numer*4, 3+numer*4, 0+numer*4); numer++; } vh.FillMesh(m); } }
public override void ModifyMesh (VertexHelper vh) { if (!this.IsActive()) return; List<UIVertex> list = new List<UIVertex>(); vh.GetUIVertexStream(list); ModifyVertices(list); // calls the old ModifyVertices which was used on pre 5.2 for (int i = 0; i < list.Count; ++i) { vh.SetUIVertex (list [i], i); } }
public override void ModifyMesh(VertexHelper vh) { if (!IsActive()) return; UIVertex vert = new UIVertex(); for (int i = 0; i < vh.currentVertCount; i++) { vh.PopulateUIVertex(ref vert, i); vert.uv1.x = (i >> 1); vert.uv1.y = ((i >> 1) ^ (i & 1)); vh.SetUIVertex(vert, i); } }
static public int SetUINormal(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); self.SetUINormal(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int AddVert__UIVertex(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex a1; checkValueType(l, 2, out a1); self.AddVert(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int AddUIVertexTriangleStream(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); System.Collections.Generic.List <UnityEngine.UIVertex> a1; checkType(l, 2, out a1); self.AddUIVertexTriangleStream(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
/// private function void EditMesh(VertexHelper vh) { vh.Clear(); UIVertex[] prvVert = null; for (int n = 0; n < points.Count-1; n++) { if (CheckLength(GetLength(n))) { break; } prvVert = DrawLine(n, vh, prvVert); } }
public override void ModifyMesh (VertexHelper vh) { if (IsActive() == false) { return; } var vList = new List<UIVertex>(); vh.GetUIVertexStream(vList); ModifyVertices(vList); vh.Clear(); vh.AddUIVertexTriangleStream(vList); }
public override void ModifyMesh(VertexHelper vh) { if (!IsActive()) { return; } var vertexList = new List<UIVertex>(); vh.GetUIVertexStream(vertexList); int count = vertexList.Count; ApplyGradient(vertexList, 0, count); vh.Clear(); vh.AddUIVertexTriangleStream(vertexList); }
static public int ctor__Mesh_s(IntPtr l) { try { UnityEngine.UI.VertexHelper o; UnityEngine.Mesh a1; checkType(l, 1, out a1); o = new UnityEngine.UI.VertexHelper(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int SetUIVertex(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex a1; checkValueType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.SetUIVertex(a1, a2); return(0); } catch (Exception e) { return(error(l, e)); } }
public override void ModifyMesh(UnityEngine.UI.VertexHelper vh) { if (!IsActive()) { return; } List <UIVertex> vertices = new List <UIVertex>(); vh.GetUIVertexStream(vertices); TextMove(ref vertices); vh.Clear(); vh.AddUIVertexTriangleStream(vertices); }
static public int AddTriangle(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); self.AddTriangle(a1, a2, a3); return(0); } catch (Exception e) { return(error(l, e)); } }
static public int PopulateUIVertex(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.UIVertex a1; checkValueType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.PopulateUIVertex(ref a1, a2); pushValue(l, true); pushValue(l, a1); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); UnityEngine.UI.VertexHelper o; if (argc == 1) { o = new UnityEngine.UI.VertexHelper(); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 2) { UnityEngine.Mesh a1; checkType(l, 2, out a1); o = new UnityEngine.UI.VertexHelper(a1); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int AddVert__Vector3__Color32__Vector2(IntPtr l) { try { UnityEngine.UI.VertexHelper self = (UnityEngine.UI.VertexHelper)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); UnityEngine.Color32 a2; checkValueType(l, 3, out a2); UnityEngine.Vector2 a3; checkType(l, 4, out a3); self.AddVert(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }