| 173 | } |
| 174 | |
| 175 | void common_init() { |
| 176 | // Create a PBR floor material |
| 177 | tex_t tex_color = tex_create_file("test.png"); |
| 178 | //tex_t tex_norm = tex_create_file("test_normal.png"); |
| 179 | floor_mat = material_copy_id(default_id_material); |
| 180 | material_set_texture(floor_mat, "diffuse", tex_color); |
| 181 | //material_set_texture(floor_mat, "normal", tex_norm); |
| 182 | material_set_float (floor_mat, "tex_scale", 6); |
| 183 | material_set_float (floor_mat, "roughness", 1.0f); |
| 184 | material_set_float (floor_mat, "metallic", 0.5f); |
| 185 | material_set_queue_offset(floor_mat, 1); |
| 186 | if (tex_color != nullptr) tex_release(tex_color); |
| 187 | //if (tex_norm != nullptr) tex_release(tex_norm); |
| 188 | |
| 189 | // Procedurally create a cube model |
| 190 | mesh_t mesh_cube = mesh_gen_cube(vec3_one, 0); |
| 191 | floor_model = model_create_mesh(mesh_cube, floor_mat); |
| 192 | mesh_release(mesh_cube); |
| 193 | |
| 194 | // Build a physical floor! |
| 195 | vec3 pos = vec3{ 0,-1.5f,0 }; |
| 196 | vec3 scale = vec3{ 5,1,5 }; |
| 197 | floor_tr = matrix_trs(pos, quat_identity, scale); |
| 198 | floor_solid = solid_create(pos, quat_identity, solid_type_immovable); |
| 199 | solid_add_box (floor_solid, scale); |
| 200 | |
| 201 | demo_select_pose.position = vec3{0, 0, -0.4f}; |
| 202 | demo_select_pose.orientation = quat_lookat(vec3_forward, vec3_zero); |
| 203 | |
| 204 | // Log some system info |
| 205 | const char* text = ""; |
| 206 | log_infof("Device: %s", device_get_name()); |
| 207 | log_infof("GPU: %s", device_get_gpu()); |
| 208 | switch (device_get_tracking()) { case device_tracking_none: text = "none"; break; case device_tracking_3dof: text = "3dof"; break; case device_tracking_6dof: text = "6dof"; break; } |
| 209 | log_infof("Tracking: %s", text); |
| 210 | log_infof("Hands: %s", device_has_hand_tracking()?"true":"false"); |
| 211 | log_infof("Eyes: %s", device_has_eye_gaze()?"true":"false"); |
| 212 | switch (device_display_get_type()) { case display_type_none: text = "none"; break; case display_type_flatscreen: text = "flatscreen"; break; case display_type_stereo: text = "stereo"; break; } |
| 213 | log_infof("Display Type: %s", text); |
| 214 | switch (device_display_get_blend()) { case display_blend_additive: text = "additive"; break; case display_blend_blend: text = "blend"; break; case display_blend_opaque: text = "opaque"; break; case display_blend_none: text = "none"; break; default: text = "unknown"; break; } |
| 215 | log_infof("Display Blend: %s", text); |
| 216 | log_infof("Display FoV: %.0f, %.0f, %.0f, %.0f", |
| 217 | device_display_get_fov().right, |
| 218 | device_display_get_fov().left, |
| 219 | device_display_get_fov().top, |
| 220 | device_display_get_fov().bottom); |
| 221 | log_infof("Display Hz: %.1f", device_display_get_refresh_rate()); |
| 222 | log_infof("Display Size: %d<~BLK>x<~clr>%d", device_display_get_width(), device_display_get_height()); |
| 223 | } |
| 224 | |
| 225 | void common_update() { |
| 226 | static app_focus_ prev_focus = app_focus_hidden; |
no test coverage detected