public void Draw(FreeCamera camera, GraphicsDevice gd, int cam_z) { be.View = camera.View; be.Projection = camera.Projection; float tsper = 1/(Commons.TextureAtlas.X/(Commons.TextureAtlasTexSize)); float tsperh = 1/(Commons.TextureAtlas.Y/(Commons.TextureAtlasTexSize)); RasterizerState last = gd.RasterizerState; gd.RasterizerState = new RasterizerState {CullMode = CullMode.None}; foreach (EffectPass pass in be.CurrentTechnique.Passes) { pass.Apply(); foreach (LocalUnit lh in N) { if (lh.Pos.Z >= cam_z - 1) { float umovx = (Main.dbcreatures.Data[lh.ID].MetatexN%(Commons.TextureAtlasWCount*2))*tsper; float umovy = (Main.dbcreatures.Data[lh.ID].MetatexN/(Commons.TextureAtlasWCount*2))*tsperh; verts[0].TextureCoordinate = new Vector2(0 + umovx, 0 + umovy); verts[1].TextureCoordinate = new Vector2(tsper + umovx, 0 + umovy); verts[2].TextureCoordinate = new Vector2(0 + umovx, tsperh + umovy); verts[3].TextureCoordinate = new Vector2(0 + umovx, tsperh + umovy); verts[4].TextureCoordinate = new Vector2(tsper + umovx, 0 + umovy); verts[5].TextureCoordinate = new Vector2(tsper + umovx, tsperh + umovy); verts[0].Position = new Vector3(lh.Pos.X, lh.Pos.Y, -lh.Pos.Z); verts[1].Position = new Vector3(lh.Pos.X + 1, lh.Pos.Y, -lh.Pos.Z); verts[2].Position = new Vector3(lh.Pos.X, lh.Pos.Y, -lh.Pos.Z - 1); verts[3].Position = new Vector3(lh.Pos.X, lh.Pos.Y, -lh.Pos.Z - 1); verts[4].Position = new Vector3(lh.Pos.X + 1, lh.Pos.Y, -lh.Pos.Z); verts[5].Position = new Vector3(lh.Pos.X + 1, lh.Pos.Y, -lh.Pos.Z - 1); gd.DrawUserPrimitives(PrimitiveType.TriangleList, verts, 0, 2); } } } gd.RasterizerState = last; }
public void AsyRAMG(int z_cam, FreeCamera Camera) { }
protected override void Initialize() { base.Initialize(); Assembly currentAssembly = Assembly.Load("Mork"); OurName = AssemblyName.GetAssemblyName(currentAssembly.Location).Name; OurVer = "v" + AssemblyName.GetAssemblyName(currentAssembly.Location).Version; graphics.IsFullScreen = false; //true graphics.PreferredBackBufferHeight = resy; graphics.PreferredBackBufferWidth = resx; graphics.SynchronizeWithVerticalRetrace = false; IsFixedTimeStep = false; IsMouseVisible = true; graphics.ApplyChanges(); Camera = new FreeCamera(new Vector3(100, 100, 500), MathHelper.ToRadians(45), MathHelper.ToRadians(45), GraphicsDevice) {Target = new Vector3(100, 100, 0)}; Directory.CreateDirectory(@"Maps"); Directory.CreateDirectory(@"Data"); Directory.CreateDirectory(@"Data/Levels"); Window.Title = OurName + " " + OurVer; asynccore = AsyncCore; DrawProc = MainMenuDraw; CalcProc = () => { }; }