private void MenuItem_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filename = dlg.FileName; DemData dm = new DemData(filename); dm.createMesh(); var sceneMgr = _ogreImage.SceneManager; Entity thisEntity = sceneMgr.CreateEntity("cc", "ColourCube"); thisEntity.SetMaterialName("Examples/GrassFloor"); SceneNode thisSceneNode = sceneMgr.RootSceneNode.CreateChildSceneNode(); thisSceneNode.AttachObject(thisEntity); thisSceneNode.ShowBoundingBox = true; _ogreImage.Camera.Position = new Vector3((dm.max.x - dm.min.x) / 2, (dm.max.y - dm.min.y) / 2,- dm.max.z+1000); // Look back along -Z _ogreImage.Camera.LookAt(new Vector3((dm.max.x - dm.min.x) / 2, (dm.max.y - dm.min.y) / 2, dm.max.z)); //_ogreImage.Camera.NearClipDistance = 5; } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filename = dlg.FileName; DemData dm = new DemData(filename); dm.createMesh(); var sceneMgr = _ogreImage.SceneManager; Entity thisEntity = sceneMgr.CreateEntity("cc", "ColourCube"); thisEntity.SetMaterialName("Examples/GrassFloor"); SceneNode thisSceneNode = sceneMgr.RootSceneNode.CreateChildSceneNode(); thisSceneNode.AttachObject(thisEntity); thisSceneNode.ShowBoundingBox = true; _ogreImage.Camera.Position = new Vector3((dm.max.x - dm.min.x) / 2, (dm.max.y - dm.min.y) / 2, -dm.max.z + 1000); // Look back along -Z _ogreImage.Camera.LookAt(new Vector3((dm.max.x - dm.min.x) / 2, (dm.max.y - dm.min.y) / 2, dm.max.z)); //_ogreImage.Camera.NearClipDistance = 5; } }