由于最近一直没有时间,所以这篇博客一直没发,下面我说说uv画圆弧,圆面,不规则面拼接。

先来两张效果图

图截的不咋滴,凑合着看吧,画圆弧主要用的贝塞尔曲线画的,我感觉这个比较简单,当然大家也可以使用圆的方程,抛物线的方程都可以实现这种效果

但是我比较倾向于用贝塞尔,如果大家会ps的话,知道里边有一个钢笔工具,他就是贝塞尔的原理,贝塞尔的算法大家可以去网上搜搜,

贝塞尔计算方法类网上也有很多

下面先上我的代码

  1. using UnityEngine;
  2.  
  3. [System.Serializable]
  4.  
  5. public class Bezier : System.Object
  6.  
  7. {
  8.  
  9. public Vector3 p0;
  10.  
  11. public Vector3 p1;
  12.  
  13. public Vector3 p2;
  14.  
  15. public Vector3 p3;
  16.  
  17. public float ti = 0f;
  18.  
  19. private Vector3 b0 = Vector3.zero;
  20.  
  21. private Vector3 b1 = Vector3.zero;
  22.  
  23. private Vector3 b2 = Vector3.zero;
  24.  
  25. private Vector3 b3 = Vector3.zero;
  26.  
  27. private float Ax;
  28.  
  29. private float Ay;
  30.  
  31. private float Az;
  32.  
  33. private float Bx;
  34.  
  35. private float By;
  36.  
  37. private float Bz;
  38.  
  39. private float Cx;
  40.  
  41. private float Cy;
  42.  
  43. private float Cz;
  44.  
  45. public Bezier( Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3 )
  46.  
  47. {
  48.  
  49. this.p0 = v0;
  50.  
  51. this.p1 = v1;
  52.  
  53. this.p2 = v2;
  54.  
  55. this.p3 = v3;
  56.  
  57. }
  58.  
  59. // 0.0 >= t <= 1.0
  60.  
  61. public Vector3 GetPointAtTime( float t )
  62.  
  63. {
  64.  
  65. this.CheckConstant();
  66.  
  67. float t2 = t * t;
  68.  
  69. float t3 = t * t * t;
  70.  
  71. float x = this.Ax * t3 + this.Bx * t2 + this.Cx * t + p0.x;
  72.  
  73. float y = this.Ay * t3 + this.By * t2 + this.Cy * t + p0.y;
  74.  
  75. float z = this.Az * t3 + this.Bz * t2 + this.Cz * t + p0.z;
  76.  
  77. return new Vector3( x, y, z );
  78.  
  79. }
  80.  
  81. private void SetConstant()
  82.  
  83. {
  84.  
  85. this.Cx = 3f * ( ( this.p0.x + this.p1.x ) - this.p0.x );
  86.  
  87. this.Bx = 3f * ( ( this.p3.x + this.p2.x ) - ( this.p0.x + this.p1.x ) ) - this.Cx;
  88.  
  89. this.Ax = this.p3.x - this.p0.x - this.Cx - this.Bx;
  90.  
  91. this.Cy = 3f * ( ( this.p0.y + this.p1.y ) - this.p0.y );
  92.  
  93. this.By = 3f * ( ( this.p3.y + this.p2.y ) - ( this.p0.y + this.p1.y ) ) - this.Cy;
  94.  
  95. this.Ay = this.p3.y - this.p0.y - this.Cy - this.By;
  96.  
  97. this.Cz = 3f * ( ( this.p0.z + this.p1.z ) - this.p0.z );
  98.  
  99. this.Bz = 3f * ( ( this.p3.z + this.p2.z ) - ( this.p0.z + this.p1.z ) ) - this.Cz;
  100.  
  101. this.Az = this.p3.z - this.p0.z - this.Cz - this.Bz;
  102.  
  103. }
  104.  
  105. // Check if p0, p1, p2 or p3 have changed
  106.  
  107. private void CheckConstant()
  108.  
  109. {
  110.  
  111. if( this.p0 != this.b0 || this.p1 != this.b1 || this.p2 != this.b2 || this.p3 != this.b3 )
  112.  
  113. {
  114.  
  115. this.SetConstant();
  116.  
  117. this.b0 = this.p0;
  118.  
  119. this.b1 = this.p1;
  120.  
  121. this.b2 = this.p2;
  122.  
  123. this.b3 = this.p3;
  124.  
  125. }
  126.  
  127. }
  128.  
  129. }

这就是贝塞尔计算类,很简单的计算方法,

  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class TriangleSubdivision :MonoBehaviour{
  6. public static int[] TriangulatePolygon (Vector2[] XZofVertices) {
  7. //
  8. int VertexCount = XZofVertices.Length;
  9. //minx miny maxx maxy
  10. float xmin = XZofVertices[0].x;
  11. float ymin = XZofVertices[0].y;
  12. float xmax = xmin;
  13. float ymax = ymin;
  14. for (int ii1 = 1; ii1 < VertexCount; ii1++)
  15. {
  16. if (XZofVertices[ii1].x < xmin)
  17. {
  18. xmin = XZofVertices[ii1].x;
  19. }
  20. else if (XZofVertices[ii1].x > xmax)
  21. {
  22. xmax = XZofVertices[ii1].x;
  23. }
  24. if (XZofVertices[ii1].y < ymin)
  25. {
  26. ymin = XZofVertices[ii1].y;
  27. }
  28. else if (XZofVertices[ii1].y > ymax)
  29. {
  30. ymax = XZofVertices[ii1].y;
  31. }
  32. }
  33. float dx = xmax - xmin;
  34. float dy = ymax - ymin;
  35. float dmax = (dx > dy) ? dx : dy;
  36. float xmid = (xmax + xmin) * 0.5f;
  37. float ymid = (ymax + ymin) * 0.5f;
  38. Vector2[] ExpandedXZ = new Vector2[3 + VertexCount];
  39. for (int ii1 = 0; ii1 < VertexCount; ii1++)
  40. {
  41. ExpandedXZ[ii1] = XZofVertices[ii1];
  42. }
  43. ExpandedXZ[VertexCount] = new Vector2((xmid - 2 * dmax), (ymid - dmax));
  44. ExpandedXZ[VertexCount + 1] = new Vector2(xmid, (ymid + 2 * dmax));
  45. ExpandedXZ[VertexCount + 2] = new Vector2((xmid + 2 * dmax), (ymid - dmax));
  46. List<Triangle> TriangleList = new List<Triangle>();
  47. TriangleList.Add(new Triangle(VertexCount, VertexCount+1, VertexCount+2));
  48. for (int ii1 = 0; ii1 < VertexCount; ii1++)
  49. {
  50. //检查构成的三角形
  51. List<Edge> Edges = new List<Edge>();
  52. for (int ii2 = 0; ii2 < TriangleList.Count; ii2++)
  53. {
  54. if (TriangulatePolygonSubFunc_InCircle(ExpandedXZ[ii1], ExpandedXZ[TriangleList[ii2].p1],ExpandedXZ[TriangleList[ii2].p2],ExpandedXZ[TriangleList[ii2].p3]))
  55. {
  56. Edges.Add(new Edge(TriangleList[ii2].p1, TriangleList[ii2].p2));
  57. Edges.Add(new Edge(TriangleList[ii2].p2, TriangleList[ii2].p3));
  58. Edges.Add(new Edge(TriangleList[ii2].p3, TriangleList[ii2].p1));
  59. TriangleList.RemoveAt(ii2);
  60. ii2--;
  61. }
  62. }
  63. if (ii1 >= VertexCount) { continue; }
  64. //判断相同的三个点构成的三角形
  65. for (int ii2 = Edges.Count - 2; ii2 >= 0; ii2--)
  66. {
  67. for (int ii3 = Edges.Count - 1; ii3 >= ii2 + 1; ii3--)
  68. {
  69. if (Edges[ii2].Equals(Edges[ii3]))
  70. {
  71. Edges.RemoveAt(ii3);
  72. Edges.RemoveAt(ii2);
  73. ii3--;
  74. continue;
  75. }
  76. }
  77. }
  78. for (int ii2 = 0; ii2 < Edges.Count; ii2++)
  79. {
  80. TriangleList.Add(new Triangle(Edges[ii2].p1, Edges[ii2].p2, ii1));
  81. }
  82. Edges.Clear();
  83. Edges = null;
  84. }
  85. //大于点集外围的点
  86. for (int ii1 = TriangleList.Count - 1; ii1 >= 0; ii1--)
  87. {
  88. if (TriangleList[ii1].p1 >= VertexCount ||TriangleList[ii1].p2 >= VertexCount ||TriangleList[ii1].p3 >= VertexCount)
  89. {
  90. TriangleList.RemoveAt(ii1);
  91. }
  92. }
  93. //不在房间内的面
  94. for(int ii3 = 0;ii3<TriangleList.Count;ii3++){
  95. if(TriangleInPolygonOuter(XZofVertices,XZofVertices[TriangleList[ii3].p1],XZofVertices[TriangleList[ii3].p2],XZofVertices[TriangleList[ii3].p3])){
  96. TriangleList.RemoveAt(ii3);
  97. ii3--;
  98. }
  99. }
  100. TriangleList.TrimExcess();
  101. int[] Triangles = new int[3 * TriangleList.Count];
  102. for (int ii1 = 0; ii1 < TriangleList.Count; ii1++)
  103. {
  104. Triangles[3 * ii1] = TriangleList[ii1].p1;
  105. Triangles[3 * ii1 + 1] = TriangleList[ii1].p2;
  106. Triangles[3 * ii1 + 2] = TriangleList[ii1].p3;
  107. }
  108. return Triangles;
  109. }
  110. static bool TriangulatePolygonSubFunc_InCircle(Vector2 p, Vector2 p1, Vector2 p2, Vector2 p3) {
  111. if (Mathf.Abs(p1.y - p2.y) < 0.0000001&&Mathf.Abs(p2.y - p3.y) < 0.0000001)
  112. {
  113. return false;
  114. }
  115. float m1, m2, mx1, mx2, my1, my2, xc, yc;
  116. if (Mathf.Abs(p2.y - p1.y) < 0.0000001)
  117. {
  118. m2 = -(p3.x - p2.x) / (p3.y - p2.y);
  119. mx2 = (p2.x + p3.x) * 0.5f;
  120. my2 = (p2.y + p3.y) * 0.5f;
  121. xc = (p2.x + p1.x) * 0.5f;
  122. yc = m2 * (xc - mx2) + my2;
  123. }
  124. else if (Mathf.Abs(p3.y - p2.y) < 0.0000001)
  125. {
  126. m1 = -(p2.x - p1.x) / (p2.y - p1.y);
  127. mx1 = (p1.x + p2.x) * 0.5f;
  128. my1 = (p1.y + p2.y) * 0.5f;
  129. xc = (p3.x + p2.x) * 0.5f;
  130. yc = m1 * (xc - mx1) + my1;
  131. }
  132. else
  133. {
  134. m1 = -(p2.x - p1.x) / (p2.y - p1.y);
  135. m2 = -(p3.x - p2.x) / (p3.y - p2.y);
  136. mx1 = (p1.x + p2.x) * 0.5f;
  137. mx2 = (p2.x + p3.x) * 0.5f;
  138. my1 = (p1.y + p2.y) * 0.5f;
  139. my2 = (p2.y + p3.y) * 0.5f;
  140. xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2);
  141. yc = m1 * (xc - mx1) + my1;
  142. }
  143. float dx = p2.x - xc;
  144. float dy = p2.y - yc;
  145. float rsqr = dx * dx + dy * dy;
  146. dx = p.x - xc;
  147. dy = p.y - yc;
  148. double drsqr = dx * dx + dy * dy;
  149. return (drsqr <= rsqr);
  150. }
  151. static bool TriangleInPolygonOuter(Vector2[] pList,Vector2 p1,Vector2 p2,Vector2 p3){
  152. Vector2[] centerPoint = new Vector2[3];
  153. centerPoint[0] = new Vector2((p1.x+p2.x)/2,(p1.y+p2.y)/2);
  154. centerPoint[1] = new Vector2((p1.x+p3.x)/2,(p1.y+p3.y)/2);
  155. centerPoint[2] = new Vector2((p3.x+p2.x)/2,(p3.y+p2.y)/2);
  156. for(int j = 0,crossNum = 0;j<centerPoint.Length;j++){
  157. for (int i = 0; i < pList.Length; i++)
  158. {
  159. if (IsPointInLine(centerPoint[j].x, centerPoint[j].y, pList[i].x, pList[i].y, pList[(i+1)%pList.Length].x, pList[(i+1)%pList.Length].y)==0)
  160. {
  161. crossNum=crossNum+1;
  162. continue;
  163. }else if(IsPointInLine(centerPoint[j].x, centerPoint[j].y, pList[i].x, pList[i].y, pList[(i+1)%pList.Length].x, pList[(i+1)%pList.Length].y)==2){
  164. crossNum = 1;
  165. break;
  166. }
  167. }
  168. if ((crossNum % 2) == 0)
  169. {
  170. return true;
  171. }
  172. crossNum = 0;
  173. }
  174.  
  175. return false;
  176. }
  177. //0 在外 1 在内 2 边上
  178. static int IsPointInLine(float x,float y,float x1,float y1,float x2,float y2)
  179. {
  180. float maxY =y1;
  181. float minY = y2;
  182. if(y1>y2){
  183. maxY = y1;
  184. minY = y2;
  185. }else{
  186. maxY = y2;
  187. minY = y1;
  188. }
  189. float averageX = (x1+x2)/2;
  190. float averageY = (y1+y2)/2;
  191. if(y==averageY&&x==averageX){
  192. return 2;
  193. }
  194. if (y < maxY && y >minY)
  195. {
  196. if (x >(x1 + (x2 - x1) * (y - y1) / (y2 - y1)))
  197. {
  198. return 0;
  199. }
  200. }
  201. return 1;
  202. }
  203. }
  204. struct Triangle
  205. {
  206. public int p1;
  207. public int p2;
  208. public int p3;
  209. public Triangle(int point1, int point2, int point3)
  210. {
  211. p1 = point1; p2 = point2; p3 = point3;
  212. }
  213. }
  214. class Edge
  215. {
  216. public int p1;
  217. public int p2;
  218. public Edge(int point1, int point2)
  219. {
  220. p1 = point1; p2 = point2;
  221. }
  222. public Edge() : this(0, 0)
  223. {}
  224. public bool Equals(Edge other)
  225. {
  226. return ((this.p1 == other.p2) && (this.p2 == other.p1)) ||((this.p1 == other.p1) && (this.p2 == other.p2));
  227. }
  228. }

这个类上一张已经说过了,就是画不规则图形的类,不过我这篇文章是把圆和不规则拼接出带有圆弧状的图形,看图大家就会明白了

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ChartletManager : System.Object {
  5. Bezier myBezier;
  6. public ChartletManager(){
  7.  
  8. }
  9. public GameObject WallChartletInMesh(GameObject obj,Vector3 startPoint,Vector3 endPoint,float height,Texture2D tex,float excursion,float zoom)
  10. {
  11. myBezier = new Bezier( startPoint, new Vector3( excursion, zoom, 0f ), new Vector3( excursion, zoom, 0f ), endPoint);
  12. MeshFilter myFilter = (MeshFilter)obj.GetComponent (typeof(MeshFilter));
  13. Mesh myMesh = myFilter.mesh;
  14. Vector3[] myVertices = new Vector3[52];
  15. for(int i = 0;i<52;i++){
  16. if(i<26){
  17. myVertices[i] = myBezier.GetPointAtTime( (float)((i) *0.04) );
  18. myVertices[i] = new Vector3(myVertices[i].x,myVertices[i].y,myVertices[i].z-height);
  19. }else{
  20. myVertices[i] = myBezier.GetPointAtTime( (float)((i-26) *0.04) );
  21. myVertices[i] = new Vector3(myVertices[i].x,myVertices[i].y,myVertices[i].z);
  22. }
  23. }
  24. myMesh.vertices = myVertices;
  25. int[] myTriangles = new int[52 * 3];
  26. for(int i = 0; i < 52; i++){
  27. if(i<25){
  28. myTriangles[i*3] = 26+i;
  29. myTriangles[i*3+1] = i;
  30. myTriangles[i*3+2] = i+1;
  31. }else if(i == 25||i==51){
  32. myTriangles[i*3] = 0;
  33. myTriangles[i*3+1] = 0;
  34. myTriangles[i*3+2] = 0;
  35. }else{
  36. myTriangles[i*3+2] = i;
  37. myTriangles[i*3+1] = i+1;
  38. myTriangles[i*3] = i-25;
  39. }
  40. }
  41. Vector2[] myuvs = new Vector2[52];
  42. for (int i = 0; i < 52; i++) {
  43. myuvs [i] = new Vector2 ( (myVertices [i].x), (myVertices [i].y));
  44. }
  45. myMesh.triangles = myTriangles;
  46. myMesh.uv = myuvs;
  47. myMesh.RecalculateBounds ();
  48. myMesh.RecalculateNormals ();
  49. obj.renderer.material.mainTexture = tex;
  50. return obj;
  51. }
  52. public GameObject CircleChartletInMesh(GameObject obj,Vector3 startPoint,Vector3 endPoint,Texture2D tex,float excursion,float zoom)
  53. {
  54. myBezier = new Bezier( startPoint, new Vector3( excursion, zoom, 0f ), new Vector3( excursion, zoom, 0f ), endPoint);
  55. MeshFilter myFilter = (MeshFilter)obj.GetComponent (typeof(MeshFilter));
  56. Mesh myMesh = myFilter.mesh;
  57.  
  58. Vector3[] myVertices = new Vector3[27];
  59. myVertices[0] = new Vector3(0,0,0);
  60. for(int i =0; i <= 25; i++)
  61. {
  62. myVertices[i+1] = myBezier.GetPointAtTime( (float)(i *0.04) );
  63. }
  64.  
  65. myMesh.vertices = myVertices;
  66.  
  67. Vector2[] myuvs = new Vector2[27];
  68. for (int i = 0; i < 27; i++) {
  69. myuvs [i] = new Vector2 ( (myVertices [i].x), (myVertices [i].y));
  70. }
  71. myMesh.triangles = TriangleSubdivision.TriangulatePolygon(myuvs);
  72. myMesh.uv = myuvs;
  73. myMesh.RecalculateBounds ();
  74. myMesh.RecalculateNormals ();
  75. obj.renderer.material.mainTexture = tex;
  76. return obj;
  77. }
  78. public GameObject CircleAndTriangleChartletInMesh(GameObject obj,Vector3 startPoint,Vector3 endPoint,Vector3[] points,Texture2D tex,float excursion,float zoom)
  79. {
  80. myBezier = new Bezier( startPoint, new Vector3( excursion, zoom, 0f ), new Vector3( excursion, zoom, 0f ), endPoint);
  81. MeshFilter myFilter = (MeshFilter)obj.GetComponent (typeof(MeshFilter));
  82. Mesh myMesh = myFilter.mesh;
  83. Vector3[] myVertices = new Vector3[27+points.Length];
  84.  
  85. myVertices[0] = new Vector3((startPoint.x+endPoint.x)/2,(startPoint.y+endPoint.y)/2,(startPoint.z+endPoint.z)/2);
  86. for(int i =0; i <= 25; i++)
  87. {
  88. myVertices[i+1] = myBezier.GetPointAtTime( (float)(i *0.04) );
  89. }
  90. for(int i = 27;i<27+points.Length;i++){
  91. myVertices[i] = points[i-27];
  92. }
  93. myMesh.vertices = myVertices;
  94. Vector2[] myuvs = new Vector2[27+points.Length];
  95. for (int i = 0; i < myuvs.Length; i++) {
  96. myuvs [i] = new Vector2 ( (myVertices [i].x), (myVertices [i].y));
  97. }
  98. myMesh.triangles = TriangleSubdivision.TriangulatePolygon(myuvs);
  99. myMesh.uv = myuvs;
  100.  
  101. myMesh.RecalculateBounds ();
  102. myMesh.RecalculateNormals ();
  103. obj.renderer.material.mainTexture = tex;
  104. return obj;
  105. }
  106. }

为了方便大家测试,我把我的测试放在了一个类里,大家直接调这个方法即可,我是测试用的,大家可以修改成自己的脚本

  1. using UnityEngine;
  2.  
  3. public class MyBezier : MonoBehaviour
  4.  
  5. {
  6. public Bezier myBezier;
  7. public GameObject circleline;
  8. public Texture2D tex;
  9. void Start()
  10. {
  11.  
  12. GameObject floorTexture = (GameObject)Instantiate(circleline,new Vector3(0,0,10),Quaternion.Euler(new Vector3(0,0,0)));
  13. GameObject wallTexture =(GameObject) Instantiate(circleline,new Vector3(0,0,10),Quaternion.Euler(new Vector3(0,0,0)));
  14. ChartletManager chartlet = new ChartletManager();
  15. Vector3[] ceilVertices = new Vector3[4];
  16. ceilVertices[0] = new Vector3(-4,0,0);
  17. ceilVertices[1] = new Vector3(-4,-5,0);
  18. ceilVertices[2] = new Vector3(4,-5,0);
  19. ceilVertices[3] = new Vector3(4,0,0);
  20. // ceilVertices[1] = new Vector3(-5,1,0);
  21. // ceilVertices[2] = new Vector3(-5,-4,0);
  22. // ceilVertices[3] = new Vector3(-2,-4.5f,0);
  23. // ceilVertices[4] = new Vector3(-2.5f,-2,0);
  24. // ceilVertices[5] = new Vector3(2,-2.5f,0);
  25. // ceilVertices[6] = new Vector3(2.5f,-4,0);
  26. // ceilVertices[7] = new Vector3(5,-4,0);
  27. // ceilVertices[8] = new Vector3(5,0,0);
  28. // ceilVertices[9] = new Vector3(4,0,0);
  29.  
  30. wallTexture= chartlet.WallChartletInMesh(wallTexture,new Vector3( -4f, 0f, 0f ),new Vector3( 4f, 0f, 0f ),3.0f,tex,0,6);
  31. floorTexture= chartlet.CircleAndTriangleChartletInMesh(floorTexture,new Vector3( -4f, 0f, 0f ),new Vector3( 4f, 0f, 0f ),ceilVertices,tex,0,6);
  32. }
  33.  
  34. }
  1. 测试用例,大家可以做自己想要的东西了,CircleAndTriangleChartletInMesh(GameObject obj,Vector3 startPoint,Vector3 endPoint,Vector3[] points
  1. ,Texture2D tex,float excursion,float zoom)
  1. 我解释一下这个类的传递参数吧
  1. obj,就是传进来的obj对象,大家可以使用out,那个直接能用了
  1. startPoint圆弧起始点
  1. endPoint终点圆弧点
  1. points 是传入的不规则图形的各个点
  1. tex 是那张贴图
  1. excursion这个是圆弧的 倾斜度
  1. zoom是圆弧的大小就是圆弧顶点到起始点于终止点中间的那个点的距离 正规半圆这个值应该是圆半径的1.5
  1. using UnityEngine;
  2.  
  3. public class MyBezier : MonoBehaviour
  4.  
  5. {
  6. public Bezier myBezier;
  7. public GameObject circleline;
  8. public Texture2D tex;
  9. void Start()
  10. {
  11.  
  12. GameObject floorTexture = (GameObject)Instantiate(circleline,new Vector3(0,0,10),Quaternion.Euler(new Vector3(0,0,0)));
  13. GameObject wallTexture =(GameObject) Instantiate(circleline,new Vector3(0,0,10),Quaternion.Euler(new Vector3(0,0,0)));
  14. ChartletManager chartlet = new ChartletManager();
  15. Vector3[] ceilVertices = new Vector3[10];
  16. ceilVertices[0] = new Vector3(-4,0,0);
  17. // ceilVertices[1] = new Vector3(-4,-5,0);
  18. // ceilVertices[2] = new Vector3(4,-5,0);
  19. // ceilVertices[3] = new Vector3(4,0,0);
  20. ceilVertices[1] = new Vector3(-5,1,0);
  21. ceilVertices[2] = new Vector3(-5,-4,0);
  22. ceilVertices[3] = new Vector3(-2,-4.5f,0);
  23. ceilVertices[4] = new Vector3(-2.5f,-2,0);
  24. ceilVertices[5] = new Vector3(2,-2.5f,0);
  25. ceilVertices[6] = new Vector3(2.5f,-4,0);
  26. ceilVertices[7] = new Vector3(5,-4,0);
  27. ceilVertices[8] = new Vector3(5,0,0);
  28. ceilVertices[9] = new Vector3(4,0,0);
  29.  
  30. wallTexture= chartlet.WallChartletInMesh(wallTexture,new Vector3( -4f, 0f, 0f ),new Vector3( 4f, 0f, 0f ),3.0f,tex,3,8);
  31. floorTexture= chartlet.CircleAndTriangleChartletInMesh(floorTexture,new Vector3( -4f, 0f, 0f ),new Vector3( 4f, 0f, 0f ),ceilVertices,tex,3,8);
  32. }
  33.  
  34. }
  1. 如果我数值改改就会出现这种,zoom就是倾斜程度,当然也可以是负数,是往里凹进去的,excursion是负数就向另一个方向倾斜。
  1. 凹进去的就是这种情况,具体情况大家可以测试,值的范围有限制的,超出了,会出现空的情况,当然我写的也有很多不足之处,大家可以修改修改

  1.  

  1.  
  1. 不知为何 csdn编辑问题,我的图片文字与代码都混合了 所以乱了 我把我的工程打包上去 大家可以下载看看具体实现效果
  1.  
  1.  
  1. 下载地址
  1. http://download.csdn.net/detail/pzw0416/6727303
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  

unity之uv贴图画圆弧,圆弧面,不规则图形的更多相关文章

  1. unity多边形uv地图

    我曾经写过一篇文章,不规则图形uv地图.(http://blog.csdn.net/itolfn/article/details/17240131)我用三角算法.但是,这种方法已经不完全,有一个指明: ...

  2. 使用CSS 3创建不规则图形 文字围绕

    前言 CSS 创建复杂图形的技术即将会被广泛支持,并且应用到实际项目中.本篇文章的目的是为大家开启它的冰山一角.我希望这篇文章能让你对不规则图形有一个初步的了解. 现在,我们已经可以使用CSS 3 常 ...

  3. qt button以及label实现不规则图形(五种方法:使用QSS,设置Mask图片,自己画)

    1.方法1:准备一张边界是透明的不规则图形 QPushButton * pbtn = new QPushButton;    pbtn->setStyleSheet("QPushBut ...

  4. border三角形阴影(不规则图形阴影)和多重边框的制作

    前言:这是笔者学习之后自己的理解与整理.如果有错误或者疑问的地方,请大家指正,我会持续更新! 1. border的组合写法 border:border-width border-style borde ...

  5. 使用CSS 3创建不规则图形

    前言 CSS 创建复杂图形的技术即将会被广泛支持,并且应用到实际项目中.本篇文章的目的是为大家开启它的冰山一角.我希望这篇文章能让你对不规则图形有一个初步的了解. 现在,我们已经可以使用CSS 3 常 ...

  6. WPF入门(三)->几何图形之不规则图形(PathGeometry) (2)

    原文:WPF入门(三)->几何图形之不规则图形(PathGeometry) (2) 上一节我们介绍了PathGeometry中LineSegment是点与点之间绘制的一条直线,那么我们这一节来看 ...

  7. WPF入门(三)->几何图形之不规则图形(PathGeometry)

    原文:WPF入门(三)->几何图形之不规则图形(PathGeometry) 前面我们给大家介绍了LineGeometry,EllipseGeometry,CombinedGeometry等一些规 ...

  8. css border 三角形阴影(不规则图形阴影) & 多重边框的制作

    前言:这是笔者学习之后自己的理解与整理.如果有错误或者疑问的地方,请大家指正,我会持续更新! border 的组合写法 border:border-width border-style border- ...

  9. Open gl 的不规则图形的4联通种子递归填充和扫描线种子递归填充算法实现

    实验题目:不规则区域的填充算法 实验目的:验证不规则区域的填充算法 实验内容:利用VC与OpenGL,实现不规则区域的填充算法. 1.必做:实现简单递归的不规则区域填充算法. 2.选做:针对简单递归算 ...

随机推荐

  1. mobile&nbsp;web&nbsp;手机开发

    1.   -webkit-tap-highlight-color -webkit-tap-highlight-color:rgba(255,255,255,0); 用来把android上点击网页时出现 ...

  2. Module中引用Module中的Activity时报错了,错误是找不到R文件中的id引用

    1.好像库modul和主modul不能有相同名字和layout文件 2.资源文件名冲突导致的

  3. [转贴]JavaScript中Array(数组)的属性和方法

    数组有四种定义的方式 使用构造函数:var a = new Array();var b = new Array(8); var c = new Array("first", &qu ...

  4. Android利用Fiddler进行网络数据抓包,手机抓包工具汇总

    Fiddler抓包工具 Fiddler抓包工具很好用的,它可以干嘛用呢,举个简单例子,当你浏览网页时,网页中有段视频非常好,但网站又不提供下载,用迅雷下载你又找不到下载地址,这个时候,Fiddler抓 ...

  5. UVA122-Trees on the level(链二叉树)

    Trees on the level Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Sub ...

  6. c++11新特性(4) lambda捕捉块

    lambda表达式中的方括号成为捕捉块,能够在这里指定怎样从所在的作用域中捕捉变量. 捕捉的意思是指能够在该lambda中使用该变量.即能够捕获外部变量在lambda表达式内使用. 能够使用两种方式来 ...

  7. linux下emacs安装

    1.下载地址:http://ftp.gnu.org/pub/gnu/emacs/ 下载文件:emacs-24.2.tar.gz 步骤: 一.安装依赖文件:  (先进入root:终端中输入 su -) ...

  8. dans le quartier

    culture /kyltyr/ 文化 une école [ekɔl] un cinéma un musée une église un théâtre  [teɑtr] un opéra  [ɔp ...

  9. If We Were a Child Again

    Description The Problem The first project for the poor student was to make a calculator that can jus ...

  10. 在数组中找几个数的和等于某个数[LeetCode]

    首先明确一点,这个方面的问题设计到的知识点是数组的查找的问题.对于类似的这样的查找操作的具体办法就是三种解决方法: 1.暴力算法,多个for循环,很高的时间复杂度 2.先排序,然后左右夹逼,但是这样会 ...