Compare commits

..

No commits in common. "0f9be33bd65da96fd8e65477a239f2b0d6c9b8cf" and "fe7e168e21cb271c8bb9797da56f83b364406216" have entirely different histories.

6 changed files with 17 additions and 26 deletions

View File

@ -60,24 +60,21 @@ public:
void ShowComponents(Entity& selected) void ShowComponents(Entity& selected)
{ {
auto component = selected.GetComponent<IdentifierComponent>(); auto component = selected.GetComponent<IdentifierComponent>();
ImGui::InputText("Name:", (char*)component.name.c_str(), component.name.size() * sizeof(char), ImGuiInputTextFlags_ReadOnly); char* buf = new char(component.name.size());
strcpy(buf, component.name.c_str());
ImGui::InputText("Name:", buf, sizeof(buf), ImGuiInputTextFlags_ReadOnly);
if (selected.HasComponent<TransformComponent>()) { if (selected.HasComponent<TransformComponent>()) {
auto& transform = selected.GetComponent<TransformComponent>(); auto& transform = selected.GetComponent<TransformComponent>();
if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::DragFloat3("Position", glm::value_ptr(transform.Position), 0.1f); ImGui::DragFloat3("Position", glm::value_ptr(transform.Position), 0.01f);
ImGui::DragFloat3("Rotation", glm::value_ptr(transform.Rotation), 0.1f); ImGui::DragFloat3("Rotation", glm::value_ptr(transform.Rotation), 0.01f);
ImGui::DragFloat3("Scale", glm::value_ptr(transform.Scale), 0.1f, 0.0f); ImGui::DragFloat3("Scale", glm::value_ptr(transform.Scale), 0.01f, 0.0f);
} }
if (selected.HasComponent<RelationComponent>()) {
ImGui::Text("Has relation");
}
} }
if (selected.HasComponent<Render3DComponent>()) { if (selected.HasComponent<Render3DComponent>()) {
auto& render3d = selected.GetComponent<Render3DComponent>(); auto& render3d = selected.GetComponent<Render3DComponent>();
if (ImGui::CollapsingHeader("Render3D", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::CollapsingHeader("Render3D", ImGuiTreeNodeFlags_DefaultOpen)) {

View File

@ -1,5 +1,8 @@
#include <YoggieEngine.h> #include <YoggieEngine.h>
#include "CubeMap.h" #include "CubeMap.h"
#define STB_IMAGE_IMPLEMENTATION
#include "../stb_image.h"
YoggieEngine::CubeMap::CubeMap() YoggieEngine::CubeMap::CubeMap()
{ {

View File

@ -1,8 +1,11 @@
#include <YoggieEngine.h> #include <YoggieEngine.h>
#include "Texture.h" #include "Texture.h"
#include <GLFW/glfw3.h>
#define STB_IMAGE_IMPLEMENTATION
#include "../stb_image.h"
namespace YoggieEngine { namespace YoggieEngine {
Texture::Texture(const std::string texturePath , bool Transparency) { Texture::Texture(const std::string texturePath) {
int width, height, channels; int width, height, channels;
unsigned char* data = stbi_load(texturePath.c_str(), &width, &height, &channels, 0); unsigned char* data = stbi_load(texturePath.c_str(), &width, &height, &channels, 0);
@ -13,15 +16,8 @@ namespace YoggieEngine {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D); glGenerateMipmap(GL_TEXTURE_2D);
if (Transparency) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

View File

@ -2,7 +2,7 @@
namespace YoggieEngine { namespace YoggieEngine {
class Texture { class Texture {
public: public:
Texture(const std::string texturePath, bool Transparency = false); Texture(const std::string texturePath);
void Bind(); void Bind();
void Unbind(); void Unbind();

View File

@ -1,4 +0,0 @@
#include <YoggieEngine.h>
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image.h"

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
// Important STL // Important STL
#include <string> #include <string>
#include <list> #include <list>
@ -19,7 +18,7 @@
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include <imgui.h> #include <imgui.h>
#include <entt/entt.hpp> #include <entt/entt.hpp>
#include "Graphics/stb_image.h"
extern "C" extern "C"