public Enemy() { string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; model = new md2LOL(projectPath + "\\ModelFiles\\zombie.md2"); Initialize(); }
public Player() { string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; model = new md2LOL(projectPath + "\\ModelFiles\\zombie.md2"); mySound = new SoundPlayer(projectPath + "\\Sounds\\fire.wav"); Initialize(); }
public Enemy(string path) { health = 5; AngleX = AngleY = 0; attack_animation = false; stand_animation = true; run_animation = false; this.model = new md2LOL(path); isDead = false; }
public void Initialize() { string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; sh = new Shader(projectPath + "\\Shaders\\SimpleVertexShader.vertexshader", projectPath + "\\Shaders\\SimpleFragmentShader.fragmentshader"); //tex1 = new Texture(projectPath + "\\Textures\\grass_mix_d.jpg", 2); tex1 = new Texture(projectPath + "\\Textures\\ground_cracks2v_d.jpg", 2); tex = new Texture(projectPath + "\\Textures\\crate.jpg", 3); textri2 = new Texture(projectPath + "\\Textures\\crate.jpg", 4); //m = new md2LOL(projectPath + "\\ModelFiles\\animated\\md2LOL\\fiora.md2"); //bytl3 ghreb!!!!!!!!!! m = new md2LOL(projectPath + "\\ModelFiles\\zombie.md2"); m.StartAnimation(animType_LOL.STAND); m.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); m.scaleMatrix = glm.scale(new mat4(1), new vec3(0.8f, 0.8f, 0.8f)); m.TranslationMatrix = glm.translate(new mat4(1), new vec3(15, 1, 20)); // enemy2 = new md2LOL(projectPath + "\\ModelFiles\\animated\\md2LOL\\zombie1.md2"); enemy2 = new md2LOL(projectPath + "\\ModelFiles\\zombie.md2"); enemy2.StartAnimation(animType_LOL.STAND); enemy2.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); enemy2.scaleMatrix = glm.scale(new mat4(1), new vec3(0.8f, 0.8f, 0.8f)); enemy2.TranslationMatrix = glm.translate(new mat4(1), new vec3(30, 1, 20)); //building PROBLEM HERE building = new Model3D(); building.LoadFile(projectPath + "\\ModelFiles\\static\\building", 5, "Building 02.obj"); building.scalematrix = glm.scale(new mat4(1), new vec3(20, 20, 30)); building.transmatrix = glm.translate(new mat4(1), new vec3(200, 40, -300)); //tree tree = new Model3D(); tree.LoadFile(projectPath + "\\ModelFiles\\static\\tree", 6, "Tree.obj"); tree.scalematrix = glm.scale(new mat4(1), new vec3(5f, 10f, 5f)); tree.transmatrix = glm.translate(new mat4(1), new vec3(-70, 10, 1)); //spider spider = new Model3D(); spider.LoadFile(projectPath + "\\ModelFiles\\static\\spider", 7, "spider.obj"); spider.scalematrix = glm.scale(new mat4(1), new vec3(0.099f, 0.099f, 0.099f)); spider.transmatrix = glm.translate(new mat4(1), new vec3(-70, 2, 1)); //jeep jeep = new Model3D(); jeep.LoadFile(projectPath + "\\ModelFiles\\static\\car", 8, "dpv.obj"); jeep.scalematrix = glm.scale(new mat4(1), new vec3(0.1f, 0.1f, 0.1f)); jeep.transmatrix = glm.translate(new mat4(1), new vec3(-50, 5, 1)); jeep.rotmatrix = glm.rotate((float)((1 / 180) * Math.PI), new vec3(1, 0, 0)); //house house = new Model3D(); house.LoadFile(projectPath + "\\ModelFiles\\static\\house", 9, "house.obj"); house.scalematrix = glm.scale(new mat4(1), new vec3(9, 9, 9)); house.transmatrix = glm.translate(new mat4(1), new vec3(-60, 10, -45)); // skybox Downtex = new Texture(projectPath + "\\Textures\\nottingham_dn.jpg", 2); //ground Uptex = new Texture(projectPath + "\\Textures\\nottingham_up.jpg", 3); //up Fronttex = new Texture(projectPath + "\\Textures\\nottingham_ft.jpg", 4); //front Righttex = new Texture(projectPath + "\\Textures\\nottingham_rt.jpg", 5); //right Backtex = new Texture(projectPath + "\\Textures\\nottingham_bk.jpg", 6); ///back Lefttex = new Texture(projectPath + "\\Textures\\nottingham_lf.jpg", 7); //left //define normal for each vertex float[] ground = { -10.0f, 0.0f, 10.0f, 0, 0, 1, 0, 1, 0, 1, 0, 10.0f, 0.0f, -10.0f, 0, 0, 1, 1, 0, 0, 1, 0, -10.0f, 0.0f, -10.0f, 0, 0, 1, 0, 0, 0, 1, 0, 10.0f, 0.0f, 10.0f, 0, 0, 1, 1, 1, 0, 1, 0, -10.0f, 0.0f, 10.0f, 0, 0, 1, 0, 1, 0, 1, 0, 10.0f, 0.0f, -10.0f, 0, 0, 1, 1, 0, 0, 1, 0, }; vertexBufferID = GPU.GenerateBuffer(ground); //skybox Gl.glClearColor(1.0f, 1.0f, 1.0f, 1); float[] myCube = { //ground -10.0f, -1.0f,-10.0f, //0 1, 0, 0, 0, 1, 0, -10.0f, -1.0f,10.0f, //1 1, 0, 0, 0, 1, 0, 10.0f, -1.0f,10.0f,//2 1, 0, 0, 0, 1, 0, 10.0f, -1.0f,-10.0f,//3 1, 0, 0, 0, 1, 0, //roof -10.0f, 9.0f,-10.0f,//4 1, 0, 0, 0, 1, 0, -10.0f, 9.0f,10.0f,//10 1, 0, 0, 0, 1, 0, 10.0f, 9.0f,10.0f,//6 1, 0, 0, 0, 1, 0, 10.0f, 9.0f,-10.0f,//7 1, 0, 0, 0, 1, 0, //back -10.0f, -1.0f,-10.0f, //8 1, 0, 0, 0, 1, 0, -10.0f, 9.0f,-10.0f,//10 1, 0, 0, 0, 1, 0, //normal 10.0f, 9.0f,-10.0f,//9 1, 0, 0, 0, 1, 0, 10.0f, -1.0f,-10.0f,//11 1, 0, 0, 0, 1, 0, //right 10.0f, -1.0f,-10.0f,//12 1, 0, 0, 0, 1, 0, 10.0f, 9.0f,-10.0f,//14 1, 0, 0, 0, 1, 0, 10.0f, 9.0f,10.0f,//13 1, 0, 0, 0, 1, 0, 10.0f, -1.0f,10.0f,//110 1, 0, 0, 0, 1, 0, //front -10.0f, -1.0f,10.0f, //8 1, 0, 0, 0, 1, 0, 10.0f, -1.0f,10.0f,//11 1, 0, 0, 0, 1, 0, 10.0f, 9.0f,10.0f,//10 1, 0, 0, 0, 1, 0, -10.0f, 9.0f,10.0f,//9 1, 0, 0, 0, 1, 0, //left -10.0f, -1.0f,-10.0f, //20 1, 0, 0, 0, 1, 0, -10.0f, -1.0f,10.0f,//23 1, 0, 0, 0, 1, 0, -10.0f, 9.0f,10.0f,//21 1, 0, 0, 0, 1, 0, -10.0f, 9.0f,-10.0f,//22 1, 0, 0, 0, 1, 0, }; float[] CubeCoord = { //down 1, 0, 0, 0, 0, 1, 1, 1, /////22222 up 0, 0, 1, 0, 1, 1, 0, 1, /////333333 BACK 0, 1, 0, 0, 1, 0, 1, 1, /////444444 right 0, 1, 0, 0, 1, 0, 1, 1, /////555555 front 1, 1, 0, 1, 0, 0, 1, 0, /////66666 left 1, 1, 0, 1, 0, 0, 1, 0, }; SkyboxBufferID = GPU.GenerateBuffer(myCube); cubeCoordID = GPU.GenerateBuffer(CubeCoord); //triangle float[] TrianleCoord = { 0, 0, 1, 1, 0, 1, }; float[] triangle = { -1.0f, -1.0f, 0.0f, 0, 0, 0, 1.0f, -1.0f, 0.0f, 0, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0, }; vertexBufferID2 = GPU.GenerateBuffer(triangle); TriangleCoordID = GPU.GenerateBuffer(TrianleCoord); //2nd triangle //triangle float[] TrianleCoord2 = { 0, 0, 1, 1, 0, 1, }; float[] triangle2 = { -1.0f, -1.0f, 0.0f, 0, 0, 0, 1.0f, -1.0f, 0.0f, 0, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0, }; vertexBuffer2ID2 = GPU.GenerateBuffer(triangle2); TriangleCoord2ID = GPU.GenerateBuffer(TrianleCoord2); Gl.glClearColor(0, 0, 0.4f, 1); cam = new Camera(); cam.Reset(0, 34, 100, 0, 0, 0, 0, 1, 0); ProjectionMatrix = cam.GetProjectionMatrix(); ViewMatrix = cam.GetViewMatrix(); transID = Gl.glGetUniformLocation(sh.ID, "trans"); //7ala m7l l model kman fl vertex shader projID = Gl.glGetUniformLocation(sh.ID, "projection"); viewID = Gl.glGetUniformLocation(sh.ID, "view"); //modelID = Gl.glGetUniformLocation(sh.ID, "model"); modelmatrix = glm.scale(new mat4(1), new vec3(50, 50, 50)) * glm.translate(new mat4(1), new vec3(1, 1, 1)); //here! zombies // modelmatrix2 = glm.scale(new mat4(1), new vec3(15,15,15)) * glm.translate(new mat4(1), new vec3(80, 100, -100)); //wooden triangle1 sh.UseShader(); //get location of specular and attenuation then send their values //get location of light position and send its value //setup the ambient light component. //setup the eye position. camposID = Gl.glGetUniformLocation(sh.ID, "campos"); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glDepthFunc(Gl.GL_LESS); }
public void Initialize() { string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; sh = new Shader(projectPath + "\\Shaders\\SimpleVertexShader.vertexshader", projectPath + "\\Shaders\\SimpleFragmentShader.fragmentshader"); d = new Texture(projectPath + "\\Textures\\skybox\\bottom.jpg", 1, true); u = new Texture(projectPath + "\\Textures\\skybox\\top.jpg", 2, true); l = new Texture(projectPath + "\\Textures\\skybox\\left.jpg", 3, true); r = new Texture(projectPath + "\\Textures\\skybox\\right.jpg", 4, true); f = new Texture(projectPath + "\\Textures\\skybox\\front.jpg", 5, true); b = new Texture(projectPath + "\\Textures\\skybox\\back.jpg", 6, true); groundTexture = new Texture(projectPath + "\\Textures\\ground.jpg", 7, true); shoot = new Texture(projectPath + "\\Textures\\gunshot.png", 8, true); cam = new Camera(); cam.Reset(0, 34, 55, 0, 0, 0, 0, 1, 0); float[] square = { -1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, -1, 0, -1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, -1, 0, -1, 1, 0, 0, 0, 1, 1, 0, -1, 1, 0, 0, 1, 1 }; skyboxBuffer_ID = GPU.GenerateBuffer(square); up = MathHelper.MultiplyMatrices(new List <mat4> { glm.rotate(3.1412f, new vec3(1, 0, 0)), glm.translate(new mat4(1), new vec3(0, 1, 0)) }); down = glm.translate(new mat4(1), new vec3(0, -1, 0)); // Dclare Matrices For transformation edges front = MathHelper.MultiplyMatrices(new List <mat4> { glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.translate(new mat4(1), new vec3(0, 0, -1)) }); left = MathHelper.MultiplyMatrices(new List <mat4> { glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(-1, 0, 0)) }); back = MathHelper.MultiplyMatrices(new List <mat4> { glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.rotate(3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(0, 0, 1)) }); right = MathHelper.MultiplyMatrices(new List <mat4> { glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.rotate(-90.0f / 180.0f * 3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(1, 0, 0)) }); ground = MathHelper.MultiplyMatrices(new List <mat4> { glm.scale(new mat4(1), new vec3(6000, 6000, 6000)), glm.translate(new mat4(1), new vec3(0, -45, 0)) }); building = new Model3D(); building.LoadFile(projectPath + "\\ModelFiles\\static\\building", 1, "Building 02.obj"); building.scalematrix = glm.scale(new mat4(1), new vec3(30, 30, 30)); building.transmatrix = glm.translate(new mat4(1), new vec3(1, 1, 1)); car = new Model3D(); car.LoadFile(projectPath + "\\ModelFiles\\static\\car", 3, "dpv.obj"); car.scalematrix = glm.scale(new mat4(1), new vec3(0.15f, 0.25f, 0.15f)); car.transmatrix = glm.translate(new mat4(1), new vec3(-150, -45.0f, 0.5f)); car.rotmatrix = glm.rotate(3.1412f, new vec3(0, 1, 0)); tree = new Model3D(); tree.LoadFile(projectPath + "\\ModelFiles\\static\\tree", 2, "Tree.obj"); tree.scalematrix = glm.scale(new mat4(1), new vec3(50, 50, 50)); tree.transmatrix = glm.translate(new mat4(1), new vec3(-240, -45.0f, 0.5f)); tree.rotmatrix = glm.rotate(3.1412f, new vec3(0, 1, 0)); Blade = new md2(projectPath + "\\ModelFiles\\animated\\md2\\blade\\Blade.md2"); Blade.StartAnimation(animType.STAND); Blade.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); Blade.scaleMatrix = glm.scale(new mat4(1), new vec3(0.8f, 0.8f, 0.8f)); Blade.TranslationMatrix = glm.translate(new mat4(1), new vec3(20, 19, -20)); zombie = new md2LOL(projectPath + "\\ModelFiles\\animated\\md2LOL\\zombie.md2"); zombie.StartAnimation(animType_LOL.STAND); zombie.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); zombie.scaleMatrix = glm.scale(new mat4(1), new vec3(0.8f, 0.8f, 0.8f)); spider = new Model3D(); spider.LoadFile(projectPath + "\\ModelFiles\\static\\spider", 4, "spider.obj"); spider.transmatrix = glm.translate(new mat4(1), new vec3(240, 0.0f, 0)); spider.rotmatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(0, 1, 0)); HandsWGun = new Model3D(); HandsWGun.LoadFile(projectPath + "\\ModelFiles\\hands with gun", 8, "gun.obj"); HandsWGun.scalematrix = glm.scale(new mat4(1), new vec3(0.2f, 0.2f, 0.2f)); bulletModel = new Model3D(); bulletModel.LoadFile(projectPath + "\\ModelFiles\\static\\bullet", 8, "bullet.obj"); sh.UseShader(); Gl.glClearColor(0, 0, 0.4f, 1); ProjectionMatrix = cam.GetProjectionMatrix(); ViewMatrix = cam.GetViewMatrix(); modelID = Gl.glGetUniformLocation(sh.ID, "model"); projID = Gl.glGetUniformLocation(sh.ID, "projection"); viewID = Gl.glGetUniformLocation(sh.ID, "view"); sh.UseShader(); c = timer; }
public void Initialize() { string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; sh = new Shader(projectPath + "\\Shaders\\SimpleVertexShader.vertexshader", projectPath + "\\Shaders\\SimpleFragmentShader.fragmentshader"); tex = new Texture(projectPath + "\\Textures\\crate.jpg", 0); down = new Texture(projectPath + "\\Textures\\down.jpg", 1); right = new Texture(projectPath + "\\Textures\\right.jpg", 2); left = new Texture(projectPath + "\\Textures\\left.jpg", 3); up = new Texture(projectPath + "\\Textures\\up.jpg", 4); front = new Texture(projectPath + "\\Textures\\front.jpg", 5); back = new Texture(projectPath + "\\Textures\\back.jpg", 6); tex1 = new Texture(projectPath + "\\Textures\\Ground.jpg", 2); m = new md2LOL(projectPath + "\\ModelFiles\\zombie.md2"); m.StartAnimation(animType_LOL.RUN); m.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); m.scaleMatrix = glm.scale(new mat4(1), new vec3(0.0093f, 0.0093f, 0.0093f)); m.TranslationMatrix = glm.translate(new mat4(1), new vec3(0, -2, 5)); ////define normal for each vertex m2 = new md2LOL(projectPath + "\\ModelFiles\\wolf.md2"); m2.StartAnimation(animType_LOL.ATTACK1); m2.rotationMatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); m2.scaleMatrix = glm.scale(new mat4(1), new vec3(0.008f, 0.008f, 0.008f)); m2.TranslationMatrix = glm.translate(new mat4(1), new vec3(-2, -2, 5)); Gl.glClearColor(0, 0, 0, 1); float ground = 1; float[] skybox = { -ground, -ground, -ground, 0, 0, ground, -ground, -ground, 1, 0, ground, ground, -ground, 1, 1, -ground, -ground, -ground, 0, 0, -ground, ground, -ground, 0, 1, ground, ground, -ground, 1, 1 }; float[] verts = { -1.0f, -1.0f, 0.0f, 0, 0, 1.0f, -1.0f, 0.0f, 1, 0, 0.0f, 1.0f, 0.0f, 0.5f, 1 }; vertexBufferID = GPU.GenerateBuffer(skybox); vertexBufferID2 = GPU.GenerateBuffer(verts); scaleMat = glm.scale(new mat4(1), new vec3(200f, 200f, 200f)); cam = new Camera(); ProjectionMatrix = cam.GetProjectionMatrix(); ViewMatrix = cam.GetViewMatrix(); transID = Gl.glGetUniformLocation(sh.ID, "model"); projID = Gl.glGetUniformLocation(sh.ID, "projection"); viewID = Gl.glGetUniformLocation(sh.ID, "view"); leftmatrix = MathHelper.MultiplyMatrices(new List <mat4>() { glm.rotate(90.0f / 180.0f * 3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(0, 0, 0)), scaleMat }); rightmatrix = MathHelper.MultiplyMatrices(new List <mat4>() { glm.rotate(270f / 180.0f * 3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(0, 0, 0)), scaleMat }); upmatrix = MathHelper.MultiplyMatrices(new List <mat4>() { glm.rotate(90 / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.translate(new mat4(1), new vec3(0, 0, 0)), scaleMat }); backmatrix = MathHelper.MultiplyMatrices(new List <mat4>() { glm.rotate(180f / 180f * 3.1412f, new vec3(0, 1, 0)), glm.translate(new mat4(1), new vec3(0, 0, 0)), scaleMat }); groundmatrix = MathHelper.MultiplyMatrices(new List <mat4>() { glm.rotate(90f / 180.0f * 3.1412f, new vec3(1, 0, 0)), glm.translate(new mat4(1), new vec3(0, -2, 0)), scaleMat }); //Gl.glClearColor(0, 0, 0.4f, 1); //cam = new Camera(); cam.Reset(0, -1.75f, 0, 0, 0, 0, 0, 0, 0); ProjectionMatrix = cam.GetProjectionMatrix(); ViewMatrix = cam.GetViewMatrix(); modelmatrix = glm.scale(new mat4(1), new vec3(50, 50, 50)); tree = new Model3D(); tree.LoadFile(projectPath + "\\ModelFiles\\tree", 6, "Tree.obj"); tree.scalematrix = glm.scale(new mat4(1), new vec3(0.1f, 0.1f, 0.1f)); tree.transmatrix = glm.translate(new mat4(1), new vec3(0.6f, -2, 0.4f)); //tree2 = new Model3D(); //tree2.LoadFile(projectPath + "\\ModelFiles\\Tree1", 6, "Tree1.obj"); //tree2.scalematrix = glm.scale(new mat4(1), new vec3(30, 30, 30)); treee3 = new Model3D(); treee3.LoadFile(projectPath + "\\ModelFiles\\Wolf Rigged and Game Ready", 6, "Wolf.fbx"); treee3.scalematrix = glm.scale(new mat4(1), new vec3(0.1f, 0.1f, 0.1f)); treee3.transmatrix = glm.translate(new mat4(1), new vec3(-0.6f, -2, 0.4f)); treee3.rotmatrix = glm.rotate((float)((-180.0f / 180) * Math.PI), new vec3(1, 0, 0)); //car = new Model3D(); //car.LoadFile(projectPath + "\\ModelFiles\\car", 6, "dpv.obj"); //car.scalematrix = glm.scale(new mat4(1), new vec3(15, 1, 15)); cottage = new Model3D(); cottage.LoadFile(projectPath + "\\ModelFiles\\House", 6, "house.obj"); cottage.scalematrix = glm.scale(new mat4(1), new vec3(0.1f, 0.1f, 0.1f)); cottage.transmatrix = glm.translate(new mat4(1), new vec3(-0.6f, -2f, 0.4f)); jeep = new Model3D(); jeep.LoadFile(projectPath + "\\ModelFiles\\jeep", 9, "jeep1.3ds"); jeep.scalematrix = glm.scale(new mat4(1), new vec3(0.05f, 0.05f, 0.05f)); jeep.transmatrix = glm.translate(new mat4(1), new vec3(1f, -2f, 1f)); jeep.rotmatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); //jeep2 = new Model3D(); //jeep2.LoadFile(projectPath + "\\ModelFiles\\jeep", 10, "jeep1.3ds"); //jeep2.scalematrix = glm.scale(new mat4(1), new vec3(5, 5, 5)); //jeep2.transmatrix = glm.translate(new mat4(1), new vec3(-80, 1, 180)); //jeep2.rotmatrix = glm.rotate((float)((-90.0f / 180) * Math.PI), new vec3(1, 0, 0)); //get location of specular and attenuation then send their values //get location of light position and send its value //setup the ambient light component. //setup the eye position. Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glDepthFunc(Gl.GL_LESS); }