truly fixing crash error

This commit is contained in:
2025-05-22 15:50:25 +02:00
parent 92967aac1f
commit 165c5a7a5e
6 changed files with 20 additions and 22 deletions

View File

@@ -52,7 +52,7 @@ World::World(Scop::Scene& scene) : m_scene(scene), m_previous_chunk_position(-10
m_scene.CreateNarrator().AttachScript(std::make_shared<Scop::NativeNarratorScript>(std::function<void()>{}, narrator_update, std::function<void()>{}));
}
void World::Quit() noexcept
World::~World()
{
m_generation_status = GenerationState::Quitting;
while(m_generation_status != GenerationState::Finished)

View File

@@ -26,14 +26,12 @@ class World
public:
World(Scop::Scene& scene);
void Quit() noexcept;
[[nodiscard]] inline Scop::Scene& GetScene() noexcept { return m_scene; }
[[nodiscard]] inline std::shared_ptr<Scop::Material> GetBlockMaterial() const { return p_block_material; }
[[nodiscard]] Scop::NonOwningPtr<Chunk> GetChunk(Scop::Vec2i position);
[[nodiscard]] Noise& GetNoiseGenerator() noexcept { return m_noise; }
~World() = default;
~World();
private:
void UnloadChunks();

View File

@@ -8,20 +8,8 @@
int main(int ac, char** av)
{
Scop::ScopEngine engine(ac, av, "Vox", 0, 0, GetExecutablePath().parent_path().parent_path() / "ScopEngine/Assets");
Scop::Scene& splash_scene = SplashScreen();
Scop::ShaderLayout shader_layout(
{
{ 1,
Scop::ShaderSetLayout({
{ 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER },
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER }
})
}
}, {}
);
std::shared_ptr<Scop::Shader> shader = Scop::LoadShaderFromFile(GetExecutablePath().parent_path().parent_path() / "Resources/Fragment.spv", Scop::ShaderType::Fragment, std::move(shader_layout));
std::shared_ptr<Scop::Shader> shader = Scop::LoadShaderFromFile(GetExecutablePath().parent_path().parent_path() / "Resources/Fragment.spv", Scop::ShaderType::Fragment, Scop::DefaultShaderLayout);
Scop::SceneDescriptor main_scene_desc;
main_scene_desc.fragment_shader = shader;
@@ -32,10 +20,9 @@ int main(int ac, char** av)
Scop::Vec2ui32 skybox_size;
main_scene.AddSkybox(std::make_shared<Scop::CubeTexture>(Scop::LoadBMPFile(GetResourcesPath() / "skybox.bmp", skybox_size), skybox_size.x, skybox_size.y));
World world(main_scene);
engine.Run();
world.Quit();
{
World world(main_scene);
engine.Run();
}
return 0;
}