mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 22:53:35 +00:00
truly fixing crash error
This commit is contained in:
@@ -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()>{}));
|
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;
|
m_generation_status = GenerationState::Quitting;
|
||||||
while(m_generation_status != GenerationState::Finished)
|
while(m_generation_status != GenerationState::Finished)
|
||||||
|
|||||||
@@ -26,14 +26,12 @@ class World
|
|||||||
public:
|
public:
|
||||||
World(Scop::Scene& scene);
|
World(Scop::Scene& scene);
|
||||||
|
|
||||||
void Quit() noexcept;
|
|
||||||
|
|
||||||
[[nodiscard]] inline Scop::Scene& GetScene() noexcept { return m_scene; }
|
[[nodiscard]] inline Scop::Scene& GetScene() noexcept { return m_scene; }
|
||||||
[[nodiscard]] inline std::shared_ptr<Scop::Material> GetBlockMaterial() const { return p_block_material; }
|
[[nodiscard]] inline std::shared_ptr<Scop::Material> GetBlockMaterial() const { return p_block_material; }
|
||||||
[[nodiscard]] Scop::NonOwningPtr<Chunk> GetChunk(Scop::Vec2i position);
|
[[nodiscard]] Scop::NonOwningPtr<Chunk> GetChunk(Scop::Vec2i position);
|
||||||
[[nodiscard]] Noise& GetNoiseGenerator() noexcept { return m_noise; }
|
[[nodiscard]] Noise& GetNoiseGenerator() noexcept { return m_noise; }
|
||||||
|
|
||||||
~World() = default;
|
~World();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UnloadChunks();
|
void UnloadChunks();
|
||||||
|
|||||||
@@ -8,20 +8,8 @@
|
|||||||
int main(int ac, char** av)
|
int main(int ac, char** av)
|
||||||
{
|
{
|
||||||
Scop::ScopEngine engine(ac, av, "Vox", 0, 0, GetExecutablePath().parent_path().parent_path() / "ScopEngine/Assets");
|
Scop::ScopEngine engine(ac, av, "Vox", 0, 0, GetExecutablePath().parent_path().parent_path() / "ScopEngine/Assets");
|
||||||
|
|
||||||
Scop::Scene& splash_scene = SplashScreen();
|
Scop::Scene& splash_scene = SplashScreen();
|
||||||
|
std::shared_ptr<Scop::Shader> shader = Scop::LoadShaderFromFile(GetExecutablePath().parent_path().parent_path() / "Resources/Fragment.spv", Scop::ShaderType::Fragment, Scop::DefaultShaderLayout);
|
||||||
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));
|
|
||||||
|
|
||||||
Scop::SceneDescriptor main_scene_desc;
|
Scop::SceneDescriptor main_scene_desc;
|
||||||
main_scene_desc.fragment_shader = shader;
|
main_scene_desc.fragment_shader = shader;
|
||||||
@@ -32,10 +20,9 @@ int main(int ac, char** av)
|
|||||||
Scop::Vec2ui32 skybox_size;
|
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));
|
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);
|
World world(main_scene);
|
||||||
|
|
||||||
engine.Run();
|
engine.Run();
|
||||||
|
}
|
||||||
world.Quit();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Scop
|
|||||||
// Only static meshes for now
|
// Only static meshes for now
|
||||||
class Model
|
class Model
|
||||||
{
|
{
|
||||||
|
friend class ScopEngine;
|
||||||
friend Model LoadModelFromObjFile(std::filesystem::path path) noexcept;
|
friend Model LoadModelFromObjFile(std::filesystem::path path) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -74,6 +74,17 @@ namespace Scop
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<Shader> LoadShaderFromFile(const std::filesystem::path& filepath, ShaderType type, ShaderLayout layout);
|
std::shared_ptr<Shader> LoadShaderFromFile(const std::filesystem::path& filepath, ShaderType type, ShaderLayout layout);
|
||||||
|
|
||||||
|
static const Scop::ShaderLayout DefaultShaderLayout(
|
||||||
|
{
|
||||||
|
{ 1,
|
||||||
|
Scop::ShaderSetLayout({
|
||||||
|
{ 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER },
|
||||||
|
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ namespace Scop
|
|||||||
#endif
|
#endif
|
||||||
m_scene_renderer.Destroy();
|
m_scene_renderer.Destroy();
|
||||||
m_renderer.Destroy();
|
m_renderer.Destroy();
|
||||||
|
Model::s_default_material.reset();
|
||||||
p_renderer_core.reset();
|
p_renderer_core.reset();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
Message("Successfully executed !");
|
Message("Successfully executed !");
|
||||||
|
|||||||
Reference in New Issue
Block a user