MCPcopy Create free account
hub / github.com/ddiakopoulos/polymer / scene_editor_app

Method scene_editor_app

apps/editor/editor-app.cpp:15–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15scene_editor_app::scene_editor_app() : polymer_app(1920, 1080, "Polymer Scene Editor")
16{
17 working_dir_on_launch = get_current_directory();
18
19 glfwMakeContextCurrent(window);
20 glfwSwapInterval(1);
21
22 int width, height;
23 glfwGetWindowSize(window, &width, &height);
24 glViewport(0, 0, width, height);
25
26 polymer::log::get()->set_engine_logger(std::make_shared<ImGui::spdlog_editor_sink>(editor_console_log));
27
28 auto asset_base = global_asset_dir::get()->get_asset_dir();
29
30 igm.reset(new gui::imgui_instance(window));
31 gui::make_light_theme();
32 igm->add_font(read_file_binary(asset_base + "/fonts/droid_sans.ttf"));
33
34 cam.look_at({ 0, 5.f, -5.f }, { 0, 3.5f, 0 });
35 cam.farclip = 32.f;
36 flycam.set_camera(&cam);
37
38 load_required_renderer_assets(asset_base, shaderMonitor);
39
40 shaderMonitor.watch("wireframe",
41 asset_base + "/shaders/wireframe_vert.glsl",
42 asset_base + "/shaders/wireframe_frag.glsl",
43 asset_base + "/shaders/wireframe_geom.glsl",
44 asset_base + "/shaders/renderer");
45
46 fullscreen_surface.reset(new simple_texture_view());
47
48 the_scene.reset({ width, height }, true);
49
50 // Load all materials from the assets directory at startup
51 the_scene.resolver->add_search_path(asset_base);
52 the_scene.resolver->resolve();
53
54 polymer::global_debug_mesh_manager::get()->initialize_resources(&the_scene);
55
56 gizmo.reset(new gizmo_controller(&the_scene));
57
58 /*
59 // glTF test imports - load test models at different positions
60 {
61 // Test 1: Triangle (basic indexed geometry)
62 auto triangle_entities = import_asset_runtime(asset_base + "/gltf/Triangle/glTF/Triangle.gltf", the_scene);
63 for (entity e : triangle_entities)
64 {
65 if (auto * xform = the_scene.get_graph().get_object(e).get_component<transform_component>())
66 {
67 xform->local_pose.position = float3(-3.f, 0.f, 0.f);
68 }
69 }
70
71 // Test 2: SciFiHelmet (textured PBR model)
72 auto helmet_entities = import_asset_runtime(asset_base + "/gltf/SciFiHelmet/glTF/SciFiHelmet.gltf", the_scene);

Callers

nothing calls this directly

Calls 14

get_current_directoryFunction · 0.85
make_light_themeFunction · 0.85
read_file_binaryFunction · 0.85
set_engine_loggerMethod · 0.80
get_asset_dirMethod · 0.80
add_fontMethod · 0.80
look_atMethod · 0.80
set_cameraMethod · 0.80
watchMethod · 0.80
initialize_resourcesMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected