public void OpenBigMesh() { String filename = SetUpOpenDialog(); if (filename == null) { return; } else { if (meshLoader != null && meshLoader.IsAlive) { meshLoader.Abort(); } this.progressBar.Visible = true; FileInfo fileInfo = new FileInfo(filename); if (fileInfo.Length > 1048576) // Open files larger than 1MB in their own thread { meshLoader = new MeshLoader(); meshLoader.MeshProcessFinished += new EventHandler(meshLoader_MeshLoaded); meshLoader.Load(filename); } else { GlobalData.Instance.TriMesh = TriMeshIO.ReadFile(filename); this.progressBar.Visible = false; } } }
TransparentDemo() { this.mesh = TriMeshIO.ReadFile("cube.obj"); foreach (var item in this.mesh.Vertices) { item.Traits.Position.z /= 3; } }
StencilDemo() { this.cube = TriMeshIO.ReadFile("cube.obj"); foreach (var v in this.cube.Vertices) { Vector3D p = v.Traits.Position; v.Traits.Position = new Vector3D(p.x * 2, p.y * 0.01, p.z * 2); } this.sphere = TriMeshIO.ReadFile("sphere.obj"); this.bunny = TriMeshIO.ReadFile("bunny.obj"); }
//TriMesh bunny; ShadowDemo() { //this.cube = TriMeshIO.ReadFile("cube.obj"); //foreach (var v in this.cube.Vertices) //{ // Vector3D p = v.Traits.Position; // v.Traits.Position = new Vector3D(p.x, p.y, p.z); //} this.sphere = TriMeshIO.ReadFile("sphere.obj"); TriMeshUtil.ScaleToUnit(this.sphere, 0.1); //this.bunny = TriMeshIO.ReadFile("bunny.obj"); //TriMeshUtil.ScaleToUnit(this.bunny, 0.3); }
static TriMesh CreateSphere() { TriMesh sphere = TriMeshIO.ReadFile("sphere.obj"); TriMeshUtil.ScaleToUnit(sphere, 0.4); TriMeshUtil.MoveToCenter(sphere); Vector3D move = new Vector3D(-0.2, -0.1, -0.1); foreach (var v in sphere.Vertices) { v.Traits.Position -= move; } TriMeshUtil.SetUpNormalVertex(sphere); return(sphere); }
static TriMesh CreateCube() { TriMesh cube = TriMeshIO.ReadFile("cube.obj"); TriMeshUtil.ScaleToUnit(cube, 0.2); TriMeshUtil.MoveToCenter(cube); Vector3D move = new Vector3D(0.2, 0.1, -0.3); foreach (var v in cube.Vertices) { v.Traits.Position -= move; } TriMeshUtil.SetUpNormalVertex(cube); return(cube); }
public void OpenManiFoldFileTwo() { String filename = SetUpOpenDialog(); if (filename == null) { return; } else { GlobalData.Instance.MeshTwo = TriMeshIO.ReadFile(filename); } GlobalData.Instance.OnChanged(EventArgs.Empty); }
private void Run() { try { mesh = TriMeshIO.ReadFile(file); lock (mesh) { //mesh.ComputeAllTraits(); } MeshProcessFinished(this, EventArgs.Empty); } catch (ThreadAbortException) { Thread.ResetAbort(); mesh = null; } }
public void AddOneMore() { String filename = SetUpOpenDialog(); if (filename == null) { return; } else { GlobalData.Instance.AllMeshes.Add(TriMeshIO.ReadFile(filename)); GlobalData.Instance.TriMesh = GlobalData.Instance.AllMeshes[GlobalData.Instance.AllMeshes.Count - 1]; } GlobalData.Instance.OnChanged(EventArgs.Empty); }
TeapotDemo() { this.mesh = TriMeshIO.ReadFile("teapot.obj"); TriMeshUtil.SetUpNormalVertex(this.mesh); }