Skip to content

Commit 0f5146b

Browse files
committed
Fixed a few bugs
1 parent e5454fa commit 0f5146b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

3Dev-Editor/main.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ int main()
587587
cam.SetViewportSize({ (uint32_t)viewportWindow->getSize().x, (uint32_t)viewportWindow->getSize().y - 28 });
588588
cam.SetGuiSize({ (uint32_t)viewportWindow->getSize().x, (uint32_t)viewportWindow->getSize().y - 28 });
589589

590-
Light shadowSource({ 0, 0, 0 }, { 30.1, 50.0, -30.1 }, true);
590+
Light* shadowSource = new Light({ 0, 0, 0 }, { 30.1, 50.0, -30.1 }, true);
591591

592592
Material skyboxMaterial(
593593
{
@@ -714,13 +714,13 @@ int main()
714714
lastPath = projectFilename.substr(0, projectFilename.find_last_of("/"));
715715
scene.Load(projectFilename, true);
716716
if(scene.GetNames()[2].empty())
717-
scene.AddLight(&shadowSource, "shadowSource");
717+
scene.AddLight(shadowSource, "shadowSource");
718718

719719
filenameEdit->setText(projectFilename.empty() ? "scene.json" : projectFilename);
720720
}
721721
else
722722
{
723-
scene.AddLight(&shadowSource, "shadowSource");
723+
scene.AddLight(shadowSource, "shadowSource");
724724
scene.AddMaterial(defaultMaterial, "default");
725725
materialBox->addItem("default");
726726
sceneTree->addItem({ "Scene", "Materials", "default" });
@@ -1577,18 +1577,6 @@ int main()
15771577
float innerCutoff = light->GetCutoff();
15781578
float outerCutoff = light->GetOuterCutoff();
15791579

1580-
lightNameEdit->setText(sceneTree->getSelectedItem().back());
1581-
1582-
lposEditX->setText(tgui::String(position.x));
1583-
lposEditY->setText(tgui::String(position.y));
1584-
lposEditZ->setText(tgui::String(position.z));
1585-
1586-
glm::vec3 euler = glm::eulerAngles(toglm(orientation));
1587-
1588-
lrotEditX->setText(tgui::String(glm::degrees(euler.x)));
1589-
lrotEditY->setText(tgui::String(glm::degrees(euler.y)));
1590-
lrotEditZ->setText(tgui::String(glm::degrees(euler.z)));
1591-
15921580
if(!lightNameEdit->isFocused() && lightNameEdit->getText() != sceneTree->getSelectedItem().back())
15931581
{
15941582
rEdit->setText(tgui::String(color.x));
@@ -1605,6 +1593,18 @@ int main()
16051593
castShadowsBox->setChecked(light->IsCastingShadows());
16061594
perspectiveShadowsBox->setChecked(light->IsCastingPerspectiveShadows());
16071595
}
1596+
1597+
lightNameEdit->setText(sceneTree->getSelectedItem().back());
1598+
1599+
lposEditX->setText(tgui::String(position.x));
1600+
lposEditY->setText(tgui::String(position.y));
1601+
lposEditZ->setText(tgui::String(position.z));
1602+
1603+
glm::vec3 euler = glm::eulerAngles(toglm(orientation));
1604+
1605+
lrotEditX->setText(tgui::String(glm::degrees(euler.x)));
1606+
lrotEditY->setText(tgui::String(glm::degrees(euler.y)));
1607+
lrotEditZ->setText(tgui::String(glm::degrees(euler.z)));
16081608
}
16091609

16101610
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Enter) && lightNameEdit->isFocused() && lightNameEdit->getText() != sceneTree->getSelectedItem().back())

0 commit comments

Comments
 (0)