Point light working
This commit is contained in:
@@ -116,12 +116,10 @@ HydraID HydraTextureBufferManager::CreateTextureArray(std::string texture_name,
|
||||
)
|
||||
{
|
||||
uint32_t gl_tex_id = 0;
|
||||
glCreateTextures(GL_TEXTURE_2D_ARRAY, 1, &gl_tex_id);
|
||||
glCreateTextures(GL_TEXTURE_2D_ARRAY,1, &gl_tex_id);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, gl_tex_id);
|
||||
|
||||
|
||||
glTextureStorage3D(gl_tex_id, 1, internal_format, width, height, levels);
|
||||
|
||||
|
||||
glTextureParameteri(gl_tex_id, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
glTextureParameteri(gl_tex_id, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
@@ -144,6 +142,44 @@ HydraID HydraTextureBufferManager::CreateTextureArray(std::string texture_name,
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
HydraID HydraTextureBufferManager::CreateCubemapTexture(std::string texture_name, uint32_t width, uint32_t height, uint32_t internal_format, uint32_t min_filter, uint32_t mag_filter)
|
||||
{
|
||||
uint32_t gl_tex_id = 0;
|
||||
glGenTextures(1, &gl_tex_id);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, gl_tex_id);
|
||||
|
||||
for(uint32_t i = 0; i < 6; i++)
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
}
|
||||
|
||||
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
|
||||
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||
HydraTextureBuffer texture_buffer = {};
|
||||
HydraID texture_id = _GetTextureID();
|
||||
|
||||
texture_buffer.texture_id = texture_id;
|
||||
texture_buffer.format = 0;
|
||||
texture_buffer.internal_format = internal_format;
|
||||
texture_buffer.width = width;
|
||||
texture_buffer.height = height;
|
||||
texture_buffer.gl_tex_id = gl_tex_id;
|
||||
texture_buffer.mag_filter = mag_filter;
|
||||
texture_buffer.min_filter = min_filter;
|
||||
|
||||
m_textures[texture_id] = texture_buffer;
|
||||
m_texture_lookup.insert(std::pair<std::string, HydraID>(texture_name, texture_id));
|
||||
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
HydraID HydraTextureBufferManager::CreateTexture(std::string texture_name,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
@@ -206,10 +242,11 @@ void HydraTextureBufferManager::BindTexture(HydraID texture_id, uint32_t target)
|
||||
}
|
||||
HydraTextureBuffer texture = m_textures[texture_id];
|
||||
glBindTexture(target, texture.gl_tex_id);
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, texture.min_filter);
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, texture.mag_filter);
|
||||
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, texture.min_filter);
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, texture.mag_filter);
|
||||
|
||||
texture.texture_binding = glGetTextureHandleARB(texture.gl_tex_id);
|
||||
glMakeTextureHandleResidentARB(texture.texture_binding);
|
||||
|
||||
Reference in New Issue
Block a user