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

Method on_input

samples/engine-performance/engine-performance.cpp:133–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131void sample_engine_performance::on_window_resize(int2 size) {}
132
133void sample_engine_performance::on_input(const app_input_event & event)
134{
135 flycam.handle_input(event);
136 imgui->update_input(event);
137
138 if (event.type == app_input_event::MOUSE && event.action == GLFW_RELEASE)
139 {
140 if (event.value[0] == GLFW_MOUSE_BUTTON_LEFT)
141 {
142 const ray r = cam.get_world_ray(event.cursor, float2(static_cast<float>(event.windowSize.x), static_cast<float>(event.windowSize.y)));
143
144 if (length(r.direction) > 0)
145 {
146 entity_hit_result result = scene.get_collision_system()->raycast(r);
147 if (result.r.hit)
148 {
149 base_object & hit_obj = scene.get_graph().get_object(result.e);
150 material_component * mc = hit_obj.get_component<material_component>();
151 mc->material = material_handle("renderer-wireframe");
152 }
153 }
154 }
155 }
156}
157
158void sample_engine_performance::on_update(const app_update_event & e)
159{

Callers

nothing calls this directly

Calls 7

lengthFunction · 0.85
update_inputMethod · 0.80
get_world_rayMethod · 0.80
raycastMethod · 0.80
get_collision_systemMethod · 0.80
get_objectMethod · 0.80
handle_inputMethod · 0.45

Tested by

no test coverage detected