@@ -28,6 +28,8 @@ void RenderSystem::Init(const pugi::xml_node& rendererNode) {
2828 std::cout << " OpenGL Renderer: " << glGetString (GL_RENDERER) << ' \n ' ;
2929#endif
3030
31+ getHardwareFeatures ();
32+
3133 const auto width = rendererNode.attribute (" width" ).as_uint ();
3234 const auto height = rendererNode.attribute (" height" ).as_uint ();
3335
@@ -47,15 +49,18 @@ void RenderSystem::Init(const pugi::xml_node& rendererNode) {
4749 shaders.emplace_back (shader.attribute (" path" ).as_string (), shader.attribute (" type" ).as_string ());
4850 }
4951
52+ // GLShaderProgram prgrm;
53+ // prgrm.Init(program.attribute("name").as_string(), shaders);
54+
5055 // Compile and cache shader program
56+ // m_shaderCache.try_emplace(program.attribute("name").as_string(), prgrm);
5157 m_shaderCache.try_emplace (program.attribute (" name" ).as_string (), program.attribute (" name" ).as_string (), shaders);
5258 }
5359
5460 setupScreenquad ();
5561 setupTextureSamplers ();
5662 setupShadowMap ();
5763 setupPostProcessing ();
58-
5964
6065#ifdef _DEBUG
6166 glEnable (GL_DEBUG_OUTPUT);
@@ -294,7 +299,6 @@ void RenderSystem::renderShadowMap(const SceneBase& scene, RenderListIterator re
294299 glCullFace (GL_BACK);
295300}
296301
297-
298302/* **********************************************************************************/
299303void RenderSystem::setupScreenquad () {
300304 const std::array<Vertex, 4 > screenQuadVertices {
@@ -317,17 +321,13 @@ void RenderSystem::setupScreenquad() {
317321
318322/* **********************************************************************************/
319323void RenderSystem::setupTextureSamplers () {
320- // Find max supported hardware anisotropy
321- float aniso = 0 .0f ;
322- glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso);
323-
324324 // Sampler for PBR textures used on meshes
325325 glGenSamplers (1 , &m_samplerPBRTextures);
326326 glSamplerParameteri (m_samplerPBRTextures, GL_TEXTURE_WRAP_S, GL_REPEAT);
327327 glSamplerParameteri (m_samplerPBRTextures, GL_TEXTURE_WRAP_T, GL_REPEAT);
328328 glSamplerParameteri (m_samplerPBRTextures, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
329329 glSamplerParameteri (m_samplerPBRTextures, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
330- glSamplerParameterf (m_samplerPBRTextures, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso );
330+ glSamplerParameterf (m_samplerPBRTextures, GL_TEXTURE_MAX_ANISOTROPY_EXT, m_features. MaxAnisotropy );
331331
332332}
333333
@@ -424,3 +424,10 @@ void RenderSystem::setupPostProcessing() {
424424 bloomBlendShader.SetUniform (" vibranceCoefficient" , m_coefficient);
425425
426426}
427+
428+ /* **********************************************************************************/
429+ void RenderSystem::setProjectionMatrix (const Camera& camera) {
430+ m_projMatrix = camera.GetProjMatrix (m_width, m_height);
431+ glBindBuffer (GL_UNIFORM_BUFFER, m_uboMatrices);
432+ glBufferSubData (GL_UNIFORM_BUFFER, 0 , sizeof (glm::mat4), value_ptr (m_projMatrix));
433+ }
0 commit comments