void Update() { trackerObject.Update(transform.position); mesh = Max2DMesh.GenerateComplexTrackerMesh(trackerObject.trackerList, transform, lineWidth, transform.position.z + 0.001f); Max2D.SetColor(Color.black); Max2DMesh.Draw(mesh, Max2D.lineMaterial); }
public void Update() { if (drawSlicer == false) { return; } float squareSize = lineEndSize; Max2DMesh.lineType = lineType; switch (sliceType) { case SliceType.Linear: if (mouseDown) { if (startSliceIfPossible == false || startedSlice == true) { // If Stripped Line if (strippedLinear) { List <Vector2D> linearPoints = GetLinearVertices(linearPair, minVertexDistance * visualScale); if (linearPoints.Count > 1) { meshBorder = Max2DMesh.GenerateComplexMesh(linearPoints, transform, lineWidth * visualScale * borderScale, minVertexDistance, zPosition + 0.001f, squareSize * visualScale, lineEndWidth * visualScale * borderScale, vertexSpace); mesh = Max2DMesh.GenerateComplexMesh(linearPoints, transform, lineWidth * visualScale, minVertexDistance, zPosition, squareSize * visualScale, lineEndWidth * visualScale, vertexSpace); Draw(); } } else { meshBorder = Max2DMesh.GenerateLinearMesh(linearPair, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize * visualScale, lineEndWidth * visualScale * borderScale); mesh = Max2DMesh.GenerateLinearMesh(linearPair, transform, lineWidth * visualScale, zPosition, squareSize * visualScale, lineEndWidth * visualScale); Draw(); } if (displayCollisions) { List <Slice2D> results = Slicer2D.LinearSliceAll(linearPair, sliceLayer, false); foreach (Slice2D slice in results) { foreach (Vector2D collision in slice.collisions) { Pair2D p = new Pair2D(collision, collision); meshBorder = Max2DMesh.GenerateLinearMesh(p, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, 0, 1.5f * lineEndWidth * visualScale * borderScale); mesh = Max2DMesh.GenerateLinearMesh(p, transform, lineWidth * visualScale, zPosition, 0, 2f * lineEndWidth * visualScale); Draw(); } } } } } break; case SliceType.Complex: if (mouseDown) { if (pointsList.Count > 0) { if (startSliceIfPossible == false || startedSlice == true) { meshBorder = Max2DMesh.GenerateComplexMesh(pointsList, transform, lineWidth * visualScale * borderScale, minVertexDistance, zPosition + 0.001f, squareSize * visualScale, lineEndWidth * visualScale * borderScale, vertexSpace); mesh = Max2DMesh.GenerateComplexMesh(pointsList, transform, lineWidth * visualScale, minVertexDistance, zPosition, squareSize * visualScale, lineEndWidth * visualScale, vertexSpace); Draw(); } } } break; case SliceType.ComplexTracked: if (pointsList.Count > 0) { meshBorder = Max2DMesh.GenerateComplexTrackerMesh(GetMousePosition(), complexTracker.trackerList, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize * visualScale); mesh = Max2DMesh.GenerateComplexTrackerMesh(GetMousePosition(), complexTracker.trackerList, transform, lineWidth * visualScale, zPosition, squareSize * visualScale); Draw(); } break; case SliceType.LinearTracked: if (pointsList.Count > 0) { meshBorder = Max2DMesh.GenerateLinearTrackerMesh(GetMousePosition(), linearTracker.trackerList, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize * visualScale); mesh = Max2DMesh.GenerateLinearTrackerMesh(GetMousePosition(), linearTracker.trackerList, transform, lineWidth * visualScale, zPosition, squareSize * visualScale); Draw(); } break; case SliceType.LinearCut: if (mouseDown) { meshBorder = Max2DMesh.GenerateLinearCutMesh(linearPair, cutSize * visualScale, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f); mesh = Max2DMesh.GenerateLinearCutMesh(linearPair, cutSize * visualScale, transform, lineWidth * visualScale, zPosition); Draw(); } break; case SliceType.ComplexCut: if (mouseDown) { meshBorder = Max2DMesh.GenerateComplexCutMesh(pointsList, cutSize * visualScale, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f); mesh = Max2DMesh.GenerateComplexCutMesh(pointsList, cutSize * visualScale, transform, lineWidth * visualScale, zPosition); Draw(); } break; case SliceType.Polygon: meshBorder = Max2DMesh.GeneratePolygonMesh(GetMousePosition(), polygonType, polygonSize * visualScale, minVertexDistance, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f); mesh = Max2DMesh.GeneratePolygonMesh(GetMousePosition(), polygonType, polygonSize * visualScale, minVertexDistance, transform, lineWidth * visualScale, zPosition); Draw(); break; case SliceType.Create: if (mouseDown) { meshBorder = Max2DMesh.GenerateCreateMesh(GetMousePosition(), polygonType, polygonSize, createType, pointsList, linearPair, minVertexDistance, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize); mesh = Max2DMesh.GenerateCreateMesh(GetMousePosition(), polygonType, polygonSize, createType, pointsList, linearPair, minVertexDistance, transform, lineWidth * visualScale, zPosition, squareSize); Draw(); } break; case SliceType.ComplexClick: if (pointsList.Count > 0) { List <Vector2D> points = new List <Vector2D>(pointsList); Vector2D posA = GetMousePosition(); points.Add(posA); meshBorder = Max2DMesh.GenerateComplexMesh(points, transform, lineWidth * visualScale * borderScale, minVertexDistance, zPosition + 0.001f, squareSize * visualScale, lineEndWidth * visualScale * borderScale, vertexSpace * visualScale); mesh = Max2DMesh.GenerateComplexMesh(points, transform, lineWidth * visualScale, minVertexDistance, zPosition, squareSize * visualScale, lineEndWidth * visualScale, vertexSpace * visualScale); Draw(); } break; case SliceType.ComplexTrail: meshBorder = Max2DMesh.GenerateComplexTrailMesh(GetMousePosition(), complexTrail.trailList, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize * visualScale); mesh = Max2DMesh.GenerateComplexTrailMesh(GetMousePosition(), complexTrail.trailList, transform, lineWidth * visualScale, zPosition, squareSize * visualScale); Draw(); break; case SliceType.LinearTrail: meshBorder = Max2DMesh.GenerateComplexTrailMesh(GetMousePosition(), linearTrail.trailList, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, squareSize * visualScale); mesh = Max2DMesh.GenerateComplexTrailMesh(GetMousePosition(), linearTrail.trailList, transform, lineWidth * visualScale, zPosition, squareSize * visualScale); Draw(); break; case SliceType.Point: case SliceType.Explode: case SliceType.ExplodeByPoint: Vector2D pos = GetMousePosition(); Pair2D pair = new Pair2D(pos, pos); meshBorder = Max2DMesh.GeneratePointMesh(pair, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f); mesh = Max2DMesh.GeneratePointMesh(pair, transform, lineWidth * visualScale, zPosition); Draw(); break; } Max2DMesh.lineType = Max2DMesh.LineType.Default; }