Use the mapped_file class instead of asset for assets
This commit is contained in:
@@ -100,7 +100,7 @@ app_launcher::app_launcher(
|
||||
stream.queue_family_index,
|
||||
stream.queue)
|
||||
{
|
||||
default_icon = textures.load_texture("default_icon.ktx2");
|
||||
default_icon = textures.load_texture("assets://default_icon.ktx2");
|
||||
}
|
||||
|
||||
app_launcher::~app_launcher()
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "input_profile.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "asset.h"
|
||||
#include "hardware.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "xr/space.h"
|
||||
#include <entt/entt.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
@@ -175,10 +175,10 @@ struct json_visual_response
|
||||
|
||||
input_profile::input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray)
|
||||
{
|
||||
std::string json = asset(json_profile);
|
||||
utils::mapped_file json{json_profile};
|
||||
|
||||
simdjson::dom::parser parser;
|
||||
simdjson::dom::element root = parser.parse(json);
|
||||
simdjson::dom::element root = parser.parse(reinterpret_cast<const char *>(json.data()), json.size());
|
||||
|
||||
id = std::string(root["profileId"]);
|
||||
|
||||
|
||||
@@ -811,12 +811,12 @@ void scenes::lobby::on_focused()
|
||||
// assert(std::ranges::all_of(views, [width](const XrViewConfigurationView & view) { return view.recommendedImageRectWidth == width; }));
|
||||
// assert(std::ranges::all_of(views, [height](const XrViewConfigurationView & view) { return view.recommendedImageRectHeight == height; }));
|
||||
|
||||
lobby_entity = add_gltf("ground.glb", layer_lobby).first;
|
||||
lobby_entity = add_gltf("assets://ground.glb", layer_lobby).first;
|
||||
|
||||
std::string profile = controller_name();
|
||||
input.emplace(
|
||||
*this,
|
||||
"controllers/" + profile + "/profile.json",
|
||||
"assets://controllers/" + profile + "/profile.json",
|
||||
layer_controllers,
|
||||
layer_rays);
|
||||
|
||||
@@ -842,8 +842,8 @@ void scenes::lobby::on_focused()
|
||||
offset_orientation = glm::degrees(glm::eulerAngles(input->offset[xr::spaces::grip_left].second));
|
||||
ray_offset = input->offset[xr::spaces::aim_left].first.z;
|
||||
|
||||
xyz_axes_left_controller = add_gltf("xyz-arrows.glb", layer_controllers).first;
|
||||
xyz_axes_right_controller = add_gltf("xyz-arrows.glb", layer_controllers).first;
|
||||
xyz_axes_left_controller = add_gltf("assets://xyz-arrows.glb", layer_controllers).first;
|
||||
xyz_axes_right_controller = add_gltf("assets://xyz-arrows.glb", layer_controllers).first;
|
||||
#endif
|
||||
|
||||
recenter_left_action = get_action("recenter_left").first;
|
||||
@@ -872,8 +872,8 @@ void scenes::lobby::on_focused()
|
||||
{
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "right-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "assets://left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "assets://right-hand.glb", layer_controllers);
|
||||
imgui_inputs.push_back({.hand = &*left_hand});
|
||||
imgui_inputs.push_back({.hand = &*right_hand});
|
||||
}
|
||||
@@ -934,7 +934,7 @@ void scenes::lobby::on_focused()
|
||||
auto tm = std::localtime(&t);
|
||||
std::string image = tm->tm_mon == 5 ? "wivrn-pride" : "wivrn";
|
||||
|
||||
about_picture = imgui_ctx->load_texture(image + ".ktx2");
|
||||
about_picture = imgui_ctx->load_texture("assets://" + image + ".ktx2");
|
||||
|
||||
setup_passthrough();
|
||||
session.set_refresh_rate(application::get_config().preferred_refresh_rate.value_or(0));
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "asset.h"
|
||||
#include "configuration.h"
|
||||
#include "crypto.h"
|
||||
#include "scene.h"
|
||||
#include "scenes/lobby_keyboard.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "wifi_lock.h"
|
||||
#include "wivrn_config.h"
|
||||
@@ -75,7 +75,7 @@ class lobby : public scene_impl<lobby>
|
||||
std::optional<xr::foveation_profile> foveation;
|
||||
|
||||
std::string selected_item;
|
||||
std::unique_ptr<asset> license;
|
||||
std::unique_ptr<utils::mapped_file> license;
|
||||
|
||||
static inline const uint32_t layer_lobby = 1 << 0;
|
||||
static inline const uint32_t layer_controllers = 1 << 1;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "android/battery.h"
|
||||
#endif
|
||||
#include "application.h"
|
||||
#include "asset.h"
|
||||
#include "configuration.h"
|
||||
#include "constants.h"
|
||||
#include "imgui.h"
|
||||
@@ -32,6 +31,7 @@
|
||||
#include "lobby.h"
|
||||
#include "scenes/stream.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "version.h"
|
||||
#include "xr/body_tracker.h"
|
||||
@@ -1100,7 +1100,7 @@ void scenes::lobby::gui_licenses()
|
||||
selected_item = *components.begin();
|
||||
try
|
||||
{
|
||||
license = std::make_unique<asset>(std::filesystem::path("licenses") / selected_item);
|
||||
license = std::make_unique<utils::mapped_file>(std::filesystem::path("assets://licenses") / selected_item);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -1113,7 +1113,7 @@ void scenes::lobby::gui_licenses()
|
||||
{
|
||||
try
|
||||
{
|
||||
auto current = std::make_unique<asset>(std::filesystem::path("licenses") / component);
|
||||
auto current = std::make_unique<utils::mapped_file>(std::filesystem::path("assets://licenses") / component);
|
||||
if (ImGui::Selectable(component, component == selected_item, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
selected_item = component;
|
||||
|
||||
Reference in New Issue
Block a user