public override void Draw(GraphicsDevice device, Camera camera) { if (visible) { 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; if (mesh.Name.Equals("screen")) { effect.Texture = (Texture2D)screen.rTarg; device.BlendState = BlendState.AlphaBlend; } else effect.Texture = (Texture2D)rTarg; effect.LightingEnabled = true; effect.AmbientLightColor = Vector3.One; effect.EmissiveColor = new Vector3(0.5f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } } }
public override void Draw(GraphicsDevice device, Camera camera) { game.GraphicsDevice.BlendState = BlendState.Additive; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { foreach (Vector3 pos in orePos) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * Matrix.CreateScale(scale) * Matrix.CreateRotationZ(rot.Z) * Matrix.CreateBillboard(pos, game.camera.cameraPosition, game.camera.tiltUp, null); ; effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = (Texture2D)rTarg; effect.Alpha = 1; } mesh.Draw(); } } }
public override void Draw(GraphicsDevice device, Camera 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.bombTex1; 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 = Vector3.One; effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.Pi) * Matrix.CreateConstrainedBillboard(pos, game.camera.cameraPosition, dir, null, dir); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = tex; effect.Alpha = alpha; effect.LightingEnabled = true; effect.DirectionalLight0.Direction = Vector3.Down; effect.AmbientLightColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); mesh.Draw(); } //base.Draw(device, camera); }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (mesh.Name.Contains("spin")) effect.World = Matrix.CreateRotationY(topRot) * GetWorld(); else effect.World = mesh.ParentBone.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = TextureManager.station1; effect.Alpha = 1; //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; effect.DirectionalLight0.DiffuseColor = new Vector3(0.2f, 0.2f, 0.2f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1, -0.2f, 1)); effect.DirectionalLight0.SpecularColor = new Vector3(0.3f); effect.AmbientLightColor = new Vector3(0.6f); effect.EmissiveColor = new Vector3(.2f, .2f, .2f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public void overrideDraw(GraphicsDevice device, Camera camera) { if (!game.camera.endGame && !game.minigame.active && !camera.transitioning) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; game.GraphicsDevice.DepthStencilState = DepthStencilState.None; 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.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; //effect.DirectionalLight0.DiffuseColor = new Vector3(0.6f, 0.5f, 0.6f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = direction; //effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(2f, 2f, 2f); //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } game.GraphicsDevice.BlendState = BlendState.Opaque; } }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; 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 = (Texture2D)rTarg; effect.Alpha = 1; //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; effect.AmbientLightColor = new Vector3(1); //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { game.GraphicsDevice.BlendState = BlendState.AlphaBlend; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; 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 = (Texture2D)rt; effect.Alpha = alpha; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work 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 = Vector3.One; effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { game.GraphicsDevice.BlendState = BlendState.AlphaBlend; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; 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 = tex; effect.Alpha = alpha; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { //game.GraphicsDevice.DepthStencilState = depthStencilState; game.GraphicsDevice.BlendState = BlendState.Additive; if (isVisible) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); Matrix[] bones = animPlayer.GetSkinTransforms(); foreach (ModelMesh mesh in model.Meshes) { foreach (SkinnedEffect effect in mesh.Effects) { effect.SetBoneTransforms(bones); //effect.Texture = (Texture2D)targ1; //effect.Texture = TextureManager.gib1_0; if (mesh.Name.Equals("round")) { game.GraphicsDevice.BlendState = BlendState.AlphaBlend; effect.Texture = (Texture2D)targ2; effect.Alpha = 0.8f; } else if (mesh.Name.Equals("round2")) { game.GraphicsDevice.BlendState = BlendState.Additive; effect.Texture = TextureManager.vortSpir; effect.Alpha = 1f; } else { game.GraphicsDevice.BlendState = BlendState.Additive; effect.Texture = (Texture2D)targ1; effect.Alpha = 1f; } //effect.World = mesh.ParentBone.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; } mesh.Draw(); } game.GraphicsDevice.BlendState = BlendState.Opaque; } }
public override void Draw(GraphicsDevice device, Camera 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 = GetWorld(); effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationX(rot.X) * Matrix.CreateRotationY(rot.Y) * Matrix.CreateTranslation(pos); //effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.PiOver2) * Matrix.CreateConstrainedBillboard(projectile.pos, game.camera.cameraPosition, Vector3.Cross(Vector3.Left, projectile.direction), null, null); } effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = (Texture2D)rTarg; effect.Alpha = 1; effect.LightingEnabled = true; effect.AmbientLightColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); foreach (BasicEffect effect in mesh.Effects) { { effect.World = Matrix.CreateRotationX(MathHelper.Pi) * Matrix.CreateScale(scale) * Matrix.CreateRotationX(rot.X) * Matrix.CreateRotationY(rot.Y) * Matrix.CreateTranslation(pos); //effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.PiOver2) * Matrix.CreateConstrainedBillboard(projectile.pos, game.camera.cameraPosition, Vector3.Cross(Vector3.Left, projectile.direction), null, null); } effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = (Texture2D)rTarg; effect.Alpha = 1; effect.LightingEnabled = true; effect.AmbientLightColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (mesh.Name.Contains("annon")) effect.World = Matrix.CreateRotationX(barrelRot) * Matrix.CreateTranslation(barrelMat) * Matrix.CreateTranslation(bodyMat * -1) * Matrix.CreateScale(barrelScale) * turretRot() * Matrix.CreateTranslation(bodyMat) * Matrix.CreateTranslation(pos); else if (mesh.Name.Contains("body")) effect.World = turretRot() * Matrix.CreateTranslation(bodyMat) * Matrix.CreateScale(scale) * Matrix.CreateTranslation(pos); else effect.World = mesh.ParentBone.Transform * Matrix.CreateScale(scale) * Matrix.CreateTranslation(pos); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Alpha = 1; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; if (mesh.Name.Contains("glow")) { effect.AmbientLightColor = Vector3.One; } else { 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, Camera 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; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; if (junkShip.destroying) { effect.Texture = TextureManager.pureWhite; effect.AmbientLightColor = Vector3.One; effect.EmissiveColor = Vector3.One; } else { if (mesh.Name.Contains("glow")) { effect.Texture = (Texture2D)rTarg; effect.AmbientLightColor = Vector3.One; } else { effect.Texture = TextureManager.artefact; 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, Camera camera) { game.GraphicsDevice.BlendState = BlendState.Additive; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { drawMesh(mesh, camera, rot.Z); drawMesh(mesh, camera, -rot.Z); } }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (mesh.Name.StartsWith("tip")) { effect.World = Matrix.CreateScale(scale * 2) * Matrix.CreateRotationY(MathHelper.PiOver2) * Matrix.CreateBillboard(pos, game.camera.cameraPosition, game.camera.tiltUp, null); //effect.World = mesh.ParentBone.Transform * GetWorld(); } else { effect.World = mesh.ParentBone.Transform * GetWorld(); effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.Pi) * Matrix.CreateConstrainedBillboard(pos, game.camera.cameraPosition, shot.direction*dirMult, null, shot.direction*dirMult); // effect.World = Matrix.CreateScale(scale) * Matrix.CreateFromYawPitchRoll(-MathHelper.Pi+0.5f,MathHelper.Pi,MathHelper.PiOver2) * Matrix.CreateConstrainedBillboard(projectile.pos, game.camera.cameraPosition, projectile.direction, null, projectile.direction); //effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.Pi) * Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateRotationZ(MathHelper.PiOver2) * Matrix.CreateConstrainedBillboard(projectile.pos, game.camera.cameraPosition, projectile.direction, null, projectile.direction); } effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = tex; effect.Alpha = 1; //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; //effect.DirectionalLight0.DiffuseColor = new Vector3(0.6f, 0.5f, 0.6f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = Vector3.Down; //effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = Vector3.One; //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); mesh.Draw(); } //base.Draw(device, camera); }
public override void Draw(GraphicsDevice device, Camera camera) { if (visible) { game.GraphicsDevice.DepthStencilState = depthStencilState; game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; if (mesh.Name.Equals("inSphere")) { effect.World = Matrix.CreateRotationY(yRot) * mesh.ParentBone.Transform * GetWorld(); effect.Texture = (Texture2D)rTarg2; } else { effect.World = Matrix.CreateRotationY(-yRot) * mesh.ParentBone.Transform * GetWorld(); effect.Texture = (Texture2D)rTarg; } effect.Alpha = 1; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; //effect.DirectionalLight0.DiffuseColor = new Vector3(0.6f, 0.5f, 0.6f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = direction; //effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(2f, 2f, 2f); //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } game.GraphicsDevice.BlendState = BlendState.Opaque; } }
public override void Draw(GraphicsDevice device, Camera 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; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); device.BlendState = BlendState.Additive; device.DepthStencilState = DepthStencilState.DepthRead; drawRings(ringTex, camera); if (time < 15) { drawRings(blipTex, camera); transforms = new Matrix[ripple.Bones.Count]; ripple.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in ripple.Meshes) { foreach (BasicEffect effect in mesh.Effects) { { effect.World = Matrix.CreateScale(rippleScale) * Matrix.CreateRotationX(MathHelper.PiOver2 * 3) * Matrix.CreateBillboard(pos, camera.cameraPosition, camera.tiltUp, null); //effect.World = Matrix.CreateScale(scale) * Matrix.CreateRotationY(MathHelper.PiOver2) * Matrix.CreateConstrainedBillboard(projectile.pos, game.camera.cameraPosition, Vector3.Cross(Vector3.Left, projectile.direction), null, null); } effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = (Texture2D)rippleTex; effect.Alpha = 1; effect.LightingEnabled = true; effect.AmbientLightColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } } //base.Draw(device, camera); }
void drawMesh(ModelMesh mesh, Camera camera, float rot) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * GetWorld(rot); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = tex; effect.Alpha = alpha*0.6f; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; } mesh.Draw(); mesh.Draw(); }
public override void Draw(GraphicsDevice device, Camera camera) { game.GraphicsDevice.BlendState = BlendState.Additive; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; 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 = (Texture2D)rTarg; effect.Alpha = 1; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { if (active) { game.GraphicsDevice.BlendState = BlendState.Additive; Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * Matrix.CreateTranslation(new Vector3(0, .5f, 0)) * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; if (mesh.Name.StartsWith("fill")) { effect.Texture = TextureManager.turLogoIn; effect.Alpha = alpha1; } else { effect.Texture = TextureManager.turLogoOut; effect.Alpha = alpha2; } } mesh.Draw(); mesh.Draw(); } } }
void drawRings(Texture2D tex, Camera camera) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (mesh.Name.Equals("ring1")) { effect.World = Matrix.CreateRotationY(ringRot2) * mesh.ParentBone.Transform * GetWorld(); } else if (mesh.Name.Equals("ring2")) { effect.World = Matrix.CreateRotationY(ringRot4) * mesh.ParentBone.Transform * GetWorld(); } else if (mesh.Name.Equals("ring3")) { effect.World = Matrix.CreateRotationY(ringRot3) * mesh.ParentBone.Transform * GetWorld(); } else if (mesh.Name.Equals("ring8")) { effect.World = Matrix.CreateRotationY(ringRot2) * mesh.ParentBone.Transform * GetWorld(); } else if (mesh.Name.Equals("ring5")) { effect.World = Matrix.CreateRotationY(ringRot) * mesh.ParentBone.Transform * GetWorld(); } else if (mesh.Name.Equals("ring6")) { effect.World = Matrix.CreateRotationY(ringRot3) * mesh.ParentBone.Transform * GetWorld(); } else { effect.World = Matrix.CreateRotationY(ringRot4) * mesh.ParentBone.Transform * GetWorld(); } effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = tex; effect.Alpha = ringAlpha; effect.LightingEnabled = true; effect.AmbientLightColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); mesh.Draw(); } }
public override void DrawAlt(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); device.BlendState = BlendState.Additive; device.DepthStencilState = DepthStencilState.DepthRead; foreach (ModelMesh mesh in model.Meshes) { if (mesh.Name.Contains("window")) { 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 = (Texture2D)TextureManager.baseWindow; effect.Alpha = 1; //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; effect.DirectionalLight0.DiffuseColor = new Vector3(0.8f, 0.8f, 0.8f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1, -0.2f, 1)); effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(0.4f, .4f, .4f); effect.EmissiveColor = new Vector3(.2f, .2f, .2f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } } }
public void DrawRails(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { if (mesh.Name.Contains("plane")) { 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.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0.5f, 0.5f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1, -0.2f, 1)); effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(0.2f, .2f, .2f); effect.EmissiveColor = new Vector3(.3f, .3f, .3f); effect.PreferPerPixelLighting = true; } mesh.Draw(); } } //System.Diagnostics.Debug.WriteLine("Model Draw Called"); }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { if (!mesh.Name.Contains("window")) { foreach (BasicEffect effect in mesh.Effects) { if(mesh.Name.Contains("cog2")) effect.World = Matrix.CreateRotationZ(cogRot) * Matrix.CreateTranslation(cog2trans) * GetWorld(); else if (mesh.Name.Contains("cog1")) effect.World = Matrix.CreateRotationZ(-cogRot) * Matrix.CreateTranslation(cog1trans) * GetWorld(); else effect.World = mesh.ParentBone.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = tex; effect.Alpha = 1; //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; effect.DirectionalLight0.DiffuseColor = new Vector3(0.2f, 0.2f, 0.2f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = new Vector3(0, -1, 1); effect.AmbientLightColor = new Vector3(0.7f, 0.7f, 0.7f); effect.SpecularColor = new Vector3(0.7f); effect.EmissiveColor = new Vector3(.3f, .3f, .3f); /* effect.DirectionalLight0.DiffuseColor = new Vector3(0.2f, 0.2f, 0.2f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1, -0.2f, 1)); effect.DirectionalLight0.SpecularColor = new Vector3(0.3f); effect.AmbientLightColor = new Vector3(0.6f); effect.EmissiveColor = new Vector3(.2f, .2f, .2f); effect.PreferPerPixelLighting = true;*/ } mesh.Draw(); } } //System.Diagnostics.Debug.WriteLine("Model Draw Called"); }
public override void Draw(GraphicsDevice device, Camera camera) { }
public void initializeGame(string level) { loadPercentage = 0; if (!loadedGameContent) { TextureManager.initialize(this); loadPercentage = 0.1f; ModelLibrary.initialize(this); loadPercentage = 0.2f; loadPercentage = 0.25f; loadedGameContent = true; } modelManager = new ModelManager(this); ship = new Ship(this); core = new BaseCore(this); camera = new Camera(this, new Vector3(40, 150, 10), Vector3.Zero, Vector3.Up); turretManager = new TurretManager(this); asteroidManager = new AsteroidManager(this); enemyManager = new EnemyManager(this); waveManager = new WaveManager(this); hud = new Hud(this, Content.Load<SpriteFont>(@"Hud/Venera40"), spriteBatch, GraphicsDevice); minigame = new Minigame(this); levelStats = new StatTracker(); loadPercentage = 0.65f; levelFileName = "dends"; //levelFileName = "map1-revis"; //levelFileName = "pac-man"; layout = new MapData(level); //layout = new MapData(@"Content/MapXml/Level2.xml"); //layout = new MapData(@"Content/MapXml/pac-man.xml"); //layout = new MapData(@"Content/MapXml/broktes.xml"); map = new Map(this, layout.getNodes()); bloom = new BloomComponent(this); Components.Add(ship); Components.Add(camera); Components.Add(modelManager); Components.Add(enemyManager); Components.Add(waveManager); Components.Add(core); Components.Add(turretManager); Components.Add(asteroidManager); Components.Add(minigame); //make sure the post process effects go second last, and the hud is absolute last //Components.Add(bloom); Components.Add(hud); loadPercentage = 1f; modelManager.makeStarField(); turretManager.Initialize(); //Debugging stuff for A* shortestPath = new Pathfinder(map); turretAvoid = new PathfinderTurretAvoid(map); System.Diagnostics.Debug.WriteLine("A new map has been loaded, our pathfinding algorithm is now finding the shortest path from each enemy spawn to the core"); List<Vector2> spawns = map.getEnemySpawn(); System.Diagnostics.Debug.WriteLine("There are " + spawns.Count() + " enemy spawn point(s) in this map"); int count = 1; foreach(Vector2 spawn in spawns) { List<Vector2> path = shortestPath.findPath(new Point((int)spawn.X, (int)spawn.Y), new Point((int)map.getCoreLocation().X, (int)map.getCoreLocation().Y)); System.Diagnostics.Debug.WriteLine("The path from spawn " + count + " is as follows:"); foreach(Vector2 nodePos in path) { System.Diagnostics.Debug.WriteLine(nodePos); } count++; } justLoadedContent = true; }
public override void Draw(GraphicsDevice device, Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (mesh.Name.Equals("anten") || mesh.Name.Equals("glowBall")) effect.World = Matrix.CreateRotationY(visorRot) * Matrix.CreateTranslation(-shakeOffset*0.8f) * Matrix.CreateTranslation(ant.Transform.Translation - topCap.Transform.Translation) * Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * 0.1f) * Matrix.CreateTranslation(topOffset) * topCap.Transform * GetWorld(); else if (mesh.Name.Equals("topCap")) effect.World = Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * 0.1f) * Matrix.CreateTranslation(-shakeOffset) * Matrix.CreateTranslation(topOffset) * topCap.Transform * GetWorld(); else if(mesh.Name.Equals("visor") || mesh.Name.Equals("eyeRound")) effect.World = Matrix.CreateScale(1, 1 + topOffset.Y / 3, 1) * Matrix.CreateRotationY(visorRot) * Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * 0.05f) * Matrix.CreateTranslation(topOffset * 0.5f) * Matrix.CreateTranslation(-shakeOffset * 0) * visor.Transform * GetWorld(); else if (mesh.Name.Equals("midCap")) effect.World = Matrix.CreateTranslation(shakeOffset*0.2f) * midCap.Transform * GetWorld(); else if (mesh.Name.Equals("cannonRound")) effect.World = Matrix.CreateScale(1, 1 + topOffset.Y / 6, 1) * Matrix.CreateRotationY(cannonRot) * Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * -0.05f) * Matrix.CreateTranslation(-topOffset * 0.25f) * canRot.Transform * GetWorld(); else if (mesh.Name.Equals("cannon") || mesh.Name.Equals("glowCannon")) effect.World = Matrix.CreateRotationY(cannonRot) * Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * -0.05f) * Matrix.CreateTranslation(-topOffset * 0.25f) * cannon.Transform * GetWorld(); else//botcap effect.World = Matrix.CreateFromAxisAngle(Vector3.Cross(shakeDir, Vector3.Up), shakeAmount * -0.1f) * Matrix.CreateTranslation(-shakeOffset) * Matrix.CreateTranslation(-topOffset* 0.5f) * botCap.Transform * GetWorld(); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Alpha = 1; effect.LightingEnabled = true; if (mesh.Name.Contains("visor")) effect.Texture = visorTex; else effect.Texture = bodyTex; if(mesh.Name.Contains("glow") || mesh.Name.Contains("visor")) { effect.AmbientLightColor = Vector3.One; effect.EmissiveColor = new Vector3(0.5f); } else { effect.DirectionalLight0.DiffuseColor = new Vector3(0.2f, 0.2f, 0.2f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = new Vector3(0, -1, 1); effect.AmbientLightColor = new Vector3(0.7f, 0.7f, 0.7f); effect.SpecularColor = new Vector3(0.3f); effect.EmissiveColor = new Vector3(.4f, .4f, .4f); /* 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.5f, 0.5f, 0.5f); effect.EmissiveColor = new Vector3(0.3f, 0.3f, 0.3f);*/ } effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override void Draw(GraphicsDevice device, Camera camera) { game.GraphicsDevice.DepthStencilState = depthStencilState; if (ship.finishingMove) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); //game.GraphicsDevice.BlendState = BlendState.Additive; 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 = (Texture2D)rTarg; effect.Alpha = 1; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; //effect.DirectionalLight0.DiffuseColor = new Vector3(0.6f, 0.5f, 0.6f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = direction; //effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(2f, 2f, 2f); //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } transforms = new Matrix[endGlow.Bones.Count]; endGlow.CopyAbsoluteBoneTransformsTo(transforms); game.GraphicsDevice.BlendState = BlendState.Additive; foreach (ModelMesh mesh in endGlow.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = mesh.ParentBone.Transform * Matrix.CreateFromYawPitchRoll(rot.Y, rot.X, (float)Utilities.random.NextDouble()*MathHelper.Pi*2) * Matrix.CreateScale(0.5f) * Matrix.CreateTranslation(endGlowPos); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Texture = glow; effect.Alpha = 1; //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader //effect.EnableDefaultLighting(); //did not work effect.LightingEnabled = true; //effect.DirectionalLight0.DiffuseColor = new Vector3(0.6f, 0.5f, 0.6f); //RGB is treated as a vector3 with xyz being rgb - so vector3.one is white effect.DirectionalLight0.Direction = direction; //effect.DirectionalLight0.SpecularColor = Vector3.One; effect.AmbientLightColor = new Vector3(2f, 2f, 2f); //effect.EmissiveColor = Vector3.One; effect.PreferPerPixelLighting = true; } mesh.Draw(); } } game.GraphicsDevice.BlendState = BlendState.Opaque; }