├── externals ├── .editorconfig ├── jpeg │ └── yasm │ │ ├── README.md │ │ ├── win32 │ │ └── bin │ │ │ ├── yasm.exe │ │ │ └── msvcr100.dll │ │ └── win64 │ │ └── bin │ │ ├── yasm.exe │ │ └── msvcr100.dll ├── stb │ ├── stb.c │ └── CMakeLists.txt ├── avir │ ├── dummy.cpp │ └── CMakeLists.txt ├── dualmc │ ├── dummy.cpp │ └── CMakeLists.txt ├── svector │ ├── dummy.cpp │ └── CMakeLists.txt ├── fastnoise │ ├── dummy.cpp │ └── CMakeLists.txt ├── gamenetworkingsockets │ └── dummy.cpp ├── wamr │ └── os_thread_get_stack_boundary_dummy.c ├── uni-algo │ └── CMakeLists.txt ├── samplerate │ └── CMakeLists.txt ├── hsluv │ └── CMakeLists.txt ├── harfbuzz │ └── CMakeLists.txt ├── cpr │ └── CMakeLists.txt ├── unordered_dense │ └── CMakeLists.txt ├── sheenbidi │ └── CMakeLists.txt ├── plf │ └── CMakeLists.txt ├── tinyexr │ ├── CMakeLists.txt │ └── tinyexr.cpp ├── openxr-sdk │ └── CMakeLists.txt ├── simplefilewatcher │ └── CMakeLists.txt ├── xatlas │ └── CMakeLists.txt ├── vorbis │ └── CMakeLists.txt ├── bc7enc_rdo │ └── CMakeLists.txt ├── glm │ └── CMakeLists.txt ├── msdfgen │ └── CMakeLists.txt ├── dr_libs │ └── CMakeLists.txt ├── fetch_latest.sh ├── freetype │ └── CMakeLists.txt ├── glfw │ └── CMakeLists.txt ├── ogg │ └── CMakeLists.txt ├── cage_gen_module.cmake ├── quickhull │ └── CMakeLists.txt ├── pmp │ └── CMakeLists.txt ├── png │ └── CMakeLists.txt ├── mbedtls │ └── CMakeLists.txt └── webp │ └── CMakeLists.txt ├── data └── cage │ ├── shaders │ ├── .gitignore │ ├── shaders.assets │ ├── shaders.pack │ ├── engine │ │ ├── engine.pack │ │ ├── engine.assets │ │ ├── blitPixels.glsl │ │ ├── blitScaled.glsl │ │ ├── skybox.glsl │ │ ├── icon.glsl │ │ ├── decal.glsl │ │ ├── standard.glsl │ │ ├── billboard.glsl │ │ └── text.glsl │ ├── gui │ │ ├── gui.pack │ │ ├── gui.assets │ │ └── colorPicker.glsl │ ├── functions │ │ ├── restoreNormalMap.glsl │ │ ├── poissonDisk3.glsl │ │ ├── randomAngle.glsl │ │ ├── poissonDisk4.glsl │ │ ├── hsvToRgb.glsl │ │ ├── poissonDisk5.glsl │ │ ├── poissonDisk6.glsl │ │ ├── poissonDisk7.glsl │ │ ├── reconstructPosition.glsl │ │ ├── poissonDisk8.glsl │ │ ├── hash.glsl │ │ ├── makeTangentSpace.glsl │ │ ├── common.glsl │ │ ├── attenuation.glsl │ │ ├── sampleTextureAnimation.glsl │ │ ├── randomFunc.glsl │ │ ├── sampleShadowMap.glsl │ │ ├── fbm.glsl │ │ ├── poissonDisk26.glsl │ │ └── noise.glsl │ └── effects │ │ ├── vertex.glsl │ │ ├── ssaoParams.glsl │ │ ├── effects.pack │ │ ├── effects.assets │ │ ├── makeMip.glsl │ │ ├── ssaoDownscaleDepth.glsl │ │ ├── ssaoResolve.glsl │ │ ├── dofCollect.glsl │ │ ├── bloomApply.glsl │ │ ├── sharpening.glsl │ │ ├── gaussianBlur.glsl │ │ ├── bloomGenerate.glsl │ │ └── tonemap.glsl │ ├── cage.assets │ ├── models │ ├── axes.mtl │ ├── axes-albedo.png │ ├── models.pack │ ├── square.obj │ ├── icon.obj │ ├── bone.obj_DefaultMaterial.cpm │ ├── fake.obj_DefaultMaterial.cpm │ ├── guiElement.obj │ ├── models.assets │ ├── fake.obj │ └── bone.obj │ ├── textures │ ├── credits.txt │ ├── gui.pdn │ ├── gui.png │ ├── helper.jpg │ ├── textures.pack │ ├── tooltips.png │ ├── keybindAdd.png │ ├── keybindClear.png │ ├── keybindRemove.png │ ├── keybindReset.png │ ├── progressbar │ │ ├── 0.png │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ └── 10.png │ ├── readme.md │ └── textures.assets │ ├── sounds │ ├── click.wav │ ├── hover.wav │ ├── sliding.wav │ ├── typing.wav │ ├── comboOpen.wav │ ├── comboSelect.wav │ ├── tooltipOpen.wav │ ├── typingConfirm.wav │ ├── typingInvalid.wav │ ├── sounds.pack │ └── sounds.assets │ ├── fonts │ ├── fonts.pack │ ├── ubuntu │ │ ├── bold.ttf │ │ ├── italic.ttf │ │ ├── regular.ttf │ │ ├── monospace.ttf │ │ ├── modifications.txt │ │ ├── copyright.txt │ │ ├── TRADEMARKS.txt │ │ ├── README.txt │ │ └── CONTRIBUTING.txt │ └── fonts.assets │ └── cage.pack ├── schemes ├── font.scheme ├── pack.scheme ├── shader.scheme ├── object.scheme ├── skeleton.scheme ├── texts.scheme ├── raw.scheme ├── collider.scheme ├── animation.scheme ├── sound.scheme └── model.scheme ├── sources ├── test-core │ ├── wasm │ │ ├── foo.wasm │ │ ├── sums.wasm │ │ ├── natives.wasm │ │ ├── strings.wasm │ │ ├── natives.c │ │ ├── foo.cpp │ │ ├── sums.c │ │ ├── compile.sh │ │ └── strings.c │ ├── copyAndMove.cpp │ ├── pointsOnSphere.cpp │ ├── rectPacking.cpp │ ├── networkHttp.cpp │ ├── logger.cpp │ ├── hashes.cpp │ ├── macros.cpp │ ├── blockContainer.cpp │ ├── installConsistentPaths.cpp │ ├── any.cpp │ ├── networkDiscovery.cpp │ ├── enums.cpp │ ├── main.h │ └── profiling.cpp ├── controller-bindings │ ├── khr_simple.ini │ ├── google_daydreem.ini │ ├── oculus_go.ini │ ├── htc_vive.ini │ ├── microsoft_motion.ini │ ├── valve_index.ini │ └── oculus_touch.ini ├── include │ ├── cage-core │ │ ├── networkUtils.h │ │ ├── memoryAlloca.h │ │ ├── mat3x4.h │ │ ├── meshShapes.h │ │ ├── hashes.h │ │ ├── stringLiteral.h │ │ ├── audioChannelsConverter.h │ │ ├── entitiesSerialization.h │ │ ├── memoryInplaceBuffer.h │ │ ├── timer.h │ │ ├── meshIoCommon.h │ │ ├── scopeGuard.h │ │ ├── guid.h │ │ ├── hashBuffer.h │ │ ├── assetsSchemes.h │ │ ├── networkTcp.h │ │ ├── memoryCompression.h │ │ ├── signedDistanceFunctions.h │ │ ├── assetHeader.h │ │ ├── threadPool.h │ │ ├── hashString.h │ │ ├── systemInformation.h │ │ ├── networkDiscovery.h │ │ ├── networkHttp.h │ │ ├── rectPacking.h │ │ ├── skeletalAnimationPreparator.h │ │ ├── audioDirectionalConverter.h │ │ ├── networkWebsocket.h │ │ ├── assetContext.h │ │ ├── sampleRateConverter.h │ │ ├── stdHash.h │ │ ├── color.h │ │ ├── lineReader.h │ │ ├── pointerRangeHolder.h │ │ ├── marchingCubes.h │ │ ├── endianness.h │ │ ├── imageImport.h │ │ ├── meshExport.h │ │ ├── process.h │ │ ├── memoryArena.h │ │ └── audioAlgorithms.h │ ├── cage-simple │ │ ├── cameraRay.h │ │ ├── guiInWorld.h │ │ ├── fpsCamera.h │ │ └── fullscreenSwitcher.h │ └── cage-engine │ │ ├── clipboard.h │ │ ├── soundCommon.h │ │ ├── winMain.h │ │ ├── sceneCustomDraw.h │ │ ├── speakerList.h │ │ ├── scenePicking.h │ │ ├── gamepad.h │ │ ├── screenList.h │ │ ├── sound.h │ │ ├── assetsSchemes.h │ │ ├── sceneScreenSpaceEffects.h │ │ ├── renderObject.h │ │ ├── lodSelection.h │ │ ├── graphicsCommon.h │ │ ├── speaker.h │ │ ├── sceneRender.h │ │ ├── sceneVirtualReality.h │ │ ├── screenSpaceEffectsProperties.h │ │ ├── soundsQueue.h │ │ ├── soundsVoices.h │ │ ├── shader.h │ │ ├── spirv.h │ │ └── graphicsBuffer.h ├── test-ginnel │ ├── common.h │ ├── client.cpp │ └── runner.cpp ├── libcore │ ├── windowsMinimumInclude.h │ ├── audio │ │ ├── audio.h │ │ ├── flac.cpp │ │ ├── ogg.cpp │ │ └── mp3.cpp │ ├── variableSmoothingBuffer.cpp │ ├── image │ │ └── image.h │ ├── windowsAutoHandle.h │ ├── math │ │ └── math.h │ ├── mesh │ │ ├── mesh.h │ │ └── quickhull.cpp │ └── guid.cpp ├── libengine │ ├── window │ │ └── private.h │ ├── assets │ │ ├── font.cpp │ │ ├── renderObject.cpp │ │ └── shader.cpp │ ├── gui │ │ └── layouts │ │ │ └── explicitSize.cpp │ └── winMain.cpp ├── libsimple │ └── externs.cpp ├── test-assets │ └── main.cpp ├── asset-processor │ ├── pack.cpp │ ├── processor.h │ ├── skeleton.cpp │ └── raw.cpp └── asset-database │ └── main.cpp ├── .gitignore ├── cmake ├── cage_ide_startup_project.cmake ├── cage_ide_category.cmake ├── cage_default_init.cmake ├── cage-asset-database.in.ini ├── cage_disable_source_build.cmake ├── cage_target_api_macro.cmake ├── cage_list_all_targets.cmake ├── cage_ide_sort_files.cmake ├── cage_ide_working_dir.cmake ├── cage_directory_link.cmake ├── cage_all.cmake ├── cage_fetch_cage_externals.cmake ├── cage_print_all_variables.cmake └── cage_build_destination.cmake ├── .editorconfig ├── LICENSE └── BUILDING.md /externals/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | -------------------------------------------------------------------------------- /data/cage/shaders/.gitignore: -------------------------------------------------------------------------------- 1 | /shaderConventions.h 2 | -------------------------------------------------------------------------------- /data/cage/cage.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | cage.pack 4 | 5 | -------------------------------------------------------------------------------- /data/cage/models/axes.mtl: -------------------------------------------------------------------------------- 1 | newmtl Material 2 | map_Kd axes-albedo.png 3 | -------------------------------------------------------------------------------- /data/cage/shaders/shaders.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | shaders.pack 4 | -------------------------------------------------------------------------------- /data/cage/textures/credits.txt: -------------------------------------------------------------------------------- 1 | helper.jpg taken from blender https://www.blender.org/ 2 | -------------------------------------------------------------------------------- /schemes/font.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor font 3 | index = 14 4 | -------------------------------------------------------------------------------- /schemes/pack.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor pack 3 | index = 0 4 | 5 | -------------------------------------------------------------------------------- /schemes/shader.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor shader 3 | index = 10 4 | -------------------------------------------------------------------------------- /data/cage/sounds/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/click.wav -------------------------------------------------------------------------------- /data/cage/sounds/hover.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/hover.wav -------------------------------------------------------------------------------- /data/cage/textures/gui.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/gui.pdn -------------------------------------------------------------------------------- /data/cage/textures/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/gui.png -------------------------------------------------------------------------------- /externals/jpeg/yasm/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Yasm 3 | 4 | Acquired at http://yasm.tortall.net/ 5 | 6 | -------------------------------------------------------------------------------- /externals/stb/stb.c: -------------------------------------------------------------------------------- 1 | 2 | #define STB_RECT_PACK_IMPLEMENTATION 3 | #include 4 | -------------------------------------------------------------------------------- /schemes/object.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor object 3 | index = 13 4 | 5 | -------------------------------------------------------------------------------- /data/cage/fonts/fonts.pack: -------------------------------------------------------------------------------- 1 | [] 2 | ubuntu/regular.ttf 3 | # the other fonts should not be preloaded 4 | -------------------------------------------------------------------------------- /data/cage/shaders/shaders.pack: -------------------------------------------------------------------------------- 1 | [] 2 | effects/effects.pack 3 | engine/engine.pack 4 | gui/gui.pack 5 | -------------------------------------------------------------------------------- /data/cage/sounds/sliding.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/sliding.wav -------------------------------------------------------------------------------- /data/cage/sounds/typing.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/typing.wav -------------------------------------------------------------------------------- /data/cage/textures/helper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/helper.jpg -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/fonts/ubuntu/bold.ttf -------------------------------------------------------------------------------- /data/cage/sounds/comboOpen.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/comboOpen.wav -------------------------------------------------------------------------------- /data/cage/textures/textures.pack: -------------------------------------------------------------------------------- 1 | [] 2 | progressbar/$.png 3 | gui.png 4 | helper.jpg 5 | tooltips.png 6 | -------------------------------------------------------------------------------- /data/cage/textures/tooltips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/tooltips.png -------------------------------------------------------------------------------- /sources/test-core/wasm/foo.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/sources/test-core/wasm/foo.wasm -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/fonts/ubuntu/italic.ttf -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/fonts/ubuntu/regular.ttf -------------------------------------------------------------------------------- /data/cage/models/axes-albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/models/axes-albedo.png -------------------------------------------------------------------------------- /data/cage/sounds/comboSelect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/comboSelect.wav -------------------------------------------------------------------------------- /data/cage/sounds/tooltipOpen.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/tooltipOpen.wav -------------------------------------------------------------------------------- /data/cage/sounds/typingConfirm.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/typingConfirm.wav -------------------------------------------------------------------------------- /data/cage/sounds/typingInvalid.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/sounds/typingInvalid.wav -------------------------------------------------------------------------------- /data/cage/textures/keybindAdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/keybindAdd.png -------------------------------------------------------------------------------- /sources/test-core/wasm/sums.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/sources/test-core/wasm/sums.wasm -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/monospace.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/fonts/ubuntu/monospace.ttf -------------------------------------------------------------------------------- /data/cage/textures/keybindClear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/keybindClear.png -------------------------------------------------------------------------------- /data/cage/textures/keybindRemove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/keybindRemove.png -------------------------------------------------------------------------------- /data/cage/textures/keybindReset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/keybindReset.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/0.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/1.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/2.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/3.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/4.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/5.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/6.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/7.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/8.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/9.png -------------------------------------------------------------------------------- /externals/avir/dummy.cpp: -------------------------------------------------------------------------------- 1 | void avir_dummy_unused_symbol_to_force_cpp_compilation() 2 | { 3 | // do nothing 4 | } 5 | -------------------------------------------------------------------------------- /sources/test-core/wasm/natives.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/sources/test-core/wasm/natives.wasm -------------------------------------------------------------------------------- /sources/test-core/wasm/strings.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/sources/test-core/wasm/strings.wasm -------------------------------------------------------------------------------- /data/cage/textures/progressbar/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/data/cage/textures/progressbar/10.png -------------------------------------------------------------------------------- /externals/dualmc/dummy.cpp: -------------------------------------------------------------------------------- 1 | void dualmc_dummy_unused_symbol_to_force_cpp_compilation() 2 | { 3 | // do nothing 4 | } 5 | -------------------------------------------------------------------------------- /externals/jpeg/yasm/win32/bin/yasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/externals/jpeg/yasm/win32/bin/yasm.exe -------------------------------------------------------------------------------- /externals/jpeg/yasm/win64/bin/yasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/externals/jpeg/yasm/win64/bin/yasm.exe -------------------------------------------------------------------------------- /externals/svector/dummy.cpp: -------------------------------------------------------------------------------- 1 | void svector_dummy_unused_symbol_to_force_cpp_compilation() 2 | { 3 | // do nothing 4 | } 5 | -------------------------------------------------------------------------------- /externals/fastnoise/dummy.cpp: -------------------------------------------------------------------------------- 1 | void fastnoise_dummy_unused_symbol_to_force_cpp_compilation() 2 | { 3 | // do nothing 4 | } 5 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/engine.pack: -------------------------------------------------------------------------------- 1 | [] 2 | blitPixels.glsl 3 | blitScaled.glsl 4 | icon.glsl 5 | standard.glsl 6 | text.glsl 7 | -------------------------------------------------------------------------------- /data/cage/textures/readme.md: -------------------------------------------------------------------------------- 1 | tooltips.png 2 | ----------- 3 | made from gui.png 4 | apply sepia: 10 % 5 | apply HSV: lighness 20 6 | -------------------------------------------------------------------------------- /externals/jpeg/yasm/win32/bin/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/externals/jpeg/yasm/win32/bin/msvcr100.dll -------------------------------------------------------------------------------- /externals/jpeg/yasm/win64/bin/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/HEAD/externals/jpeg/yasm/win64/bin/msvcr100.dll -------------------------------------------------------------------------------- /data/cage/models/models.pack: -------------------------------------------------------------------------------- 1 | [] 2 | axes.obj 3 | bone.obj 4 | fake.obj 5 | guiElement.obj 6 | icon.obj 7 | sphere.obj 8 | square.obj 9 | -------------------------------------------------------------------------------- /data/cage/cage.pack: -------------------------------------------------------------------------------- 1 | [] 2 | fonts/fonts.pack 3 | models/models.pack 4 | shaders/shaders.pack 5 | sounds/sounds.pack 6 | textures/textures.pack 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build* 2 | /Win32 3 | /x64 4 | /.vs 5 | /out 6 | CMakeLists.txt.user 7 | CMakeSettings.json 8 | *~ 9 | *.TMP 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /externals/gamenetworkingsockets/dummy.cpp: -------------------------------------------------------------------------------- 1 | void gamenetworkingsockets_dummy_unused_symbol_to_force_cpp_compilation() 2 | { 3 | // do nothing 4 | } 5 | -------------------------------------------------------------------------------- /data/cage/models/square.obj: -------------------------------------------------------------------------------- 1 | 2 | v 0 0 0 3 | v 1 0 0 4 | v 1 1 0 5 | v 0 1 0 6 | 7 | vt 0 0 8 | vt 1 0 9 | vt 1 1 10 | vt 0 1 11 | 12 | f 1/1 2/2 3/3 4/4 13 | -------------------------------------------------------------------------------- /data/cage/models/icon.obj: -------------------------------------------------------------------------------- 1 | 2 | v -1 -1 0 3 | v +1 -1 0 4 | v +1 +1 0 5 | v -1 +1 0 6 | 7 | vt 0 0 8 | vt 1 0 9 | vt 1 1 10 | vt 0 1 11 | 12 | f 1/1 2/2 3/3 4/4 13 | -------------------------------------------------------------------------------- /schemes/skeleton.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor skeleton 3 | index = 5 4 | 5 | [bakeModel] 6 | display = bake model 7 | type = bool 8 | default = false 9 | -------------------------------------------------------------------------------- /schemes/texts.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor texts 3 | index = 2 4 | 5 | [multilingual] 6 | display = multilingual 7 | type = bool 8 | default = true 9 | -------------------------------------------------------------------------------- /data/cage/models/bone.obj_DefaultMaterial.cpm: -------------------------------------------------------------------------------- 1 | 2 | [base] 3 | roughness = 0.5 4 | metallic = 0 5 | 6 | [mult] 7 | mask = 0 8 | 9 | [textures] 10 | 11 | [flags] 12 | 13 | -------------------------------------------------------------------------------- /externals/wamr/os_thread_get_stack_boundary_dummy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uint8_t * 5 | os_thread_get_stack_boundary() 6 | { 7 | return NULL; 8 | } 9 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/gui.pack: -------------------------------------------------------------------------------- 1 | [] 2 | colorPicker.glsl?F # Flat 3 | colorPicker.glsl?H # Hue 4 | colorPicker.glsl?S # Saturation & Value 5 | element.glsl 6 | font.glsl 7 | image.glsl 8 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/modifications.txt: -------------------------------------------------------------------------------- 1 | 2 | This is modified distribution of Ubuntu Font Family 0.83 3 | 4 | Some of the fonts have been removed. 5 | 6 | The files have been renamed. 7 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/restoreNormalMap.glsl: -------------------------------------------------------------------------------- 1 | 2 | vec3 restoreNormalMap(vec4 n) 3 | { 4 | n.xy = n.xy * 2 - 1; 5 | n.z = sqrt(1 - saturate(dot(n.xy, n.xy))); 6 | return n.xyz; 7 | } 8 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk3.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk3[] = 3 | { 4 | vec2(0.6063219, 0.5190338), 5 | vec2(-0.4597267, 0.382616), 6 | vec2(-0.07430658, -0.5529964) 7 | }; 8 | -------------------------------------------------------------------------------- /data/cage/models/fake.obj_DefaultMaterial.cpm: -------------------------------------------------------------------------------- 1 | [base] 2 | roughness = 0.5 3 | metallic = 0.0 4 | 5 | [mult] 6 | 7 | [textures] 8 | albedo = ../textures/helper.jpg 9 | 10 | [flags] 11 | 12 | -------------------------------------------------------------------------------- /data/cage/sounds/sounds.pack: -------------------------------------------------------------------------------- 1 | [] 2 | click.wav 3 | comboOpen.wav 4 | comboSelect.wav 5 | hover.wav 6 | sliding.wav 7 | tooltipOpen.wav 8 | typing.wav 9 | typingConfirm.wav 10 | typingInvalid.wav 11 | -------------------------------------------------------------------------------- /schemes/raw.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor raw 3 | index = 1 4 | 5 | [compressThreshold] 6 | display = compress threshold (bytes) 7 | type = uint32 8 | default = 4096 9 | 10 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/copyright.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010,2011 Canonical Ltd. 2 | 3 | This Font Software is licensed under the Ubuntu Font Licence, Version 4 | 1.0. https://launchpad.net/ubuntu-font-licence 5 | 6 | -------------------------------------------------------------------------------- /cmake/cage_ide_startup_project.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_ide_startup_project target) 3 | set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT ${target}) 4 | endfunction(cage_ide_startup_project) 5 | -------------------------------------------------------------------------------- /sources/controller-bindings/khr_simple.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/khr/simple_controller 3 | 4 | [] 5 | mapping = select/click 6 | index = 6 7 | [] 8 | mapping = menu/click 9 | index = 7 10 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/randomAngle.glsl: -------------------------------------------------------------------------------- 1 | 2 | float randomAngle(float freq, vec3 pos) 3 | { 4 | float dt = dot(floor(pos * freq), vec3(53.1215, 21.1352, 9.1322)); 5 | return fract(sin(dt) * 2105.2354) * 6.283285; 6 | } 7 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/vertex.glsl: -------------------------------------------------------------------------------- 1 | 2 | $define shader vertex 3 | 4 | layout(location = 0) in vec3 inPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = vec4(inPosition.xy * 2.0 - 1.0, inPosition.z, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk4.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk4[] = 3 | { 4 | vec2(0.3159476, -0.5665059), 5 | vec2(-0.4944367, -0.6350549), 6 | vec2(0.5838032, 0.2641156), 7 | vec2(-0.5519158, 0.2537068) 8 | }; 9 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/TRADEMARKS.txt: -------------------------------------------------------------------------------- 1 | Ubuntu and Canonical are registered trademarks of Canonical Ltd. 2 | 3 | The licence accompanying these works does not grant any rights 4 | under trademark law and all such rights are reserved. 5 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/hsvToRgb.glsl: -------------------------------------------------------------------------------- 1 | 2 | vec3 hsvToRgb(vec3 c) 3 | { 4 | vec4 K = vec4(1, 2.0 / 3, 1.0 / 3, 3); 5 | vec3 p = abs(fract(c.xxx + K.xyz) * 6 - K.www); 6 | return c.z * mix(K.xxx, saturate(p - K.xxx), c.y); 7 | } 8 | -------------------------------------------------------------------------------- /cmake/cage_ide_category.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_ide_category target category) 3 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 4 | set_target_properties(${target} PROPERTIES FOLDER "${category}") 5 | endfunction(cage_ide_category) 6 | 7 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/ssaoParams.glsl: -------------------------------------------------------------------------------- 1 | 2 | layout(std140, set = 2, binding = 0) uniform Ssao 3 | { 4 | mat4 proj; 5 | mat4 projInv; 6 | vec4 params; // strength, bias, power, raysLength 7 | ivec4 iparams; // sampleCount, hashSeed 8 | }; 9 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/engine.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | engine.pack 4 | 5 | [] 6 | scheme = shader 7 | billboard.glsl 8 | blitPixels.glsl 9 | blitScaled.glsl 10 | decal.glsl 11 | icon.glsl 12 | skybox.glsl 13 | standard.glsl 14 | text.glsl 15 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | charset = utf-8 6 | 7 | [*.{c,cpp,h,hpp}] 8 | indent_style = tab 9 | 10 | [{CMakeLists.txt,*.cmake}] 11 | indent_style = tab 12 | 13 | [*.{html,htm}] 14 | indent_style = tab 15 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/gui.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | gui.pack 4 | 5 | [] 6 | scheme = shader 7 | colorPicker.glsl?F # Flat 8 | colorPicker.glsl?H # Hue 9 | colorPicker.glsl?S # Saturation & Value 10 | element.glsl 11 | font.glsl 12 | image.glsl 13 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk5.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk5[] = 3 | { 4 | vec2(0.5653731, 0.1983621), 5 | vec2(-0.2598436, -0.2333631), 6 | vec2(0.5284665, -0.463801), 7 | vec2(-0.1618237, 0.7157764), 8 | vec2(-0.7602307, 0.2693977) 9 | }; 10 | -------------------------------------------------------------------------------- /externals/uni-algo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "uni-algo") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_subdirectory(uni-algo) 6 | -------------------------------------------------------------------------------- /cmake/cage_default_init.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(cage_default_init) 3 | cage_fetch_cage_externals() 4 | cage_disable_source_build() 5 | cage_build_configuration() 6 | cage_build_destination() 7 | cage_assets_init() 8 | cage_copy_redist() 9 | endmacro(cage_default_init) 10 | -------------------------------------------------------------------------------- /externals/samplerate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "samplerate") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_subdirectory(libsamplerate) 6 | -------------------------------------------------------------------------------- /data/cage/fonts/fonts.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | fonts.pack 4 | 5 | [] 6 | scheme = font 7 | ubuntu/bold.ttf 8 | ubuntu/bold.ttf?0 9 | ubuntu/italic.ttf 10 | ubuntu/italic.ttf?0 11 | ubuntu/monospace.ttf 12 | ubuntu/monospace.ttf?0 13 | ubuntu/regular.ttf 14 | ubuntu/regular.ttf?0 15 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/effects.pack: -------------------------------------------------------------------------------- 1 | [] 2 | bloomApply.glsl 3 | bloomGenerate.glsl 4 | dofApply.glsl 5 | dofCollect.glsl 6 | fxaa.glsl 7 | gaussianBlur.glsl 8 | makeMip.glsl 9 | sharpening.glsl 10 | ssaoDownscaleDepth.glsl 11 | ssaoGenerate.glsl 12 | ssaoResolve.glsl 13 | tonemap.glsl 14 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk6.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk6[] = 3 | { 4 | vec2(-0.1975761, -0.02255318), 5 | vec2(-0.6688942, 0.1921623), 6 | vec2(-0.3071649, -0.52874), 7 | vec2(0.5961264, -0.4090785), 8 | vec2(0.05686119, 0.5701958), 9 | vec2(0.4763275, 0.1502644) 10 | }; 11 | -------------------------------------------------------------------------------- /cmake/cage-asset-database.in.ini: -------------------------------------------------------------------------------- 1 | [path] 2 | input = ${input} 3 | schemes = ${schemes} 4 | output = ${output} 5 | intermediate = ${intermediate} 6 | database = ${database}/database 7 | listByHash = ${database}/by-hash.txt 8 | listByName = ${database}/by-name.txt 9 | [database] 10 | outputArchive = true 11 | -------------------------------------------------------------------------------- /data/cage/sounds/sounds.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = sound 3 | mono = true 4 | stream = false 5 | click.wav 6 | comboOpen.wav 7 | comboSelect.wav 8 | hover.wav 9 | sliding.wav 10 | tooltipOpen.wav 11 | typing.wav 12 | typingConfirm.wav 13 | typingInvalid.wav 14 | 15 | [] 16 | scheme = pack 17 | sounds.pack 18 | -------------------------------------------------------------------------------- /externals/hsluv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "hsluv") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(hsluv STATIC hsluv.c hsluv.h) 6 | target_include_directories(hsluv PUBLIC .) 7 | -------------------------------------------------------------------------------- /schemes/collider.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor collider 3 | index = 3 4 | 5 | [bakeModel] 6 | display = bake model 7 | type = bool 8 | default = false 9 | 10 | [axes] 11 | display = axes 12 | type = string 13 | default = +x+y+z 14 | 15 | [scale] 16 | display = scale 17 | type = real 18 | default = 1 19 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk7.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk7[] = 3 | { 4 | vec2(0.7733756, -0.2455644), 5 | vec2(0.003098245, 0.04153573), 6 | vec2(0.04825916, -0.6825925), 7 | vec2(-0.4026896, 0.598035), 8 | vec2(-0.7256346, 0.1406887), 9 | vec2(-0.4616664, -0.6016805), 10 | vec2(0.6860402, 0.450619) 11 | }; 12 | -------------------------------------------------------------------------------- /schemes/animation.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor animation 3 | index = 6 4 | 5 | [bakeModel] 6 | display = bake model 7 | type = bool 8 | default = false 9 | 10 | [skeleton] 11 | display = path to skeleton 12 | hint = leave empty to automatically deduce the name from the name of this file 13 | type = string 14 | -------------------------------------------------------------------------------- /externals/harfbuzz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "harfbuzz") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(SKIP_INSTALL_ALL ON) 6 | add_subdirectory(harfbuzz) 7 | target_include_directories(harfbuzz PUBLIC harfbuzz/src) 8 | -------------------------------------------------------------------------------- /externals/stb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "stb") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB stb-sources "stb/*.h") 6 | add_library(stb STATIC stb.c ${stb-sources}) 7 | target_include_directories(stb PUBLIC stb) 8 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/reconstructPosition.glsl: -------------------------------------------------------------------------------- 1 | 2 | vec3 reconstructPosition(sampler2D texDepth, mat4 vpInv, vec4 viewport) 3 | { 4 | float depth = texelFetch(texDepth, ivec2(gl_FragCoord.xy), 0).x; 5 | vec4 pos = vec4(gl_FragCoord.xy / viewport.zw * 2 - 1, depth, 1); 6 | pos.y = -pos.y; 7 | pos = vpInv * pos; 8 | return pos.xyz / pos.w; 9 | } 10 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/effects.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | effects.pack 4 | 5 | [] 6 | scheme = shader 7 | bloomApply.glsl 8 | bloomGenerate.glsl 9 | dofApply.glsl 10 | dofCollect.glsl 11 | fxaa.glsl 12 | gaussianBlur.glsl 13 | makeMip.glsl 14 | sharpening.glsl 15 | ssaoDownscaleDepth.glsl 16 | ssaoGenerate.glsl 17 | ssaoResolve.glsl 18 | tonemap.glsl 19 | -------------------------------------------------------------------------------- /externals/dualmc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "dualmc") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(dualmc STATIC "dualmc/include/dualmc.h" "dummy.cpp") 6 | 7 | target_include_directories(dualmc PUBLIC dualmc/include) 8 | -------------------------------------------------------------------------------- /sources/controller-bindings/google_daydreem.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/google/daydream_controller 3 | 4 | [] 5 | mapping = trackpad/click 6 | index = 5 7 | [] 8 | mapping = select/click 9 | index = 6 10 | 11 | [] 12 | mapping = trackpad/x 13 | index = 2 14 | type = axis 15 | [] 16 | mapping = trackpad/y 17 | index = 3 18 | type = axis 19 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/makeMip.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | layout(set = 2, binding = 0) uniform sampler2D texColor; 7 | 8 | layout(location = 0) out vec4 outColor; 9 | 10 | void main() 11 | { 12 | vec2 uv = 2 * vec2(gl_FragCoord) / vec2(textureSize(texColor, 0)); 13 | outColor = textureLod(texColor, uv, 0); 14 | } 15 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk8.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk8[] = 3 | { 4 | vec2(0.8835875, -0.03626551), 5 | vec2(0.4562066, -0.8122772), 6 | vec2(0.2414907, -0.2733304), 7 | vec2(-0.2934468, 0.2686865), 8 | vec2(-0.1970636, 0.7619715), 9 | vec2(-0.5787534, -0.4191496), 10 | vec2(0.6065316, 0.4605079), 11 | vec2(-0.8029583, 0.1457353) 12 | }; 13 | -------------------------------------------------------------------------------- /sources/include/cage-core/networkUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_networkUtils_h_qerf45gh88dr 2 | #define guard_networkUtils_h_qerf45gh88dr 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API Disconnected : public Exception 9 | { 10 | using Exception::Exception; 11 | }; 12 | } 13 | 14 | #endif // guard_networkUtils_h_qerf45gh88dr 15 | -------------------------------------------------------------------------------- /sources/test-ginnel/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace cage; 4 | 5 | class Conn 6 | { 7 | public: 8 | bool process(); 9 | }; 10 | 11 | Holder newConn(Holder udp); 12 | 13 | struct Runner 14 | { 15 | Runner(); 16 | void step(); 17 | 18 | private: 19 | uint64 last = 0; 20 | uint64 period = 0; 21 | }; 22 | -------------------------------------------------------------------------------- /externals/fastnoise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "fastnoise") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(fastnoise STATIC fastnoise/Cpp/FastNoiseLite.h dummy.cpp) 6 | target_include_directories(fastnoise PUBLIC fastnoise/Cpp) 7 | 8 | -------------------------------------------------------------------------------- /sources/include/cage-core/memoryAlloca.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_memoryAlloca_h_xc1drft564g57i 2 | #define guard_memoryAlloca_h_xc1drft564g57i 3 | 4 | #ifdef CAGE_SYSTEM_WINDOWS 5 | #include 6 | #define CAGE_ALLOCA(SIZE) _alloca(SIZE) 7 | #else 8 | #include 9 | #define CAGE_ALLOCA(SIZE) alloca(SIZE) 10 | #endif 11 | 12 | #endif // guard_memoryAlloca_h_xc1drft564g57i 13 | -------------------------------------------------------------------------------- /sources/controller-bindings/oculus_go.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/oculus/go_controller 3 | 4 | [] 5 | mapping = trackpad/click 6 | index = 5 7 | [] 8 | mapping = back/click 9 | index = 6 10 | [] 11 | mapping = trigger/click 12 | index = 8 13 | 14 | [] 15 | mapping = trackpad/x 16 | index = 2 17 | type = axis 18 | [] 19 | mapping = trackpad/y 20 | index = 3 21 | type = axis 22 | -------------------------------------------------------------------------------- /sources/include/cage-core/mat3x4.h: -------------------------------------------------------------------------------- 1 | #ifndef header_mat3x4_h_ij4sh9bsd 2 | #define header_mat3x4_h_ij4sh9bsd 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API Mat3x4 9 | { 10 | Vec4 data[3]; 11 | 12 | Mat3x4(); 13 | explicit Mat3x4(Mat3 in); 14 | explicit Mat3x4(Mat4 in); 15 | 16 | explicit operator Mat4() const; 17 | }; 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /sources/libcore/windowsMinimumInclude.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_windowsMinimumInclude_h_ertzi4uhg9v 2 | #define guard_windowsMinimumInclude_h_ertzi4uhg9v 3 | 4 | #ifndef WIN32_LEAN_AND_MEAN 5 | #define WIN32_LEAN_AND_MEAN 6 | #endif 7 | #ifndef VC_EXTRALEAN 8 | #define VC_EXTRALEAN 9 | #endif 10 | #ifndef NOMINMAX 11 | #define NOMINMAX 12 | #endif 13 | 14 | #include "windowsAutoHandle.h" 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /cmake/cage_disable_source_build.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(cage_disable_source_build) 3 | set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) 4 | set(CMAKE_DISABLE_SOURCE_CHANGES ON) 5 | if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") 6 | message(FATAL_ERROR "In-source build is disabled. Remove the already generated files and start again from dedicated build directory.") 7 | endif() 8 | endmacro(cage_disable_source_build) 9 | -------------------------------------------------------------------------------- /externals/cpr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "cpr") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(CPR_USE_SYSTEM_CURL ON CACHE INTERNAL "") 6 | 7 | if (NOT WIN32) 8 | set(CPR_FORCE_MBEDTLS_BACKEND ON CACHE INTERNAL "") 9 | endif() 10 | 11 | add_subdirectory(cpr) 12 | -------------------------------------------------------------------------------- /sources/libcore/audio/audio.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cage 5 | { 6 | class AudioImpl : public Audio 7 | { 8 | public: 9 | MemoryBuffer mem; 10 | uintPtr frames = 0; 11 | uint32 channels = 0, sampleRate = 0; 12 | AudioFormatEnum format = AudioFormatEnum::Default; 13 | }; 14 | 15 | uintPtr formatBytes(AudioFormatEnum format); 16 | } 17 | -------------------------------------------------------------------------------- /externals/unordered_dense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "unordered_dense") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(unordered_dense INTERFACE) 6 | target_include_directories(unordered_dense INTERFACE $) 7 | -------------------------------------------------------------------------------- /sources/libcore/variableSmoothingBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace cage 4 | { 5 | namespace privat 6 | { 7 | Quat averageQuaternions(PointerRange quaternions) 8 | { 9 | Vec3 f, u; 10 | for (const Quat &q : quaternions) 11 | { 12 | f += q * Vec3(0, 0, -1); 13 | u += q * Vec3(0, 1, 0); 14 | } 15 | return Quat(f, u); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/ssaoDownscaleDepth.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | layout(set = 2, binding = 0) uniform sampler2D texDepth; 7 | 8 | layout(location = 0) out float outDepth; 9 | 10 | const int downscale = 3; 11 | 12 | void main() 13 | { 14 | vec2 uv = downscale * vec2(gl_FragCoord) / vec2(textureSize(texDepth, 0)); 15 | outDepth = textureLod(texDepth, uv, 0).x; 16 | } 17 | -------------------------------------------------------------------------------- /data/cage/textures/textures.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = texture 3 | premultiplyAlpha = true 4 | srgb = true 5 | gui.png 6 | tooltips.png 7 | keybindAdd.png 8 | keybindClear.png 9 | keybindRemove.png 10 | keybindReset.png 11 | 12 | [] 13 | scheme = texture 14 | srgb = true 15 | helper.jpg 16 | 17 | [] 18 | scheme = texture 19 | target = array 20 | srgb = true 21 | progressbar/$.png 22 | 23 | [] 24 | scheme = pack 25 | textures.pack 26 | -------------------------------------------------------------------------------- /cmake/cage_target_api_macro.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(cage_target_api_macro target macroname) 3 | if(MSVC) 4 | target_compile_definitions(${target} PRIVATE "${macroname}=__declspec(dllexport)") 5 | target_compile_definitions(${target} INTERFACE "${macroname}=__declspec(dllimport)") 6 | else() 7 | target_compile_definitions(${target} PUBLIC "${macroname}=[[gnu::visibility(\"default\")]]") 8 | endif() 9 | endmacro(cage_target_api_macro) 10 | 11 | -------------------------------------------------------------------------------- /externals/sheenbidi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "sheenbidi") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB_RECURSE sheenbidi-sources "SheenBidi/Headers/*" "SheenBidi/Source/*") 6 | add_library(SheenBidi STATIC ${sheenbidi-sources}) 7 | target_include_directories(SheenBidi PUBLIC SheenBidi/Headers) 8 | -------------------------------------------------------------------------------- /externals/avir/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "avir") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | cage_heavily_optimized() 6 | 7 | add_library(avir STATIC avir/avir.h avir/avir_dil.h avir/avir_float4_sse.h avir/avir_float8_avx.h avir/lancir.h dummy.cpp) 8 | 9 | target_include_directories(avir PUBLIC .) 10 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/ssaoResolve.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | $include ssaoParams.glsl 7 | 8 | layout(set = 2, binding = 1) uniform sampler2D texAo; 9 | 10 | layout(location = 0) out float outAo; 11 | 12 | void main() 13 | { 14 | float ao = texelFetch(texAo, ivec2(gl_FragCoord.xy), 0).x; 15 | ao = pow(max(ao - params[1], 0), params[2]) * params[0]; 16 | outAo = clamp(1 - ao, 0, 1); 17 | } 18 | -------------------------------------------------------------------------------- /sources/include/cage-simple/cameraRay.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_cameraRay_as6erz4gt891edf 2 | #define guard_cameraRay_as6erz4gt891edf 3 | 4 | #include 5 | #include 6 | 7 | namespace cage 8 | { 9 | class Entity; 10 | 11 | Line cameraRay(Entity *camera, Vec2 screenPosition); 12 | Line cameraMouseRay(Entity *camera); 13 | Line cameraCenterRay(Entity *camera); 14 | } 15 | 16 | #endif // guard_cameraRay_as6erz4gt891edf 17 | -------------------------------------------------------------------------------- /data/cage/models/guiElement.obj: -------------------------------------------------------------------------------- 1 | 2 | v 1.1 1.1 1 3 | v 2.1 1.1 2 4 | v 3.1 1.1 3 5 | v 4.1 1.1 4 6 | v 1.1 2.1 5 7 | v 2.1 2.1 6 8 | v 3.1 2.1 7 9 | v 4.1 2.1 8 10 | v 1.1 3.1 9 11 | v 2.1 3.1 10 12 | v 3.1 3.1 11 13 | v 4.1 3.1 12 14 | v 1.1 4.1 13 15 | v 2.1 4.1 14 16 | v 3.1 4.1 15 17 | v 4.1 4.1 16 18 | 19 | f 1 2 6 5 20 | f 2 3 7 6 21 | f 3 4 8 7 22 | f 5 6 10 9 23 | f 6 7 11 10 24 | f 7 8 12 11 25 | f 9 10 14 13 26 | f 10 11 15 14 27 | f 11 12 16 15 28 | -------------------------------------------------------------------------------- /sources/include/cage-engine/clipboard.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_clipboard_h_sfghwhjshjsks4ds65 2 | #define guard_clipboard_h_sfghwhjshjsks4ds65 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_ENGINE_API void setClipboard(const char *str); 9 | CAGE_ENGINE_API void setClipboardString(const String &str); 10 | CAGE_ENGINE_API PointerRange getClipboard(); 11 | CAGE_ENGINE_API String getClipboardString(); 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /cmake/cage_list_all_targets.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_list_all_targets out_var current_dir) 3 | get_property(targets DIRECTORY ${current_dir} PROPERTY BUILDSYSTEM_TARGETS) 4 | get_property(subdirs DIRECTORY ${current_dir} PROPERTY SUBDIRECTORIES) 5 | foreach(subdir ${subdirs}) 6 | cage_list_all_targets(subdir_targets ${subdir}) 7 | list(APPEND targets ${subdir_targets}) 8 | endforeach(subdir) 9 | set(${out_var} ${targets} PARENT_SCOPE) 10 | endfunction() 11 | -------------------------------------------------------------------------------- /externals/plf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "plf") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(plf INTERFACE) 6 | target_include_directories(plf INTERFACE $ $ $) 7 | -------------------------------------------------------------------------------- /sources/include/cage-engine/soundCommon.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_soundCommon_h_dokzt5456rtz45 2 | #define guard_soundCommon_h_dokzt5456rtz45 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_ENGINE_API SoundCallbackData 9 | { 10 | PointerRange buffer; 11 | sint64 time = 0; 12 | uint32 channels = 0; 13 | uint32 frames = 0; 14 | uint32 sampleRate = 0; 15 | }; 16 | } 17 | 18 | #endif // guard_soundCommon_h_dokzt5456rtz45 19 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/blitPixels.glsl: -------------------------------------------------------------------------------- 1 | 2 | $define shader vertex 3 | 4 | layout(location = 0) in vec3 inPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = vec4(inPosition.xy * 2 - 1, inPosition.z, 1); 9 | } 10 | 11 | 12 | $define shader fragment 13 | 14 | layout(set = 2, binding = 0) uniform sampler2D texColor; 15 | 16 | layout(location = 0) out vec4 outColor; 17 | 18 | void main() 19 | { 20 | outColor = texelFetch(texColor, ivec2(gl_FragCoord.xy), 0); 21 | } 22 | -------------------------------------------------------------------------------- /data/cage/models/models.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = model 3 | fake.obj 4 | 5 | [] 6 | scheme = model 7 | uvs = false 8 | bone.obj 9 | 10 | [] 11 | scheme = model 12 | normals = false 13 | icon.obj 14 | square.obj 15 | 16 | [] 17 | scheme = model 18 | uvs = false 19 | normals = false 20 | sphere.obj 21 | guiElement.obj 22 | 23 | [] 24 | scheme = pack 25 | models.pack 26 | 27 | [] 28 | scheme = model 29 | axes.obj 30 | 31 | [] 32 | scheme = texture 33 | srgb = true 34 | axes-albedo.png 35 | -------------------------------------------------------------------------------- /sources/include/cage-core/meshShapes.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_meshShapes_h_vvcj14du74cu89f 2 | #define guard_meshShapes_h_vvcj14du74cu89f 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_CORE_API Holder newMeshSphereUv(Real radius, uint32 segments, uint32 rings); 9 | CAGE_CORE_API Holder newMeshSphereRegular(Real radius, Real edgeLength); 10 | CAGE_CORE_API Holder newMeshIcosahedron(Real radius); 11 | } 12 | 13 | #endif // guard_meshShapes_h_vvcj14du74cu89f 14 | -------------------------------------------------------------------------------- /sources/libcore/image/image.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cage 5 | { 6 | class ImageImpl : public Image 7 | { 8 | public: 9 | MemoryBuffer mem; 10 | uint32 width = 0, height = 0, channels = 0; 11 | ImageFormatEnum format = ImageFormatEnum::Default; 12 | }; 13 | 14 | uint32 formatBytes(ImageFormatEnum format); 15 | 16 | ImageColorConfig defaultConfig(uint32 channels); 17 | 18 | void swapAll(ImageImpl *a, ImageImpl *b); 19 | } 20 | -------------------------------------------------------------------------------- /sources/include/cage-core/hashes.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_hashes_h_41hbvw8e45rfgth 2 | #define guard_hashes_h_41hbvw8e45rfgth 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace cage 9 | { 10 | CAGE_CORE_API std::array hashSha1(PointerRange data); 11 | 12 | CAGE_CORE_API String hashToHexadecimal(PointerRange data); 13 | CAGE_CORE_API String hashToBase64(PointerRange data); 14 | } 15 | 16 | #endif // guard_hashes_h_41hbvw8e45rfgth 17 | -------------------------------------------------------------------------------- /sources/controller-bindings/htc_vive.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/htc/vive_controller 3 | 4 | [] 5 | mapping = trackpad/click 6 | index = 5 7 | [] 8 | mapping = menu/click 9 | index = 7 10 | [] 11 | mapping = trigger/click 12 | index = 8 13 | [] 14 | mapping = squeeze/click 15 | index = 9 16 | 17 | [] 18 | mapping = trackpad/x 19 | index = 2 20 | type = axis 21 | [] 22 | mapping = trackpad/y 23 | index = 3 24 | type = axis 25 | [] 26 | mapping = trigger/value 27 | index = 4 28 | type = axis 29 | -------------------------------------------------------------------------------- /sources/libengine/window/private.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace cage 6 | { 7 | class Window; 8 | 9 | namespace privat 10 | { 11 | struct GraphicsContext; 12 | 13 | Holder &getGlfwContext(Window *w); 14 | } 15 | 16 | void cageGlfwInitializeFunc(); 17 | class Mutex *cageGlfwMutex(); 18 | String getMonitorId(GLFWmonitor *monitor); 19 | GLFWmonitor *getMonitorById(const String &id); 20 | GLFWwindow *getGlfwWindow(Window *w); 21 | } 22 | -------------------------------------------------------------------------------- /cmake/cage_ide_sort_files.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_ide_sort_files target) 3 | get_property(files TARGET ${target} PROPERTY SOURCES) 4 | if(ARGV1) 5 | set(root "${ARGV1}") 6 | else() 7 | set(root "${CMAKE_CURRENT_SOURCE_DIR}") 8 | endif() 9 | unset(files2) 10 | foreach(f ${files}) 11 | cmake_path(IS_PREFIX root "${f}" NORMALIZE ok) 12 | if(ok) 13 | list(APPEND files2 "${f}") 14 | endif() 15 | endforeach() 16 | source_group(TREE "${root}" FILES ${files2}) 17 | endfunction(cage_ide_sort_files) 18 | 19 | -------------------------------------------------------------------------------- /cmake/cage_ide_working_dir.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_ide_working_dir target directory) 3 | set_target_properties(${target} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${directory}") 4 | endfunction(cage_ide_working_dir) 5 | 6 | function(cage_ide_working_dir_in_place target) 7 | if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.13) 8 | cage_ide_working_dir(${target} "$") 9 | else() 10 | cage_ide_working_dir(${target} "$(OutDir)") 11 | endif() 12 | endfunction(cage_ide_working_dir_in_place) 13 | -------------------------------------------------------------------------------- /sources/test-core/wasm/natives.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void cage_test_func1(void); 4 | uint32_t cage_test_func2(uint32_t a, uint64_t b); 5 | void cage_test_func3(const char *); 6 | 7 | void cage_test_call1(void) 8 | { 9 | cage_test_func1(); 10 | } 11 | 12 | void cage_test_call2a(void) 13 | { 14 | cage_test_func2(42, 13000000000123); 15 | } 16 | 17 | void cage_test_call2b(void) 18 | { 19 | cage_test_func2(10, 11); 20 | } 21 | 22 | void cage_test_call3(void) 23 | { 24 | cage_test_func3("hello"); 25 | } 26 | -------------------------------------------------------------------------------- /externals/svector/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "svector") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(svector STATIC) 6 | target_sources(svector PRIVATE dummy.cpp) 7 | target_sources(svector PRIVATE "${CMAKE_CURRENT_LIST_DIR}/svector/svector.natvis") 8 | target_include_directories(svector INTERFACE $) 9 | 10 | -------------------------------------------------------------------------------- /sources/libcore/windowsAutoHandle.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_windowsAutoHandle_h_d5t4hftg85fgujkki 2 | #define guard_windowsAutoHandle_h_d5t4hftg85fgujkki 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace cage 9 | { 10 | struct AutoHandle : private Immovable 11 | { 12 | HANDLE handle = 0; 13 | 14 | void close() 15 | { 16 | if (handle) 17 | { 18 | ::CloseHandle(handle); 19 | handle = 0; 20 | } 21 | } 22 | 23 | ~AutoHandle() { close(); } 24 | }; 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /sources/include/cage-core/stringLiteral.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_stringLiteral_h_fgh4r1se6ft4hj 2 | #define guard_stringLiteral_h_fgh4r1se6ft4hj 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | // use as template parameter 9 | template 10 | struct StringLiteral 11 | { 12 | consteval StringLiteral(const char (&str)[N]) 13 | { 14 | static_assert(N > 0); 15 | detail::memcpy(value, str, N); 16 | } 17 | char value[N]; 18 | }; 19 | } 20 | 21 | #endif // guard_stringLiteral_h_fgh4r1se6ft4hj 22 | -------------------------------------------------------------------------------- /externals/tinyexr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "tinyexr") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(TINYEXR_BUILD_SAMPLE OFF CACHE INTERNAL "Build a sample") 6 | set(TINYEXR_USE_MINIZ OFF CACHE INTERNAL "Use miniz") 7 | 8 | add_library(tinyexr STATIC tinyexr/tinyexr.h tinyexr.cpp) 9 | target_include_directories(tinyexr PUBLIC tinyexr) 10 | target_link_libraries(tinyexr PRIVATE zlib) 11 | 12 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/hash.glsl: -------------------------------------------------------------------------------- 1 | 2 | // integer finalizer hash function 3 | uint hash(uint key) 4 | { 5 | key ^= key >> 16; 6 | key *= 0x85ebca6b; 7 | key ^= key >> 13; 8 | key *= 0xc2b2ae35; 9 | key ^= key >> 16; 10 | return key; 11 | } 12 | 13 | float hash(float p) 14 | { 15 | p = fract(p * 0.011); 16 | p *= p + 7.5; 17 | p *= p + p; 18 | return fract(p); 19 | } 20 | 21 | float hash(vec2 p) 22 | { 23 | vec3 p3 = fract(vec3(p.xyx) * 0.13); 24 | p3 += dot(p3, p3.yzx + 3.333); 25 | return fract((p3.x + p3.y) * p3.z); 26 | } 27 | -------------------------------------------------------------------------------- /externals/openxr-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "openxr-sdk") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | unset(CMAKE_C_STANDARD) 6 | unset(CMAKE_CXX_STANDARD) 7 | 8 | set(DYNAMIC_LOADER OFF CACHE INTERNAL "Build the openxr loader as a .dll library") 9 | set(BUILD_WITH_SYSTEM_JSONCPP OFF CACHE INTERNAL "Use system jsoncpp instead of vendored source in openxr") 10 | 11 | add_subdirectory(OpenXR-SDK) 12 | -------------------------------------------------------------------------------- /externals/simplefilewatcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "simplefilewatcher") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB sources simplefilewatcher/source/*) 6 | add_library(simplefilewatcher STATIC ${sources}) 7 | target_include_directories(simplefilewatcher PUBLIC simplefilewatcher/include) 8 | target_compile_definitions(simplefilewatcher PRIVATE WIN32_LEAN_AND_MEAN VC_EXTRALEAN NOMINMAX) 9 | 10 | -------------------------------------------------------------------------------- /externals/xatlas/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "xatlas") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(xatlas STATIC "xatlas/source/xatlas/xatlas.h" "xatlas/source/xatlas/xatlas.cpp") 6 | 7 | target_include_directories(xatlas PUBLIC "xatlas/source/xatlas") 8 | target_compile_definitions(xatlas PRIVATE "XA_MULTITHREADED=0") 9 | 10 | if(NOT MSVC) 11 | target_link_libraries(xatlas PUBLIC pthread) 12 | endif() 13 | -------------------------------------------------------------------------------- /externals/vorbis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "vorbis") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "BUILD_SHARED_LIBS") 6 | 7 | find_package(OGG) 8 | 9 | add_subdirectory(vorbis) 10 | 11 | target_include_directories(vorbisenc INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/vorbis/include") 12 | target_include_directories(vorbisfile INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/vorbis/include") 13 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/makeTangentSpace.glsl: -------------------------------------------------------------------------------- 1 | 2 | mat3 makeTangentSpace(vec3 N, vec3 p, vec2 uv) 3 | { 4 | // http://www.thetenthplanet.de/archives/1180 5 | uv.y = 1 - uv.y; 6 | vec3 dp1 = dFdx(p); 7 | vec3 dp2 = dFdy(p); 8 | vec2 duv1 = dFdx(uv); 9 | vec2 duv2 = dFdy(uv); 10 | vec3 dp2perp = cross(dp2, N); 11 | vec3 dp1perp = cross(N, dp1); 12 | vec3 T = dp2perp * duv1.x + dp1perp * duv2.x; 13 | vec3 B = dp2perp * duv1.y + dp1perp * duv2.y; 14 | float invmax = inversesqrt(max(dot(T, T), dot(B, B))); 15 | return mat3(T * invmax, B * invmax, N); 16 | } 17 | -------------------------------------------------------------------------------- /cmake/cage_directory_link.cmake: -------------------------------------------------------------------------------- 1 | 2 | if(WIN32) 3 | function(cage_directory_link target name) 4 | if(NOT EXISTS "${name}") 5 | file(TO_NATIVE_PATH "${target}" target) 6 | file(TO_NATIVE_PATH "${name}" name) 7 | execute_process(COMMAND cmd /C mklink /J "${name}" "${target}") 8 | endif() 9 | endfunction(cage_directory_link) 10 | else() 11 | function(cage_directory_link target name) 12 | if(NOT EXISTS "${name}") 13 | execute_process(COMMAND sh -c "ln -s \"${target}\" \"${name}\"") 14 | endif() 15 | endfunction(cage_directory_link) 16 | endif() 17 | 18 | -------------------------------------------------------------------------------- /externals/tinyexr/tinyexr.cpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIN32_LEAN_AND_MEAN 3 | #define WIN32_LEAN_AND_MEAN 4 | #endif 5 | #ifndef VC_EXTRALEAN 6 | #define VC_EXTRALEAN 7 | #endif 8 | #ifndef NOMINMAX 9 | #define NOMINMAX 10 | #endif 11 | 12 | #include 13 | 14 | #define TINYEXR_IMPLEMENTATION 15 | #define TINYEXR_USE_MINIZ 0 16 | #define TINYEXR_USE_ZFP 0 17 | #define TINYEXR_USE_THREAD 0 18 | #define TINYEXR_USE_OPENMP 0 19 | 20 | #ifdef _MSC_VER 21 | #pragma warning(push, 0) 22 | #endif 23 | #include 24 | #ifdef _MSC_VER 25 | #pragma warning(pop) 26 | #endif 27 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/blitScaled.glsl: -------------------------------------------------------------------------------- 1 | 2 | layout(location = 0) varying vec2 varUv; 3 | 4 | 5 | $define shader vertex 6 | 7 | layout(location = 0) in vec3 inPosition; 8 | layout(location = 4) in vec3 inUv; 9 | 10 | void main() 11 | { 12 | gl_Position = vec4(inPosition.xy * 2 - 1, inPosition.z, 1); 13 | varUv = inUv.xy; 14 | } 15 | 16 | 17 | $define shader fragment 18 | 19 | layout(set = 2, binding = 0) uniform sampler2D texColor; 20 | 21 | layout(location = 0) out vec4 outColor; 22 | 23 | void main() 24 | { 25 | outColor = textureLod(texColor, varUv, 0); 26 | } 27 | -------------------------------------------------------------------------------- /data/cage/models/fake.obj: -------------------------------------------------------------------------------- 1 | 2 | v -1 -1 -1 3 | v -1 -1 1 4 | v -1 1 -1 5 | v -1 1 1 6 | v 1 -1 -1 7 | v 1 -1 1 8 | v 1 1 -1 9 | v 1 1 1 10 | 11 | vt 0 0 12 | vt 1 0 13 | vt 1 1 14 | vt 0 1 15 | 16 | vn 0 0 1 17 | vn 0 0 -1 18 | vn 0 1 0 19 | vn 0 -1 0 20 | vn 1 0 0 21 | vn -1 0 0 22 | 23 | f 1/2/2 7/4/2 5/1/2 24 | f 1/2/2 3/3/2 7/4/2 25 | f 1/1/6 4/3/6 3/4/6 26 | f 1/1/6 2/2/6 4/3/6 27 | f 3/4/3 8/2/3 7/3/3 28 | f 3/4/3 4/1/3 8/2/3 29 | f 5/2/5 7/3/5 8/4/5 30 | f 5/2/5 8/4/5 6/1/5 31 | f 1/1/4 5/2/4 6/3/4 32 | f 1/1/4 6/3/4 2/4/4 33 | f 2/1/1 6/2/1 8/3/1 34 | f 2/1/1 8/3/1 4/4/1 35 | -------------------------------------------------------------------------------- /externals/bc7enc_rdo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "bc7enc_rdo") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | cage_heavily_optimized() 6 | 7 | add_library(bc7enc_rdo STATIC 8 | bc7enc_rdo/bc7decomp.cpp bc7enc_rdo/bc7decomp.h 9 | bc7enc_rdo/bc7enc.cpp bc7enc_rdo/bc7enc.h 10 | bc7enc_rdo/rgbcx.cpp bc7enc_rdo/rgbcx.h 11 | ) 12 | 13 | target_include_directories(bc7enc_rdo PRIVATE bc7enc_rdo) 14 | target_include_directories(bc7enc_rdo INTERFACE .) 15 | -------------------------------------------------------------------------------- /sources/test-core/wasm/foo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct Foo 4 | { 5 | int data = 1; 6 | Foo() { data = 2; } 7 | ~Foo() { data = 3; } 8 | }; 9 | 10 | Foo foo; 11 | 12 | extern "C" 13 | { 14 | int get_foo(void) 15 | { 16 | return foo.data; 17 | } 18 | 19 | void set_foo(int v) 20 | { 21 | foo.data = v; 22 | } 23 | } // extern C 24 | 25 | std::map map; 26 | 27 | extern "C" 28 | { 29 | int get_map(int key) 30 | { 31 | return map[key].data; 32 | } 33 | 34 | void set_map(int key, int val) 35 | { 36 | map[key].data = val; 37 | } 38 | } // extern C 39 | -------------------------------------------------------------------------------- /sources/include/cage-core/audioChannelsConverter.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_audioChannelsConverter_h_56dtj4ew89a 2 | #define guard_audioChannelsConverter_h_56dtj4ew89a 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_CORE_API AudioChannelsConverter : private Immovable 9 | { 10 | public: 11 | void convert(PointerRange src, PointerRange dst, uint32 srcChannels, uint32 dstChannels); 12 | }; 13 | 14 | CAGE_CORE_API Holder newAudioChannelsConverter(); 15 | } 16 | 17 | #endif // guard_audioChannelsConverter_h_56dtj4ew89a 18 | -------------------------------------------------------------------------------- /sources/test-core/wasm/sums.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int32_t sum_int32(int32_t a, int32_t b) 4 | { 5 | return a + b; 6 | } 7 | 8 | int64_t sum_int64(int64_t a, int64_t b) 9 | { 10 | return a + b; 11 | } 12 | 13 | float sum_float(float a, float b) 14 | { 15 | return a + b; 16 | } 17 | 18 | double sum_double(double a, double b) 19 | { 20 | return a + b; 21 | } 22 | 23 | int32_t get_number(void) 24 | { 25 | return 42; 26 | } 27 | 28 | void give_number(int32_t num) 29 | { 30 | // nothing 31 | } 32 | 33 | int32_t div_int32(int32_t a, int32_t b) 34 | { 35 | return a / b; 36 | } 37 | -------------------------------------------------------------------------------- /sources/libcore/math/math.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cage 5 | { 6 | namespace privat 7 | { 8 | inline String tryRemoveParentheses(const String &str) 9 | { 10 | if (str.empty()) 11 | return str; 12 | if (str[0] == '(' && str[str.length() - 1] == ')') 13 | return subString(str, 1, str.length() - 2); 14 | return str; 15 | } 16 | 17 | inline String mathSplit(String &s) 18 | { 19 | String res = trim(split(s, "\t ,"), true, true, "\t "); 20 | s = trim(s, true, true, "\t "); 21 | return res; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sources/include/cage-core/entitiesSerialization.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_entitiesSerialization_sdrgdfzj5hsdet 2 | #define guard_entitiesSerialization_sdrgdfzj5hsdet 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class EntityManager; 9 | class EntityComponent; 10 | class Entity; 11 | 12 | CAGE_CORE_API Holder> entitiesExportBuffer(PointerRange entities, EntityComponent *component); 13 | CAGE_CORE_API void entitiesImportBuffer(PointerRange buffer, EntityManager *manager); 14 | } 15 | 16 | #endif // guard_entitiesSerialization_sdrgdfzj5hsdet 17 | -------------------------------------------------------------------------------- /cmake/cage_all.cmake: -------------------------------------------------------------------------------- 1 | 2 | include(cage_assets) 3 | include(cage_build_configuration) 4 | include(cage_build_destination) 5 | include(cage_copy_redist) 6 | include(cage_default_init) 7 | include(cage_directory_link) 8 | include(cage_disable_source_build) 9 | include(cage_embed_file) 10 | include(cage_fetch_cage_externals) 11 | include(cage_ide_category) 12 | include(cage_ide_sort_files) 13 | include(cage_ide_startup_project) 14 | include(cage_ide_working_dir) 15 | include(cage_list_all_targets) 16 | include(cage_print_all_variables) 17 | include(cage_print_target_properties) 18 | include(cage_target_api_macro) 19 | -------------------------------------------------------------------------------- /cmake/cage_fetch_cage_externals.cmake: -------------------------------------------------------------------------------- 1 | 2 | if(NOT DEFINED egac_fetch_cage_externals_done) # INTERNAL implies FORCE 3 | set(egac_fetch_cage_externals_done OFF CACHE INTERNAL "") 4 | endif() 5 | 6 | function(cage_fetch_cage_externals) 7 | if(egac_fetch_cage_externals_done) 8 | return() 9 | endif() 10 | execute_process(COMMAND "bash" "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../submodules.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.." COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY) 11 | set(egac_fetch_cage_externals_done ON CACHE INTERNAL "" FORCE) 12 | endfunction(cage_fetch_cage_externals) 13 | 14 | -------------------------------------------------------------------------------- /externals/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "glm") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(glm INTERFACE) 6 | target_include_directories(glm INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/glm") 7 | target_compile_definitions(glm INTERFACE "GLM_FORCE_COLUMN_MAJOR=1") 8 | target_compile_definitions(glm INTERFACE "GLM_FORCE_RIGHT_HANDED=1") 9 | target_compile_definitions(glm INTERFACE "GLM_FORCE_DEPTH_ZERO_TO_ONE=1") 10 | 11 | cage_gen_module(glm $ "") 12 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/skybox.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | #ifdef SkeletalAnimation 5 | #error "unintended combination of keywords" 6 | #endif 7 | 8 | void main() 9 | { 10 | propagateInputs(); 11 | vec3 p3 = mat3(uniProjection.viewMat) * transpose(mat3(uniMeshes[varInstanceId].modelMat)) * vec3(inPosition); 12 | gl_Position = uniProjection.projMat * vec4(p3, 1); 13 | } 14 | 15 | 16 | $include fragment.glsl 17 | 18 | // layout(early_fragment_tests) in; // not yet supported in tint 19 | 20 | void main() 21 | { 22 | Material material = loadMaterial(); 23 | outColor.rgb = material.albedo; 24 | outColor.a = 1; 25 | } 26 | -------------------------------------------------------------------------------- /sources/test-core/wasm/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PATH="$PATH:/c/Program Files/LLVM/bin" 3 | clang --target=wasm32 -Wl,--export-all -Wl,--no-entry -nostdlib -o sums.wasm sums.c 4 | clang --target=wasm32 -Wl,--allow-undefined -Wl,--export-all -Wl,--no-entry -nostdlib -o strings.wasm strings.c 5 | clang --target=wasm32 -Wl,--allow-undefined -Wl,--export-all -Wl,--no-entry -nostdlib -o natives.wasm natives.c 6 | #clang++ --target=wasm32 -Wl,--allow-undefined -Wl,--export-all -Wl,--no-entry -nostdlib -nostartfiles -o foo.wasm foo.cpp 7 | em++ --target=wasm32 -Wl,--allow-undefined -Wl,--export-all -Wl,--no-entry -nostartfiles -O2 -o foo.wasm foo.cpp 8 | -------------------------------------------------------------------------------- /externals/msdfgen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "msdfgen") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | cage_heavily_optimized() 6 | 7 | file(GLOB_RECURSE msdfgen-sources "msdfgen/msdfgen.h" "msdfgen/core/*" "msdfgen/ext/import-font.*") 8 | add_library(lib_msdfgen ${msdfgen-sources}) 9 | target_compile_definitions(lib_msdfgen PUBLIC MSDFGEN_USE_CPP11 MSDFGEN_PUBLIC=) 10 | target_include_directories(lib_msdfgen INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 11 | target_link_libraries(lib_msdfgen PUBLIC freetype) 12 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/common.glsl: -------------------------------------------------------------------------------- 1 | 2 | const float PI = 3.14159265359; 3 | 4 | float sqr(float x) 5 | { 6 | return x * x; 7 | } 8 | 9 | vec2 sqr(vec2 x) 10 | { 11 | return x * x; 12 | } 13 | 14 | vec3 sqr(vec3 x) 15 | { 16 | return x * x; 17 | } 18 | 19 | vec4 sqr(vec4 x) 20 | { 21 | return x * x; 22 | } 23 | 24 | float saturate(float x) 25 | { 26 | return clamp(x, 0, 1); 27 | } 28 | 29 | vec2 saturate(vec2 x) 30 | { 31 | return clamp(x, vec2(0), vec2(1)); 32 | } 33 | 34 | vec3 saturate(vec3 x) 35 | { 36 | return clamp(x, vec3(0), vec3(1)); 37 | } 38 | 39 | vec4 saturate(vec4 x) 40 | { 41 | return clamp(x, vec4(0), vec4(1)); 42 | } 43 | -------------------------------------------------------------------------------- /sources/libengine/assets/font.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | namespace cage 7 | { 8 | namespace 9 | { 10 | void processLoad(AssetContext *context) 11 | { 12 | Holder font = newFont(context->textId); 13 | font->importBuffer(context->originalData); 14 | context->assetHolder = std::move(font).cast(); 15 | } 16 | } 17 | 18 | AssetsScheme genAssetSchemeFont() 19 | { 20 | AssetsScheme s; 21 | s.load.bind(); 22 | s.typeHash = detail::typeHash(); 23 | return s; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/icon.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | #ifdef SkeletalAnimation 5 | #error "unintended combination of keywords" 6 | #endif 7 | 8 | void main() 9 | { 10 | propagateInputs(); 11 | gl_Position = uniProjection.vpMat * transpose(mat4(uniMeshes[varInstanceId].modelMat)) * vec4(varPosition, 1); 12 | } 13 | 14 | 15 | $include fragment.glsl 16 | 17 | #ifndef CutOut 18 | // layout(early_fragment_tests) in; // not yet supported in tint 19 | #endif 20 | 21 | void main() 22 | { 23 | vec4 albedo = loadAlbedo(); 24 | 25 | #ifdef CutOut 26 | if (albedo.w < 0.5) 27 | discard; 28 | #endif // CutOut 29 | 30 | outColor = albedo; 31 | } 32 | -------------------------------------------------------------------------------- /sources/test-core/copyAndMove.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "main.h" 4 | 5 | #include 6 | 7 | void testCopyAndMove() 8 | { 9 | CAGE_TESTCASE("copy and move semantics"); 10 | 11 | { 12 | CAGE_TESTCASE("vector of strings"); 13 | std::vector vec; 14 | vec.emplace_back("hi"); 15 | vec.push_back("hello"); 16 | std::vector Vec2 = std::move(vec); 17 | } 18 | 19 | { 20 | CAGE_TESTCASE("vector of memory buffers"); 21 | std::vector vec; 22 | vec.emplace_back(MemoryBuffer()); 23 | vec.push_back(MemoryBuffer()); 24 | std::vector Vec2 = std::move(vec); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sources/controller-bindings/microsoft_motion.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/microsoft/motion_controller 3 | 4 | [] 5 | mapping = thumbstick/click 6 | index = 4 7 | [] 8 | mapping = trackpad/click 9 | index = 5 10 | [] 11 | mapping = menu/click 12 | index = 7 13 | [] 14 | mapping = squeeze/click 15 | index = 9 16 | 17 | [] 18 | mapping = thumbstick/x 19 | index = 0 20 | type = axis 21 | [] 22 | mapping = thumbstick/y 23 | index = 1 24 | type = axis 25 | [] 26 | mapping = trackpad/x 27 | index = 2 28 | type = axis 29 | [] 30 | mapping = trackpad/y 31 | index = 3 32 | type = axis 33 | [] 34 | mapping = trigger/value 35 | index = 4 36 | type = axis 37 | -------------------------------------------------------------------------------- /externals/dr_libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "dr_libs") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | configure_file(dr_libs/dr_wav.h dr_wav.cpp COPYONLY) 6 | configure_file(dr_libs/dr_flac.h dr_flac.cpp COPYONLY) 7 | configure_file(dr_libs/dr_mp3.h dr_mp3.cpp COPYONLY) 8 | add_library(dr_libs STATIC dr_wav.cpp dr_flac.cpp dr_mp3.cpp) 9 | target_compile_definitions(dr_libs PRIVATE DR_WAV_IMPLEMENTATION DR_FLAC_IMPLEMENTATION DR_MP3_IMPLEMENTATION) 10 | target_include_directories(dr_libs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 11 | 12 | -------------------------------------------------------------------------------- /sources/include/cage-core/memoryInplaceBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_memoryInplaceBuffer_h_w9a8erft7gzkl 2 | #define guard_memoryInplaceBuffer_h_w9a8erft7gzkl 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | template 9 | struct InplaceBuffer : private Immovable 10 | { 11 | static constexpr uintPtr Capacity = Capacity_; 12 | char data[Capacity]; 13 | uintPtr size = 0; 14 | 15 | CAGE_FORCE_INLINE operator PointerRange() { return { data, data + size }; } 16 | CAGE_FORCE_INLINE operator PointerRange() const { return { data, data + size }; } 17 | }; 18 | } 19 | 20 | #endif // guard_memoryInplaceBuffer_h_w9a8erft7gzkl 21 | -------------------------------------------------------------------------------- /sources/include/cage-core/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_timer_h_95034fdd_21d1_4b36_b8f9_d5eeb0f6e2c1_ 2 | #define guard_timer_h_95034fdd_21d1_4b36_b8f9_d5eeb0f6e2c1_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_CORE_API Timer : private Immovable 9 | { 10 | public: 11 | void reset(); 12 | uint64 duration(); // microseconds since construction, or last call to reset, whichever is smaller 13 | uint64 elapsed(); // microseconds since construction, last call to reset, or last call to elapsed, whichever is smallest 14 | }; 15 | 16 | CAGE_CORE_API Holder newTimer(); 17 | } 18 | 19 | #endif // guard_timer_h_95034fdd_21d1_4b36_b8f9_d5eeb0f6e2c1_ 20 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/attenuation.glsl: -------------------------------------------------------------------------------- 1 | 2 | float attenuation(vec4 att, float dist) 3 | { 4 | // att: // type, minDistance, maxDistance, unused 5 | float minDistance = att[1]; 6 | float maxDistance = att[2]; 7 | dist = clamp(dist, minDistance, maxDistance); 8 | switch (int(att[0])) 9 | { 10 | case 0: // none 11 | return 1; 12 | case 1: // linear 13 | return 1 - (dist - minDistance) / (maxDistance - minDistance); 14 | case 2: // logarithmic 15 | return 1 - log(dist - minDistance + 1) / log(maxDistance - minDistance + 1); 16 | case 3: // inverse square 17 | return saturate(2 / (1 + sqr(dist / (minDistance + 1)))); 18 | default: 19 | return 1; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/decal.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | #ifdef SkeletalAnimation 5 | #error "unintended combination of keywords" 6 | #endif 7 | 8 | void main() 9 | { 10 | propagateInputs(); 11 | computePosition(); 12 | } 13 | 14 | 15 | $include fragment.glsl 16 | $include ../functions/reconstructPosition.glsl 17 | 18 | void main() 19 | { 20 | updateNormal(); 21 | Material material = loadMaterial(); 22 | vec3 prevPos = reconstructPosition(texDepth, uniProjection.vpInv, uniViewport.viewport); 23 | if (length(varPosition - prevPos) > 0.05) 24 | discard; 25 | #ifdef CutOut 26 | if (material.opacity < 0.5) 27 | discard; 28 | #endif // CutOut 29 | outColor = lighting(material); 30 | } 31 | -------------------------------------------------------------------------------- /externals/fetch_latest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # update freetype from upstream 4 | (cd freetype/freetype && git fetch upstream HEAD && git reset --hard upstream/master && git push) 5 | 6 | 7 | function pbranch { 8 | git checkout -b master 9 | git checkout master 10 | git branch --set-upstream-to=origin/HEAD master 11 | git pull --ff-only 12 | #git submodule update --init 13 | } 14 | export -f pbranch 15 | git submodule foreach pbranch 16 | 17 | 18 | # restore openxr - newer versions are not supported by hardware 19 | git submodule update openxr-sdk/OpenXR-SDK 20 | 21 | # restore wamr & zydis 22 | git submodule update --init --recursive wamr/wamr 23 | git submodule update --init --recursive wamr/zydis 24 | -------------------------------------------------------------------------------- /cmake/cage_print_all_variables.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(cage_print_all_variables) 3 | message(STATUS "----------------------------------------------------------------") 4 | message(STATUS "print all variables begin") 5 | message(STATUS "----------------------------------------------------------------") 6 | get_cmake_property(variableNames VARIABLES) 7 | foreach(variableName ${variableNames}) 8 | message(STATUS "${variableName} = ${${variableName}}") 9 | endforeach() 10 | message(STATUS "----------------------------------------------------------------") 11 | message(STATUS "print all variables end") 12 | message(STATUS "----------------------------------------------------------------") 13 | endfunction() 14 | 15 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/dofCollect.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | layout(set = 2, binding = 0) uniform sampler2D texColor; 7 | 8 | layout(location = 0) out vec4 outDof; 9 | 10 | const int downscale = 3; 11 | 12 | void main() 13 | { 14 | vec2 texelSize = float(downscale) / textureSize(texColor, 0).xy; 15 | vec2 uv = gl_FragCoord.xy * texelSize; 16 | vec3 color = vec3(0.0); 17 | int cnt = 0; 18 | for (int y = 0; y < downscale; y++) 19 | for (int x = 0; x < downscale; x++) 20 | color += texelFetch(texColor, ivec2(gl_FragCoord) * downscale + ivec2(x, y) - downscale / 2, 0).rgb; 21 | color /= float(downscale * downscale); 22 | outDof = vec4(color, 1); 23 | } 24 | -------------------------------------------------------------------------------- /sources/controller-bindings/valve_index.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/valve/index_controller 3 | 4 | [] 5 | mapping = a/click 6 | index = 0 7 | [] 8 | mapping = b/click 9 | index = 1 10 | [] 11 | mapping = thumbstick/click 12 | index = 4 13 | [] 14 | mapping = trigger/click 15 | index = 8 16 | 17 | [] 18 | mapping = thumbstick/x 19 | index = 0 20 | type = axis 21 | [] 22 | mapping = thumbstick/y 23 | index = 1 24 | type = axis 25 | [] 26 | mapping = trackpad/x 27 | index = 2 28 | type = axis 29 | [] 30 | mapping = trackpad/y 31 | index = 3 32 | type = axis 33 | [] 34 | mapping = trigger/value 35 | index = 4 36 | type = axis 37 | [] 38 | mapping = squeeze/value 39 | index = 5 40 | type = axis 41 | -------------------------------------------------------------------------------- /sources/libcore/mesh/mesh.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace cage 6 | { 7 | template 8 | struct MeshAttribute : public std::vector 9 | {}; 10 | 11 | class MeshImpl : public Mesh 12 | { 13 | public: 14 | MeshAttribute positions; 15 | MeshAttribute normals; 16 | MeshAttribute boneIndices; 17 | MeshAttribute boneWeights; 18 | MeshAttribute uvs; 19 | MeshAttribute uvs3; 20 | 21 | std::vector indices; 22 | 23 | MeshTypeEnum type = MeshTypeEnum::Triangles; 24 | 25 | void swap(MeshImpl &other); 26 | }; 27 | } 28 | 29 | #define POLYHEDRON_ATTRIBUTES positions, normals, boneIndices, boneWeights, uvs, uvs3 30 | -------------------------------------------------------------------------------- /externals/freetype/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "freetype") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "BUILD_SHARED_LIBS") 6 | set(SKIP_INSTALL_ALL ON CACHE INTERNAL "SKIP_INSTALL_ALL") 7 | 8 | add_subdirectory(freetype) 9 | 10 | target_include_directories(freetype INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/freetype/include") 11 | target_include_directories(freetype INTERFACE "${CMAKE_CURRENT_BUILD_DIR}/freetype/include") 12 | 13 | cage_gen_module(Freetype $ $) 14 | 15 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/standard.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | void main() 5 | { 6 | propagateInputs(); 7 | skeletalAnimation(); 8 | computePosition(); 9 | } 10 | 11 | 12 | $include fragment.glsl 13 | 14 | #ifndef CutOut 15 | // layout(early_fragment_tests) in; // not yet supported in tint 16 | #endif 17 | 18 | void main() 19 | { 20 | #ifdef DepthOnly 21 | 22 | #ifdef CutOut 23 | if (loadMaterial().opacity < 0.5) 24 | discard; 25 | #endif // CutOut 26 | 27 | #else // DepthOnly 28 | 29 | updateNormal(); 30 | Material material = loadMaterial(); 31 | #ifdef CutOut 32 | if (material.opacity < 0.5) 33 | discard; 34 | #endif // CutOut 35 | outColor = lighting(material); 36 | 37 | #endif // DepthOnly 38 | } 39 | -------------------------------------------------------------------------------- /sources/test-ginnel/client.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void runClient() 9 | { 10 | CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "running in client mode"); 11 | 12 | ConfigString address("address"); 13 | ConfigUint32 port("port"); 14 | CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "address: " + (String)address); 15 | CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "port: " + (uint32)port); 16 | 17 | Holder client = newConn(newGinnelConnection(address, port, 0)); 18 | Runner runner; 19 | while (!client->process()) 20 | runner.step(); 21 | } 22 | -------------------------------------------------------------------------------- /sources/test-core/pointsOnSphere.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | #include 5 | 6 | namespace 7 | { 8 | String generatePoint() 9 | { 10 | Vec3 p = randomDirection3(); 11 | return Stringizer() + "vec3(" + p[0] + ", " + p[1] + ", " + p[2] + ")"; 12 | } 13 | } 14 | 15 | void generatePointsOnSphere() 16 | { 17 | CAGE_TESTCASE("generatePointsOnSphere"); 18 | 19 | Holder file = writeFile("pointsOnSphere.txt"); 20 | 21 | file->writeLine("vec3 pointsOnSphere[] ="); 22 | file->writeLine("{"); 23 | for (uint32 i = 0; i < 255; i++) 24 | file->writeLine(generatePoint() + ","); 25 | file->writeLine(generatePoint()); 26 | file->writeLine("}"); 27 | 28 | file->close(); 29 | } 30 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/README.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Ubuntu Font Family 3 | ====================== 4 | 5 | The Ubuntu Font Family are a set of matching new libre/open fonts in 6 | development during 2010--2011. And with further expansion work and 7 | bug fixing during 2015. The development is being funded by 8 | Canonical Ltd on behalf the wider Free Software community and the 9 | Ubuntu project. The technical font design work and implementation is 10 | being undertaken by Dalton Maag. 11 | 12 | Both the final font Truetype/OpenType files and the design files used 13 | to produce the font family are distributed under an open licence and 14 | you are expressly encouraged to experiment, modify, share and improve. 15 | 16 | http://font.ubuntu.com/ 17 | -------------------------------------------------------------------------------- /sources/controller-bindings/oculus_touch.ini: -------------------------------------------------------------------------------- 1 | [profile] 2 | profile = /interaction_profiles/oculus/touch_controller 3 | 4 | [] 5 | mapping = a/click 6 | index = 0 7 | left = false 8 | [] 9 | mapping = b/click 10 | index = 1 11 | left = false 12 | [] 13 | mapping = x/click 14 | index = 2 15 | right = false 16 | [] 17 | mapping = y/click 18 | index = 3 19 | right = false 20 | [] 21 | mapping = thumbstick/click 22 | index = 4 23 | [] 24 | mapping = menu/click 25 | index = 7 26 | right = false 27 | 28 | [] 29 | mapping = thumbstick/x 30 | index = 0 31 | type = axis 32 | [] 33 | mapping = thumbstick/y 34 | index = 1 35 | type = axis 36 | [] 37 | mapping = trigger/value 38 | index = 4 39 | type = axis 40 | [] 41 | mapping = squeeze/value 42 | index = 5 43 | type = axis 44 | 45 | -------------------------------------------------------------------------------- /sources/include/cage-engine/winMain.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_winMain_h_jh4ser564uj 2 | #define guard_winMain_h_jh4ser564uj 3 | 4 | #include 5 | 6 | #ifdef _WIN32 7 | 8 | #ifndef VC_EXTRALEAN 9 | #define VC_EXTRALEAN 10 | #endif 11 | #ifndef NOMINMAX 12 | #define NOMINMAX 13 | #endif 14 | #include 15 | 16 | namespace cage 17 | { 18 | namespace privat 19 | { 20 | CAGE_ENGINE_API std::pair winMainParams(); 21 | } 22 | } 23 | 24 | int main(int argc, const char *args[]); 25 | 26 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 27 | { 28 | const auto cmd = ::cage::privat::winMainParams(); 29 | return ::main(cmd.first, cmd.second); 30 | } 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /sources/test-core/rectPacking.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | #include 5 | 6 | void testRectPacking() 7 | { 8 | CAGE_TESTCASE("rect packing"); 9 | 10 | Holder rp = newRectPacking(); 11 | rp->resize(10); 12 | for (uint32 i = 0; i < 10; i++) 13 | rp->data()[i] = PackingRect{ i, (uint32)randomRange(10, 30), (uint32)randomRange(10, 30) }; 14 | RectPackingSolveConfig cfg; 15 | cfg.margin = 2; 16 | cfg.width = cfg.height = 30; 17 | CAGE_TEST(!rp->solve(cfg)); // not enough space 18 | cfg.width = 130; 19 | cfg.height = 100; 20 | CAGE_TEST(rp->solve(cfg)); // always enough 21 | CAGE_TEST(rp->data().size() == 10); 22 | for (const auto &it : rp->data()) 23 | CAGE_TEST(it.x <= 120 && it.y <= 90); 24 | } 25 | -------------------------------------------------------------------------------- /sources/include/cage-engine/sceneCustomDraw.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_sceneCustomDraw_srui74ko8er 2 | #define guard_sceneCustomDraw_srui74ko8er 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class Entity; 9 | class GraphicsEncoder; 10 | class GraphicsAggregateBuffer; 11 | struct SceneRenderConfig; 12 | 13 | struct CAGE_ENGINE_API CustomDrawConfig 14 | { 15 | const SceneRenderConfig *renderConfig = nullptr; 16 | GraphicsEncoder *encoder = nullptr; 17 | GraphicsAggregateBuffer *aggregate = nullptr; 18 | Entity *entity = nullptr; 19 | }; 20 | 21 | struct CAGE_ENGINE_API CustomDrawComponent 22 | { 23 | Delegate callback; 24 | sint32 renderLayer = 0; 25 | }; 26 | } 27 | 28 | #endif // guard_sceneCustomDraw_srui74ko8er 29 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/bloomApply.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | layout(std140, set = 2, binding = 0) uniform Params 7 | { 8 | vec4 uniBloomParams; // threshold, blur passes 9 | }; 10 | 11 | layout(set = 2, binding = 1) uniform sampler2D texColor; 12 | layout(set = 2, binding = 3) uniform sampler2D texBloom; 13 | 14 | layout(location = 0) out vec4 outColor; 15 | 16 | void main() 17 | { 18 | int levels = int(uniBloomParams.y); 19 | vec3 color = texelFetch(texColor, ivec2(gl_FragCoord), 0).rgb; 20 | vec3 bloom = vec3(0); 21 | vec2 uv = vec2(gl_FragCoord) / vec2(textureSize(texColor, 0)); 22 | for (int i = 0; i < levels; i++) 23 | bloom += textureLod(texBloom, uv, i).rgb; 24 | outColor = vec4(color + bloom / levels, 1); // additive mixing 25 | } 26 | -------------------------------------------------------------------------------- /sources/test-core/networkHttp.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | void testNetworkHttp() 8 | { 9 | CAGE_TESTCASE("network http"); 10 | 11 | { 12 | CAGE_TESTCASE("get github"); 13 | const auto r = http(HttpRequest{ .url = "https://github.com/ucpu/cage" }); 14 | CAGE_TEST((r.body.find("game engine", 0) != r.body.npos)); // verify that the returned body contains specific text 15 | CAGE_TEST(r.statusCode == 200); 16 | } 17 | 18 | { 19 | CAGE_TESTCASE("invalid protocol"); 20 | CAGE_TEST_THROWN((http(HttpRequest{ .url = "sptth://github.com" }))); 21 | } 22 | 23 | { 24 | CAGE_TESTCASE("invalid url"); 25 | CAGE_TEST_THROWN((http(HttpRequest{ .url = "https://nonexistenturlforsureyouknowiamsure.com" }))); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/sampleTextureAnimation.glsl: -------------------------------------------------------------------------------- 1 | 2 | // anim: time (seconds), speed, offset (normalized), unused 3 | // mat: animation duration, animation loops, unused, unused 4 | vec4 sampleTextureAnimation(sampler2DArray tex, vec2 uv, vec4 anim, vec4 mat) 5 | { 6 | int frames = textureSize(tex, 0)[2]; 7 | if (frames <= 1) 8 | return texture(tex, vec3(uv, 0)); 9 | float sampl = (anim[0] * anim[1] / mat[0] + anim[2]) * float(frames); 10 | if (mat[1] > 0.5) 11 | sampl += (-int(sampl) / frames + 1) * frames; 12 | else 13 | sampl = clamp(sampl, 0, float(frames) - 1); 14 | int i = int(sampl) % frames; 15 | float f = sampl - float(int(sampl)); 16 | vec4 a = texture(tex, vec3(uv, float(i))); 17 | vec4 b = texture(tex, vec3(uv, float((i + 1) % frames))); 18 | return mix(a, b, f); 19 | } 20 | -------------------------------------------------------------------------------- /sources/include/cage-core/meshIoCommon.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_meshIoCommon_h_nbv1ec9rt7zh 2 | #define guard_meshIoCommon_h_nbv1ec9rt7zh 3 | 4 | #include 5 | #include 6 | 7 | namespace cage 8 | { 9 | enum class MeshRenderFlags : uint32 10 | { 11 | None = 0, 12 | CutOut = 1 << 0, // leaves, holes in cloth 13 | Transparent = 1 << 1, // glass, plastic 14 | Fade = 1 << 2, // holograms, fade out animation 15 | TwoSided = 1 << 3, 16 | DepthTest = 1 << 4, 17 | DepthWrite = 1 << 5, 18 | ShadowCast = 1 << 6, 19 | Lighting = 1 << 7, 20 | Default = MeshRenderFlags::DepthTest | MeshRenderFlags::DepthWrite | MeshRenderFlags::ShadowCast | MeshRenderFlags::Lighting, 21 | }; 22 | GCHL_ENUM_BITS(MeshRenderFlags); 23 | } 24 | 25 | #endif // guard_meshIoCommon_h_nbv1ec9rt7zh 26 | -------------------------------------------------------------------------------- /sources/include/cage-engine/speakerList.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_speakerList_h_m1n5ewqa7r8fuj4 2 | #define guard_speakerList_h_m1n5ewqa7r8fuj4 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_ENGINE_API SpeakerDevice 9 | { 10 | String id; 11 | String name; 12 | String group; 13 | String vendor; 14 | 15 | uint32 channels = 0; 16 | uint32 minSamplerate = 0; 17 | uint32 maxSamplerate = 0; 18 | uint32 defaultSamplerate = 0; 19 | 20 | bool available = false; 21 | }; 22 | 23 | class CAGE_ENGINE_API SpeakerList : private Immovable 24 | { 25 | public: 26 | uint32 defaultDevice() const; 27 | PointerRange devices() const; 28 | }; 29 | 30 | CAGE_ENGINE_API Holder newSpeakerList(); 31 | } 32 | 33 | #endif // guard_speakerList_h_m1n5ewqa7r8fuj4 34 | -------------------------------------------------------------------------------- /sources/include/cage-engine/scenePicking.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_scenePicking_h_dzjlhgfds 2 | #define guard_scenePicking_h_dzjlhgfds 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace cage 9 | { 10 | struct CAGE_ENGINE_API PickableComponent 11 | {}; 12 | 13 | struct CAGE_ENGINE_API ScenePickingConfig 14 | { 15 | Line picker; 16 | LodSelection lodSelection; 17 | const AssetsManager *assets = nullptr; 18 | const EntityManager *entities = nullptr; 19 | }; 20 | 21 | struct CAGE_ENGINE_API ScenePickingResult 22 | { 23 | Vec3 point; 24 | Entity *entity = nullptr; 25 | }; 26 | 27 | CAGE_ENGINE_API Holder> scenePicking(const ScenePickingConfig &config); 28 | } 29 | 30 | #endif // guard_scenePicking_h_dzjlhgfds 31 | -------------------------------------------------------------------------------- /sources/libsimple/externs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cage 5 | { 6 | EngineControlThread &controlThread() 7 | { 8 | static EngineControlThread instance; 9 | return instance; 10 | } 11 | 12 | EngineGraphicsThread &graphicsThread() 13 | { 14 | static EngineGraphicsThread instance; 15 | return instance; 16 | } 17 | 18 | EngineSoundThread &soundThread() 19 | { 20 | static EngineSoundThread instance; 21 | return instance; 22 | } 23 | 24 | EventDispatcher &engineEvents() 25 | { 26 | static EventDispatcher instance; 27 | return instance; 28 | } 29 | 30 | EngineDynamicResolution &engineDynamicResolution() 31 | { 32 | static EngineDynamicResolution instance; 33 | return instance; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sources/test-ginnel/runner.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | Runner::Runner() : last(applicationTime()) 8 | { 9 | const uint32 freq = randomRange(10, 100); 10 | CAGE_LOG(SeverityEnum::Info, "runner", Stringizer() + "frequency: " + freq + " updates per second"); 11 | period = 1000000 / freq; 12 | } 13 | 14 | void Runner::step() 15 | { 16 | const uint64 curr = applicationTime(); 17 | 18 | if (curr > last + period * 2) 19 | { 20 | CAGE_LOG(SeverityEnum::Warning, "runner", "cannot keep up"); 21 | last = curr + period; 22 | return; 23 | } 24 | 25 | // sleep = period - elapsed = period - (curr - last) 26 | const sint64 slp = period + last - curr; 27 | if (slp > 0) 28 | threadSleep(slp); 29 | 30 | last += period; 31 | } 32 | -------------------------------------------------------------------------------- /externals/glfw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "glfw") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs") 6 | set(GLFW_BUILD_TESTS OFF CACHE INTERNAL "Build the GLFW test programs") 7 | set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation") 8 | set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target") 9 | set(GLFW_BUILD_X11 ON CACHE INTERNAL "Build support for X11") 10 | set(GLFW_BUILD_WAYLAND ON CACHE INTERNAL "Build support for Wayland") 11 | set(USE_MSVC_RUNTIME_LIBRARY_DLL ON CACHE INTERNAL "Use MSVC runtime library DLL") 12 | 13 | add_subdirectory(glfw) 14 | 15 | cage_gen_module(glfw3 $ "") 16 | -------------------------------------------------------------------------------- /externals/ogg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "ogg") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "BUILD_SHARED_LIBS") 6 | set(INSTALL_DOCS OFF CACHE INTERNAL "Install documentation") 7 | set(INSTALL_PKG_CONFIG_MODULE OFF CACHE INTERNAL "Install ogg.pc file") 8 | set(INSTALL_CMAKE_PACKAGE_MODULE OFF CACHE INTERNAL "Install CMake package configiguration module") 9 | 10 | add_subdirectory(ogg) 11 | 12 | target_include_directories(ogg PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/ogg/include") 13 | target_include_directories(ogg INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ogg/include") 14 | 15 | cage_gen_module(OGG $ $) 16 | -------------------------------------------------------------------------------- /sources/test-core/logger.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void testLogger() 9 | { 10 | CAGE_TESTCASE("logger"); 11 | 12 | { 13 | CAGE_TESTCASE("logging into file interface into memory buffer"); 14 | MemoryBuffer buff; 15 | Holder f = newFileBuffer(Holder(&buff, nullptr)); 16 | { 17 | Holder output = newLoggerOutputFile(f.share()); 18 | Holder logger = newLogger(); 19 | logger->output.bind(+output); 20 | CAGE_LOG(SeverityEnum::Info, "loggerTest", "Alea iacta est"); 21 | } 22 | CAGE_TEST(buff.size() > 0); 23 | f->seek(0); 24 | CAGE_TEST(isPattern(f->readLine(), "", "Alea iacta est", "")); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sources/include/cage-engine/gamepad.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_gamepad_oi56awe41g7 2 | #define guard_gamepad_oi56awe41g7 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_ENGINE_API Gamepad : private Immovable 9 | { 10 | public: 11 | EventDispatcher events; 12 | 13 | void processEvents(); 14 | 15 | String name() const; 16 | bool connected() const; 17 | bool mapped() const; 18 | PointerRange axes() const; // left stick x, y, right stick x, y, left trigger, right trigger 19 | PointerRange buttons() const; // a, b, x, y, left shoulder, right shoulder, select, menu, _, _, _, up, right, down, left 20 | 21 | Real deadzone = 0.05; 22 | }; 23 | 24 | CAGE_ENGINE_API Holder newGamepad(); 25 | 26 | CAGE_ENGINE_API uint32 gamepadsAvailable(); 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /data/cage/models/bone.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.79 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | o bone 4 | v -0.000000 0.150000 -0.250000 5 | v 0.150000 0.000000 -0.250000 6 | v -0.000000 -0.150000 -0.250000 7 | v -0.150000 0.000000 -0.250000 8 | v -0.000000 -0.000000 0.000000 9 | v -0.000000 0.150000 -0.250000 10 | v 0.150000 0.000000 -0.250000 11 | v -0.000000 -0.150000 -0.250000 12 | v -0.150000 0.000000 -0.250000 13 | v -0.000000 0.000000 -1.000000 14 | vn 0.6509 0.6509 0.3906 15 | vn 0.6509 -0.6509 0.3906 16 | vn -0.6509 -0.6509 0.3906 17 | vn -0.6509 0.6509 0.3906 18 | vn 0.7001 0.7001 -0.1400 19 | vn 0.7001 -0.7001 -0.1400 20 | vn -0.7001 -0.7001 -0.1400 21 | vn -0.7001 0.7001 -0.1400 22 | s off 23 | f 1//1 5//1 2//1 24 | f 2//2 5//2 3//2 25 | f 3//3 5//3 4//3 26 | f 4//4 5//4 1//4 27 | f 6//5 7//5 10//5 28 | f 7//6 8//6 10//6 29 | f 8//7 9//7 10//7 30 | f 9//8 6//8 10//8 31 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/randomFunc.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include hash.glsl 3 | 4 | float egacIntToFloat(uint m) 5 | { 6 | const uint ieeeMantissa = 0x007FFFFFu; 7 | const uint ieeeOne = 0x3F800000u; 8 | m &= ieeeMantissa; 9 | m |= ieeeOne; 10 | float f = uintBitsToFloat(m); 11 | return f - 1; 12 | } 13 | 14 | float randomFunc(float x) 15 | { 16 | return egacIntToFloat(hash(floatBitsToUint(x))); 17 | } 18 | float randomFunc(vec2 v) 19 | { 20 | return egacIntToFloat(hash(floatBitsToUint(v.x) ^ hash(floatBitsToUint(v.y)))); 21 | } 22 | float randomFunc(vec3 v) 23 | { 24 | return egacIntToFloat(hash(floatBitsToUint(v.x) ^ hash(floatBitsToUint(v.y)) ^ hash(floatBitsToUint(v.z)))); 25 | } 26 | float randomFunc(vec4 v) 27 | { 28 | return egacIntToFloat(hash(floatBitsToUint(v.x) ^ hash(floatBitsToUint(v.y)) ^ hash(floatBitsToUint(v.z)) ^ hash(floatBitsToUint(v.w)))); 29 | } 30 | -------------------------------------------------------------------------------- /sources/include/cage-engine/screenList.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_screenList_h_q56ew4rk87h64847 2 | #define guard_screenList_h_q56ew4rk87h64847 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_ENGINE_API ScreenMode 9 | { 10 | Vec2i resolution; 11 | uint32 frequency = 0; 12 | }; 13 | 14 | class CAGE_ENGINE_API ScreenDevice : private Immovable 15 | { 16 | public: 17 | String id() const; 18 | String name() const; 19 | 20 | uint32 currentMode() const; 21 | PointerRange modes() const; 22 | }; 23 | 24 | class CAGE_ENGINE_API ScreenList : private Immovable 25 | { 26 | public: 27 | uint32 defaultDevice() const; 28 | Holder> devices() const; 29 | }; 30 | 31 | CAGE_ENGINE_API Holder newScreenList(); 32 | } 33 | 34 | #endif // guard_screenList_h_q56ew4rk87h64847 35 | -------------------------------------------------------------------------------- /externals/cage_gen_module.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(cage_gen_module_helper filename name lib inc) 3 | file(APPEND ${filename} "set(${name}_FOUND 1)\n") 4 | file(APPEND ${filename} "set(${name}_INCLUDE_DIR \"${inc}\")\n") 5 | file(APPEND ${filename} "set(${name}_INCLUDE_DIRS \"${inc}\")\n") 6 | file(APPEND ${filename} "set(${name}_LIBRARY \"${lib}\")\n") 7 | file(APPEND ${filename} "set(${name}_LIBRARIES \"${lib}\")\n") 8 | endmacro() 9 | 10 | macro(cage_gen_module name lib inc) 11 | string(TOUPPER ${name} name_upper) 12 | string(TOLOWER ${name} name_lower) 13 | set(filename "${CAGE_EXTERNALS_MODULE_PATH}/Find${name_upper}.cmake") 14 | file(WRITE ${filename} "\n") 15 | cage_gen_module_helper(${filename} ${name} "${lib}" "${inc}") 16 | cage_gen_module_helper(${filename} ${name_upper} "${lib}" "${inc}") 17 | cage_gen_module_helper(${filename} ${name_lower} "${lib}" "${inc}") 18 | endmacro() 19 | -------------------------------------------------------------------------------- /sources/include/cage-core/scopeGuard.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_scopeGuard_h_gj4hgs1ev8gfzujsd 2 | #define guard_scopeGuard_h_gj4hgs1ev8gfzujsd 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | template 9 | struct ScopeGuard : private Noncopyable 10 | { 11 | ScopeGuard() = default; 12 | [[nodiscard]] ScopeGuard(Callable &&callable) : callable(std::move(callable)) {} 13 | 14 | ~ScopeGuard() 15 | { 16 | if (dismissed) 17 | return; 18 | try 19 | { 20 | callable(); 21 | } 22 | catch (...) 23 | { 24 | detail::logCurrentCaughtException(); 25 | detail::irrecoverableError("exception thrown in ~ScopeGuard"); 26 | } 27 | } 28 | 29 | void dismiss() { dismissed = true; } 30 | 31 | private: 32 | Callable callable = {}; 33 | bool dismissed = false; 34 | }; 35 | } 36 | 37 | #endif // guard_scopeGuard_h_gj4hgs1ev8gfzujsd 38 | -------------------------------------------------------------------------------- /schemes/sound.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor sound 3 | index = 20 4 | 5 | [gain] 6 | display = gain 7 | type = real 8 | min = 0 9 | default = 1.0 10 | 11 | [sampleRate] 12 | display = sample rate 13 | hint = use 0 to keep original from the input file 14 | type = uint32 15 | default = 48000 16 | 17 | [mono] 18 | display = mono channel 19 | hint = convert to mono channel (required for spatial audio) 20 | type = bool 21 | default = true 22 | 23 | [stream] 24 | display = stream 25 | hint = streamed sounds are small in memory but have overhead associated with decoding and should not be used for frequently (repeatedly) played short sound effects 26 | type = bool 27 | default = false 28 | 29 | [compressThreshold] 30 | display = small file threshold 31 | hint = raw file format is used if the file is smaller than the threshold (bytes) 32 | type = uint32 33 | default = 5000000 34 | -------------------------------------------------------------------------------- /sources/include/cage-core/guid.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_quid_h_cc82a428_1147_4841_aa4c_4b7784111e63_ 2 | #define guard_quid_h_cc82a428_1147_4841_aa4c_4b7784111e63_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | namespace privat 9 | { 10 | CAGE_CORE_API void generateRandomData(uint8 *target, uint32 size); 11 | CAGE_CORE_API String guidToString(const uint8 *data, uint32 size); 12 | } 13 | 14 | template 15 | struct Guid 16 | { 17 | explicit Guid(bool randomize = false) 18 | { 19 | if (randomize) 20 | privat::generateRandomData(data, N); 21 | } 22 | 23 | uint8 data[N] = {}; 24 | 25 | operator String() const { return privat::guidToString(data, N); } 26 | 27 | auto operator<=>(const Guid &) const = default; 28 | bool operator==(const Guid &) const = default; 29 | }; 30 | } 31 | 32 | #endif // guard_quid_h_cc82a428_1147_4841_aa4c_4b7784111e63_ 33 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/sharpening.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include vertex.glsl 3 | 4 | $define shader fragment 5 | 6 | layout(std140, set = 2, binding = 0) uniform Sharpening 7 | { 8 | vec4 params; // strength 9 | }; 10 | 11 | layout(set = 2, binding = 1) uniform sampler2D texColor; 12 | 13 | layout(location = 0) out vec4 outColor; 14 | 15 | void main() 16 | { 17 | ivec2 coord = ivec2(gl_FragCoord.xy); 18 | vec3 center = texelFetch(texColor, coord, 0).rgb; 19 | vec3 up = texelFetch(texColor, coord + ivec2(0, 1), 0).rgb; 20 | vec3 down = texelFetch(texColor, coord + ivec2(0, -1), 0).rgb; 21 | vec3 left = texelFetch(texColor, coord + ivec2(-1, 0), 0).rgb; 22 | vec3 right = texelFetch(texColor, coord + ivec2(1, 0), 0).rgb; 23 | float strength = params.x; 24 | vec3 sharpenedColor = center * (1 + 4 * strength) - (up + down + left + right) * strength; 25 | outColor = vec4(clamp(sharpenedColor, 0, 1), 1); 26 | } 27 | -------------------------------------------------------------------------------- /externals/quickhull/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "quickhull") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | 6 | # remove prints to cerr 7 | set(quickhull_path "${CMAKE_CURRENT_LIST_DIR}/quickhull/QuickHull.cpp") 8 | file(READ "${quickhull_path}" quickhull_content) 9 | string(REPLACE "std::cerr << \"Failed to solve horizon edge.\" << std::endl;" "// cage: no printing please" quickhull_content "${quickhull_content}") 10 | set(CMAKE_DISABLE_SOURCE_CHANGES OFF) 11 | file(CONFIGURE OUTPUT "${quickhull_path}" CONTENT "${quickhull_content}" @ONLY) 12 | set(CMAKE_DISABLE_SOURCE_CHANGES ON) 13 | 14 | 15 | file(GLOB SOURCES quickhull/*.cpp quickhull/*.hpp quickhull/Structs/*) 16 | 17 | add_library(quickhull STATIC ${SOURCES}) 18 | 19 | target_include_directories(quickhull INTERFACE .) 20 | -------------------------------------------------------------------------------- /sources/include/cage-core/hashBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_hashBuffer_h_io45uuzjhd8s5xfgh 2 | #define guard_hashBuffer_h_io45uuzjhd8s5xfgh 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | namespace detail 9 | { 10 | constexpr uint32 HashOffset = 2166136261u; 11 | constexpr uint32 HashPrime = 16777619u; 12 | } 13 | 14 | CAGE_FORCE_INLINE constexpr uint32 hashBuffer(PointerRange buffer) 15 | { 16 | const char *b = buffer.begin(); 17 | const char *e = buffer.end(); 18 | uint32 hash = detail::HashOffset; 19 | while (b != e) 20 | { 21 | hash ^= *b++; 22 | hash *= detail::HashPrime; 23 | } 24 | return hash; 25 | } 26 | 27 | CAGE_FORCE_INLINE constexpr uint32 hashRawString(const char *str) 28 | { 29 | const char *e = str; 30 | while (*e) 31 | e++; 32 | return hashBuffer({ str, e }); 33 | } 34 | } 35 | 36 | #endif // guard_hashBuffer_h_io45uuzjhd8s5xfgh 37 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/sampleShadowMap.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include poissonDisk4.glsl 3 | $include randomAngle.glsl 4 | 5 | 6 | float sampleShadowMap2d(texture2DArray texShadow, vec3 shadowPos, int cascade) 7 | { 8 | vec2 radius = 1.3 / textureSize(sampler2DArray(texShadow, samplerShadows), 0).xy; 9 | float visibility = 0.0; 10 | for (int i = 0; i < 4; i++) 11 | { 12 | float ra = randomAngle(12000.0, shadowPos); 13 | mat2 rot = mat2(cos(ra), sin(ra), -sin(ra), cos(ra)); 14 | vec2 samp = rot * poissonDisk4[i] * radius; 15 | visibility += float(textureLod(sampler2DArray(texShadow, samplerShadows), vec3(shadowPos.xy + samp, float(cascade)), 0).x > shadowPos.z); 16 | } 17 | visibility /= 4.0; 18 | return visibility; 19 | } 20 | 21 | float sampleShadowMapCube(textureCube texShadow, vec3 shadowPos) 22 | { 23 | return float(textureLod(samplerCube(texShadow, samplerShadows), normalize(shadowPos), 0).x > length(shadowPos)); 24 | } 25 | -------------------------------------------------------------------------------- /sources/test-core/hashes.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | 5 | void testHashes() 6 | { 7 | CAGE_TESTCASE("hashes"); 8 | 9 | { 10 | CAGE_TESTCASE("sha1"); 11 | 12 | { 13 | const auto r = hashSha1(""); 14 | CAGE_TEST(hashToHexadecimal(r) == "da39a3ee5e6b4b0d3255bfef95601890afd80709"); 15 | CAGE_TEST(hashToBase64(r) == "2jmj7l5rSw0yVb/vlWAYkK/YBwk="); 16 | } 17 | 18 | { 19 | const auto r = hashSha1("The quick brown fox jumps over the lazy dog"); 20 | CAGE_TEST(hashToHexadecimal(r) == "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"); 21 | CAGE_TEST(hashToBase64(r) == "L9ThxnotKPzthJ7hu3bnORuT6xI="); 22 | } 23 | 24 | { 25 | const auto r = hashSha1("The quick brown fox jumps over the lazy cog"); 26 | CAGE_TEST(hashToHexadecimal(r) == "de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3"); 27 | CAGE_TEST(hashToBase64(r) == "3p8sf9JeGzr60+haC9F9mxANtLM="); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sources/test-assets/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace cage; 7 | 8 | int main(int argc, const char *args[]) 9 | { 10 | initializeConsoleLogger(); 11 | try 12 | { 13 | while (true) 14 | { 15 | ProcessCreateConfig cfg("cage-asset-database"); 16 | cfg.discardStdErr = cfg.discardStdIn = cfg.discardStdOut = true; 17 | Holder proc = newProcess(cfg); 18 | const auto res = proc->wait(); 19 | if (res != 0) 20 | CAGE_THROW_ERROR(Exception, "asset database failed"); 21 | 22 | pathRemove("process-log"); 23 | pathRemove("../assets.carch"); 24 | pathRemove("../data/database"); 25 | 26 | // give some time for the filesystem 27 | threadSleep(1000 * 1000); 28 | } 29 | } 30 | catch (...) 31 | { 32 | detail::logCurrentCaughtException(); 33 | } 34 | return 1; 35 | } 36 | -------------------------------------------------------------------------------- /sources/include/cage-core/assetsSchemes.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_assetsSchemes_jhdsre4r 2 | #define guard_assetsSchemes_jhdsre4r 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API AssetPack 9 | {}; 10 | CAGE_CORE_API AssetsScheme genAssetSchemePack(); 11 | constexpr uint32 AssetSchemeIndexPack = 0; 12 | 13 | CAGE_CORE_API AssetsScheme genAssetSchemeRaw(); 14 | constexpr uint32 AssetSchemeIndexRaw = 1; 15 | 16 | CAGE_CORE_API AssetsScheme genAssetSchemeTexts(); 17 | constexpr uint32 AssetSchemeIndexTexts = 2; 18 | 19 | CAGE_CORE_API AssetsScheme genAssetSchemeCollider(); 20 | constexpr uint32 AssetSchemeIndexCollider = 3; 21 | 22 | CAGE_CORE_API AssetsScheme genAssetSchemeSkeletonRig(); 23 | constexpr uint32 AssetSchemeIndexSkeletonRig = 5; 24 | 25 | CAGE_CORE_API AssetsScheme genAssetSchemeSkeletalAnimation(); 26 | constexpr uint32 AssetSchemeIndexSkeletalAnimation = 6; 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /sources/include/cage-core/networkTcp.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_networkTcp_h_olkjhgv56ce 2 | #define guard_networkTcp_h_olkjhgv56ce 3 | 4 | #include 5 | #include 6 | 7 | namespace cage 8 | { 9 | struct CAGE_CORE_API TcpRemoteInfo 10 | { 11 | String address; 12 | uint16 port = 0; 13 | }; 14 | 15 | class CAGE_CORE_API TcpConnection : public File 16 | { 17 | public: 18 | TcpRemoteInfo remoteInfo() const; 19 | }; 20 | 21 | CAGE_CORE_API Holder newTcpConnection(const String &address, uint16 port); // blocking 22 | 23 | class CAGE_CORE_API TcpServer : private Immovable 24 | { 25 | public: 26 | uint16 port() const; // local port 27 | 28 | // returns empty holder if no new peer has connected 29 | Holder accept(); // non-blocking 30 | }; 31 | 32 | CAGE_CORE_API Holder newTcpServer(uint16 port); 33 | } 34 | 35 | #endif // guard_networkTcp_h_olkjhgv56ce 36 | -------------------------------------------------------------------------------- /sources/include/cage-core/memoryCompression.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_memoryCompression_h_edrz4gh6ret54zh6r4t 2 | #define guard_memoryCompression_h_edrz4gh6ret54zh6r4t 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | // preference = 100 -> best compression ratio, but very slow 9 | // preference = 0 -> full compression speed, but worse compression ratio 10 | CAGE_CORE_API Holder> memoryCompress(PointerRange input, sint32 preference = 90); 11 | CAGE_CORE_API Holder> memoryDecompress(PointerRange input, uintPtr outputSize); 12 | CAGE_CORE_API void memoryCompress(PointerRange input, PointerRange &output, sint32 preference = 90); 13 | CAGE_CORE_API void memoryDecompress(PointerRange input, PointerRange &output); 14 | CAGE_CORE_API uintPtr compressionBound(uintPtr size); 15 | } 16 | 17 | #endif // guard_memoryCompression_h_edrz4gh6ret54zh6r4t 18 | -------------------------------------------------------------------------------- /sources/include/cage-core/signedDistanceFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_signedDistanceFunction_h_sdfgr1esd56r 2 | #define guard_signedDistanceFunction_h_sdfgr1esd56r 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_CORE_API Real sdfPlane(Vec3 pos, Plane plane); 9 | CAGE_CORE_API Real sdfSphere(Vec3 pos, Real radius); 10 | CAGE_CORE_API Real sdfCapsule(Vec3 pos, Real prolong, Real radius); 11 | CAGE_CORE_API Real sdfCylinder(Vec3 pos, Real halfHeight, Real radius); 12 | CAGE_CORE_API Real sdfBox(Vec3 pos, Vec3 radius); 13 | CAGE_CORE_API Real sdfTetrahedron(Vec3 pos, Real radius); 14 | CAGE_CORE_API Real sdfOctahedron(Vec3 pos, Real radius); 15 | CAGE_CORE_API Real sdfHexagonalPrism(Vec3 pos, Real halfHeight, Real radius); 16 | CAGE_CORE_API Real sdfTorus(Vec3 pos, Real major, Real minor); 17 | CAGE_CORE_API Real sdfKnot(Vec3 pos, Real scale, Real k); 18 | } 19 | 20 | #endif // guard_signedDistanceFunction_h_sdfgr1esd56r 21 | -------------------------------------------------------------------------------- /sources/test-core/macros.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | 5 | void testMacros() 6 | { 7 | CAGE_TESTCASE("macros"); 8 | 9 | { 10 | CAGE_TESTCASE("GCHL_NUM_ARGS"); 11 | 12 | CAGE_TEST(CAGE_EVAL(GCHL_NUM_ARGS()) == 0); 13 | CAGE_TEST(CAGE_EVAL(GCHL_NUM_ARGS(a)) == 1); 14 | CAGE_TEST(CAGE_EVAL(GCHL_NUM_ARGS(42, 13)) == 2); 15 | CAGE_TEST(CAGE_EVAL(GCHL_NUM_ARGS(abc, def, ghi)) == 3); 16 | CAGE_TEST(CAGE_EVAL(GCHL_NUM_ARGS(a, b, c, d, e, f, g, h, i)) == 9); 17 | } 18 | 19 | { 20 | CAGE_TESTCASE("CAGE_EXPAND_ARGS"); 21 | 22 | uint32 tmp = 0; 23 | #define ADD(X) tmp += X; 24 | CAGE_EVAL(CAGE_EXPAND_ARGS(ADD, 13, 17, 42)); 25 | #undef ADD 26 | CAGE_TEST(tmp == 13 + 17 + 42); 27 | } 28 | 29 | { 30 | CAGE_TESTCASE("CAGE_REPEAT"); 31 | 32 | uint32 tmp = 0; 33 | #define ADD(X) tmp += X; 34 | CAGE_EVAL(CAGE_REPEAT(5, ADD)); 35 | #undef ADD 36 | CAGE_TEST(tmp == 1 + 2 + 3 + 4 + 5); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/fbm.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include noise.glsl 3 | 4 | const int fbmOctaves = 5; 5 | 6 | float fbm(float x) 7 | { 8 | float v = 0; 9 | float a = 0.5; 10 | const float shift = float(100); 11 | for (int i = 0; i < fbmOctaves; ++i) 12 | { 13 | v += a * noise(x); 14 | x = x * 2 + shift; 15 | a *= 0.5; 16 | } 17 | return v; 18 | } 19 | 20 | 21 | float fbm(vec2 x) 22 | { 23 | float v = 0; 24 | float a = 0.5; 25 | const vec2 shift = vec2(100); 26 | const mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.5)); 27 | for (int i = 0; i < fbmOctaves; ++i) 28 | { 29 | v += a * noise(x); 30 | x = rot * x * 2 + shift; 31 | a *= 0.5; 32 | } 33 | return v; 34 | } 35 | 36 | 37 | float fbm(vec3 x) 38 | { 39 | float v = 0; 40 | float a = 0.5; 41 | const vec3 shift = vec3(100); 42 | for (int i = 0; i < fbmOctaves; ++i) 43 | { 44 | v += a * noise(x); 45 | x = x * 2 + shift; 46 | a *= 0.5; 47 | } 48 | return v; 49 | } 50 | -------------------------------------------------------------------------------- /sources/include/cage-core/assetHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_assetHeader_h_k1i7178asdvujhz89jhg14j 2 | #define guard_assetHeader_h_k1i7178asdvujhz89jhg14j 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace cage 9 | { 10 | struct CAGE_CORE_API AssetHeader 11 | { 12 | // this is the first header found in every asset file 13 | 14 | std::array cageName = { "cageAss" }; 15 | uint32 version = 0; 16 | uint32 flags = 0; 17 | AssetLabel textId; 18 | uint64 compressedSize = 0; 19 | uint64 originalSize = 0; 20 | uint16 scheme = m; 21 | uint16 dependenciesCount = 0; 22 | 23 | AssetHeader() = default; 24 | explicit AssetHeader(const String &textId, uint16 schemeIndex); // this will convert too long name to fit in the label 25 | 26 | // follows: 27 | // array of dependency names, each uint32 28 | // any other asset-specific data 29 | }; 30 | } 31 | 32 | #endif // guard_assetHeader_h_k1i7178asdvujhz89jhg14j 33 | -------------------------------------------------------------------------------- /sources/include/cage-engine/sound.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_sound_h_8EF0985E04CD4714B530EA7D605E92EC 2 | #define guard_sound_h_8EF0985E04CD4714B530EA7D605E92EC 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class Audio; 9 | 10 | class CAGE_ENGINE_API Sound : private Immovable 11 | { 12 | detail::StringBase<128> label; 13 | 14 | public: 15 | void setLabel(const String &name); 16 | 17 | void importAudio(Holder