Shadows - need to fix frame buffers
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#ifndef HYDRASHADOWBUFFER
|
||||
#define HYDRASHADOWBUFFER
|
||||
|
||||
|
||||
#include "../engine/HydraEngine.h"
|
||||
struct HydraShadowBuffer
|
||||
{
|
||||
uint32_t entity_id;
|
||||
uint32_t cascade_count;
|
||||
uint32_t shadow_texture_id;
|
||||
uint32_t padding0;
|
||||
float near_plane[8];
|
||||
float far_plane[8];
|
||||
glm::mat4 light_space_proj[6];
|
||||
glm::mat4 light_space_view[6];
|
||||
};
|
||||
#endif /* HYDRASHADOWBUFFER */
|
||||
@@ -64,6 +64,7 @@ HydraID HydraTextureBufferManager::LoadTexture(std::string texture_filename)
|
||||
format,
|
||||
GL_NEAREST_MIPMAP_NEAREST,
|
||||
GL_LINEAR,
|
||||
1,
|
||||
GL_UNSIGNED_BYTE,
|
||||
5,
|
||||
data,
|
||||
@@ -112,6 +113,7 @@ HydraID HydraTextureBufferManager::CreateTexture(std::string texture_name,
|
||||
uint32_t internal_format,
|
||||
uint32_t min_filter,
|
||||
uint32_t mag_filter,
|
||||
uint32_t levels,
|
||||
uint32_t format,
|
||||
uint32_t data_type,
|
||||
uint32_t mip_levels,
|
||||
@@ -121,8 +123,8 @@ HydraID HydraTextureBufferManager::CreateTexture(std::string texture_name,
|
||||
glCreateTextures(GL_TEXTURE_2D, 1, &gl_tex_id);
|
||||
glBindTexture(GL_TEXTURE_2D, gl_tex_id);
|
||||
|
||||
// important to create mip_levels + 1 images
|
||||
glTextureStorage2D(gl_tex_id, mip_levels + 1, internal_format, width, height);
|
||||
|
||||
glTextureStorage2D(gl_tex_id, levels, internal_format, width, height);
|
||||
|
||||
if (data != nullptr)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ class HydraTextureBufferManager : public HydraObject
|
||||
void Intialise();
|
||||
void Shutdown();
|
||||
HydraID CreateTexture(std::string texture_name, uint32_t width, uint32_t height, uint32_t internal_format,
|
||||
uint32_t min_filter, uint32_t mag_filter,
|
||||
uint32_t min_filter, uint32_t mag_filter, uint32_t levels,
|
||||
uint32_t format = GL_RGBA, uint32_t data_type = GL_UNSIGNED_BYTE, uint32_t mip_levels = 0, void* data = nullptr);
|
||||
void BindTexture(HydraID texture_id);
|
||||
void UnbindTexture(HydraID texture_id);
|
||||
|
||||
Reference in New Issue
Block a user