public void Draw() { //material.color = color; material.SetColor("_Emission", color); Max2DMesh.Draw(mesh, material); }
public void DrawTrajectory() { Polygon2D trajectory = new Polygon2D(); //trajectory.AddPoint(0, 0); Vector2 pos = spawner.transform.position; Vector2 gravity = Physics2D.gravity; Vector2 force = spawner.transform.right * applyForce; float timer = 0; while (timer < 3) { float delta = 0.1f; trajectory.AddPoint(pos); pos += force * delta; force += gravity * delta; timer += delta; } Mesh mesh = Max2DMesh.CreatePolygon(transform, trajectory, -3f, 1f, false); Max2DMesh.Draw(mesh, trajectoryMaterial); }
void Update() { trackerObject.Update(transform.position); mesh = Slicer2DVisualsMesh.Linear.GenerateTrackerMesh(trackerObject.trackerList, transform, lineWidth, transform.position.z + 0.001f); //Max2D.SetColor (Color.black); Max2DMesh.Draw(mesh, GetStaticMaterial()); }
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 Draw() { //material.color = color; material.SetColor("_Emission", color); if (mesh == null) { return; } Max2DMesh.Draw(mesh, transform, material); }
public void Draw() { if (customColor) { material.SetColor("_Emission", color); Max2DMesh.Draw(mesh, transform, material, orderInLayer); } else { Max2D.Check(); Max2D.lineMaterial.SetColor("_Emission", Color.black); Max2DMesh.Draw(mesh, transform, Max2D.lineMaterial, orderInLayer); } }
public void DrawLine(Pair2D pair) { Mesh meshBorder = Max2DMesh.GenerateLinearMesh(pair, transform, lineWidth * 2f * visualScale, zPosition + 0.001f, 0, lineWidth * 2f * visualScale); Mesh mesh = Max2DMesh.GenerateLinearMesh(pair, transform, lineWidth * visualScale, zPosition, 0, lineWidth * 2f * visualScale); lineMaterial.SetColor("_Emission", Color.black); Max2DMesh.Draw(Max2DMesh.GenerateLinearMesh(new Pair2D(pair.A, pair.A), transform, lineWidth * 10f * visualScale, zPosition + 0.001f, 0, lineWidth * 10f * visualScale), lineMaterialBorder); Max2DMesh.Draw(Max2DMesh.GenerateLinearMesh(new Pair2D(pair.B, pair.B), transform, lineWidth * 10f * visualScale, zPosition + 0.001f, 0, lineWidth * 10f * visualScale), lineMaterialBorder); Max2DMesh.Draw(meshBorder, lineMaterialBorder); lineMaterial.SetColor("_Emission", slicerColor); Max2DMesh.Draw(Max2DMesh.GenerateLinearMesh(new Pair2D(pair.A, pair.A), transform, lineWidth * 5f * visualScale, zPosition + 0.001f, 0, lineWidth * 5f * visualScale), lineMaterial); Max2DMesh.Draw(Max2DMesh.GenerateLinearMesh(new Pair2D(pair.B, pair.B), transform, lineWidth * 5f * visualScale, zPosition + 0.001f, 0, lineWidth * 5f * visualScale), lineMaterial); Max2DMesh.Draw(mesh, lineMaterial); }
public void DrawLine(Pair2D pair) { Mesh meshBorder = Slicer2DVisualsMesh.Linear.GenerateMesh(pair, transform, lineWidth * 2f * visualScale, zPosition + 0.001f, 0, lineWidth * 2f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount); Mesh mesh = Slicer2DVisualsMesh.Linear.GenerateMesh(pair, transform, lineWidth * visualScale, zPosition, 0, lineWidth * 2f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount); lineMaterial.SetColor(Color.black); Max2DMesh.Draw(Slicer2DVisualsMesh.Linear.GenerateMesh(new Pair2D(pair.A, pair.A), transform, lineWidth * 10f * visualScale, zPosition + 0.001f, 0, lineWidth * 10f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount), lineMaterialBorder.material); Max2DMesh.Draw(Slicer2DVisualsMesh.Linear.GenerateMesh(new Pair2D(pair.B, pair.B), transform, lineWidth * 10f * visualScale, zPosition + 0.001f, 0, lineWidth * 10f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount), lineMaterialBorder.material); Max2DMesh.Draw(meshBorder, lineMaterialBorder.material); lineMaterial.SetColor(slicerColor); Max2DMesh.Draw(Slicer2DVisualsMesh.Linear.GenerateMesh(new Pair2D(pair.A, pair.A), transform, lineWidth * 5f * visualScale, zPosition + 0.001f, 0, lineWidth * 5f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount), lineMaterial.material); Max2DMesh.Draw(Slicer2DVisualsMesh.Linear.GenerateMesh(new Pair2D(pair.B, pair.B), transform, lineWidth * 5f * visualScale, zPosition + 0.001f, 0, lineWidth * 5f * visualScale, visuals.lineEndingType, visuals.lineEndingEdgeCount), lineMaterial.material); Max2DMesh.Draw(mesh, lineMaterial.material); }
public void Draw(Pair2D pair) { Mesh2DMesh trianglesList = new Mesh2DMesh(); trianglesList.Add(Max2DMesh.CreateLine(pair, new Vector3(1, 1, 1), lineWidth, transform.position.z + lineOffset)); Mesh mesh = Max2DMesh.Export(trianglesList); if (customColor) { material.SetColor(color); Max2DMesh.Draw(mesh, GetMaterial().material); } else { Max2DMesh.Draw(mesh, GetStaticMaterial().material); } }
public void Draw(Pair2D pair) { List <Mesh2DTriangle> trianglesList = new List <Mesh2DTriangle>(); trianglesList.Add(Max2DMesh.CreateLineNew(pair, lineWidth, transform.position.z + lineOffset)); Mesh mesh = Max2DMesh.ExportMesh(trianglesList); if (customColor) { material.SetColor("_Emission", color); Max2DMesh.Draw(mesh, material); } else { Max2DMesh.Draw(mesh, Max2D.lineMaterial); } }
public void Draw() { if (customColor) { if (material != null) { material.SetColor("_Emission", color); Max2DMesh.Draw(mesh, transform, material); } } else { Max2D.Check(); if (staticMaterial != null) { staticMaterial.SetColor("_Emission", Color.black); Max2DMesh.Draw(mesh, transform, staticMaterial); } } }
public void Draw() { if (lineBorder && meshBorder.Count > 0) { if (meshBorder.Count > 0) { foreach (Mesh m in meshBorder) { Max2DMesh.Draw(m, GetBorderMaterial()); } } } if (mesh.Count > 0) { foreach (Mesh m in mesh) { Max2DMesh.Draw(m, GetFillMaterial()); } } if (customEndingsPosition.Count > 0) { Matrix4x4 matrix; foreach (Pair2D pair in customEndingsPosition) { Polygon2D polyA = Polygon2D.CreateFromRect(new Vector2(1, 1)); //polyA.ToOffset(pair.A); Mesh mA = polyA.CreateMesh(new Vector2(2, 2), Vector2.zero); matrix = Matrix4x4.TRS(pair.A.ToVector3(zPosition), Quaternion.Euler(0, 0, 0), new Vector3(1, 1, 1)); Graphics.DrawMesh(mA, matrix, customEndingImageMaterial, 0); matrix = Matrix4x4.TRS(pair.B.ToVector3(zPosition), Quaternion.Euler(0, 0, 0), new Vector3(1, 1, 1)); Graphics.DrawMesh(mA, matrix, customEndingImageMaterial, 0); } } }
public void Draw() { SmartMaterial mat; if (customColor) { mat = GetMaterial(); if (mat != null) { mat.SetColor(color); Max2DMesh.Draw(mesh, transform, mat.material); } } else { mat = GetStaticMaterial(); if (mat != null) { Max2DMesh.Draw(mesh, transform, mat.material); } } }
public void Draw() { if (lineType == Max2DMesh.LineType.Legacy) { lineLegacyMaterial.SetColor("_Emission", slicerColor); Max2DMesh.Draw(mesh, lineLegacyMaterial); } else { if (lineBorder) { if (meshBorder != null) { //lineMaterialBorder.color = Color.black; lineMaterial.SetColor("_Emission", Color.black); Max2DMesh.Draw(meshBorder, lineMaterialBorder); } } //lineMaterial.color = slicerColor; lineMaterial.SetColor("_Emission", slicerColor); Max2DMesh.Draw(mesh, lineMaterial); } }