Added 3D picking of models to renderer

This commit is contained in:
viktorljung
2015-12-02 18:00:11 +01:00
parent eb50a747fa
commit 18b63c7ef3
9 changed files with 329 additions and 48 deletions
+27 -1
View File
@@ -7,6 +7,7 @@
#include "ShaderProgram.h"
//TODO: Temp resourceManager
#include "../Core/ResourceManager.h"
#include "Util/UnorderedMapVec2.h"
class Renderer : public IRenderer
{
@@ -20,16 +21,41 @@ private:
RenderQueueCollection m_TempRQ;
Texture* m_ErrorTexture;
Texture* m_WhiteTexture;
float m_CameraMoveSpeed = 3.f;
float m_CameraMoveSpeed;
GLuint m_PickingBuffer;
GLuint m_PickingTexture;
GLuint m_DepthBuffer;
Model* m_ScreenQuad;
Model* m_UnitQuad;
Model* m_UnitSphere;
//Temporary
Model* m;
Model* m2;
Model* m3;
Model* MapModel;
std::unordered_map<glm::vec2, const Model*> m_PickingColorsToModels;
//----------------------Functions----------------------//
void InitializeWindow();
void InitializeShaders();
void InitializeTextures();
void InitializeFrameBuffers();
//TODO: Render: Remove ModelsToDraw from Renderer.
void ModelsToDraw();
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);
//--------------------ShaderPrograms-------------------//
ShaderProgram m_BasicForwardProgram;
ShaderProgram m_PickingProgram;
ShaderProgram m_DrawScreenQuadProgram;
};
#endif
+1 -1
View File
@@ -18,7 +18,6 @@ public:
std::string GetFileName() const;
GLuint GetHandle() const;
bool IsCompiled() const;
protected:
GLenum m_ShaderType;
std::string m_FileName;
@@ -74,6 +73,7 @@ public:
GLuint GetHandle();
void Bind();
void Unbind();
void BindFragDataLocation(int index, std::string name);
private:
GLuint m_ShaderProgramHandle;