private void InitializeRefractionFrameBuffer(JGameWindow gameWindow) { RefractionFrameBuffer = CreateFrameBuffer(); RefractionTexture = CreateTextureAttachment(REFRACTION_WIDTH, REFRACTION_HEIGHT); RefractionDepthTexture = CreateDepthTextureAttachment(REFRACTION_WIDTH, REFRACTION_HEIGHT); UnbindFrameBuffer(gameWindow); }
/// <summary> /// Create a JMousePicker instance. JMousePicker will project a 2D screen coordinate into a 3D unit vector within the world. /// It can determine intersection with terrain as well as check for intersection with a JBoundingSphere. /// </summary> /// <param name="camera">The JCamera entity.</param> /// <param name="projectionMatrix">The JMasterRenderers Projection Matrix based off of the JCameras properties.</param> /// <param name="terrain">The JTerrain the Mouse Ray will intersect with.</param> /// <param name="gameWindow">The active JGameWindow. We need this to get it's height and width.</param> public JMousePicker(JCamera camera, Matrix4 projectionMatrix, JPerlinTerrain terrain, JGameWindow gameWindow) { Camera = camera; ProjectionMatrix = projectionMatrix; ViewMatrix = JMathUtils.createViewMatrix(camera); Terrain = terrain; GameWindow = gameWindow; }
static void Main(string[] args) { Console.WriteLine("Launching Game Window..."); myWindow = new JGameWindow(); //myWindow = new JNoiseWindow(); Console.WriteLine("Updates per second: " + updatesPerSecond); Console.WriteLine("Frames per second: " + framesPerSecond); myWindow.Run(updatesPerSecond, framesPerSecond); }
private void PrepareRender(JCamera camera, JLight light) { WaterShader.start(); WaterShader.LoadViewMatrix(camera); distortionVariance += DISTORTION_SPEED * JGameWindow.FrameTimeSeconds(); distortionVariance %= 1.0f; WaterShader.LoadDistortionVariance(distortionVariance); WaterShader.LoadLight(light); GL.BindVertexArray(WaterQuad.vaoID); GL.EnableVertexAttribArray(0); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, FrameBuffer.ReflectionTexture); GL.ActiveTexture(TextureUnit.Texture1); GL.BindTexture(TextureTarget.Texture2D, FrameBuffer.RefractionTexture); GL.ActiveTexture(TextureUnit.Texture2); GL.BindTexture(TextureTarget.Texture2D, WaterTile.ColorTexture.TextureID); GL.ActiveTexture(TextureUnit.Texture3); GL.BindTexture(TextureTarget.Texture2D, dudvMap); GL.ActiveTexture(TextureUnit.Texture4); GL.BindTexture(TextureTarget.Texture2D, normalMap); }
public JWaterFrameBuffer(JGameWindow gameWindow) { InitializeReflectionFrameBuffer(gameWindow); InitializeRefractionFrameBuffer(gameWindow); }
/// <summary> /// Unbind any FrameBuffers to begin rendering to the screen. /// </summary> /// <param name="gameWindow">The running JGameWindow.</param> public void UnbindFrameBuffer(JGameWindow gameWindow) { GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); GL.Viewport(0, 0, gameWindow.Width, gameWindow.Height); }