protected virtual void WriteMesh() { MeshUtility.InverseTransformMesh(tsMesh, this.transform); if (_doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } else if (_flipFaces) { MeshUtility.FlipFaces(tsMesh); } if (_tangents) { MeshUtility.CalculateTangents(tsMesh); } tsMesh.WriteMesh(ref mesh); if (_normalMethod == 0) { mesh.RecalculateNormals(); } if (filter != null) { filter.sharedMesh = mesh; } updateCollider = true; }
protected override void BuildMesh() { if (computer.pointCount == 0) { return; } base.BuildMesh(); Generate(); if (doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } if (calculateTangents) { MeshUtility.CalculateTangents(tsMesh); } }
protected override void BuildMesh() { if (_sides <= 2) { return; } base.BuildMesh(); GenerateVertices(); GenerateTriangles(); if (doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } if (calculateTangents) { MeshUtility.CalculateTangents(tsMesh); } }
protected override void BuildMesh() { if (clippedSamples.Length == 0) { return; } base.BuildMesh(); GenerateVertices(); tsMesh.triangles = MeshUtility.GeneratePlaneTriangles(_slices, clippedSamples.Length, false); if (doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } if (calculateTangents) { MeshUtility.CalculateTangents(tsMesh); } }
void Generate() { if (_symmetry) { GenerateSymmetrical(); } else { GenerateDefault(); } if (doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } if (calculateTangents) { MeshUtility.CalculateTangents(tsMesh); } }
protected override void BuildMesh() { if (_sides <= 2) { return; } base.BuildMesh(); bodyVertexCount = (_sides + 1) * clippedSamples.Length; CapMethod _capModeFinal = _capMode; if (!useCap) { _capModeFinal = CapMethod.None; } switch (_capModeFinal) { case CapMethod.Flat: capVertexCount = _sides + 1; break; case CapMethod.Round: capVertexCount = _roundCapLatitude * (sides + 1); break; default: capVertexCount = 0; break; } int vertexCount = bodyVertexCount + capVertexCount * 2; if (tsMesh.vertexCount != vertexCount) { tsMesh.vertices = new Vector3[vertexCount]; tsMesh.normals = new Vector3[vertexCount]; tsMesh.colors = new Color[vertexCount]; tsMesh.uv = new Vector2[vertexCount]; bodyTrisCount = _sides * (clippedSamples.Length - 1) * 2 * 3; switch (_capModeFinal) { case CapMethod.Flat: capTrisCount = (_sides - 1) * 3 * 2; break; case CapMethod.Round: capTrisCount = _sides * _roundCapLatitude * 6; break; default: capTrisCount = 0; break; } if (tsMesh.triangles.Length != bodyTrisCount + capTrisCount * 2) { tsMesh.triangles = new int[bodyTrisCount + capTrisCount * 2]; } } Generate(); switch (_capModeFinal) { case CapMethod.Flat: GenerateFlatCaps(); break; case CapMethod.Round: GenerateRoundCaps(); break; } if (doubleSided) { MeshUtility.MakeDoublesided(tsMesh); } if (calculateTangents) { MeshUtility.CalculateTangents(tsMesh); } }