public byte GetClosetPlayer( LocalPlayer localP ) { Vector3 eyePos = localP.EyePosition; Vector3 dir = Utils.GetDirVector( localP.YawRadians, localP.PitchRadians ); float closestDist = float.PositiveInfinity; byte targetId = 255; for( int i = 0; i < Players.Length - 1; i++ ) { // -1 because we don't want to pick against local player Player p = Players[i]; if( p == null ) continue; float t0, t1; if( Intersection.RayIntersectsRotatedBox( eyePos, dir, p, out t0, out t1 ) && t0 < closestDist ) { closestDist = t0; targetId = (byte)i; } } return targetId; }
void HandleCpeHackControl() { LocalPlayer p = game.LocalPlayer; p.Hacks.CanFly = reader.ReadUInt8() != 0; p.Hacks.CanNoclip = reader.ReadUInt8() != 0; p.Hacks.CanSpeed = reader.ReadUInt8() != 0; p.Hacks.CanRespawn = reader.ReadUInt8() != 0; p.Hacks.CanUseThirdPersonCamera = reader.ReadUInt8() != 0; p.CheckHacksConsistency(); float jumpHeight = reader.ReadInt16() / 32f; if (jumpHeight < 0) { p.jumpVel = 0.42f; } else { p.CalculateJumpVelocity(jumpHeight); } p.serverJumpVel = p.jumpVel; game.Events.RaiseHackPermissionsChanged(); }
public PerspectiveCamera(Game game) { this.game = game; player = game.LocalPlayer; tiltM = Matrix4.Identity; }
public PerspectiveCamera( Game game ) { this.game = game; player = game.LocalPlayer; tiltMatrix = Matrix4.Identity; }
public PerspectiveCamera( Game game ) { this.game = game; player = game.LocalPlayer; }
protected override void OnLoad( EventArgs e ) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api( this ); #endif try { Options.Load(); } catch( IOException ) { Utils.LogWarning( "Unable to load options.txt" ); } ViewDistance = Options.GetInt( "viewdist", 16, 8192, 512 ); Keys = new KeyMap(); InputHandler = new InputHandler( this ); Chat = new ChatLog( this ); Drawer2D = new GdiPlusDrawer2D( Graphics ); defaultIb = Graphics.MakeDefaultIb(); ModelCache = new ModelCache( this ); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader( skinServer ); Graphics.PrintGraphicsInfo(); TerrainAtlas1D = new TerrainAtlas1D( Graphics ); TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D ); Animations = new Animations( this ); TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract( defaultTexPack, this ); Inventory = new Inventory( this ); BlockInfo = new BlockInfo(); BlockInfo.Init(); BlockInfo.SetDefaultBlockPermissions( Inventory.CanPlace, Inventory.CanDelete ); Map = new Map( this ); LocalPlayer = new LocalPlayer( this ); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer( this ); MapEnvRenderer = new MapEnvRenderer( this ); EnvRenderer = new StandardEnvRenderer( this ); if( IPAddress == null ) { Network = new Singleplayer.SinglePlayerServer( this ); } else { Network = new NetworkProcessor( this ); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera( this ); thirdPersonCam = new ThirdPersonCamera( this ); Camera = firstPersonCam; CommandManager = new CommandManager(); CommandManager.Init( this ); SelectionManager = new SelectionManager( this ); ParticleManager = new ParticleManager( this ); WeatherRenderer = new WeatherRenderer( this ); WeatherRenderer.Init(); Graphics.SetVSync( this, true ); Graphics.DepthTest = true; Graphics.DepthTestFunc( CompareFunc.LessEqual ); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha ); Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f ); Title = Utils.AppName; fpsScreen = new FpsScreen( this ); fpsScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapEnvRenderer.Init(); Picking = new PickingRenderer( this ); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; SetNewScreen( new LoadingMapScreen( this, connectString, "Reticulating splines" ) ); Network.Connect( IPAddress, Port ); }
internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); bool visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (visible) { World.ChunkHandler.UpdateCurChunk(); } Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += delta; Vertices = 0; Mode.BeginFrame(delta); Graphics.UpdateLightsEntity(); Camera.UpdateMouse(); if (!Focused && !Gui.ActiveScreen.HandlesAllInput) { Gui.SetNewScreen(new PauseScreen(this)); } CheckZoomFov(); DoScheduledTasks(delta); float t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer.SetInterpPosition(t); if (!SkipClear) { Graphics.Clear(); } CurrentCameraPos = Camera.GetCameraPos(t); UpdateViewMatrix(); visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (!World.HasBlocks) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } Gui.Render(delta); if (screenshotRequested) { TakeScreenshot(); } Mode.EndFrame(delta); Graphics.EndFrame(this); LimitFPS(); }
internal void OnLoad() { #if ANDROID Graphics = new OpenGLESApi(); #elif !USE_DX Graphics = new OpenGLApi(window); #else Graphics = new Direct3D9Api(window); #endif Graphics.MakeApiInfo(); ErrorHandler.ExtraInfo = Graphics.ApiInfo; #if ANDROID Drawer2D = new CanvasDrawer2D(Graphics); #else Drawer2D = new GdiPlusDrawer2D(Graphics); #endif UpdateClientSize(); Entities = new EntityList(this); TextureCache.Init(); #if SURVIVAL_TEST if (Options.GetBool(OptionsKey.SurvivalMode, false)) { Mode = new SurvivalGameMode(); } else { Mode = new CreativeGameMode(); } #endif Input = new InputHandler(this); ParticleManager = new ParticleManager(); Components.Add(ParticleManager); TabList = new TabList(); Components.Add(TabList); LoadOptions(); LoadGuiOptions(); Chat = new Chat(); Components.Add(Chat); Events.OnNewMap += OnNewMapCore; Events.OnNewMapLoaded += OnNewMapLoadedCore; Events.TextureChanged += TextureChangedCore; Events.LowVRAMDetected += OnLowVRAMDetected; BlockInfo.Allocate(256); BlockInfo.Init(); ModelCache = new ModelCache(this); ModelCache.InitCache(); Downloader = new AsyncDownloader(Drawer2D); Components.Add(Downloader); Lighting = new BasicLighting(); Components.Add(Lighting); Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.UseChatFont, false); Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackText, false); Graphics.Mipmaps = Options.GetBool(OptionsKey.Mipmaps, false); Atlas1D.game = this; Atlas2D.game = this; Animations = new Animations(); Components.Add(Animations); Inventory = new Inventory(); Components.Add(Inventory); Inventory.Map = new BlockID[BlockInfo.Count]; BlockInfo.SetDefaultPerms(); World = new World(this); LocalPlayer = new LocalPlayer(this); Components.Add(LocalPlayer); Entities.List[EntityList.SelfID] = LocalPlayer; MapRenderer = new MapRenderer(this); ChunkUpdater = new ChunkUpdater(this); EnvRenderer = new EnvRenderer(); Components.Add(EnvRenderer); MapBordersRenderer = new MapBordersRenderer(); Components.Add(MapBordersRenderer); string renType = Options.Get(OptionsKey.RenderType, "normal"); int flags = CalcRenderType(renType); if (flags == -1) { flags = 0; } MapBordersRenderer.legacy = (flags & 1) != 0; EnvRenderer.legacy = (flags & 1) != 0; EnvRenderer.minimal = (flags & 2) != 0; if (IPAddress == null) { Server = new Singleplayer.SinglePlayerServer(this); } else { Server = new Network.NetworkProcessor(this); } Components.Add(Server); Graphics.LostContextFunction = Server.Tick; Cameras.Add(new FirstPersonCamera(this)); Cameras.Add(new ThirdPersonCamera(this, false)); Cameras.Add(new ThirdPersonCamera(this, true)); Camera = Cameras[0]; UpdateProjection(); Gui = new GuiInterface(this); Components.Add(Gui); CommandList = new CommandList(); Components.Add(CommandList); SelectionManager = new SelectionManager(); Components.Add(SelectionManager); WeatherRenderer = new WeatherRenderer(); Components.Add(WeatherRenderer); HeldBlockRenderer = new HeldBlockRenderer(); Components.Add(HeldBlockRenderer); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); Culling = new FrustumCulling(); Picking = new PickedPosRenderer(); Components.Add(Picking); AudioPlayer = new AudioPlayer(); Components.Add(AudioPlayer); AxisLinesRenderer = new AxisLinesRenderer(); Components.Add(AxisLinesRenderer); SkyboxRenderer = new SkyboxRenderer(); Components.Add(SkyboxRenderer); List <string> nonLoaded = PluginLoader.LoadAll(this); for (int i = 0; i < Components.Count; i++) { Components[i].Init(this); } ExtractInitialTexturePack(); for (int i = 0; i < Components.Count; i++) { Components[i].Ready(this); } InitScheduledTasks(); if (nonLoaded != null) { for (int i = 0; i < nonLoaded.Count; i++) { Overlay warning = new PluginOverlay(this, nonLoaded[i]); Gui.ShowOverlay(warning, false); } } LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; if (Graphics.WarnIfNecessary(Chat)) { MapBordersRenderer.UseLegacyMode(true); EnvRenderer.UseLegacyMode(true); } Gui.SetNewScreen(new LoadingScreen(this, connectString, "")); Server.BeginConnect(); }
protected override void OnLoad( EventArgs e ) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api( this ); #endif Graphics.MakeGraphicsInfo(); Options.Load(); ViewDistance = Options.GetInt( OptionsKey.ViewDist, 16, 4096, 512 ); InputHandler = new InputHandler( this ); Chat = new ChatLog( this ); Chat.FontSize = Options.GetInt( OptionsKey.FontSize, 6, 30, 12 ); defaultIb = Graphics.MakeDefaultIb(); MouseSensitivity = Options.GetInt( OptionsKey.Sensitivity, 1, 100, 30 ); BlockInfo = new BlockInfo(); BlockInfo.Init(); ChatLines = Options.GetInt( OptionsKey.ChatLines, 1, 30, 12 ); ModelCache = new ModelCache( this ); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader( skinServer ); Drawer2D = new GdiPlusDrawer2D( Graphics ); Drawer2D.UseBitmappedChat = !Options.GetBool( OptionsKey.ArialChatFont, false ); TerrainAtlas1D = new TerrainAtlas1D( Graphics ); TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D ); Animations = new Animations( this ); TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract( defaultTexPack, this ); Inventory = new Inventory( this ); BlockInfo.SetDefaultBlockPermissions( Inventory.CanPlace, Inventory.CanDelete ); Map = new Map( this ); LocalPlayer = new LocalPlayer( this ); LocalPlayer.SpeedMultiplier = Options.GetInt( OptionsKey.Speed, 1, 50, 10 ); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer( this ); MapEnvRenderer = new MapEnvRenderer( this ); EnvRenderer = new StandardEnvRenderer( this ); if( IPAddress == null ) { Network = new Singleplayer.SinglePlayerServer( this ); } else { Network = new NetworkProcessor( this ); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera( this ); thirdPersonCam = new ThirdPersonCamera( this ); forwardThirdPersonCam = new ForwardThirdPersonCamera( this ); Camera = firstPersonCam; CommandManager = new CommandManager(); CommandManager.Init( this ); SelectionManager = new SelectionManager( this ); ParticleManager = new ParticleManager( this ); WeatherRenderer = new WeatherRenderer( this ); WeatherRenderer.Init(); bool vsync = Options.GetBool( OptionsKey.VSync, true ); Graphics.SetVSync( this, vsync ); Graphics.DepthTest = true; Graphics.DepthTestFunc( CompareFunc.LessEqual ); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha ); Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f ); fpsScreen = new FpsScreen( this ); fpsScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapEnvRenderer.Init(); Picking = new PickingRenderer( this ); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; Graphics.WarnIfNecessary( Chat ); SetNewScreen( new LoadingMapScreen( this, connectString, "Reticulating splines" ) ); Network.Connect( IPAddress, Port ); }
protected override void OnLoad(EventArgs e) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeGraphicsInfo(); Players = new EntityList(this); Options.Load(); AcceptedUrls.Load(); DeniedUrls.Load(); ViewDistance = Options.GetInt(OptionsKey.ViewDist, 16, 4096, 512); UserViewDistance = ViewDistance; CameraClipping = Options.GetBool(OptionsKey.CameraClipping, true); InputHandler = new InputHandler(this); Chat = new ChatLog(this); ParticleManager = new ParticleManager(this); HudScale = Options.GetFloat(OptionsKey.HudScale, 0.25f, 5f, 1f); ChatScale = Options.GetFloat(OptionsKey.ChatScale, 0.35f, 5f, 1f); defaultIb = Graphics.MakeDefaultIb(); MouseSensitivity = Options.GetInt(OptionsKey.Sensitivity, 1, 100, 30); UseClassicGui = Options.GetBool(OptionsKey.UseClassicGui, false); BlockInfo = new BlockInfo(); BlockInfo.Init(); ChatLines = Options.GetInt(OptionsKey.ChatLines, 1, 30, 12); ClickableChat = Options.GetBool(OptionsKey.ClickableChat, true); ModelCache = new ModelCache(this); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader(skinServer); Drawer2D = new GdiPlusDrawer2D(Graphics); Drawer2D.UseBitmappedChat = !Options.GetBool(OptionsKey.ArialChatFont, false); ViewBobbing = Options.GetBool(OptionsKey.ViewBobbing, false); ShowBlockInHand = Options.GetBool(OptionsKey.ShowBlockInHand, true); InvertMouse = Options.GetBool(OptionsKey.InvertMouse, false); SimpleArmsAnim = Options.GetBool(OptionsKey.SimpleArmsAnim, false); TerrainAtlas1D = new TerrainAtlas1D(Graphics); TerrainAtlas = new TerrainAtlas2D(Graphics, Drawer2D); Animations = new Animations(this); defTexturePack = Options.Get(OptionsKey.DefaultTexturePack) ?? "default.zip"; TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract("default.zip", this); // in case the user's default texture pack doesn't have all required textures if (defTexturePack != "default.zip") { extractor.Extract(DefaultTexturePack, this); } Inventory = new Inventory(this); BlockInfo.SetDefaultBlockPermissions(Inventory.CanPlace, Inventory.CanDelete); Map = new Map(this); LocalPlayer = new LocalPlayer(this); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer(this); MapBordersRenderer = new MapBordersRenderer(this); EnvRenderer = new StandardEnvRenderer(this); if (IPAddress == null) { Network = new Singleplayer.SinglePlayerServer(this); } else { Network = new NetworkProcessor(this); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera(this); thirdPersonCam = new ThirdPersonCamera(this); forwardThirdPersonCam = new ForwardThirdPersonCamera(this); Camera = firstPersonCam; FieldOfView = Options.GetInt(OptionsKey.FieldOfView, 1, 150, 70); ZoomFieldOfView = FieldOfView; UpdateProjection(); CommandManager = new CommandManager(); CommandManager.Init(this); SelectionManager = new SelectionManager(this); WeatherRenderer = new WeatherRenderer(this); WeatherRenderer.Init(); BlockHandRenderer = new BlockHandRenderer(this); BlockHandRenderer.Init(); FpsLimitMethod method = Options.GetEnum(OptionsKey.FpsLimit, FpsLimitMethod.LimitVSync); SetFpsLimitMethod(method); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); fpsScreen = new FpsScreen(this); fpsScreen.Init(); hudScreen = new HudScreen(this); hudScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapBordersRenderer.Init(); Picking = new PickingRenderer(this); AudioPlayer = new AudioPlayer(this); LiquidsBreakable = Options.GetBool(OptionsKey.LiquidsBreakable, false); AxisLinesRenderer = new AxisLinesRenderer(this); LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; Graphics.WarnIfNecessary(Chat); SetNewScreen(new LoadingMapScreen(this, connectString, "Waiting for handshake")); Network.Connect(IPAddress, Port); }
protected override void OnRenderFrame(FrameEventArgs e) { PerformFpsElapsed(e.Time * 1000); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += e.Time; Vertices = 0; if (!Focused && !ScreenLockedInput) { SetNewScreen(new PauseScreen(this)); } base.OnRenderFrame(e); CheckScheduledTasks(e.Time); float t = (float)(ticksAccumulator / ticksPeriod); LocalPlayer.SetInterpPosition(t); Graphics.Clear(); Graphics.SetMatrixMode(MatrixType.Modelview); Matrix4 modelView = Camera.GetView(e.Time); View = modelView; Graphics.LoadMatrix(ref modelView); Culling.CalcFrustumEquations(ref Projection, ref modelView); bool visible = activeScreen == null || !activeScreen.BlocksWorld; if (visible) { AxisLinesRenderer.Render(e.Time); Players.RenderModels(Graphics, e.Time, t); Players.RenderNames(Graphics, e.Time, t); CurrentCameraPos = Camera.GetCameraPos(LocalPlayer.EyePosition); ParticleManager.Render(e.Time, t); Camera.GetPickedBlock(SelectedPos); // TODO: only pick when necessary EnvRenderer.Render(e.Time); if (SelectedPos.Valid && !HideGui) { Picking.Render(e.Time, SelectedPos); } MapRenderer.Render(e.Time); SelectionManager.Render(e.Time); WeatherRenderer.Render(e.Time); Players.RenderHoveredNames(Graphics, e.Time, t); bool left = IsMousePressed(MouseButton.Left); bool middle = IsMousePressed(MouseButton.Middle); bool right = IsMousePressed(MouseButton.Right); InputHandler.PickBlocks(true, left, middle, right); if (!HideGui) { BlockHandRenderer.Render(e.Time, t); } } else { SelectedPos.SetAsInvalid(); } Graphics.Mode2D(Width, Height, EnvRenderer is StandardEnvRenderer); fpsScreen.Render(e.Time); if (activeScreen == null || !activeScreen.HidesHud) { hudScreen.Render(e.Time); } if (activeScreen != null) { activeScreen.Render(e.Time); } Graphics.Mode3D(EnvRenderer is StandardEnvRenderer); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); }
internal void OnLoad() { Mouse = window.Mouse; Keyboard = window.Keyboard; #if ANDROID Graphics = new OpenGLESApi(); #elif !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api(this); #endif Graphics.MakeApiInfo(); ErrorHandler.AdditionalInfo = Graphics.ApiInfo; #if ANDROID Drawer2D = new CanvasDrawer2D(Graphics); #else Drawer2D = new GdiPlusDrawer2D(Graphics); #endif Entities = new EntityList(this); AcceptedUrls.Load(); DeniedUrls.Load(); ETags.Load(); LastModified.Load(); if (Options.GetBool(OptionsKey.SurvivalMode, false)) { Mode = new SurvivalGameMode(); } else { Mode = new CreativeGameMode(); } Components.Add(Mode); Input = new InputHandler(this); defaultIb = Graphics.MakeDefaultIb(); ParticleManager = new ParticleManager(); Components.Add(ParticleManager); TabList = new TabList(); Components.Add(TabList); LoadOptions(); LoadGuiOptions(); Chat = new Chat(); Components.Add(Chat); WorldEvents.OnNewMap += OnNewMapCore; WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore; Events.TextureChanged += TextureChangedCore; BlockInfo.Init(); ModelCache = new ModelCache(this); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader(Drawer2D); Components.Add(AsyncDownloader); Lighting = new BasicLighting(); Components.Add(Lighting); Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.UseChatFont, false); Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackText, false); Graphics.Mipmaps = Options.GetBool(OptionsKey.Mipmaps, false); TerrainAtlas1D = new TerrainAtlas1D(this); TerrainAtlas = new TerrainAtlas2D(this); Animations = new Animations(); Components.Add(Animations); Inventory = new Inventory(); Components.Add(Inventory); BlockInfo.SetDefaultPerms(); World = new World(this); LocalPlayer = new LocalPlayer(this); Components.Add(LocalPlayer); Entities.List[EntityList.SelfID] = LocalPlayer; Width = window.Width; Height = window.Height; MapRenderer = new MapRenderer(this); string renType = Options.Get(OptionsKey.RenderType) ?? "normal"; if (!SetRenderType(renType)) { SetRenderType("normal"); } if (IPAddress == null) { Server = new Singleplayer.SinglePlayerServer(this); } else { Server = new Network.NetworkProcessor(this); } Graphics.LostContextFunction = Server.Tick; Cameras.Add(new FirstPersonCamera(this)); Cameras.Add(new ThirdPersonCamera(this, false)); Cameras.Add(new ThirdPersonCamera(this, true)); Camera = Cameras[0]; UpdateProjection(); Gui = new GuiInterface(this); Components.Add(Gui); CommandList = new CommandList(); Components.Add(CommandList); SelectionManager = new SelectionManager(); Components.Add(SelectionManager); WeatherRenderer = new WeatherRenderer(); Components.Add(WeatherRenderer); HeldBlockRenderer = new HeldBlockRenderer(); Components.Add(HeldBlockRenderer); Graphics.DepthTest = true; Graphics.DepthTestFunc(CompareFunc.LessEqual); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha); Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f); Culling = new FrustumCulling(); Picking = new PickedPosRenderer(); Components.Add(Picking); AudioPlayer = new AudioPlayer(); Components.Add(AudioPlayer); AxisLinesRenderer = new AxisLinesRenderer(); Components.Add(AxisLinesRenderer); SkyboxRenderer = new SkyboxRenderer(); Components.Add(SkyboxRenderer); plugins = new PluginLoader(this); List <string> nonLoaded = plugins.LoadAll(); for (int i = 0; i < Components.Count; i++) { Components[i].Init(this); } ExtractInitialTexturePack(); for (int i = 0; i < Components.Count; i++) { Components[i].Ready(this); } InitScheduledTasks(); if (nonLoaded != null) { for (int i = 0; i < nonLoaded.Count; i++) { plugins.MakeWarning(this, nonLoaded[i]); } } window.LoadIcon(); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; if (Graphics.WarnIfNecessary(Chat)) { MapBordersRenderer.UseLegacyMode(true); EnvRenderer.UseLegacyMode(true); } Gui.SetNewScreen(new LoadingMapScreen(this, connectString, "")); Server.Connect(IPAddress, Port); }