private void QueueUI(double timeDelta) { (int windowWidth, int windowHeight) = GameEngine.windowHandler.GetWindowDimensions(); double uiScale = windowWidth > windowHeight ? windowWidth / 1920d : windowHeight / 1080d; textMesh = TextMeshGenerator.RegenerateMesh($"Vector Engine\n" + $"VSync: {UseVSync}\n" + $"FPS: {((int)(1 / timeDelta * 10)) / 10f}", arialFont, textMesh, 2, 50); RenderEngine.AddToRenderQueue(uiMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(1, 0, 0) / uiScale, Vector3d.Zero, new Vector3d(250d / windowWidth, 250d / windowHeight, 1) * uiScale), true); //RenderEngine.AddToRenderQueue(uiMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, 0) / uiScale, Vector3d.Zero, new Vector3d(0.5d, 0.5d, 1) * uiScale), true); RenderEngine.AddToRenderQueue(arialFontMaterial, textMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(-windowWidth + 50, windowHeight - 50, 0) / uiScale, Vector3d.Zero, new Vector3d(1d / windowWidth, 1d / windowHeight, 1) * uiScale), true); }
public void OnRender(double timeDelta) { double time = (DateTime.UtcNow - engineStartTime).TotalSeconds; secondCamera.Position = new Vector3d(Math.Sin(time) * 5, 3, Math.Cos(time) * 5); secondCamera.Rotation = new Vector3d(25, -Math.Atan2(Math.Sin(time), Math.Cos(time)) * 180 / Mathmatics.PI, 0); RenderEngine.AddCamera(camera); RenderEngine.AddCamera(secondCamera); RenderEngine.AddLight(light); RenderEngine.AddLight(mainLight); RenderEngine.AddLight(anotherLight); QueueUI(timeDelta); RenderEngine.AddToRenderQueue(standardMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, 0), Vector3d.Zero, Vector3d.One), false); RenderEngine.AddToRenderQueue(standardMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, -5), Vector3d.Zero, Vector3d.One), false); }