Skip to content

Commit

Permalink
Added groups
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-beqiraj committed Feb 4, 2025
1 parent 6ff45dd commit 8e52a58
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 11 deletions.
13 changes: 7 additions & 6 deletions Engine/include/GlobalData/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ namespace Prisma

void defaultNormal(const Texture& defaultNormal);

void addGlobalTexture(std::pair<unsigned int, std::string> texture) {
m_textures.push_back(texture);
}
void transparencies(bool transparencies);

const std::vector<std::pair<unsigned int,std::string>>& globalTextures() {
return m_textures;
}
bool transparencies() const;

void addGlobalTexture(std::pair<unsigned int, std::string> texture);

const std::vector<std::pair<unsigned int,std::string>>& globalTextures();

private:
std::shared_ptr<Scene> m_currentGlobalScene;
Expand All @@ -74,5 +74,6 @@ namespace Prisma
Texture m_defaultBlack;
Texture m_defaultWhite;
Texture m_defaultNormal;
bool m_transparencies = true;
};
}
16 changes: 16 additions & 0 deletions Engine/src/GlobalData/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,19 @@ void Prisma::GlobalData::defaultNormal(const Texture& defaultNormal)
{
m_defaultNormal = defaultNormal;
}

void Prisma::GlobalData::transparencies(bool transparencies) {
m_transparencies = transparencies;
}

bool Prisma::GlobalData::transparencies() const {
return m_transparencies;
}

void Prisma::GlobalData::addGlobalTexture(std::pair<unsigned int, std::string> texture) {
m_textures.push_back(texture);
}

const std::vector<std::pair<unsigned int, std::string>>& Prisma::GlobalData::globalTextures() {
return m_textures;
}
8 changes: 5 additions & 3 deletions Engine/src/SceneData/MeshIndirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ void Prisma::MeshIndirect::sort() const
m_shaderCopy->setInt(m_indicesCopyLocation, 1);
m_shaderCopy->dispatchCompute({ meshes.size(), 1, 1 });
m_shaderCopy->wait(GL_COMMAND_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);
m_shader->use();
m_shader->dispatchCompute({1, 1, 1});
m_shader->wait(GL_COMMAND_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);
if (Prisma::GlobalData::getInstance().transparencies()) {
m_shader->use();
m_shader->dispatchCompute({ 1, 1, 1 });
m_shader->wait(GL_COMMAND_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);
}
m_shaderCopy->use();
m_shaderCopy->setInt(m_indicesCopyLocation, 2);
m_shaderCopy->dispatchCompute({ meshes.size(), 1, 1 });
Expand Down
2 changes: 1 addition & 1 deletion GUI/include/ImGuiTabs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Prisma

unsigned int m_maxSize = 0;

const int m_nextSize = 65;
const int m_nextSize = 25;

int64_t m_current = -1;
std::shared_ptr<Prisma::Node> m_parent = nullptr;
Expand Down
5 changes: 4 additions & 1 deletion GUI/src/ImGuiTabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ Prisma::ImGuiTabs::ImGuiTabs()

void Prisma::ImGuiTabs::showCurrentNodes(std::shared_ptr<Node> root, int depth, ImGuiCamera& camera)
{
if (root&& m_index<m_maxSize)
if (root)
{
// Iterate through children of the current node
for (const auto& child : root->children())
{
if (m_index >= m_maxSize) {
break;
}
m_index++;
// Add spacing based on depth
ImGui::Indent(depth * 20.0f); // Indent by 20 pixels per depth level
Expand Down
6 changes: 6 additions & 0 deletions GUI/src/SettingsTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ void Prisma::SettingsTab::drawSettings()

ImGui::Checkbox("PHYSICS DEBUG", &debugPhysics);

bool sortTransparencies = Prisma::GlobalData::getInstance().transparencies();

ImGui::Checkbox("SORT TRANSPARENCIES", &sortTransparencies);

Prisma::GlobalData::getInstance().transparencies(sortTransparencies);

Physics::getInstance().debug(debugPhysics);

Engine::getInstance().engineSettings(settings);
Expand Down

0 comments on commit 8e52a58

Please sign in to comment.