public virtual void Draw(GraphicsDevice device, MgCamera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Alpha = 1; effect.LightingEnabled = true; effect.DirectionalLight0.DiffuseColor = new Vector3(0.3f, 0.3f, 0.3f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = new Vector3(0, -1, 1); effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(0.3f, 0.3f, 0.3f); effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, MgCamera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = TextureManager.mgBack; effect.Alpha = 1; effect.LightingEnabled = true; effect.AmbientLightColor = new Vector3(0.9f); effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
void drawPoly(GraphicsDevice device, MgCamera camera, int type) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if(type == 0) effect.World = mesh.ParentBone.Transform * GetWorld(); else if(type == 1) effect.World = mesh.ParentBone.Transform * Matrix.CreateScale(5) * GetWorld(); else effect.World = mesh.ParentBone.Transform * Matrix.CreateScale(10) * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; if (type == 0) { effect.Texture = TextureManager.mgBlue; effect.Alpha = 0.6f; } else if(type == 1) { effect.Texture = TextureManager.mgPink; effect.Alpha = 0.5f; } else { effect.Texture = TextureManager.pureWhite; effect.Alpha = 0.3f; } effect.LightingEnabled = true; effect.AmbientLightColor = new Vector3(0.9f); effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public MgModelManager(Game1 game, Minigame minigame) { this.game = game; this.minigame = minigame; additive = new List<MgModel>(); solid = new List<MgModel>(); cam = new MgCamera(game); depthStencilState = new DepthStencilState(); depthStencilState.DepthBufferEnable = true; depthStencilState.DepthBufferWriteEnable = true; dbNoWriteEnable = new DepthStencilState(); depthStencilState.DepthBufferEnable = true; dbNoWriteEnable.DepthBufferWriteEnable = false; addModels(); }
public override void Draw(GraphicsDevice device, MgCamera camera) { drawPoly(device, camera, 1); drawPoly(device, camera, 0); //drawPoly(device, camera, 3); }