-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Textures Basically Working (I think)
- Loading branch information
1 parent
c23b30a
commit 0ed6fc3
Showing
6 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,57 @@ | ||
#include "OpenGLDescriptorSet.h" | ||
#include "OpenGLTexture.h" | ||
|
||
#include<glad/glad.h> | ||
|
||
namespace Arcane | ||
{ | ||
OpenGLDescriptorSet::OpenGLDescriptorSet(DescriptorSetSpecs& setSpecs, std::initializer_list<DescriptorLayoutSpecs> layoutSpecs) | ||
{ | ||
|
||
for (DescriptorLayoutSpecs spec : layoutSpecs) { | ||
m_Textures[{spec.Binding, spec.Name}] = nullptr; | ||
} | ||
} | ||
|
||
OpenGLDescriptorSet::OpenGLDescriptorSet(DescriptorSetSpecs& setSpecs, std::vector<DescriptorLayoutSpecs> layoutSpecs) | ||
{ | ||
|
||
} | ||
|
||
void OpenGLDescriptorSet::AddImageSampler(Texture* texture, uint32_t setNum, uint32_t bindingNum) | ||
{ | ||
|
||
std::map<std::pair<int, std::string>, Texture*>::iterator it; | ||
for (it = m_Textures.begin(); it != m_Textures.end(); it++) { | ||
if (it->first.first == bindingNum) { | ||
it->second = texture; | ||
} | ||
} | ||
} | ||
|
||
void OpenGLDescriptorSet::AddImageSampler(Framebuffer* framebuffer, uint32_t setNum, uint32_t bindingNum) | ||
{ | ||
|
||
} | ||
|
||
void OpenGLDescriptorSet::AddUniformBuffer(UniformBuffer* buffer, uint32_t setNum, uint32_t bindingNum) | ||
{ | ||
} | ||
|
||
void OpenGLDescriptorSet::BindTextures(uint32_t shaderID) | ||
{ | ||
int textureCount = 0; | ||
|
||
std::map<std::pair<int, std::string>, Texture*>::iterator it; | ||
for (it = m_Textures.begin(); it != m_Textures.end(); it++) { | ||
// Cast Texture to opengl texture | ||
OpenGLTexture* openglTexture = static_cast<OpenGLTexture*>(it->second); | ||
|
||
// Get Texture Uniform Name | ||
std::string uniformName = it->first.second; | ||
|
||
// Set Uniform Value | ||
glUniform1i(glGetUniformLocation(shaderID, uniformName.c_str()), textureCount); | ||
|
||
// Set Active Texture | ||
glActiveTexture(GL_TEXTURE + textureCount); | ||
glBindTexture(GL_TEXTURE_2D, openglTexture->GetTextureID()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters