public void DrawSkybox(CameraEntity camera) { Gl.Disable(EnableCap.CullFace); var modelMatrix = Matrix4x4.Identity; var scale = 10000.0f; modelMatrix *= Matrix4x4.CreateScale(scale); skyboxShader.Use(); skyboxShader.SetMatrix("projMatrix", camera.GetComponent <CameraComponent>().ProjMatrix); skyboxShader.SetMatrix("viewMatrix", camera.GetComponent <CameraComponent>().ViewMatrix); skyboxShader.SetMatrix("modelMatrix", modelMatrix); skyboxShader.SetInt("environmentMap", 0); Gl.ActiveTexture(TextureUnit.Texture0); Gl.BindTexture(TextureTarget.TextureCubeMap, skybox.Id); skyboxCube.Draw(); Gl.BindTexture(TextureTarget.TextureCubeMap, 0); Gl.Enable(EnableCap.CullFace); }
protected override bool Initialize() { if (cameraEntity != null) { cameraGimbalController = cameraEntity.GetComponent <GimbalController>(); return(true); } else { return(false); } }
private void DrawCamera(CameraEntity cameraEntity) { var windowWidth = ImGui.GetWindowSize().X; var windowHeight = ImGui.GetWindowSize().Y; var camera = cameraEntity.GetComponent <CameraComponent>(); var ratio = camera.Resolution.X / camera.Resolution.Y; var image = camera.Framebuffer.ColorTexture; var cameraScale = 1.0f; ImGui.Image( (IntPtr)image, new System.Numerics.Vector2(windowHeight * ratio, windowHeight) * cameraScale, new System.Numerics.Vector2(0, 1), new System.Numerics.Vector2(1, 0)); }