Misc renderer improvements:
- Reuse renderer and gltf loader between scenes - Use puish descriptors to simplify the management of descriptor sets in the scene renderer - Don't keep the imgui swapchain in the scene classes - Fix alpha blending, add alpha masking - Fix mipmaps not being used in renderer - Add cache when loading images and models - Only premultiply the colours if required - Add support for gltTF animations Allow removing an object and its descendants from the scene, allow loading from a memory buffer
This commit is contained in:
@@ -182,7 +182,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
|
||||
id = std::string(root["profileId"]);
|
||||
|
||||
std::vector<std::tuple<std::string, entt::entity, entt::registry>> models;
|
||||
std::vector<std::tuple<std::string, entt::entity, std::shared_ptr<entt::registry>>> models;
|
||||
std::vector<json_visual_response> json_responses;
|
||||
|
||||
// Fill models with the different models to be loaded and their name ("left" or "right")
|
||||
@@ -193,9 +193,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
// std::string user_path = "/user/hand/" + std::string(layout.key);
|
||||
std::filesystem::path asset_path = json_profile.parent_path() / std::string(layout.value["assetPath"]);
|
||||
|
||||
// scene.load_gltf(asset_path);
|
||||
|
||||
entt::registry & data = std::get<2>(models.emplace_back(layout.key, entt::null, (*scene.loader)(asset_path)));
|
||||
std::shared_ptr<entt::registry> data = std::get<2>(models.emplace_back(layout.key, entt::null, scene.load_gltf(asset_path)));
|
||||
|
||||
for (simdjson::dom::key_value_pair component: simdjson::dom::object(layout.value["components"]))
|
||||
{
|
||||
@@ -221,14 +219,14 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
vr.component_subpath = component_subpath;
|
||||
|
||||
// Check if the node exists
|
||||
find_node_by_name(data, vr.target_node);
|
||||
find_node_by_name(*data, vr.target_node);
|
||||
|
||||
auto node_property = parse_value_node_property(response.value["valueNodeProperty"]);
|
||||
switch (node_property)
|
||||
{
|
||||
case value_node_property::transform: {
|
||||
auto min_node = data.get<components::node>(find_node_by_name(data, std::string(response.value["minNodeName"])));
|
||||
auto max_node = data.get<components::node>(find_node_by_name(data, std::string(response.value["maxNodeName"])));
|
||||
auto min_node = data->get<components::node>(find_node_by_name(*data, std::string(response.value["minNodeName"])));
|
||||
auto max_node = data->get<components::node>(find_node_by_name(*data, std::string(response.value["maxNodeName"])));
|
||||
|
||||
components::details::node_state_transform min{
|
||||
min_node.position,
|
||||
@@ -265,14 +263,10 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
else
|
||||
continue;
|
||||
|
||||
entity = scene.world.create();
|
||||
scene.world.emplace<bound_space>(entity, space);
|
||||
scene.world.emplace<components::node>(entity, components::node{
|
||||
.name = layout,
|
||||
.layer_mask = layer_mask_controller,
|
||||
});
|
||||
|
||||
scene.loader->add_prefab(scene.world, std::move(model), entity);
|
||||
auto [e, node] = scene.add_gltf(model, layer_mask_controller);
|
||||
node.name = layout;
|
||||
entity = e;
|
||||
scene.world.emplace<bound_space>(e, space);
|
||||
|
||||
spdlog::debug("Created entity {}", layout);
|
||||
}
|
||||
@@ -287,7 +281,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
else
|
||||
continue;
|
||||
|
||||
auto && [entity, node] = scene.load_gltf(controller_ray_model_name(), layer_mask_ray);
|
||||
auto && [entity, node] = scene.add_gltf(controller_ray_model_name(), layer_mask_ray);
|
||||
node.name = (std::string)layout.key + "_ray";
|
||||
spdlog::debug("Created entity {}", node.name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user