public Rocket(Framework framework) { Mesh = framework.AssetManager.Load(@"RocketCommander\rocket.meshb") as Mesh; MeshNode = new MeshNode(framework.Device, this.Mesh) { Scale = new Vector3(scale, scale, scale) }; }
public Asteroid(Framework framework, SceneManager sceneManager, int type) { string meshFile = @"RocketCommander\asteroid" + (type + 1).ToString() + ".meshb"; Mesh = framework.AssetManager.Load(meshFile) as Mesh; var random = new Random(); float[] scalings = new float[] {0.0249557421f, 0.01308855f, 0.0136641478f, 0.0136658037f, 0.008148187f}; float scale = random.Next(minScale, maxScale) * scalings[type]; MeshNode = new MeshNode(framework.Device, Mesh) { Scale = new Vector3(scale, scale, scale) }; sceneManager.AddRenderable(MeshNode); }
public SmallAsteroid(Framework framework, SceneManager sceneManager, int type) { string meshFile = @"RocketCommander\SmallAsteroid" + (type + 1).ToString() + ".meshb"; Mesh = framework.AssetManager.Load(meshFile) as Mesh; var random = new Random(); float[] scalings = new float[] {0.00243701926f, 0.00213851035f, 0.00200786744f}; float scale = (smallAsteroidSize + RandomHelper.GetRandomFloat(-2.5f, 5.0f)) * scalings[type]; MeshNode = new MeshNode(framework.Device, this.Mesh) { Scale = new Vector3(scale, scale, scale) }; sceneManager.AddRenderable(MeshNode); }
public Item(Framework framework, SceneManager sceneManager, Type type) { ItemType = type; string meshFile = @"RocketCommander\" + Enum.GetName(typeof(Type), ItemType) + ".meshb"; Mesh = framework.AssetManager.Load(meshFile) as Mesh; float[] scalings = new float[] { 0.006876214f, 0.009066273f, 0.0125944568f, 0.0146259107f, 0.0168181341f }; float scale = scalings[(int)type]; MeshNode = new MeshNode(framework.Device, Mesh) { Scale = new Vector3(scale, scale, scale) }; sceneManager.AddRenderable(MeshNode); }
public MaterialEditorViewModel(MaterialAsset materialAsset, Framework framework) { MaterialEditor = new MaterialEditor(materialAsset.Material); ResetCommand = new DelegateCommand<PropertyItem>((item) => System.Windows.MessageBox.Show(item.ToString())); AdvancedOptions = new List<MenuItem>(); AdvancedOptions.Add(new MenuItem() { Header = "Reset", Command = ResetCommand }); SaveCommand = new DelegateCommand(() => { materialAsset.Material.Save(materialAsset.FullPath); StatusBarService.StatusText = "Material saved: " + materialAsset.ShortName; }); var mesh = Mesh.CreateSphere(framework.Device, framework.AssetManager, materialAsset.Material, 5.0f, 80, 80); this.meshNode = new MeshNode(framework.Device, mesh); var sceneManager = new SceneManager(framework.Device, framework.AssetManager); sceneManager.LocateCameraLookingMesh(mesh); sceneManager.AddRenderable(this.meshNode); RenderViewModel = new RenderViewModel(framework, sceneManager); RenderViewModel.MouseMove += RenderViewModel_MouseMove; }
public void LookMeshNode(MeshNode meshNode) { EyePos = meshNode.BoundingCenter + new Vector3(0, 0, meshNode.BoundingRadius * -3.0f); LookAt = meshNode.BoundingCenter; }