Skip to content

Commit

Permalink
Select entity when creating it
Browse files Browse the repository at this point in the history
  • Loading branch information
roeas committed Oct 31, 2024
1 parent 1984107 commit 80d2eb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Engine/Asset/Shader/Lib/Material.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ vec3 SampleNormalTexture(vec2 uv)
}
vec3 SampleEmissiveTexture(vec2 uv)
{
return texture(s_emissive, uv).xyz;
// TODO: Compile emissive textures to linear space before rendering.
return pow(texture(s_emissive, uv).xyz, vec3(2.2));
}
vec3 SampleORMTexture(vec2 uv)
{
Expand Down
8 changes: 7 additions & 1 deletion Engine/Source/Editor/Layer/ImGuiLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,13 @@ void ImGuiLayer::ShowEntityList()
{
if (ImGui::MenuItem("Creat Empty Entity"))
{
sl::ECSWorld::CreateEntity();
m_selectedEntity = sl::ECSWorld::CreateEntity();
}
if (ImGui::MenuItem("Creat Directional Light"))
{
auto entity = sl::ECSWorld::CreateEntity("Directional Light");
m_selectedEntity = entity;

auto &light = entity.AddComponent<sl::LightComponent>();
light.type = sl::LightType::Directional;
// light.intensity = 100000.0f;
Expand All @@ -691,12 +693,16 @@ void ImGuiLayer::ShowEntityList()
if (ImGui::MenuItem("Creat Point Light"))
{
auto entity = sl::ECSWorld::CreateEntity("Point Light");
m_selectedEntity = entity;

auto &light = entity.AddComponent<sl::LightComponent>();
light.type = sl::LightType::Point;
}
if (ImGui::MenuItem("Creat Spot Light"))
{
auto entity = sl::ECSWorld::CreateEntity("Spot Light");
m_selectedEntity = entity;

auto &light = entity.AddComponent<sl::LightComponent>();
light.type = sl::LightType::Spot;

Expand Down

0 comments on commit 80d2eb5

Please sign in to comment.