Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions LevelScene
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Scene: LevelScene
Environment: assets/skybox/monkstown_castle_4k.hdr
Entities:
- Entity: Point Light 1
Transform:
Position: [-0.400000006, 7.69999981, -10.1999998]
Scale: [0.899999976, 0.899999976, -3.70000005]
Rotation: [0, 0, 0]
Quaternion: [0, 0, 0, 1]
Mesh Source:
Model Path: ""
Diffuse: ""
Specular: ""
Point Light:
Color: [1, 1.55999994, 2.92000008, 1.90999997]
Attenuation: 10.0769997
Ambient: [1, 1, 1, 1]
Diffuse: [1, 1, 1, 1]
Specular: [1, 1, 1, 1]
- Entity: Viking Room
Transform:
Position: [-8, 1.79999995, 1.5]
Scale: [1, 1, 1]
Rotation: [2.29999995, 95.9000015, 91.8000031]
Quaternion: [0, 0, 0, 1]
Mesh Source:
Model Path: assets/models/viking_room.obj
Diffuse: assets/models/viking_room.png
Specular: ""
Point Light:
Color: [1, 1, 1, 1]
Attenuation: 1
Ambient: [1, 1, 1, 1]
Diffuse: [1, 1, 1, 1]
Specular: [1, 1, 1, 1]
Physics Body:
Linear Velocity: [0, 10, 0]
Angular Velocity: [-0.100000001, 0, 0]
Force: [0, 0, 0]
Impulse: [0, 10, 0]
Torque: [0, 0, 0]
Mass Factor: 1
Center Mass Position: [0, 0, 0]
Friction: 15
Restitution: 0.300000012
Body Movement Type: 2
Body Layer Type: 1
Box Collider:
Half Extent: [0.5, 0.5, 0.5]
Sphere Collider:
Radius: 1
- Entity: Cube
Transform:
Position: [-7.5999999, 4.67999983, -1.79999995]
Scale: [1, 1, 1]
Rotation: [2.9000001, 16.5, 0.600000024]
Quaternion: [-1.5550123e-08, -1.33205403e-05, -1.63867355e-08, 1]
Mesh Source:
Model Path: assets/models/cube.obj
Diffuse: assets/models/container_diffuse.png
Specular: assets/models/wallace_gromit_image.jpg
Physics Body:
Linear Velocity: [-7.65907615e-11, -2.44006509e-10, 2.08939643e-10]
Angular Velocity: [2.11050205e-10, -3.93799064e-16, 7.73631575e-11]
Force: [0, 0, 0]
Impulse: [0, 0, 0]
Torque: [0, 0, 0]
Mass Factor: 1
Center Mass Position: [-2.70028043, 1.2799989, 4.10127163]
Friction: 0.800000012
Restitution: 0.200000003
Body Movement Type: 2
Body Layer Type: 1
Box Collider:
Half Extent: [1, 1, 1]
Sphere Collider:
Radius: 0.5
4 changes: 2 additions & 2 deletions atlas/core/application.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export namespace atlas {

ref<scene> current_scene = m_current_world->current();

invoke_start(current_scene.get());

m_renderer->current_scene_context(current_scene);

// Bug-prone API.
Expand All @@ -135,8 +137,6 @@ export namespace atlas {
m_renderer->preload(
m_window->current_swapchain().swapchain_renderpass());

invoke_start(current_scene.get());

/*
- flecs::system is how your able to schedule changes for given
portions of data in this case the projection/view matrices are
Expand Down
4 changes: 4 additions & 0 deletions atlas/core/scene/components.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export namespace atlas {
}
};

struct environment {
std::string filepath="";
};

struct material_metadata {
glm::vec4 ambient{ 0.2f };
glm::vec4 diffuse{ 0.5f };
Expand Down
15 changes: 15 additions & 0 deletions atlas/core/scene/scene.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import atlas.core.utilities;
import atlas.core.event;
import atlas.core.scene.game_object;
import atlas.core.scene.uuid;
import atlas.core.scene.components;

export namespace atlas {
/**
Expand Down Expand Up @@ -229,6 +230,20 @@ export namespace atlas {
*/
[[nodiscard]] uint64_t unique_id() const { return m_scene_uuid; }


void set_environment_map(const std::string& p_filepath) {
environment environment_mapping = {
.filepath = p_filepath,
};

m_registry.set(environment_mapping);
}

template<typename T>
[[nodiscard]] const T* get() const {
return m_registry.get<T>();
}

/**
* @brief Requires to return flecs::world is returned by reference to
* prevent making copies of flecs::world
Expand Down
11 changes: 11 additions & 0 deletions atlas/core/serialize/serializer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import atlas.common;
import atlas.core.scene;
import atlas.core.serialize.types;
import atlas.core.scene.components;
import atlas.logger;

namespace atlas {
// used to serialize entities
Expand Down Expand Up @@ -234,6 +235,16 @@ namespace atlas {
return false;
}

console_log_info("Before loading environment mappings!");
std::string environment_map_data="";
if(data["Environment"]) {
environment_map_data = data["Environment"].as<std::string>();

console_log_info("Environment Map Loaded Path (from yaml): {}", environment_map_data);
}

p_registry.set<environment>({ .filepath = environment_map_data });

YAML::Node entity_objects = data["Entities"];

if (entity_objects) {
Expand Down
11 changes: 3 additions & 8 deletions atlas/drivers/vulkan/render_system.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,10 @@ export namespace atlas::vulkan {
// };
// m_skybox = environment_map(m_device, faces,
// m_physical.memory_properties(), m_final_renderpass); std::string
// filename = "assets/skybox/rogland_clear_night_24k.hdr";
// std::string filename = "assets/skybox/HDR_multi_nebulae_1.hdr";
std::string filename =
"assets/skybox/HDR_silver_and_gold_nebulae.hdr";
// m_skybox = environment_map(m_device,
// std::filesystem::path("assets/skybox/monkstown_castle_4k.hdr"),
// m_physical.memory_properties(), m_final_renderpass);

const environment* environment_data = m_current_scene->get<environment>();
m_skybox = environment_map(m_device,
std::filesystem::path(filename),
std::filesystem::path(environment_data->filepath),
m_physical.memory_properties(),
m_final_renderpass);

Expand Down
5 changes: 2 additions & 3 deletions atlas/drivers/vulkan/uniforms.cppm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module;

#include <glm/glm.hpp>
#include <array>

export module atlas.drivers.vulkan.uniforms;

Expand Down Expand Up @@ -42,7 +43,6 @@ export namespace atlas::vulkan {
struct geometry_uniform {
glm::mat4 model{ 1.f };
glm::vec4 color{ 1.f };
// std::vector<std::string> texture_paths;
};

/**
Expand Down Expand Up @@ -70,7 +70,6 @@ export namespace atlas::vulkan {

struct light_scene_ubo {
alignas(16) uint32_t num_lights;
// alignas(16) std::array<point_light, 10> light_sources;
alignas(16) point_light_ubo light_sources[10];
alignas(16) std::array<point_light_ubo, 10> light_sources;
};
};
5 changes: 5 additions & 0 deletions editor/level_scene.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ public:
}

flecs::world registry = *this;

// TODO: Should consider having this be a custom UI property to the editor.
auto viking_room = entity("Viking Room");
atlas::mesh_source* src = viking_room.get_mut<atlas::mesh_source>();
src->flip = true;
m_physics_engine = atlas::physics::engine(registry, *event_handle());
}

Expand Down
Loading