Added a ScreenCoords class with some util functions to clean up the Renderer class.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "../OpenGL.h"
|
||||
#include "../GLM.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
#include "Util/ScreenCoords.h"
|
||||
#include "Camera.h"
|
||||
#include "RenderQueue.h"
|
||||
#include "Model.h"
|
||||
|
||||
@@ -44,19 +44,15 @@ private:
|
||||
void InitializeShaders();
|
||||
void InitializeTextures();
|
||||
void InitializeFrameBuffers();
|
||||
//TODO: Render: Remove ModelsToDraw from Renderer.
|
||||
//TODO: Renderer: Remove ModelsToDraw from Renderer.
|
||||
void ModelsToDraw();
|
||||
//TODO: Renderer: Get EnqueueModel and InputUpdate out of renderer
|
||||
void EnqueueModel(Model* model);
|
||||
void InputUpdate(double dt);
|
||||
void PickingPass();
|
||||
void DrawScreenQuad(GLuint textureToDraw);
|
||||
glm::vec3 GetClickedPixelData(float x, float y);
|
||||
void DrawScene(RenderQueueCollection& rq);
|
||||
|
||||
//--------------------Utility functions----------------//
|
||||
glm::vec3 ScreenCoordsToWorldPos(glm::vec2 screenCoord, float depth);
|
||||
//EntityID ScreenCoordsToEntityID(glm::vec2 screenCoord, float depth);
|
||||
|
||||
//--------------------ShaderPrograms-------------------//
|
||||
ShaderProgram m_BasicForwardProgram;
|
||||
ShaderProgram m_PickingProgram;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef ScreenCoords_h__
|
||||
#define ScreenCoords_h__
|
||||
|
||||
#include "../../Common.h"
|
||||
#include "../../OpenGL.h"
|
||||
#include "../../GLM.h"
|
||||
#include "../../Core/Util/Rectangle.h"
|
||||
|
||||
class ScreenCoords
|
||||
{
|
||||
public:
|
||||
ScreenCoords() = delete;
|
||||
//Return world position from given screenspace coordinates and depth value in viewspace.
|
||||
static glm::vec3 ToWorldPos(glm::vec2 screenCoord, float depth, Rectangle resolution, glm::mat4 cameraProjectionMat, glm::mat4 cameraViewMat);
|
||||
static glm::vec3 ToWorldPos(float x, float y, float depth, Rectangle resolution, glm::mat4 cameraProjectionMat, glm::mat4 cameraViewMat);
|
||||
static glm::vec3 ToWorldPos(glm::vec2 screenCoord, float depth, float screenWidth, float screenHeight, glm::mat4 cameraProjectionMat, glm::mat4 cameraViewMat);
|
||||
static glm::vec3 ToWorldPos(float x, float y, float depth, float screenWidth, float screenHeight, glm::mat4 cameraProjectionMat, glm::mat4 cameraViewMat);
|
||||
//Return data from the given buffers at the coordinates given in screenspace. Buffer should probably have a texture that covers the screen.
|
||||
//Data is given as R = x, B = y, and
|
||||
static glm::vec3 ToPixelData(glm::vec2 screenCoord, GLuint PickDataBuffer, GLuint DepthBuffer);
|
||||
static glm::vec3 ToPixelData(float x, float y, GLuint PickDataBuffer, GLuint DepthBuffer);
|
||||
//Return EntityID of the clicked coordinate in given screenspace coordinates.
|
||||
//EntityID ScreenCoordsToEntityID(glm::vec2 screenCoord, float depth);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user