本文整理汇总了C#中UnityEngine.UI.VertexHelper类的典型用法代码示例。如果您正苦于以下问题:C# VertexHelper类的具体用法?C# VertexHelper怎么用?C# VertexHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertexHelper类属于UnityEngine.UI命名空间,在下文中一共展示了VertexHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModifyMesh
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);
}
}
开发者ID:l980305284,项目名称:UGUIPlugin,代码行数:35,代码来源:Gradient.cs
示例2: ModifyMesh
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);
}
开发者ID:NetherDrk,项目名称:Eternal-Empire,代码行数:25,代码来源:Outline.cs
示例3: OnPopulateMesh
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);
}
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:30,代码来源:UIMeshRenderer.cs
示例4: ModifyMesh
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);
}
}
}
开发者ID:randomize,项目名称:VimConfig,代码行数:33,代码来源:Outline.cs
示例5: ModifyMesh
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);
}
开发者ID:gdzzzyyy,项目名称:UGUIlok,代码行数:32,代码来源:Outline.cs
示例6: OnPopulateMesh
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);
}
}
}
开发者ID:randomize,项目名称:VimConfig,代码行数:35,代码来源:RawImage.cs
示例7: ModifyMesh
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);
}
}
开发者ID:RuFengLau,项目名称:Unity3d.UI.Windows,代码行数:25,代码来源:BaseVertexEffect.cs
示例8: ModifyMesh
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);
}
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:28,代码来源:UITextOutline.cs
示例9: EditMesh
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);
}
}
}
开发者ID:cupsster,项目名称:drawLine,代码行数:32,代码来源:UIPolygon.cs
示例10: ModifyMesh
/// <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);
}
}
开发者ID:NetherDrk,项目名称:Eternal-Empire,代码行数:16,代码来源:BaseMeshEffect.cs
示例11: ModifyMesh
/// <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);
}
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:BaseMeshEffect.cs
示例12: ModifyMesh
public override void ModifyMesh(VertexHelper vertexHelper)
{
List<UIVertex> vertexList = new List<UIVertex>();
vertexHelper.GetUIVertexStream(vertexList);
ModifyVertices(vertexList);
vertexHelper.Clear();
vertexHelper.AddUIVertexTriangleStream(vertexList);
}
开发者ID:tettasun,项目名称:BookSample,代码行数:8,代码来源:VertexMesh.cs
示例13: ModifyMesh
public void ModifyMesh(Mesh mesh)
{
using (var vh = new VertexHelper(mesh))
{
EditMesh(vh);
vh.FillMesh(mesh);
}
}
开发者ID:cupsster,项目名称:drawLine,代码行数:8,代码来源:UIPolygon.cs
示例14: ModifyMesh
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);
}
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:10,代码来源:PositionAsUV1.cs
示例15: AddQuad
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);
}
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:Image.cs
示例16: ModifyMesh
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);
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:10,代码来源:UIFlippable.cs
示例17: ModifyMesh
public override void ModifyMesh(Mesh mesh)
{
if (!this.IsActive())
return;
using (var vh = new VertexHelper(mesh))
{
ModifyMesh(vh);
vh.FillMesh(mesh);
}
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:11,代码来源:ModifiedShadow.cs
示例18: ModifyMesh
public override void ModifyMesh(VertexHelper vertexHelper)
{
if (!this.IsActive())
return;
List<UIVertex> list = new List<UIVertex>();
vertexHelper.GetUIVertexStream(list);
ModifyVertices(list);
vertexHelper.AddUIVertexTriangleStream(list);
}
开发者ID:DevonHansen,项目名称:DudeWheresMyCombo,代码行数:12,代码来源:Gradient.cs
示例19: ModifyMesh
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);
}
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:Shadow.cs
示例20: OnPopulateMesh
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);
}
}
开发者ID:clydeshaffer,项目名称:SteamVR_Unity_Toolkit,代码行数:52,代码来源:UICircle.cs
注:本文中的UnityEngine.UI.VertexHelper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论