diff --git a/examples/36-sky/vs_sky_ColorBandingFix.sc b/examples/36-sky/fs_sky_color_banding_fix.sc similarity index 99% rename from examples/36-sky/vs_sky_ColorBandingFix.sc rename to examples/36-sky/fs_sky_color_banding_fix.sc index cee2b1640..6782e03e3 100644 --- a/examples/36-sky/vs_sky_ColorBandingFix.sc +++ b/examples/36-sky/fs_sky_color_banding_fix.sc @@ -25,14 +25,14 @@ float nrand(in vec2 n) float n4rand_ss(in vec2 n) { float nrnd0 = nrand( n + 0.07*fract( u_parameters.w ) ); - float nrnd1 = nrand( n + 0.11*fract( u_parameters.w + 0.573953 ) ); + float nrnd1 = nrand( n + 0.11*fract( u_parameters.w + 0.573953 ) ); return 0.23*sqrt(-log(nrnd0+0.00001))*cos(2.0*3.141592*nrnd1)+0.5; } void main() { float size2 = u_parameters.x * u_parameters.x; - + vec3 lightDir = normalize(u_sunDirection.xyz); float distance = 2.0 * (1.0 - dot(normalize(v_viewDir), lightDir)); float sun = exp(-distance/ u_parameters.y / size2) + step(distance, size2); @@ -41,6 +41,6 @@ void main() color = toGamma(color); float r = n4rand_ss(v_screenPos); color += vec3(r, r, r) / 40.0; - + gl_FragColor = vec4(color, 1.0); } diff --git a/examples/36-sky/makefile b/examples/36-sky/makefile new file mode 100644 index 000000000..94d3aae70 --- /dev/null +++ b/examples/36-sky/makefile @@ -0,0 +1,10 @@ +# +# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +# + +BGFX_DIR=../.. +RUNTIME_DIR=$(BGFX_DIR)/examples/runtime +BUILD_DIR=../../.build + +include $(BGFX_DIR)/scripts/shader.mk diff --git a/examples/36-sky/sky.cpp b/examples/36-sky/sky.cpp index 1146a005b..102179729 100644 --- a/examples/36-sky/sky.cpp +++ b/examples/36-sky/sky.cpp @@ -1,7 +1,7 @@ /* -* Copyright 2017 Stanislav Pidhorskyi. All rights reserved. -* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -*/ + * Copyright 2017 Stanislav Pidhorskyi. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ /* * This example demonstrates: @@ -227,7 +227,7 @@ namespace class SunController { public: - enum Month :int + enum Month : int { January = 0, February, @@ -333,7 +333,7 @@ namespace ProceduralSky::ScreenPosVertex::init(); m_skyProgram = loadProgram("vs_sky", "fs_sky"); - m_skyProgram_colorBandingFix = loadProgram("vs_sky", "fs_sky_ColorBandingFix"); + m_skyProgram_colorBandingFix = loadProgram("vs_sky", "fs_sky_color_banding_fix"); m_preventBanding = true; @@ -529,7 +529,6 @@ namespace ImGui::End(); } - bool update() override { if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState)) diff --git a/examples/assets/meshes/meshes.ninja b/examples/assets/meshes/meshes.ninja index f8a95dac4..cc88f052a 100644 --- a/examples/assets/meshes/meshes.ninja +++ b/examples/assets/meshes/meshes.ninja @@ -15,3 +15,4 @@ build $meshes/tree1b_lod1_1.bin: geometryc_pack_normal $pwd/tree1b build $meshes/tree1b_lod1_2.bin: geometryc_pack_normal $pwd/tree1b_lod1_2.obj build $meshes/tree1b_lod2_1.bin: geometryc_pack_normal $pwd/tree1b_lod2_1.obj build $meshes/tree1b_lod2_2.bin: geometryc_pack_normal $pwd/tree1b_lod2_2.obj +build $meshes/test_scene.bin: geometryc_pack_normal $pwd/../sky/test_scene.obj diff --git a/examples/assets/textures/textures.ninja b/examples/assets/textures/textures.ninja index f273052a2..bc7f67c51 100644 --- a/examples/assets/textures/textures.ninja +++ b/examples/assets/textures/textures.ninja @@ -9,3 +9,4 @@ build $textures/texture_compression_etc2.ktx: texturec_etc2 $pwd/texture_compres build $textures/parallax-d.ktx: texturec_diffuse $pwd/parallax-d.png build $textures/parallax-n.ktx: texturec_normal $pwd/parallax-n.png build $textures/parallax-h.ktx: texturec_height $pwd/parallax-h.png +build $textures/lightmap.ktx: texturec_height $pwd/../sky/lightmap.png diff --git a/examples/makefile b/examples/makefile index 63741147a..3a5fff89c 100644 --- a/examples/makefile +++ b/examples/makefile @@ -35,6 +35,8 @@ rebuild: @make -s --no-print-directory rebuild -C 31-rsm @make -s --no-print-directory rebuild -C 33-pom # @make -s --no-print-directory rebuild -C 34-mvs +# @make -s --no-print-directory rebuild -C 35-dynamic + @make -s --no-print-directory rebuild -C 36-sky @make -s --no-print-directory rebuild -C common/debugdraw @make -s --no-print-directory rebuild -C common/font @make -s --no-print-directory rebuild -C common/imgui diff --git a/examples/runtime/meshes/bunny.bin b/examples/runtime/meshes/bunny.bin index 794ec22c7..e3aaed17b 100644 Binary files a/examples/runtime/meshes/bunny.bin and b/examples/runtime/meshes/bunny.bin differ diff --git a/examples/runtime/meshes/bunny_decimated.bin b/examples/runtime/meshes/bunny_decimated.bin index 74810680e..d2f2f07e3 100644 Binary files a/examples/runtime/meshes/bunny_decimated.bin and b/examples/runtime/meshes/bunny_decimated.bin differ diff --git a/examples/runtime/meshes/bunny_patched.bin b/examples/runtime/meshes/bunny_patched.bin index 4031761a5..217bffeb5 100644 Binary files a/examples/runtime/meshes/bunny_patched.bin and b/examples/runtime/meshes/bunny_patched.bin differ diff --git a/examples/runtime/meshes/column.bin b/examples/runtime/meshes/column.bin index a58c780d1..2d1d1dc5d 100644 Binary files a/examples/runtime/meshes/column.bin and b/examples/runtime/meshes/column.bin differ diff --git a/examples/runtime/meshes/cube.bin b/examples/runtime/meshes/cube.bin index 9395fc6a3..874c9408e 100644 Binary files a/examples/runtime/meshes/cube.bin and b/examples/runtime/meshes/cube.bin differ diff --git a/examples/runtime/meshes/hollowcube.bin b/examples/runtime/meshes/hollowcube.bin index 0ea300901..7e3e4b842 100644 Binary files a/examples/runtime/meshes/hollowcube.bin and b/examples/runtime/meshes/hollowcube.bin differ diff --git a/examples/runtime/meshes/orb.bin b/examples/runtime/meshes/orb.bin index 22b9a8af4..bd454afba 100644 Binary files a/examples/runtime/meshes/orb.bin and b/examples/runtime/meshes/orb.bin differ diff --git a/examples/runtime/meshes/platform.bin b/examples/runtime/meshes/platform.bin index de63c2457..27b604341 100644 Binary files a/examples/runtime/meshes/platform.bin and b/examples/runtime/meshes/platform.bin differ diff --git a/examples/runtime/meshes/test_scene.bin b/examples/runtime/meshes/test_scene.bin new file mode 100644 index 000000000..86e152620 Binary files /dev/null and b/examples/runtime/meshes/test_scene.bin differ diff --git a/examples/runtime/meshes/tree.bin b/examples/runtime/meshes/tree.bin index 93aaea0bc..6daa0cef7 100644 Binary files a/examples/runtime/meshes/tree.bin and b/examples/runtime/meshes/tree.bin differ diff --git a/examples/runtime/meshes/tree1b_lod0_1.bin b/examples/runtime/meshes/tree1b_lod0_1.bin index 66b672664..dcce8a7aa 100644 Binary files a/examples/runtime/meshes/tree1b_lod0_1.bin and b/examples/runtime/meshes/tree1b_lod0_1.bin differ diff --git a/examples/runtime/meshes/tree1b_lod0_2.bin b/examples/runtime/meshes/tree1b_lod0_2.bin index 8cb6e5f9e..c7cdb1dd6 100644 Binary files a/examples/runtime/meshes/tree1b_lod0_2.bin and b/examples/runtime/meshes/tree1b_lod0_2.bin differ diff --git a/examples/runtime/meshes/tree1b_lod1_1.bin b/examples/runtime/meshes/tree1b_lod1_1.bin index 8d69ed81a..d27ea1f0e 100644 Binary files a/examples/runtime/meshes/tree1b_lod1_1.bin and b/examples/runtime/meshes/tree1b_lod1_1.bin differ diff --git a/examples/runtime/meshes/tree1b_lod1_2.bin b/examples/runtime/meshes/tree1b_lod1_2.bin index 2c903cb9f..08d57375f 100644 Binary files a/examples/runtime/meshes/tree1b_lod1_2.bin and b/examples/runtime/meshes/tree1b_lod1_2.bin differ diff --git a/examples/runtime/meshes/tree1b_lod2_1.bin b/examples/runtime/meshes/tree1b_lod2_1.bin index 5a172df2a..4b8d4b7d2 100644 Binary files a/examples/runtime/meshes/tree1b_lod2_1.bin and b/examples/runtime/meshes/tree1b_lod2_1.bin differ diff --git a/examples/runtime/meshes/tree1b_lod2_2.bin b/examples/runtime/meshes/tree1b_lod2_2.bin index 8b44cb322..821151e0d 100644 Binary files a/examples/runtime/meshes/tree1b_lod2_2.bin and b/examples/runtime/meshes/tree1b_lod2_2.bin differ diff --git a/examples/runtime/shaders/dx11/fs_sky.bin b/examples/runtime/shaders/dx11/fs_sky.bin new file mode 100644 index 000000000..efa83e430 Binary files /dev/null and b/examples/runtime/shaders/dx11/fs_sky.bin differ diff --git a/examples/runtime/shaders/dx11/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/dx11/fs_sky_color_banding_fix.bin new file mode 100644 index 000000000..4f27bda5f Binary files /dev/null and b/examples/runtime/shaders/dx11/fs_sky_color_banding_fix.bin differ diff --git a/examples/runtime/shaders/dx11/fs_sky_landscape.bin b/examples/runtime/shaders/dx11/fs_sky_landscape.bin new file mode 100644 index 000000000..86e0973aa Binary files /dev/null and b/examples/runtime/shaders/dx11/fs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/dx11/vs_sky.bin b/examples/runtime/shaders/dx11/vs_sky.bin new file mode 100644 index 000000000..34523302e Binary files /dev/null and b/examples/runtime/shaders/dx11/vs_sky.bin differ diff --git a/examples/runtime/shaders/dx11/vs_sky_landscape.bin b/examples/runtime/shaders/dx11/vs_sky_landscape.bin new file mode 100644 index 000000000..c7b2078a0 Binary files /dev/null and b/examples/runtime/shaders/dx11/vs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/dx9/fs_sky.bin b/examples/runtime/shaders/dx9/fs_sky.bin new file mode 100644 index 000000000..c4dd3e088 Binary files /dev/null and b/examples/runtime/shaders/dx9/fs_sky.bin differ diff --git a/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin new file mode 100644 index 000000000..2d6725b0b Binary files /dev/null and b/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin differ diff --git a/examples/runtime/shaders/dx9/fs_sky_landscape.bin b/examples/runtime/shaders/dx9/fs_sky_landscape.bin new file mode 100644 index 000000000..14df655f5 Binary files /dev/null and b/examples/runtime/shaders/dx9/fs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/dx9/vs_sky.bin b/examples/runtime/shaders/dx9/vs_sky.bin new file mode 100644 index 000000000..07984d2af Binary files /dev/null and b/examples/runtime/shaders/dx9/vs_sky.bin differ diff --git a/examples/runtime/shaders/dx9/vs_sky_landscape.bin b/examples/runtime/shaders/dx9/vs_sky_landscape.bin new file mode 100644 index 000000000..e73c96f92 Binary files /dev/null and b/examples/runtime/shaders/dx9/vs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/essl/fs_sky.bin b/examples/runtime/shaders/essl/fs_sky.bin new file mode 100644 index 000000000..2f5255b47 Binary files /dev/null and b/examples/runtime/shaders/essl/fs_sky.bin differ diff --git a/examples/runtime/shaders/essl/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/essl/fs_sky_color_banding_fix.bin new file mode 100644 index 000000000..b29146fb1 Binary files /dev/null and b/examples/runtime/shaders/essl/fs_sky_color_banding_fix.bin differ diff --git a/examples/runtime/shaders/essl/fs_sky_landscape.bin b/examples/runtime/shaders/essl/fs_sky_landscape.bin new file mode 100644 index 000000000..d0135478c Binary files /dev/null and b/examples/runtime/shaders/essl/fs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/essl/vs_sky.bin b/examples/runtime/shaders/essl/vs_sky.bin new file mode 100644 index 000000000..30651ac7e Binary files /dev/null and b/examples/runtime/shaders/essl/vs_sky.bin differ diff --git a/examples/runtime/shaders/essl/vs_sky_landscape.bin b/examples/runtime/shaders/essl/vs_sky_landscape.bin new file mode 100644 index 000000000..b90c54552 Binary files /dev/null and b/examples/runtime/shaders/essl/vs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/glsl/fs_sky.bin b/examples/runtime/shaders/glsl/fs_sky.bin new file mode 100644 index 000000000..c78ac5816 Binary files /dev/null and b/examples/runtime/shaders/glsl/fs_sky.bin differ diff --git a/examples/runtime/shaders/glsl/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/glsl/fs_sky_color_banding_fix.bin new file mode 100644 index 000000000..abcc25523 Binary files /dev/null and b/examples/runtime/shaders/glsl/fs_sky_color_banding_fix.bin differ diff --git a/examples/runtime/shaders/glsl/fs_sky_landscape.bin b/examples/runtime/shaders/glsl/fs_sky_landscape.bin new file mode 100644 index 000000000..50aa653ff Binary files /dev/null and b/examples/runtime/shaders/glsl/fs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/glsl/vs_sky.bin b/examples/runtime/shaders/glsl/vs_sky.bin new file mode 100644 index 000000000..bcbc1dda1 Binary files /dev/null and b/examples/runtime/shaders/glsl/vs_sky.bin differ diff --git a/examples/runtime/shaders/glsl/vs_sky_landscape.bin b/examples/runtime/shaders/glsl/vs_sky_landscape.bin new file mode 100644 index 000000000..d56b6b8df Binary files /dev/null and b/examples/runtime/shaders/glsl/vs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/metal/fs_sky.bin b/examples/runtime/shaders/metal/fs_sky.bin new file mode 100644 index 000000000..ec4e5e83b Binary files /dev/null and b/examples/runtime/shaders/metal/fs_sky.bin differ diff --git a/examples/runtime/shaders/metal/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/metal/fs_sky_color_banding_fix.bin new file mode 100644 index 000000000..133d6b9fc Binary files /dev/null and b/examples/runtime/shaders/metal/fs_sky_color_banding_fix.bin differ diff --git a/examples/runtime/shaders/metal/fs_sky_landscape.bin b/examples/runtime/shaders/metal/fs_sky_landscape.bin new file mode 100644 index 000000000..dac3a52b3 Binary files /dev/null and b/examples/runtime/shaders/metal/fs_sky_landscape.bin differ diff --git a/examples/runtime/shaders/metal/vs_sky.bin b/examples/runtime/shaders/metal/vs_sky.bin new file mode 100644 index 000000000..f0b21f2b3 Binary files /dev/null and b/examples/runtime/shaders/metal/vs_sky.bin differ diff --git a/examples/runtime/shaders/metal/vs_sky_landscape.bin b/examples/runtime/shaders/metal/vs_sky_landscape.bin new file mode 100644 index 000000000..c01ad2cb6 Binary files /dev/null and b/examples/runtime/shaders/metal/vs_sky_landscape.bin differ diff --git a/examples/runtime/textures/lightmap.ktx b/examples/runtime/textures/lightmap.ktx new file mode 100644 index 000000000..93daf24a2 Binary files /dev/null and b/examples/runtime/textures/lightmap.ktx differ