Add skybox selection and fix UV issues
This commit is contained in:
parent
22fde39062
commit
af441960e7
8 changed files with 581 additions and 103 deletions
|
@ -1,40 +1,356 @@
|
||||||
[03:38:05 PM] Info: Starting...
|
[04:55:10 AM] Info: Starting...
|
||||||
|
|
||||||
KP3D version 2
|
KP3D version 2
|
||||||
===============================
|
===============================
|
||||||
Copyright (C) kpworld.xyz 2018-2024
|
Copyright (C) kpworld.xyz 2018-2024
|
||||||
Contact me! @kp_cftsz
|
Contact me! @kp_cftsz
|
||||||
|
|
||||||
[03:38:05 PM] Info: Initializing SDL
|
[04:55:10 AM] Info: Initializing SDL
|
||||||
[03:38:05 PM] Info: Initializing OpenGL
|
[04:55:10 AM] Info: Initializing OpenGL
|
||||||
[03:38:05 PM] Info: OpenGL version: 4.6.0 NVIDIA 536.23
|
[04:55:10 AM] Info: OpenGL version: 4.6.0 NVIDIA 536.23
|
||||||
[03:38:05 PM] Info: Initializing GLEW
|
[04:55:10 AM] Info: Initializing GLEW
|
||||||
[03:38:05 PM] Info: Initializing SDL_mixer
|
[04:55:10 AM] Info: Initializing SDL_mixer
|
||||||
[03:38:05 PM] Info: Reticulating splines...
|
[04:55:10 AM] Info: Reticulating splines...
|
||||||
[03:38:05 PM] Info: Ready!
|
[04:55:10 AM] Info: Ready!
|
||||||
[03:38:05 PM] Info: Loading script: build-cylinder.scm
|
[04:55:10 AM] Info: Loading script: build-cylinder.scm
|
||||||
[03:38:05 PM] Info: Loading script: build-stairs.scm
|
[04:55:10 AM] Info: Loading script: build-stairs.scm
|
||||||
[03:38:05 PM] Info: Loading material resource: block.png
|
[04:55:10 AM] Info: Loading material resource: block.png
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/block_n.png
|
[04:55:10 AM] Info: Found normal map texture: materials/block_n.png
|
||||||
[03:38:05 PM] Info: Loading material resource: brick2.jpg
|
[04:55:10 AM] Info: Loading material resource: brick2.jpg
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/brick2_n.jpg
|
[04:55:10 AM] Info: Found normal map texture: materials/brick2_n.jpg
|
||||||
[03:38:05 PM] Info: Loading material resource: bricks.jpg
|
[04:55:10 AM] Info: Loading material resource: bricks.jpg
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/bricks_n.jpg
|
[04:55:10 AM] Info: Found normal map texture: materials/bricks_n.jpg
|
||||||
[03:38:05 PM] Info: Loading material resource: FLAT5_7.png
|
[04:55:10 AM] Info: Loading material resource: FLAT5_7.png
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/FLAT5_7_n.png
|
[04:55:10 AM] Info: Found normal map texture: materials/FLAT5_7_n.png
|
||||||
[03:38:05 PM] Info: Loading material resource: floor0.png
|
[04:55:10 AM] Info: Loading material resource: floor0.png
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/floor0_n.png
|
[04:55:10 AM] Info: Found normal map texture: materials/floor0_n.png
|
||||||
[03:38:05 PM] Info: Loading material resource: floor1.png
|
[04:55:10 AM] Info: Loading material resource: floor1.png
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/floor1_n.png
|
[04:55:10 AM] Info: Found normal map texture: materials/floor1_n.png
|
||||||
[03:38:05 PM] Info: Loading material resource: GRASS2.png
|
[04:55:10 AM] Info: Loading material resource: GRASS2.png
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/GRASS2_n.png
|
[04:55:10 AM] Info: Found normal map texture: materials/GRASS2_n.png
|
||||||
[03:38:05 PM] Info: Loading material resource: hardwood.jpg
|
[04:55:10 AM] Info: Loading material resource: hardwood.jpg
|
||||||
[03:38:05 PM] Info: Found normal map texture: materials/hardwood_n.jpg
|
[04:55:10 AM] Info: Found normal map texture: materials/hardwood_n.jpg
|
||||||
[03:38:05 PM] Info: Map init
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/banner.png
|
||||||
[03:38:05 PM] Info: Finalized mesh with 49 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/crosshair.png
|
||||||
[03:38:14 PM] Info: Finalized mesh with 54 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/empty.png
|
||||||
[03:38:15 PM] Info: Finalized mesh with 54 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/logo.png
|
||||||
[03:38:18 PM] Info: Finalized mesh with 54 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/map_grid.png
|
||||||
[03:38:33 PM] Info: Finalized mesh with 60 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/not_found.png
|
||||||
[03:38:41 PM] Info: Finalized mesh with 68 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/skybox.png
|
||||||
[03:38:41 PM] Info: Finalized mesh with 68 batches
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/uv_test.png
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: .kp3d/water.png
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: dot.png
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: editor/stem.png
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: logo.png
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/sky50e2dd1d496fc.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/sky8.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/sky9.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/skybox.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/skybox_11.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/skybox_14.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/skybox_15.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skyboxes/skybox_3.jpg
|
||||||
|
[04:55:10 AM] Info: Loading texture resource: skybox_16.jpg
|
||||||
|
[04:55:10 AM] Info: Map init
|
||||||
|
[04:55:10 AM] Info: Finalized mesh with 49 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:23 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:24 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:25 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:26 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:27 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:30 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 47 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:31 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:32 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:33 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:33 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:33 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:33 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
[04:55:34 AM] Info: Finalized mesh with 48 batches
|
||||||
|
|
|
@ -304,6 +304,10 @@ void Map::BuildQuad(Sector& sector, Wall& wall, Flat& flat_topr, Flat& flat_bott
|
||||||
// Fix up the UVs so they keep the right scale
|
// Fix up the UVs so they keep the right scale
|
||||||
float tw = texture_scale / wall.materials[mat_type]->textures[MAT_TEX_DIFFUSE].GetWidth();
|
float tw = texture_scale / wall.materials[mat_type]->textures[MAT_TEX_DIFFUSE].GetWidth();
|
||||||
float th = texture_scale / wall.materials[mat_type]->textures[MAT_TEX_DIFFUSE].GetHeight();
|
float th = texture_scale / wall.materials[mat_type]->textures[MAT_TEX_DIFFUSE].GetHeight();
|
||||||
|
if (flip)
|
||||||
|
tw *= -1;
|
||||||
|
// TODO: Consider offsetting the UV by the length of the wall beside it
|
||||||
|
// This will mitigate most texture alignment issues you'd otherwise have to fix manually
|
||||||
Vertex3D vtxa = Vertex3D(fva, Vec2(au * tw + uv_offset.x/128.0f, av * th + uv_offset.y/128.0f));
|
Vertex3D vtxa = Vertex3D(fva, Vec2(au * tw + uv_offset.x/128.0f, av * th + uv_offset.y/128.0f));
|
||||||
Vertex3D vtxb = Vertex3D(fvb, Vec2(bu * tw + uv_offset.x/128.0f, bv * th + uv_offset.y/128.0f));
|
Vertex3D vtxb = Vertex3D(fvb, Vec2(bu * tw + uv_offset.x/128.0f, bv * th + uv_offset.y/128.0f));
|
||||||
Vertex3D vtxc = Vertex3D(fvc, Vec2(cu * tw + uv_offset.x/128.0f, cv * th + uv_offset.y/128.0f));
|
Vertex3D vtxc = Vertex3D(fvc, Vec2(cu * tw + uv_offset.x/128.0f, cv * th + uv_offset.y/128.0f));
|
||||||
|
@ -558,7 +562,7 @@ void Map::Init()
|
||||||
m_mesh.Reset();
|
m_mesh.Reset();
|
||||||
sectors.reserve(10000);
|
sectors.reserve(10000);
|
||||||
|
|
||||||
BuildSkybox("skybox_16.jpg");
|
BuildSkybox(res::texture_cache["skyboxes/skybox_14.jpg"].get());
|
||||||
BuildGrid();
|
BuildGrid();
|
||||||
|
|
||||||
//static Texture tex, tex2, tex3, tex4;
|
//static Texture tex, tex2, tex3, tex4;
|
||||||
|
@ -820,8 +824,14 @@ void Map::Render()
|
||||||
kp3d::Renderer3D::PopShader();
|
kp3d::Renderer3D::PopShader();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::BuildSkybox(const std::string& texture_path, float scale)
|
void Map::BuildSkybox(const Texture* texture, float scale)
|
||||||
{
|
{
|
||||||
|
if (const auto& old_batches = skybox_data.mesh.GetBatchesRef();
|
||||||
|
!old_batches.empty() && old_batches.back().texture == texture)
|
||||||
|
return;
|
||||||
|
|
||||||
|
skybox_data.texture = texture;
|
||||||
|
|
||||||
float lxo = 3.0f / 4.0f, lyo = 1.0f / 3.0f; // left quad uv offset
|
float lxo = 3.0f / 4.0f, lyo = 1.0f / 3.0f; // left quad uv offset
|
||||||
float rxo = 1.0f / 4.0f, ryo = 1.0f / 3.0f; // right quad uv offset
|
float rxo = 1.0f / 4.0f, ryo = 1.0f / 3.0f; // right quad uv offset
|
||||||
float fxo = 2.0f / 4.0f, fyo = 1.0f / 3.0f; // front quad uv offset
|
float fxo = 2.0f / 4.0f, fyo = 1.0f / 3.0f; // front quad uv offset
|
||||||
|
@ -869,19 +879,19 @@ void Map::BuildSkybox(const std::string& texture_path, float scale)
|
||||||
Vertex3D(Vec3(-1.0f, 1.0f, 1.0f), Vec2(-(kxo + u), -(kyo + v))),
|
Vertex3D(Vec3(-1.0f, 1.0f, 1.0f), Vec2(-(kxo + u), -(kyo + v))),
|
||||||
Vertex3D(Vec3( 1.0f, -1.0f, 1.0f), Vec2(-(kxo + n), -(kyo + n)))
|
Vertex3D(Vec3( 1.0f, -1.0f, 1.0f), Vec2(-(kxo + n), -(kyo + n)))
|
||||||
};
|
};
|
||||||
m_skybox_data.texture.Load(texture_path);
|
// m_skybox_data.texture.Load(texture_path);
|
||||||
m_skybox_data.mesh.Reset();
|
skybox_data.mesh.Reset();
|
||||||
m_skybox_data.mesh.AddBatch(&m_skybox_data.texture, skybox_vertex_data, true);
|
skybox_data.mesh.AddBatch(skybox_data.texture, skybox_vertex_data, true);
|
||||||
m_skybox_data.mesh.Finalize();
|
skybox_data.mesh.Finalize();
|
||||||
m_skybox_data.transform.scale = Vec3(scale);
|
skybox_data.transform.scale = Vec3(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::RenderSkybox()
|
void Map::RenderSkybox()
|
||||||
{
|
{
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
Renderer3D::PushShader(Renderer3D::GetDefaultShader());
|
Renderer3D::PushShader(Renderer3D::GetDefaultShader());
|
||||||
m_skybox_data.transform.translation = Renderer3D::GetPrimaryCamera()->position;
|
skybox_data.transform.translation = Renderer3D::GetPrimaryCamera()->position;
|
||||||
Renderer3D::DrawMesh(m_skybox_data.mesh, m_skybox_data.transform);
|
Renderer3D::DrawMesh(skybox_data.mesh, skybox_data.transform);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,16 @@ struct Wall
|
||||||
UFLAG_DOUBLESIDED = 1 << 1
|
UFLAG_DOUBLESIDED = 1 << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const Material* materials[3];
|
const Material* materials[3] = {
|
||||||
XYf uv_offset[3];
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
XYf uv_offset[3] = {
|
||||||
|
{0, 0},
|
||||||
|
{0, 0},
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
XYf start;
|
XYf start;
|
||||||
XYf end;
|
XYf end;
|
||||||
|
@ -112,7 +120,7 @@ struct Sector
|
||||||
|
|
||||||
struct Skybox
|
struct Skybox
|
||||||
{
|
{
|
||||||
Texture texture;
|
const Texture* texture;
|
||||||
StaticMesh mesh;
|
StaticMesh mesh;
|
||||||
Transform transform;
|
Transform transform;
|
||||||
};
|
};
|
||||||
|
@ -154,7 +162,7 @@ public:
|
||||||
void Update();
|
void Update();
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
void BuildSkybox(const std::string& texture_path, float scale = 128.0f);
|
void BuildSkybox(const Texture* texture, float scale = 128.0f);
|
||||||
void RenderSkybox();
|
void RenderSkybox();
|
||||||
|
|
||||||
void BuildGrid(float y = 0.0f);
|
void BuildGrid(float y = 0.0f);
|
||||||
|
@ -168,6 +176,7 @@ public:
|
||||||
bool render_wireframe = true;
|
bool render_wireframe = true;
|
||||||
float texture_scale = 128.0f;
|
float texture_scale = 128.0f;
|
||||||
Vec3 grid_box[6];
|
Vec3 grid_box[6];
|
||||||
|
Skybox skybox_data;
|
||||||
|
|
||||||
float test_u = -1.5f, test_l = 3.0f;
|
float test_u = -1.5f, test_l = 3.0f;
|
||||||
|
|
||||||
|
@ -177,7 +186,6 @@ private:
|
||||||
Shader m_grid_shader;
|
Shader m_grid_shader;
|
||||||
float m_grid_y = 0.0f;
|
float m_grid_y = 0.0f;
|
||||||
Texture m_grid_texture;
|
Texture m_grid_texture;
|
||||||
Skybox m_skybox_data;
|
|
||||||
Transform m_transform;
|
Transform m_transform;
|
||||||
Texture m_dot;
|
Texture m_dot;
|
||||||
std::vector<Vec3> m_dots;
|
std::vector<Vec3> m_dots;
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
namespace kp3d::res {
|
namespace kp3d::res {
|
||||||
|
|
||||||
std::unordered_map<std::string, std::shared_ptr<Material>> material_cache;
|
std::unordered_map<std::string, std::shared_ptr<Material>> material_cache;
|
||||||
|
std::unordered_map<std::string, std::shared_ptr<Texture>> texture_cache;
|
||||||
|
|
||||||
void LoadMaterials()
|
void LoadMaterials()
|
||||||
{
|
{
|
||||||
material_cache.clear();
|
material_cache.clear();
|
||||||
|
|
||||||
// Load every available texture
|
// Load every available texture
|
||||||
for (const auto& entry: std::filesystem::recursive_directory_iterator(kp3d::sys::GetTextureDir() + "materials/"))
|
for (const auto& entry: std::filesystem::recursive_directory_iterator(sys::GetTextureDir() + "materials/"))
|
||||||
{
|
{
|
||||||
if (entry.is_directory())
|
if (entry.is_directory())
|
||||||
continue;
|
continue;
|
||||||
|
@ -24,13 +25,13 @@ void LoadMaterials()
|
||||||
std::filesystem::path entry_path = entry.path();
|
std::filesystem::path entry_path = entry.path();
|
||||||
std::string path_str = entry_path.string();
|
std::string path_str = entry_path.string();
|
||||||
|
|
||||||
if (!kp3d::str::EndsWith(path_str, ".png") && !kp3d::str::EndsWith(path_str, ".jpg"))
|
if (!str::EndsWith(path_str, ".png") && !str::EndsWith(path_str, ".jpg"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string filename = std::filesystem::proximate(path_str, kp3d::sys::GetTextureDir() + "materials/").string();
|
std::string filename = std::filesystem::proximate(path_str, sys::GetTextureDir() + "materials/").string();
|
||||||
std::replace(filename.begin(), filename.end(), '\\', '/');
|
std::replace(filename.begin(), filename.end(), '\\', '/');
|
||||||
|
|
||||||
if (kp3d::str::EndsWith(path_str, "_n.png") || kp3d::str::EndsWith(path_str, "_n.jpg"))
|
if (str::EndsWith(path_str, "_n.png") || str::EndsWith(path_str, "_n.jpg"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
KP3D_LOG_INFO("Loading material resource: {}", filename);
|
KP3D_LOG_INFO("Loading material resource: {}", filename);
|
||||||
|
@ -47,4 +48,49 @@ void LoadMaterials()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadTextures()
|
||||||
|
{
|
||||||
|
// Load every available texture
|
||||||
|
for (const auto& entry: std::filesystem::recursive_directory_iterator(sys::GetTextureDir()))
|
||||||
|
{
|
||||||
|
if (entry.is_directory())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::filesystem::path entry_path = entry.path();
|
||||||
|
std::string path_str = entry_path.string();
|
||||||
|
|
||||||
|
if (!str::EndsWith(path_str, ".png") && !str::EndsWith(path_str, ".jpg"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string filename = std::filesystem::proximate(path_str, sys::GetTextureDir()).string();
|
||||||
|
std::replace(filename.begin(), filename.end(), '\\', '/');
|
||||||
|
|
||||||
|
if (str::StartsWith(filename, "materials/"))
|
||||||
|
{
|
||||||
|
// We can either just continue or make this point to the texture in the material cache.
|
||||||
|
// I think I'll opt for the latter.
|
||||||
|
// We can change this behavior if we decide it's not necessary though I guess.
|
||||||
|
std::string mat_path = filename.substr(10);
|
||||||
|
if (str::EndsWith(mat_path, "_n.png") || str::EndsWith(mat_path, "_n.jpg"))
|
||||||
|
continue;
|
||||||
|
if (!material_cache.count(mat_path))
|
||||||
|
{
|
||||||
|
KP3D_LOG_WARNING("LoadTextures() apparently called before LoadMaterials()! Found {} ({})", mat_path, filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Initializing a shared pointer from an already existing pointer to something
|
||||||
|
// Not sure how to feel about this...
|
||||||
|
texture_cache.emplace(filename, &material_cache[mat_path]->textures[MAT_TEX_DIFFUSE]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
KP3D_LOG_INFO("Loading texture resource: {}", filename);
|
||||||
|
|
||||||
|
texture_cache.emplace(filename, std::make_shared<Texture>());
|
||||||
|
texture_cache[filename]->Load(filename, true, Texture::FILTER_LINEAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace kp3d::res
|
} // namespace kp3d::res
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
namespace kp3d::res {
|
namespace kp3d::res {
|
||||||
|
|
||||||
extern std::unordered_map<std::string, std::shared_ptr<Material>> material_cache;
|
extern std::unordered_map<std::string, std::shared_ptr<Material>> material_cache;
|
||||||
|
extern std::unordered_map<std::string, std::shared_ptr<Texture>> texture_cache;
|
||||||
|
|
||||||
void LoadMaterials();
|
void LoadMaterials();
|
||||||
|
void LoadTextures();
|
||||||
|
|
||||||
} // namespace kp3d::res
|
} // namespace kp3d::res
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
//
|
||||||
|
// WARNING: This code is messy atm, will clean later (allegedly)
|
||||||
|
//
|
||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
@ -237,16 +240,16 @@ void Editor::Update()
|
||||||
|
|
||||||
KEY_SHORTCUT(SPACE, m_mode = MODE_NORMAL);
|
KEY_SHORTCUT(SPACE, m_mode = MODE_NORMAL);
|
||||||
KEY_SHORTCUT(V, m_mode = MODE_BUILD);
|
KEY_SHORTCUT(V, m_mode = MODE_BUILD);
|
||||||
|
|
||||||
KEY_SHORTCUT(Z, {
|
KEY_SHORTCUT(Z, {
|
||||||
if (sandbox->IsKeyDown(kp3d::KEY_LCTRL))
|
if (sandbox->IsKeyDown(kp3d::KEY_LCTRL))
|
||||||
Undo();
|
Undo();
|
||||||
});
|
});
|
||||||
|
|
||||||
KEY_SHORTCUT(Y, {
|
KEY_SHORTCUT(Y, {
|
||||||
if (sandbox->IsKeyDown(kp3d::KEY_LCTRL))
|
if (sandbox->IsKeyDown(kp3d::KEY_LCTRL))
|
||||||
Redo();
|
Redo();
|
||||||
});
|
});
|
||||||
|
KEY_SHORTCUT(F2, show_grid ^= 1);
|
||||||
|
KEY_SHORTCUT(TAB, show_selection_info ^= 1);
|
||||||
|
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +260,8 @@ void Editor::Update()
|
||||||
|
|
||||||
void Editor::RenderMap()
|
void Editor::RenderMap()
|
||||||
{
|
{
|
||||||
sandbox->map.RenderGrid();
|
if (show_grid)
|
||||||
|
sandbox->map.RenderGrid();
|
||||||
|
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +300,7 @@ void Editor::RebuildMap()
|
||||||
{
|
{
|
||||||
double start = kp3d::CurrentTimeInMilliseconds().count();
|
double start = kp3d::CurrentTimeInMilliseconds().count();
|
||||||
sandbox->map.Rebuild(kp3d::GEN_NORMALS);
|
sandbox->map.Rebuild(kp3d::GEN_NORMALS);
|
||||||
|
sandbox->map.BuildSkybox(sandbox->map.skybox_data.texture);
|
||||||
m_build_time = kp3d::CurrentTimeInMilliseconds().count() - start;
|
m_build_time = kp3d::CurrentTimeInMilliseconds().count() - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,28 +863,43 @@ void Editor::RenderUI()
|
||||||
ImGui::BeginMainMenuBar();
|
ImGui::BeginMainMenuBar();
|
||||||
if (ImGui::BeginMenu("File"))
|
if (ImGui::BeginMenu("File"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Exit")) exit(0);
|
if (ImGui::MenuItem("Save", "Ctrl+S")) {}
|
||||||
|
if (ImGui::MenuItem("Save As...", "Ctrl+Shift+S")) {}
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::MenuItem("Exit", "Alt+F4")) exit(0);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("Edit"))
|
if (ImGui::BeginMenu("Edit"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Undo")) Undo();
|
if (ImGui::MenuItem("Undo", "Ctrl+Z")) Undo();
|
||||||
if (ImGui::MenuItem("Redo")) Redo();
|
if (ImGui::MenuItem("Redo", "Ctrl+Y")) Redo();
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::MenuItem("Set Skybox..."))
|
||||||
|
RenderUITextureSelect(&sandbox->map.skybox_data.texture, "skyboxes/");
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginMenu("Mode"))
|
||||||
|
{
|
||||||
|
if (ImGui::MenuItem("Normal Mode", "Space")) m_mode = MODE_NORMAL;
|
||||||
|
if (ImGui::MenuItem("Build Mode", "V")) m_mode = MODE_BUILD;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("View"))
|
if (ImGui::BeginMenu("View"))
|
||||||
{
|
{
|
||||||
ImGui::Checkbox("Info Overlay", &show_info_overlay);
|
ImGui::MenuItem("Show Info Overlay", nullptr, &show_info_overlay);
|
||||||
ImGui::Checkbox("Selection Info", &show_selection_info);
|
// ImGui::Checkbox("Selection Info", &show_selection_info);
|
||||||
|
ImGui::MenuItem("Show Selection Info", "Tab", &show_selection_info);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Checkbox("Wireframe", &sandbox->map.render_wireframe);
|
ImGui::MenuItem("Show Wireframe", "F1", &sandbox->map.render_wireframe);
|
||||||
|
ImGui::MenuItem("Show Grid", "F2", &show_grid);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Checkbox("Console", &kp3d::console::open);
|
ImGui::MenuItem("Open Console", "`", & kp3d::console::open);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("Help"))
|
if (ImGui::BeginMenu("Help"))
|
||||||
{
|
{
|
||||||
ImGui::Checkbox("About KP3Dii", &show_about_view);
|
if (ImGui::MenuItem("About KP3Dii...", nullptr))
|
||||||
|
show_about_view = true;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
ImGui::EndMainMenuBar();
|
ImGui::EndMainMenuBar();
|
||||||
|
@ -964,6 +983,9 @@ void Editor::RenderUI()
|
||||||
if (!m_materials_to_update.empty())
|
if (!m_materials_to_update.empty())
|
||||||
RenderUIMaterialModal();
|
RenderUIMaterialModal();
|
||||||
|
|
||||||
|
if (!m_textures_to_update.empty())
|
||||||
|
RenderUITextureModal();
|
||||||
|
|
||||||
anything_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) || ImGui::IsAnyItemHovered();
|
anything_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) || ImGui::IsAnyItemHovered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1090,6 @@ void Editor::RenderUIMaterialSelect(const char* name, int type, const kp3d::Mate
|
||||||
std::string str = "Set " + kp3d::str::ToLower(name) + " material...";
|
std::string str = "Set " + kp3d::str::ToLower(name) + " material...";
|
||||||
if (ImGui::Button(str.c_str())) {}
|
if (ImGui::Button(str.c_str())) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::RenderUIMaterialModal()
|
void Editor::RenderUIMaterialModal()
|
||||||
|
@ -1079,43 +1100,31 @@ void Editor::RenderUIMaterialModal()
|
||||||
ImGui::SetNextWindowSize(ImVec2(960, 720), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(960, 720), ImGuiCond_FirstUseEver);
|
||||||
if (ImGui::BeginPopupModal("Select Material"))
|
if (ImGui::BeginPopupModal("Select Material"))
|
||||||
{
|
{
|
||||||
ImGui::InputText("Filter by Name", m_tex_filter_buf, std::size(m_tex_filter_buf));
|
ImGui::InputText("Filter by Name", m_mat_filter_buf, std::size(m_mat_filter_buf));
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
bool should_remove_texture = ImGui::Button("Remove material");
|
||||||
bool should_remove_texture = false;
|
bool should_close = ImGui::Button("Cancel");
|
||||||
if (ImGui::Button("Remove material"))
|
|
||||||
should_remove_texture = true;
|
|
||||||
|
|
||||||
bool should_close = false;
|
|
||||||
if (ImGui::Button("Cancel"))
|
|
||||||
should_close = true;
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Clear search")) memset(m_mat_filter_buf, 0, 512);
|
||||||
if (ImGui::Button("Clear search"))
|
|
||||||
memset(m_tex_filter_buf, 0, 512);
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
ImGui::BeginChild("MaterialList");
|
||||||
ImGui::BeginChild("TextureList");
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
const kp3d::Material* chosen_tex = nullptr;
|
const kp3d::Material* chosen_tex = nullptr;
|
||||||
bool should_update_texture = false;
|
bool should_update_texture = false;
|
||||||
using namespace std::regex_constants;
|
using namespace std::regex_constants;
|
||||||
for (const auto& [path, tex_ptr] : kp3d::res::material_cache)
|
for (const auto& [path, tex_ptr] : kp3d::res::material_cache)
|
||||||
{
|
{
|
||||||
if (strlen(m_tex_filter_buf) > 0)
|
if (strlen(m_mat_filter_buf) > 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!std::regex_search(path, std::regex(std::string(m_tex_filter_buf), icase)))
|
if (!std::regex_search(path, std::regex(std::string(m_mat_filter_buf), icase)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
catch (std::regex_error& e)
|
catch (std::regex_error& e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const kp3d::Material* tex = tex_ptr.get();
|
const kp3d::Material* tex = tex_ptr.get();
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
|
@ -1129,18 +1138,13 @@ void Editor::RenderUIMaterialModal()
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
//int ww = (int)ImGui::GetTopMostPopupModal()->Size.x;
|
|
||||||
int ww = (int)ImGui::GetWindowSize().x;
|
int ww = (int)ImGui::GetWindowSize().x;
|
||||||
|
if (i % ((ww <= 256 ? 602 : ww - 96) / 128) != 0) // line wrap hack
|
||||||
// Some ugly hardcoding here
|
|
||||||
// Basically this controls the texture preview line wrapping
|
|
||||||
if (i % ((ww <= 256 ? 602 : ww - 96) / 128) != 0)
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
// Should we rebuild the map when we change stuff? I guess.
|
|
||||||
if (should_remove_texture)
|
if (should_remove_texture)
|
||||||
{
|
{
|
||||||
for (auto mats : m_materials_to_update)
|
for (auto mats : m_materials_to_update)
|
||||||
|
@ -1170,7 +1174,103 @@ void Editor::RenderUIMaterialModal()
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should probably rename this as its behavior doesn't reflect RenderUIMaterialSelect
|
||||||
|
void Editor::RenderUITextureSelect(const kp3d::Texture** texture, const char* filter)
|
||||||
|
{
|
||||||
|
memset(m_tex_filter_buf, '\0', std::size(m_tex_filter_buf));
|
||||||
|
|
||||||
|
if (filter)
|
||||||
|
strcpy(m_tex_filter_buf, filter);
|
||||||
|
|
||||||
|
m_textures_to_update.clear();
|
||||||
|
m_textures_to_update.push_back(texture);
|
||||||
|
should_show_texture_modal = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::RenderUITextureModal()
|
||||||
|
{
|
||||||
|
if (should_show_texture_modal)
|
||||||
|
ImGui::OpenPopup("Select Texture");
|
||||||
|
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(960, 720), ImGuiCond_FirstUseEver);
|
||||||
|
if (ImGui::BeginPopupModal("Select Texture"))
|
||||||
|
{
|
||||||
|
ImGui::InputText("Filter by Name##tex", m_tex_filter_buf, std::size(m_tex_filter_buf));
|
||||||
|
ImGui::Separator();
|
||||||
|
bool should_remove_texture = ImGui::Button("Remove texture##tex");
|
||||||
|
bool should_close = ImGui::Button("Cancel##tex");
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Clear search##tex")) memset(m_tex_filter_buf, 0, 512);
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::BeginChild("TextureList");
|
||||||
|
int i = 10000;
|
||||||
|
const kp3d::Texture* chosen_tex = nullptr;
|
||||||
|
bool should_update_texture = false;
|
||||||
|
using namespace std::regex_constants;
|
||||||
|
for (const auto& [path, tex_ptr] : kp3d::res::texture_cache)
|
||||||
|
{
|
||||||
|
if (strlen(m_tex_filter_buf) > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!std::regex_search(path, std::regex(std::string(m_tex_filter_buf), icase)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch (std::regex_error& e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const kp3d::Texture* tex = tex_ptr.get();
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
ImGui::PushID(i);
|
||||||
|
bool tex_img_button = ImGui::ImageButton((ImTextureID)tex->GetGLID(), {128, 128});
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGui::SetTooltip(path.c_str());
|
||||||
|
if (tex_img_button)
|
||||||
|
{
|
||||||
|
should_update_texture = true;
|
||||||
|
chosen_tex = tex;
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
ImGui::EndGroup();
|
||||||
|
int ww = (int)ImGui::GetWindowSize().x;
|
||||||
|
if (i % ((ww <= 256 ? 602 : ww - 96) / 128) != 0) // line wrap hack
|
||||||
|
ImGui::SameLine();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
if (should_remove_texture)
|
||||||
|
{
|
||||||
|
for (auto texs: m_textures_to_update)
|
||||||
|
*texs = nullptr;
|
||||||
|
m_textures_to_update.clear();
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
should_show_texture_modal = false;
|
||||||
|
RebuildMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (should_close)
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
should_show_texture_modal = false;
|
||||||
|
RebuildMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (should_update_texture)
|
||||||
|
{
|
||||||
|
for (auto texs: m_textures_to_update)
|
||||||
|
*texs = chosen_tex;
|
||||||
|
m_textures_to_update.clear();
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
should_show_texture_modal = false;
|
||||||
|
RebuildMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::OnScrollWheel(const kp3d::ScrollWheelEvent* e)
|
void Editor::OnScrollWheel(const kp3d::ScrollWheelEvent* e)
|
||||||
|
|
|
@ -51,11 +51,12 @@ public:
|
||||||
void RenderUIAbout();
|
void RenderUIAbout();
|
||||||
void RenderUIMaterialSelect(const char* name, int type, const kp3d::Material** material);
|
void RenderUIMaterialSelect(const char* name, int type, const kp3d::Material** material);
|
||||||
void RenderUIMaterialModal();
|
void RenderUIMaterialModal();
|
||||||
|
void RenderUITextureSelect(const kp3d::Texture** texture, const char* filter = nullptr);
|
||||||
|
void RenderUITextureModal();
|
||||||
|
|
||||||
void OnScrollWheel(const kp3d::ScrollWheelEvent* e);
|
void OnScrollWheel(const kp3d::ScrollWheelEvent* e);
|
||||||
void OnKeyPress(const kp3d::KeyPressEvent* e);
|
void OnKeyPress(const kp3d::KeyPressEvent* e);
|
||||||
|
|
||||||
|
|
||||||
// Undo/redo stack
|
// Undo/redo stack
|
||||||
struct MapData
|
struct MapData
|
||||||
{
|
{
|
||||||
|
@ -87,10 +88,14 @@ private:
|
||||||
bool show_info_overlay = true;
|
bool show_info_overlay = true;
|
||||||
bool show_selection_info = false;
|
bool show_selection_info = false;
|
||||||
bool show_about_view = false;
|
bool show_about_view = false;
|
||||||
bool should_show_material_modal = false;
|
bool show_grid = true;
|
||||||
char m_tex_filter_buf[512];
|
|
||||||
bool editing_gizmo = false;
|
bool editing_gizmo = false;
|
||||||
|
bool should_show_material_modal = false;
|
||||||
|
bool should_show_texture_modal = false;
|
||||||
|
char m_mat_filter_buf[512];
|
||||||
|
char m_tex_filter_buf[512];
|
||||||
std::vector<const kp3d::Material**> m_materials_to_update;
|
std::vector<const kp3d::Material**> m_materials_to_update;
|
||||||
|
std::vector<const kp3d::Texture**> m_textures_to_update;
|
||||||
|
|
||||||
WallUpdate wall_update;
|
WallUpdate wall_update;
|
||||||
bool can_wall_update = false;
|
bool can_wall_update = false;
|
||||||
|
|
|
@ -17,6 +17,7 @@ Sandbox::Sandbox(const std::string& path):
|
||||||
kp3d::Game(path, "sandbox-cfg.json", "sandbox-log.txt")
|
kp3d::Game(path, "sandbox-cfg.json", "sandbox-log.txt")
|
||||||
{
|
{
|
||||||
kp3d::res::LoadMaterials();
|
kp3d::res::LoadMaterials();
|
||||||
|
kp3d::res::LoadTextures();
|
||||||
|
|
||||||
tex.Load("logo.png");
|
tex.Load("logo.png");
|
||||||
crosshair.Load(".kp3d/crosshair.png");
|
crosshair.Load(".kp3d/crosshair.png");
|
||||||
|
@ -71,16 +72,6 @@ void Sandbox::Update()
|
||||||
map.render_wireframe ^= 1;
|
map.render_wireframe ^= 1;
|
||||||
KeyReset(kp3d::KEY_F1);
|
KeyReset(kp3d::KEY_F1);
|
||||||
}
|
}
|
||||||
if (IsKeyDown(kp3d::KEY_F2))
|
|
||||||
{
|
|
||||||
map.Rebuild(kp3d::GEN_NORMALS);
|
|
||||||
KeyReset(kp3d::KEY_F2);
|
|
||||||
}
|
|
||||||
if (IsKeyDown(kp3d::KEY_F3))
|
|
||||||
{
|
|
||||||
map.Rebuild(kp3d::GEN_SMOOTH_NORMALS);
|
|
||||||
KeyReset(kp3d::KEY_F3);
|
|
||||||
}
|
|
||||||
if (IsKeyDown(kp3d::KEY_B))
|
if (IsKeyDown(kp3d::KEY_B))
|
||||||
{
|
{
|
||||||
//map.Init();
|
//map.Init();
|
||||||
|
|
Loading…
Reference in a new issue