├── .editorconfig ├── .github └── workflows │ ├── codeql.yml │ └── tests.yml ├── .gitignore ├── .gitmodules ├── BUILDING.md ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── cage-asset-database.in.ini ├── cage_all.cmake ├── cage_assets.cmake ├── cage_build_configuration.cmake ├── cage_build_destination.cmake ├── cage_copy_redist.cmake ├── cage_default_init.cmake ├── cage_directory_link.cmake ├── cage_disable_source_build.cmake ├── cage_embed_file.cmake ├── cage_ide_category.cmake ├── cage_ide_sort_files.cmake ├── cage_ide_startup_project.cmake ├── cage_ide_working_dir.cmake ├── cage_print_all_variables.cmake ├── cage_print_target_properties.cmake └── cage_target_api_macro.cmake ├── data └── cage │ ├── cage.assets │ ├── cage.pack │ ├── fonts │ ├── fonts.assets │ ├── fonts.pack │ └── ubuntu │ │ ├── CONTRIBUTING.txt │ │ ├── FONTLOG.txt │ │ ├── LICENCE-FAQ.txt │ │ ├── LICENCE.txt │ │ ├── README.txt │ │ ├── TRADEMARKS.txt │ │ ├── bold.ttf │ │ ├── copyright.txt │ │ ├── italic.ttf │ │ ├── modifications.txt │ │ ├── monospace.ttf │ │ └── regular.ttf │ ├── models │ ├── axes-albedo.png │ ├── axes.mtl │ ├── axes.obj │ ├── bone.obj │ ├── bone.obj_DefaultMaterial.cpm │ ├── fake.obj │ ├── fake.obj_DefaultMaterial.cpm │ ├── guiElement.obj │ ├── icon.obj │ ├── models.assets │ ├── models.pack │ ├── sphere.obj │ └── square.obj │ ├── shaders │ ├── .gitignore │ ├── effects │ │ ├── bloomApply.glsl │ │ ├── bloomGenerate.glsl │ │ ├── dofApply.glsl │ │ ├── dofCollect.glsl │ │ ├── effects.assets │ │ ├── effects.pack │ │ ├── fxaa.glsl │ │ ├── gaussianBlur.glsl │ │ ├── luminanceApply.glsl │ │ ├── luminanceCollection.glsl │ │ ├── luminanceHistogram.glsl │ │ ├── luminanceParams.glsl │ │ ├── sharpening.glsl │ │ ├── ssaoDownscaleDepth.glsl │ │ ├── ssaoGenerate.glsl │ │ ├── ssaoParams.glsl │ │ ├── ssaoResolve.glsl │ │ ├── tonemap.glsl │ │ └── vertex.glsl │ ├── engine │ │ ├── billboard.glsl │ │ ├── blitPixels.glsl │ │ ├── blitScaled.glsl │ │ ├── decal.glsl │ │ ├── engine.assets │ │ ├── engine.pack │ │ ├── fragment.glsl │ │ ├── icon.glsl │ │ ├── skybox.glsl │ │ ├── standard.glsl │ │ ├── text.glsl │ │ ├── uniforms.glsl │ │ └── vertex.glsl │ ├── functions │ │ ├── attenuation.glsl │ │ ├── biplanar.glsl │ │ ├── brdf.glsl │ │ ├── common.glsl │ │ ├── fbm.glsl │ │ ├── hash.glsl │ │ ├── hsvToRgb.glsl │ │ ├── makeTangentSpace.glsl │ │ ├── noise.glsl │ │ ├── poissonDisk26.glsl │ │ ├── poissonDisk3.glsl │ │ ├── poissonDisk4.glsl │ │ ├── poissonDisk5.glsl │ │ ├── poissonDisk6.glsl │ │ ├── poissonDisk64.glsl │ │ ├── poissonDisk7.glsl │ │ ├── poissonDisk8.glsl │ │ ├── randomAngle.glsl │ │ ├── randomFunc.glsl │ │ ├── reconstructPosition.glsl │ │ ├── restoreNormalMap.glsl │ │ ├── sampleShadowMap.glsl │ │ ├── sampleTextureAnimation.glsl │ │ └── simplex.glsl │ ├── gui │ │ ├── colorPicker.glsl │ │ ├── element.glsl │ │ ├── font.glsl │ │ ├── gui.assets │ │ ├── gui.pack │ │ └── image.glsl │ ├── shaders.assets │ └── shaders.pack │ ├── sounds │ ├── click.wav │ ├── comboOpen.wav │ ├── comboSelect.wav │ ├── hover.wav │ ├── sliding.wav │ ├── sounds.assets │ ├── sounds.pack │ ├── tooltipOpen.wav │ ├── typing.wav │ ├── typingConfirm.wav │ └── typingInvalid.wav │ └── textures │ ├── credits.txt │ ├── gui.pdn │ ├── gui.png │ ├── helper.jpg │ ├── keybindAdd.png │ ├── keybindClear.png │ ├── keybindRemove.png │ ├── keybindReset.png │ ├── progressbar │ ├── 0.png │ ├── 1.png │ ├── 10.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png │ ├── readme.md │ ├── textures.assets │ ├── textures.pack │ └── tooltips.png ├── externals ├── .editorconfig ├── CMakeLists.txt ├── assimp │ └── CMakeLists.txt ├── avir │ ├── CMakeLists.txt │ └── dummy.cpp ├── bc7enc_rdo │ └── CMakeLists.txt ├── cage_gen_module.cmake ├── cpr │ └── CMakeLists.txt ├── cubeb │ └── CMakeLists.txt ├── curl │ └── CMakeLists.txt ├── dr_libs │ └── CMakeLists.txt ├── dualmc │ ├── CMakeLists.txt │ └── dummy.cpp ├── fastnoise │ ├── CMakeLists.txt │ └── dummy.cpp ├── fetch_latest.sh ├── freetype │ └── CMakeLists.txt ├── gamenetworkingsockets │ └── CMakeLists.txt ├── glad │ └── CMakeLists.txt ├── glfw │ └── CMakeLists.txt ├── glm │ └── CMakeLists.txt ├── harfbuzz │ └── CMakeLists.txt ├── hsluv │ ├── CMakeLists.txt │ ├── hsluv.c │ └── hsluv.h ├── jpeg │ ├── CMakeLists.txt │ └── yasm │ │ ├── Artistic.txt │ │ ├── BSD.txt │ │ ├── COPYING │ │ ├── README.md │ │ ├── win32 │ │ └── bin │ │ │ ├── msvcr100.dll │ │ │ └── yasm.exe │ │ └── win64 │ │ └── bin │ │ ├── msvcr100.dll │ │ └── yasm.exe ├── mbedtls │ └── CMakeLists.txt ├── msdfgen │ └── CMakeLists.txt ├── ogg │ └── CMakeLists.txt ├── openxr-sdk │ └── CMakeLists.txt ├── plf │ └── CMakeLists.txt ├── pmp │ └── CMakeLists.txt ├── png │ └── CMakeLists.txt ├── protobuf │ ├── CMakeLists.txt │ └── protoc │ │ ├── win32 │ │ └── bin │ │ │ └── protoc.exe │ │ └── win64 │ │ └── bin │ │ └── protoc.exe ├── quickhull │ └── CMakeLists.txt ├── samplerate │ └── CMakeLists.txt ├── sheenbidi │ └── CMakeLists.txt ├── simplefilewatcher │ └── CMakeLists.txt ├── stb │ ├── CMakeLists.txt │ └── stb.c ├── tiff │ └── CMakeLists.txt ├── tinyexr │ ├── CMakeLists.txt │ └── tinyexr.cpp ├── uni-algo │ └── CMakeLists.txt ├── unordered_dense │ └── CMakeLists.txt ├── vorbis │ └── CMakeLists.txt ├── wamr │ ├── CMakeLists.txt │ └── os_thread_get_stack_boundary_dummy.c ├── xatlas │ └── CMakeLists.txt ├── zlib-ng │ └── CMakeLists.txt └── zstd │ └── CMakeLists.txt ├── schemes ├── animation.scheme ├── collider.scheme ├── font.scheme ├── model.scheme ├── object.scheme ├── pack.scheme ├── raw.scheme ├── shader.scheme ├── skeleton.scheme ├── sound.scheme ├── texts.scheme └── texture.scheme └── sources ├── .clang-format ├── CMakeLists.txt ├── asset-analyze └── main.cpp ├── asset-database ├── config.cpp ├── databank.cpp ├── database.h ├── main.cpp ├── notifier.cpp ├── processing.cpp └── scheme.cpp ├── asset-processor ├── analyze.cpp ├── animation.cpp ├── collider.cpp ├── font.cpp ├── main.cpp ├── model.cpp ├── object.cpp ├── pack.cpp ├── processor.h ├── raw.cpp ├── shader.cpp ├── skeleton.cpp ├── sound.cpp ├── texts.cpp └── texture.cpp ├── controller-bindings ├── google_daydreem.ini ├── htc_vive.ini ├── khr_simple.ini ├── microsoft_motion.ini ├── oculus_go.ini ├── oculus_touch.ini └── valve_index.ini ├── image-channels └── main.cpp ├── image-convert └── main.cpp ├── image-info ├── imageInfo.h └── main.cpp ├── image-resize └── main.cpp ├── image-untile └── main.cpp ├── include ├── cage-core │ ├── any.h │ ├── assetContext.h │ ├── assetHeader.h │ ├── assetProcessor.h │ ├── assetsManager.h │ ├── assetsOnDemand.h │ ├── audio.h │ ├── audioAlgorithms.h │ ├── audioChannelsConverter.h │ ├── audioDirectionalConverter.h │ ├── blockContainer.h │ ├── camera.h │ ├── collider.h │ ├── collisionStructure.h │ ├── color.h │ ├── concurrent.h │ ├── concurrentQueue.h │ ├── config.h │ ├── containerSerialization.h │ ├── core.h │ ├── debug.h │ ├── endianness.h │ ├── entities.h │ ├── entitiesCopy.h │ ├── entitiesVisitor.h │ ├── enumBits.h │ ├── enumerate.h │ ├── events.h │ ├── files.h │ ├── flatBag.h │ ├── flatSet.h │ ├── geometry.h │ ├── guid.h │ ├── hashBuffer.h │ ├── hashString.h │ ├── hashes.h │ ├── image.h │ ├── imageAlgorithms.h │ ├── imageBlocks.h │ ├── imageImport.h │ ├── ini.h │ ├── lineReader.h │ ├── logger.h │ ├── lruCache.h │ ├── macros.h │ ├── marchingCubes.h │ ├── mat3x4.h │ ├── math.h │ ├── memoryAlloca.h │ ├── memoryAllocators.h │ ├── memoryArena.h │ ├── memoryBuffer.h │ ├── memoryCompression.h │ ├── memoryInplaceBuffer.h │ ├── memoryUtils.h │ ├── mesh.h │ ├── meshAlgorithms.h │ ├── meshExport.h │ ├── meshImport.h │ ├── meshIoCommon.h │ ├── meshShapes.h │ ├── networkDiscovery.h │ ├── networkGinnel.h │ ├── networkHttp.h │ ├── networkSteam.h │ ├── networkTcp.h │ ├── networkUtils.h │ ├── networkWebsocket.h │ ├── noiseFunction.h │ ├── pointerRangeHolder.h │ ├── process.h │ ├── profiling.h │ ├── random.h │ ├── rectPacking.h │ ├── sampleRateConverter.h │ ├── scheduler.h │ ├── scopeGuard.h │ ├── scopeLock.h │ ├── serialization.h │ ├── signedDistanceFunctions.h │ ├── skeletalAnimation.h │ ├── skeletalAnimationPreparator.h │ ├── spatialStructure.h │ ├── stdBufferStream.h │ ├── stdHash.h │ ├── string.h │ ├── stringLiteral.h │ ├── swapBufferGuard.h │ ├── systemInformation.h │ ├── tasks.h │ ├── texts.h │ ├── threadPool.h │ ├── timer.h │ ├── typeIndex.h │ ├── unicode.h │ ├── variableInterpolatingBuffer.h │ ├── variableSmoothingBuffer.h │ └── wasm.h ├── cage-engine │ ├── assetStructs.h │ ├── clipboard.h │ ├── core.h │ ├── font.h │ ├── frameBuffer.h │ ├── gamepad.h │ ├── graphicsError.h │ ├── guiBuilder.h │ ├── guiComponents.h │ ├── guiManager.h │ ├── guiSkins.h │ ├── highPerformanceGpuHint.h │ ├── inputs.h │ ├── keybinds.h │ ├── model.h │ ├── opengl.h │ ├── provisionalGraphics.h │ ├── provisionalHandles.h │ ├── renderObject.h │ ├── renderPipeline.h │ ├── renderQueue.h │ ├── scene.h │ ├── sceneScreenSpaceEffects.h │ ├── sceneVirtualReality.h │ ├── screenList.h │ ├── screenSpaceEffects.h │ ├── screenSpaceEffectsProperties.h │ ├── shaderConventions.h │ ├── shaderProgram.h │ ├── sound.h │ ├── soundCommon.h │ ├── soundsQueue.h │ ├── soundsVoices.h │ ├── speaker.h │ ├── speakerList.h │ ├── texture.h │ ├── uniformBuffer.h │ ├── virtualReality.h │ ├── winMain.h │ └── window.h └── cage-simple │ ├── cameraRay.h │ ├── engine.h │ ├── fpsCamera.h │ ├── fullscreenSwitcher.h │ ├── guiInWorld.h │ └── statisticsGui.h ├── libcore ├── assets │ ├── assetProcessor.cpp │ ├── assetStructs.cpp │ ├── assetsManager.cpp │ ├── assetsOnDemand.cpp │ └── texts.cpp ├── audio │ ├── audio.cpp │ ├── audio.h │ ├── audioIo.cpp │ ├── audioStream.cpp │ ├── channelsConverter.cpp │ ├── directionalConverter.cpp │ ├── flac.cpp │ ├── mp3.cpp │ ├── ogg.cpp │ ├── sampleRateConverter.cpp │ ├── vorbis.cpp │ ├── vorbis.h │ └── wav.cpp ├── cage-core.natvis ├── color.cpp ├── concurrent │ ├── concurrent.cpp │ ├── openUrl.cpp │ ├── process.cpp │ ├── tasks.cpp │ └── threadPool.cpp ├── config.cpp ├── crashHandler.cpp ├── debug.cpp ├── entities.cpp ├── entitiesCopy.cpp ├── events.cpp ├── exception.cpp ├── filesystem │ ├── abstractFiles.cpp │ ├── api.cpp │ ├── archiveCarch.cpp │ ├── archiveZip.cpp │ ├── files.h │ ├── memoryFiles.cpp │ ├── paths.cpp │ ├── proxyFile.cpp │ ├── realFiles.cpp │ └── realWatcher.cpp ├── geometry │ ├── aabbCone.cpp │ ├── collider.cpp │ ├── collisionStructure.cpp │ ├── geometry.cpp │ ├── linesDistances.cpp │ ├── minimumBoundingSphere.cpp │ ├── shapes.cpp │ ├── spatialStructure.cpp │ ├── triangleBox.cpp │ └── triangleTriangle.cpp ├── guid.cpp ├── hashes.cpp ├── image │ ├── bcn.cpp │ ├── dds.cpp │ ├── exr.cpp │ ├── image.cpp │ ├── image.h │ ├── imageAlgorithms.cpp │ ├── imageImport.cpp │ ├── imageIo.cpp │ ├── imageResize.cpp │ ├── jpeg.cpp │ ├── png.cpp │ ├── psd.cpp │ ├── tga.cpp │ └── tiff.cpp ├── ini.cpp ├── lineReader.cpp ├── logger.cpp ├── math │ ├── camera.cpp │ ├── math.h │ ├── matrices.cpp │ ├── random.cpp │ ├── scalars.cpp │ ├── transform.cpp │ └── vectors.cpp ├── memory │ ├── allocators.cpp │ ├── buffer.cpp │ ├── compression.cpp │ ├── memoryArena.cpp │ └── utils.cpp ├── mesh │ ├── exportGltf.cpp │ ├── exportObj.cpp │ ├── importAssimp.cpp │ ├── importConvert.cpp │ ├── marchingCubes.cpp │ ├── mesh.cpp │ ├── mesh.h │ ├── meshAlgorithms.cpp │ ├── meshAttributes.cpp │ ├── meshSerialization.cpp │ ├── pmp.cpp │ ├── quickhull.cpp │ ├── shapes.cpp │ ├── skeletalAnimation.cpp │ ├── skeletalAnimationPreparator.cpp │ └── xatlas.cpp ├── network │ ├── abslLog.cpp │ ├── discovery.cpp │ ├── ginnel.cpp │ ├── http.cpp │ ├── net.cpp │ ├── net.h │ ├── steam.cpp │ ├── tcp.cpp │ └── websocket.cpp ├── noiseFunction.cpp ├── profiling.cpp ├── rectPacking.cpp ├── scheduler.cpp ├── serialization.cpp ├── signedDistanceFunctions.cpp ├── stdBufferStream.cpp ├── string.cpp ├── swapBufferGuard.cpp ├── systemInformation.cpp ├── timer.cpp ├── typeIndex.cpp ├── unicode │ ├── unicode.cpp │ └── utf.cpp ├── variableSmoothingBuffer.cpp ├── wasm.cpp ├── windowsAutoHandle.h └── windowsMinimumInclude.h ├── libengine ├── assets │ ├── font.cpp │ ├── model.cpp │ ├── renderObject.cpp │ ├── shaderProgram.cpp │ ├── sound.cpp │ └── texture.cpp ├── graphics │ ├── font.cpp │ ├── frameBuffer.cpp │ ├── graphicsError.cpp │ ├── model.cpp │ ├── provisionalGraphics.cpp │ ├── renderObject.cpp │ ├── renderPipeline.cpp │ ├── renderQueue.cpp │ ├── screenSpaceEffects.cpp │ ├── shaderProgram.cpp │ ├── ssaoPoints.cpp │ ├── texture.cpp │ └── uniformBuffer.cpp ├── gui │ ├── elementsTemplate.cpp │ ├── events.cpp │ ├── graphics.cpp │ ├── gui.cpp │ ├── guiBuilder.cpp │ ├── items.cpp │ ├── layouts │ │ ├── alignment.cpp │ │ ├── explicitSize.cpp │ │ ├── line.cpp │ │ ├── scrollbars.cpp │ │ ├── split.cpp │ │ └── table.cpp │ ├── private.h │ ├── skin.cpp │ ├── tooltips.cpp │ └── widgets │ │ ├── button.cpp │ │ ├── checkBox.cpp │ │ ├── colorPicker.cpp │ │ ├── comboBox.cpp │ │ ├── frame.cpp │ │ ├── header.cpp │ │ ├── input.cpp │ │ ├── label.cpp │ │ ├── panel.cpp │ │ ├── progressBar.cpp │ │ ├── radioBox.cpp │ │ ├── separator.cpp │ │ ├── sliderBar.cpp │ │ ├── solidColor.cpp │ │ ├── spoiler.cpp │ │ └── textArea.cpp ├── keybinds.cpp ├── sound │ ├── effectiveGain.h │ ├── sound.cpp │ ├── soundsQueue.cpp │ ├── soundsVoices.cpp │ ├── speaker.cpp │ └── speakerList.cpp ├── virtualReality │ ├── controllerBindings.cpp │ ├── openxr.cpp │ ├── platforms.cpp │ └── sceneUpdateEvents.cpp ├── winMain.cpp └── window │ ├── gamepad.cpp │ ├── glfw.cpp │ ├── private.h │ ├── screenList.cpp │ └── window.cpp ├── libsimple ├── cameraRay.cpp ├── engine.h ├── externs.cpp ├── fpsCamera.cpp ├── fullscreenSwitcher.cpp ├── gameloop.cpp ├── graphics.cpp ├── guiInWorld.cpp ├── interpolationTimingCorrector.h ├── sound.cpp └── statisticsGui.cpp ├── mesh-info └── main.cpp ├── profiling.htm ├── test-assets └── main.cpp ├── test-core ├── any.cpp ├── archivesBigFiles.cpp ├── archivesCarch.cpp ├── archivesRecursion.cpp ├── archivesZip.cpp ├── assetsManager.cpp ├── assetsOnDemand.cpp ├── audio.cpp ├── blockContainer.cpp ├── classes.cpp ├── collider.cpp ├── collisionStructure.cpp ├── color.cpp ├── concurrent.cpp ├── concurrentQueue.cpp ├── config.cpp ├── configIni.cpp ├── containerSerialization.cpp ├── copyAndMove.cpp ├── delegates.cpp ├── entities.cpp ├── entitiesCopy.cpp ├── entitiesSerialization.cpp ├── entitiesVisitor.cpp ├── enumerate.cpp ├── enums.cpp ├── events.cpp ├── exceptions.cpp ├── files.cpp ├── flatBag.cpp ├── flatSet.cpp ├── geometry.cpp ├── hashes.cpp ├── holder.cpp ├── image.cpp ├── installConsistentPaths.cpp ├── lineReader.cpp ├── logger.cpp ├── lruCache.cpp ├── macros.cpp ├── main.cpp ├── main.h ├── marchingCubes.cpp ├── math.cpp ├── mathGlm.cpp ├── memoryAllocators.cpp ├── memoryArena.cpp ├── memoryBuffer.cpp ├── mesh.cpp ├── networkDiscovery.cpp ├── networkGinnel.cpp ├── networkHttp.cpp ├── networkSteam.cpp ├── networkTcp.cpp ├── networkWebsocket.cpp ├── noiseFunction.cpp ├── numericTypes.cpp ├── paths.cpp ├── pointerRange.cpp ├── pointsOnSphere.cpp ├── process.cpp ├── profiling.cpp ├── random.cpp ├── rectPacking.cpp ├── scheduler.cpp ├── serialization.cpp ├── signedDistanceFunctions.cpp ├── spatialStructure.cpp ├── stdHash.cpp ├── strings.cpp ├── swapBufferGuard.cpp ├── systemInformation.cpp ├── tasks.cpp ├── typeIndex.cpp ├── unicode.cpp ├── variableInterpolatingBuffer.cpp ├── variableSmoothingBuffer.cpp ├── wasm.cpp └── wasm │ ├── compile.sh │ ├── foo.cpp │ ├── foo.wasm │ ├── natives.c │ ├── natives.wasm │ ├── strings.c │ ├── strings.wasm │ ├── sums.c │ └── sums.wasm ├── test-entities └── main.cpp ├── test-ginnel ├── client.cpp ├── common.h ├── conn.cpp ├── main.cpp ├── runner.cpp └── server.cpp └── test-install ├── .gitignore ├── CMakeLists.txt ├── README.md └── main.cpp /.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 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | Analyze: 6 | runs-on: ubuntu-24.04 7 | permissions: 8 | actions: read 9 | contents: read 10 | security-events: write 11 | env: 12 | CC: clang 13 | CXX: clang++ 14 | strategy: 15 | fail-fast: false 16 | 17 | steps: 18 | - name: Install packages 19 | run: | 20 | sudo apt-get update 21 | sudo apt-get install -y xorg-dev libwayland-dev libxkbcommon-dev libpulse-dev libasound2-dev nasm libssl-dev 22 | 23 | - name: Checkout repository 24 | uses: actions/checkout@v4 25 | with: 26 | submodules: recursive 27 | 28 | - name: Initialize CodeQL 29 | uses: github/codeql-action/init@v2 30 | with: 31 | languages: cpp 32 | config: | 33 | query-filters: 34 | - exclude: 35 | id: cpp/integer-multiplication-cast-to-long 36 | 37 | - name: Configure 38 | run: | 39 | mkdir build 40 | cd build 41 | cmake -DCMAKE_BUILD_TYPE=DEBUG .. 42 | 43 | - name: Build 44 | run: | 45 | cd build 46 | cmake --build . -- -j$(( `nproc` + 1 )) 47 | 48 | - name: CodeQL Analysis 49 | uses: github/codeql-action/analyze@v2 50 | with: 51 | category: "/language:cpp" 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build* 2 | /Win32 3 | /x64 4 | /.vs 5 | /out 6 | CMakeLists.txt.user 7 | CMakeSettings.json 8 | *~ 9 | *.TMP 10 | -------------------------------------------------------------------------------- /BUILDING.md: -------------------------------------------------------------------------------- 1 | 2 | # Git submodules 3 | 4 | Make sure that git submodules are loaded too. 5 | ```bash 6 | git pull 7 | git submodule sync --recursive 8 | git submodule update --init --recursive 9 | ``` 10 | 11 | # Building 12 | 13 | ## Windows 14 | 15 | These instructions assume using bash that comes with "git for windows", but is not mandatory to the build itself. 16 | 17 | Prepare build directory. 18 | ```bash 19 | mkdir build ; cd build 20 | ``` 21 | 22 | Configure the project. 23 | ```bash 24 | cmake .. 25 | ``` 26 | 27 | Open VS solution or build everything. 28 | ```bash 29 | cmake --build . --config RELWITHDEBINFO 30 | ``` 31 | 32 | ## Linux 33 | 34 | These instructions apply to debian-based distributions (eg. ubuntu). 35 | It may work on other distributions with little changes. 36 | 37 | Install required packages. 38 | ```bash 39 | sudo apt install xorg-dev libwayland-dev libxkbcommon-dev libpulse-dev libasound2-dev nasm libssl-dev 40 | ``` 41 | 42 | Prepare build directory. 43 | ```bash 44 | mkdir build ; cd build 45 | ``` 46 | 47 | Configure the project. 48 | ```bash 49 | cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO .. 50 | ``` 51 | 52 | Build. 53 | ```bash 54 | cmake --build . -- -j8 # 8 is number of processor cores 55 | ``` 56 | 57 | # Converting Assets 58 | 59 | Run `cage-asset-database`. You may find it in build/result/relwithdebinfo. 60 | 61 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.31) 2 | project(cage LANGUAGES CXX C) 3 | 4 | message(STATUS "----------------------------------------------------------------") 5 | message(STATUS "cage start") 6 | message(STATUS "----------------------------------------------------------------") 7 | 8 | message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") 9 | message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}") 10 | message(STATUS "CMAKE_CXX_SIMULATE_ID: ${CMAKE_CXX_SIMULATE_ID}") 11 | if(NOT CMAKE_CONFIGURATION_TYPES) 12 | message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") 13 | endif() 14 | if(WIN32) 15 | message(STATUS "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") 16 | endif() 17 | 18 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 19 | include(cage_all) 20 | 21 | if(CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_BINARY_DIR) 22 | cage_default_init() # standalone build 23 | else() 24 | cage_disable_source_build() 25 | cage_build_configuration() 26 | endif() 27 | 28 | add_subdirectory(externals EXCLUDE_FROM_ALL) 29 | add_subdirectory(sources) 30 | cage_ide_startup_project(cage-test-core) 31 | 32 | message(STATUS "----------------------------------------------------------------") 33 | message(STATUS "cage done") 34 | message(STATUS "----------------------------------------------------------------") 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Tomáš Malý 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_ide_category) 11 | include(cage_ide_sort_files) 12 | include(cage_ide_startup_project) 13 | include(cage_ide_working_dir) 14 | include(cage_print_all_variables) 15 | include(cage_print_target_properties) 16 | include(cage_target_api_macro) 17 | -------------------------------------------------------------------------------- /cmake/cage_build_destination.cmake: -------------------------------------------------------------------------------- 1 | 2 | set(cage_build_destination_directory "${CMAKE_BINARY_DIR}/result" CACHE PATH "Directory to put in all final build products (subdir per configuration).") 3 | set(cage_build_destination_archives OFF CACHE BOOL "Move archive artifacts into the output directory.") 4 | 5 | function(cage_build_destination) 6 | foreach(conf IN ITEMS ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) 7 | string(TOUPPER ${conf} conf_upper) 8 | string(TOLOWER ${conf} conf_lower) 9 | if(${cage_build_destination_archives}) 10 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${conf_upper} "${cage_build_destination_directory}/${conf_lower}/lib" PARENT_SCOPE) 11 | endif() 12 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${conf_upper} "${cage_build_destination_directory}/${conf_lower}" PARENT_SCOPE) 13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${conf_upper} "${cage_build_destination_directory}/${conf_lower}" PARENT_SCOPE) 14 | endforeach(conf) 15 | endfunction(cage_build_destination) 16 | 17 | -------------------------------------------------------------------------------- /cmake/cage_default_init.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(cage_default_init) 3 | cage_disable_source_build() 4 | cage_build_configuration() 5 | cage_build_destination() 6 | cage_assets_init() 7 | cage_copy_redist() 8 | endmacro(cage_default_init) 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/cage/cage.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | cage.pack 4 | 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/fonts/fonts.pack: -------------------------------------------------------------------------------- 1 | [] 2 | ubuntu/regular.ttf 3 | # the other fonts should not be preloaded 4 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/CONTRIBUTING.txt: -------------------------------------------------------------------------------- 1 | The Ubuntu Font Family is very long-term endeavour, and the first time 2 | that a professionally-designed font has been funded specifically with 3 | the intent of being an on-going community expanded project: 4 | 5 | http://font.ubuntu.com/ 6 | 7 | Development of the Ubuntu Font Family is undertaken on Launchpad: 8 | 9 | http://launchpad.net/ubuntu-font-family/ 10 | 11 | and this is where milestones, bug management and releases are handled. 12 | 13 | Contributions are welcomed. Your work will be used on millions of 14 | computers every single day! Following the initial bootstrapping of 15 | Latin, Cyrillic, Greek, Arabic and Hebrew expansion will be undertaken 16 | by font designers from the font design and Ubuntu communities. 17 | 18 | To ensure that the Ubuntu Font Family can be re-licensed to future 19 | widely-used libre font licences, copyright assignment is being required: 20 | 21 | https://launchpad.net/~uff-contributors 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/fonts/ubuntu/bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/fonts/ubuntu/bold.ttf -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/fonts/ubuntu/italic.ttf -------------------------------------------------------------------------------- /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/fonts/ubuntu/monospace.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/fonts/ubuntu/monospace.ttf -------------------------------------------------------------------------------- /data/cage/fonts/ubuntu/regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/fonts/ubuntu/regular.ttf -------------------------------------------------------------------------------- /data/cage/models/axes-albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/models/axes-albedo.png -------------------------------------------------------------------------------- /data/cage/models/axes.mtl: -------------------------------------------------------------------------------- 1 | newmtl Material 2 | map_Kd axes-albedo.png 3 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/shaders/.gitignore: -------------------------------------------------------------------------------- 1 | /shaderConventions.h 2 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/bloomApply.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | layout(binding = 0) uniform sampler2D texColor; 9 | layout(binding = 1) uniform sampler2D texBloom; 10 | 11 | layout(location = 0) uniform int uniLodLevel; 12 | 13 | out vec3 outColor; 14 | 15 | void main() 16 | { 17 | vec3 color = texelFetch(texColor, ivec2(gl_FragCoord), 0).rgb; 18 | vec3 bloom = vec3(0); 19 | vec2 uv = vec2(gl_FragCoord) / textureSize(texColor, 0).xy; 20 | for (int i = 0; i < uniLodLevel; i++) 21 | bloom += textureLod(texBloom, uv, i).rgb; 22 | outColor = color + bloom / uniLodLevel; // additive mixing 23 | } 24 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/bloomGenerate.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | layout(location = 0) uniform vec4 uniBloomParams; // threshold 9 | 10 | layout(binding = 0) uniform sampler2D texColor; 11 | 12 | out vec3 outBloom; 13 | 14 | const int downscale = 3; 15 | 16 | void main() 17 | { 18 | vec3 acc = vec3(0.0); 19 | int cnt = 0; 20 | for (int y = 0; y < downscale; y++) 21 | { 22 | for (int x = 0; x < downscale; x++) 23 | { 24 | vec3 c = texelFetch(texColor, ivec2(gl_FragCoord) * downscale + ivec2(x, y) - downscale / 2, 0).rgb; 25 | //float l = dot(c, vec3(0.2126, 0.7152, 0.0722)); // todo make the "grayscale factor" configurable 26 | float l = dot(c, vec3(0.3333)); 27 | if (isnan(l)) 28 | continue; // prevent spreading a NaN to other pixels 29 | int m = int(l > uniBloomParams[0]); 30 | acc += float(m) * c; 31 | cnt += m; 32 | } 33 | } 34 | if (cnt > 0) 35 | outBloom = acc / float(cnt); 36 | else 37 | outBloom = vec3(0.0); 38 | } 39 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/dofCollect.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | layout(binding = 0) uniform sampler2D texColor; 9 | 10 | out vec3 outDof; 11 | 12 | const int downscale = 3; 13 | 14 | void main() 15 | { 16 | vec2 texelSize = float(downscale) / textureSize(texColor, 0).xy; 17 | vec2 uv = gl_FragCoord.xy * texelSize; 18 | vec3 color = vec3(0.0); 19 | int cnt = 0; 20 | for (int y = 0; y < downscale; y++) 21 | for (int x = 0; x < downscale; x++) 22 | color += texelFetch(texColor, ivec2(gl_FragCoord) * downscale + ivec2(x, y) - downscale / 2, 0).rgb; 23 | color /= float(downscale * downscale); 24 | outDof = color; 25 | } 26 | -------------------------------------------------------------------------------- /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 | luminanceApply.glsl 14 | luminanceCollection.glsl 15 | luminanceHistogram.glsl 16 | sharpening.glsl 17 | ssaoDownscaleDepth.glsl 18 | ssaoGenerate.glsl 19 | ssaoResolve.glsl 20 | tonemap.glsl 21 | -------------------------------------------------------------------------------- /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 | luminanceApply.glsl 9 | luminanceCollection.glsl 10 | luminanceHistogram.glsl 11 | sharpening.glsl 12 | ssaoDownscaleDepth.glsl 13 | ssaoGenerate.glsl 14 | ssaoResolve.glsl 15 | tonemap.glsl 16 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/gaussianBlur.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | // http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ 9 | 10 | const float offsets[3] = { 0.0, 1.3846153846, 3.2307692308 }; 11 | const float weights[3] = { 0.2270270270, 0.3162162162, 0.0702702703 }; 12 | 13 | layout(binding = 0) uniform sampler2D texInput; 14 | 15 | out vec4 outOutput; 16 | 17 | layout(location = 0) uniform vec2 uniDirection; 18 | layout(location = 1) uniform int uniLodLevel; 19 | 20 | void main() 21 | { 22 | vec2 texelSize = 1.0 / textureSize(texInput, uniLodLevel).xy; 23 | vec2 center = gl_FragCoord.xy; 24 | vec4 val = textureLod(texInput, center * texelSize, uniLodLevel) * weights[0]; 25 | for(int i = 1; i < 3; i++) 26 | { 27 | val += textureLod(texInput, (center - uniDirection * offsets[i]) * texelSize, uniLodLevel) * weights[i]; 28 | val += textureLod(texInput, (center + uniDirection * offsets[i]) * texelSize, uniLodLevel) * weights[i]; 29 | } 30 | outOutput = val; 31 | } 32 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/luminanceApply.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | $include luminanceParams.glsl 9 | 10 | layout(binding = 0) uniform sampler2D texColor; 11 | layout(binding = 1) uniform sampler2D texLuminance; 12 | 13 | out vec3 outColor; 14 | 15 | vec3 desaturate(vec3 color, float strength) 16 | { 17 | float i = dot(color, vec3(0.299, 0.587, 0.114)); // gray intensity 18 | return mix(color, vec3(i), strength); 19 | } 20 | 21 | vec3 contrast(vec3 color, float strength) 22 | { 23 | return max((color - 0.5) * (1 + strength) + 0.5, 0.0); 24 | } 25 | 26 | void main() 27 | { 28 | vec3 color = texelFetch(texColor, ivec2(gl_FragCoord.xy), 0).xyz; 29 | float avgLuminance = texelFetch(texLuminance, ivec2(0), 0).x; 30 | vec3 c = color * uniApplyParams[0] / avgLuminance; 31 | float night = -log(avgLuminance) - uniNightParams[0]; 32 | c = desaturate(c, clamp(night * uniNightParams[1], 0.0, 1.0)); 33 | c = contrast(c, clamp(night * uniNightParams[2], 0.0, 1.0)); 34 | outColor = mix(color, c, uniApplyParams[1]); 35 | } 36 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/luminanceParams.glsl: -------------------------------------------------------------------------------- 1 | 2 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) uniform Luminance 3 | { 4 | vec4 uniLogRange; // min, max range in log2 space 5 | vec4 uniAdaptationSpeed; // darker, lighter 6 | vec4 uniNightParams; // nightOffset, nightDesaturation, nightContrast 7 | vec4 uniApplyParams; // key, strength 8 | }; 9 | 10 | const int downscale = 4; 11 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/sharpening.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | layout(binding = 0) uniform sampler2D texColor; 9 | 10 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) uniform Sharpening 11 | { 12 | vec4 params; // strength 13 | }; 14 | 15 | out vec3 outColor; 16 | 17 | void main() 18 | { 19 | ivec2 coord = ivec2(gl_FragCoord.xy); 20 | vec3 center = texelFetch(texColor, coord, 0).rgb; 21 | vec3 up = texelFetch(texColor, coord + ivec2(0, 1), 0).rgb; 22 | vec3 down = texelFetch(texColor, coord + ivec2(0, -1), 0).rgb; 23 | vec3 left = texelFetch(texColor, coord + ivec2(-1, 0), 0).rgb; 24 | vec3 right = texelFetch(texColor, coord + ivec2(1, 0), 0).rgb; 25 | float strength = params.x; 26 | vec3 sharpenedColor = center * (1 + 4 * strength) - (up + down + left + right) * strength; 27 | outColor = clamp(sharpenedColor, 0, 1); 28 | } 29 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/ssaoDownscaleDepth.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $define shader vertex 5 | 6 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 7 | layout(location = CAGE_SHADER_ATTRIB_IN_UV) in vec3 inUv; 8 | out vec2 varUv; 9 | 10 | void main() 11 | { 12 | gl_Position = vec4(inPosition.xy * 2 - 1, inPosition.z, 1); 13 | varUv = inUv.xy; 14 | varUv.y = 1 - varUv.y; 15 | } 16 | 17 | $define shader fragment 18 | 19 | layout(binding = 0) uniform sampler2D texDepth; 20 | in vec2 varUv; 21 | out float outDepth; 22 | 23 | void main() 24 | { 25 | outDepth = textureLod(texDepth, varUv, 0).x; 26 | } 27 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/ssaoParams.glsl: -------------------------------------------------------------------------------- 1 | 2 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) 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/effects/ssaoResolve.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | $include ssaoParams.glsl 9 | 10 | layout(binding = 0) uniform sampler2D texAo; 11 | 12 | out float outAo; 13 | 14 | void main() 15 | { 16 | float ao = texelFetch(texAo, ivec2(gl_FragCoord.xy), 0).x; 17 | ao = pow(max(ao - params[1], 0), params[2]) * params[0]; 18 | outAo = clamp(1 - ao, 0, 1); 19 | } 20 | -------------------------------------------------------------------------------- /data/cage/shaders/effects/tonemap.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | $define shader fragment 7 | 8 | layout(binding = 0) uniform sampler2D texColor; 9 | 10 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) uniform Tonemap 11 | { 12 | vec4 params; // gamma, tonemapEnabled 13 | }; 14 | 15 | out vec3 outColor; 16 | 17 | // https://github.com/KhronosGroup/ToneMapping/blob/main/PBR_Neutral/pbrNeutral.glsl 18 | vec3 neutralToneMapping(vec3 color) 19 | { 20 | const float startCompression = 0.8 - 0.04; 21 | const float desaturation = 0.15; 22 | float x = min(color.r, min(color.g, color.b)); 23 | float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 24 | color -= offset; 25 | float peak = max(color.r, max(color.g, color.b)); 26 | if (peak < startCompression) return color; 27 | const float d = 1. - startCompression; 28 | float newPeak = 1. - d * d / (peak + d - startCompression); 29 | color *= newPeak / peak; 30 | float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.); 31 | return mix(color, newPeak * vec3(1, 1, 1), g); 32 | } 33 | 34 | void main() 35 | { 36 | vec3 color = texelFetch(texColor, ivec2(gl_FragCoord.xy), 0).xyz; 37 | 38 | // tone mapping 39 | if (params[1] > 0.5) 40 | color = neutralToneMapping(color); 41 | 42 | // gamma correction 43 | color = pow(color, vec3(params[0])); 44 | 45 | outColor = color; 46 | } 47 | -------------------------------------------------------------------------------- /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/engine/billboard.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | mat4 removeRotation(mat4 m) 7 | { 8 | m[0].xyz = vec3(1, 0, 0); 9 | m[1].xyz = vec3(0, 1, 0); 10 | m[2].xyz = vec3(0, 0, 1); 11 | return m; 12 | } 13 | 14 | void main() 15 | { 16 | varInstanceId = gl_InstanceID; 17 | varPosition = inPosition; 18 | varNormal = inNormal; 19 | varUv = inUv; 20 | skeletalAnimation(); 21 | 22 | mat4 m = transpose(mat4(uniMeshes[varInstanceId].modelMat)); 23 | mat4 mvp = uniProjection.projMat * removeRotation(uniProjection.viewMat * m); 24 | m = removeRotation(m); 25 | gl_Position = mvp * vec4(varPosition, 1); 26 | varPosition = vec3(m * vec4(varPosition, 1)); 27 | } 28 | 29 | $include fragment.glsl 30 | 31 | layout(early_fragment_tests) in; 32 | 33 | void main() 34 | { 35 | updateNormal(); 36 | mat3 nm = transpose(mat3(uniMeshes[varInstanceId].modelMat)); 37 | normal = inverse(nm) * normal; // revert normal rotation 38 | Material material = loadMaterial(); 39 | outColor = lighting(material); 40 | } 41 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/blitPixels.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $define shader vertex 5 | 6 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 7 | 8 | void main() 9 | { 10 | gl_Position = vec4(inPosition.xy * 2 - 1, inPosition.z, 1); 11 | } 12 | 13 | $define shader fragment 14 | 15 | layout(binding = 0) uniform sampler2D texColor; 16 | out vec4 outColor; 17 | 18 | void main() 19 | { 20 | outColor = texelFetch(texColor, ivec2(gl_FragCoord.xy), 0); 21 | } 22 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/blitScaled.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $define shader vertex 5 | 6 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 7 | layout(location = CAGE_SHADER_ATTRIB_IN_UV) in vec3 inUv; 8 | out vec2 varUv; 9 | 10 | void main() 11 | { 12 | gl_Position = vec4(inPosition.xy * 2 - 1, inPosition.z, 1); 13 | varUv = inUv.xy; 14 | varUv.y = 1 - varUv.y; 15 | } 16 | 17 | $define shader fragment 18 | 19 | layout(binding = 0) uniform sampler2D texColor; 20 | in vec2 varUv; 21 | out vec4 outColor; 22 | 23 | void main() 24 | { 25 | outColor = textureLod(texColor, varUv, 0); 26 | } 27 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/decal.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | void main() 7 | { 8 | updateVertex(); 9 | } 10 | 11 | $include fragment.glsl 12 | 13 | $include ../functions/reconstructPosition.glsl 14 | 15 | layout(binding = CAGE_SHADER_TEXTURE_DEPTH) uniform sampler2D texDepth; 16 | 17 | void main() 18 | { 19 | vec3 prevPos = reconstructPosition(texDepth, uniProjection.vpInv, uniViewport.viewport); 20 | if (length(varPosition - prevPos) > 0.05) 21 | discard; 22 | updateNormal(); 23 | Material material = loadMaterial(); 24 | #ifdef CutOut 25 | if (material.opacity < 0.5) 26 | discard; 27 | #endif // CutOut 28 | outColor = lighting(material); 29 | } 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/shaders/engine/icon.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | void main() 7 | { 8 | varInstanceId = gl_InstanceID; 9 | varPosition = inPosition; 10 | varUv = inUv; 11 | gl_Position = uniProjection.vpMat * transpose(mat4(uniMeshes[varInstanceId].modelMat)) * vec4(varPosition, 1); 12 | } 13 | 14 | $include fragment.glsl 15 | 16 | #ifndef CutOut 17 | layout(early_fragment_tests) in; 18 | #endif 19 | 20 | void main() 21 | { 22 | #ifdef Animated 23 | vec4 albedo = sampleTextureAnimation(texMaterialAlbedoArray, varUv.xy, uniMeshes[varInstanceId].animation, uniMaterial.animation); 24 | #else 25 | vec4 albedo = texture(texMaterialAlbedo2d, varUv.xy); 26 | #endif 27 | 28 | #ifdef CutOut 29 | if (albedo.w < 0.5) 30 | discard; 31 | #endif // CutOut 32 | 33 | outColor = albedo; 34 | } 35 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/skybox.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | void main() 7 | { 8 | varInstanceId = gl_InstanceID; 9 | varUv = inUv; 10 | vec3 p3 = mat3(uniProjection.viewMat) * transpose(mat3(uniMeshes[varInstanceId].modelMat)) * vec3(inPosition); 11 | gl_Position = uniProjection.projMat * vec4(p3, 1); 12 | } 13 | 14 | $include fragment.glsl 15 | 16 | layout(early_fragment_tests) in; 17 | 18 | void main() 19 | { 20 | Material material = loadMaterial(); 21 | outColor.rgb = material.albedo; 22 | outColor.a = 1; 23 | } 24 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/standard.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $include vertex.glsl 5 | 6 | void main() 7 | { 8 | updateVertex(); 9 | } 10 | 11 | $include fragment.glsl 12 | 13 | #ifndef CutOut 14 | layout(early_fragment_tests) in; 15 | #endif 16 | 17 | void main() 18 | { 19 | #ifdef DepthOnly 20 | 21 | #ifdef CutOut 22 | if (loadMaterial().opacity < 0.5) 23 | discard; 24 | #endif // CutOut 25 | 26 | #else // DepthOnly 27 | 28 | updateNormal(); 29 | Material material = loadMaterial(); 30 | #ifdef CutOut 31 | if (material.opacity < 0.5) 32 | discard; 33 | #endif // CutOut 34 | outColor = lighting(material); 35 | 36 | #endif // DepthOnly 37 | } 38 | -------------------------------------------------------------------------------- /data/cage/shaders/engine/text.glsl: -------------------------------------------------------------------------------- 1 | $include ../shaderConventions.h 2 | 3 | $define shader vertex 4 | 5 | struct InstanceStruct 6 | { 7 | vec4 wrld; 8 | vec4 text; 9 | }; 10 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) uniform Instances 11 | { 12 | InstanceStruct instances[512]; 13 | }; 14 | 15 | layout(location = 0) uniform mat4 uniMvp; 16 | 17 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 18 | layout(location = CAGE_SHADER_ATTRIB_IN_UV) in vec2 inUv; 19 | 20 | out vec2 varUv; 21 | 22 | void main() 23 | { 24 | InstanceStruct inst = instances[gl_InstanceID]; 25 | gl_Position = uniMvp * vec4(inPosition.xy * inst.wrld.zw + inst.wrld.xy, 0, 1); 26 | varUv = inPosition.xy * inst.text.zw + inst.text.xy; 27 | } 28 | 29 | $define shader fragment 30 | 31 | layout(binding = 0) uniform sampler2D uniTexture; 32 | layout(location = 4) uniform vec3 uniColor; 33 | 34 | in vec2 varUv; 35 | out vec4 outColor; 36 | 37 | float median(vec3 v) 38 | { 39 | return max(min(v.r, v.g), min(max(v.r, v.g), v.b)); 40 | } 41 | 42 | void main() 43 | { 44 | float sd = median(texture(uniTexture, varUv).rgb); 45 | float edgeWidth = fwidth(sd); 46 | float opacity = smoothstep(0.5 - edgeWidth, 0.5 + edgeWidth, sd); 47 | outColor = vec4(uniColor, opacity); 48 | } 49 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/noise.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include hash.glsl 3 | 4 | float noise(float x) 5 | { 6 | float i = floor(x); 7 | float f = fract(x); 8 | float u = f * f * (3 - 2 * f); 9 | return mix(hash(i), hash(i + 1), u); 10 | } 11 | 12 | float noise(vec2 x) 13 | { 14 | vec2 i = floor(x); 15 | vec2 f = fract(x); 16 | float a = hash(i); 17 | float b = hash(i + vec2(1, 0)); 18 | float c = hash(i + vec2(0, 1)); 19 | float d = hash(i + vec2(1, 1)); 20 | vec2 u = f * f * (3 - 2 * f); 21 | return mix(a, b, u.x) + (c - a) * u.y * (1 - u.x) + (d - b) * u.x * u.y; 22 | } 23 | 24 | float noise(vec3 x) 25 | { 26 | const vec3 step = vec3(110, 241, 171); 27 | vec3 i = floor(x); 28 | vec3 f = fract(x); 29 | float n = dot(i, step); 30 | vec3 u = f * f * (3 - 2 * f); 31 | return mix(mix(mix(hash(n + dot(step, vec3(0, 0, 0))), hash(n + dot(step, vec3(1, 0, 0))), u.x), 32 | mix(hash(n + dot(step, vec3(0, 1, 0))), hash(n + dot(step, vec3(1, 1, 0))), u.x), u.y), 33 | mix(mix(hash(n + dot(step, vec3(0, 0, 1))), hash(n + dot(step, vec3(1, 0, 1))), u.x), 34 | mix(hash(n + dot(step, vec3(0, 1, 1))), hash(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z); 35 | } 36 | -------------------------------------------------------------------------------- /data/cage/shaders/functions/poissonDisk26.glsl: -------------------------------------------------------------------------------- 1 | 2 | const vec2 poissonDisk26[] = 3 | { 4 | vec2(-0.8395362f, 0.001017071f), 5 | vec2(-0.5569903f, 0.40532f), 6 | vec2(-0.4803437f, -0.2107135f), 7 | vec2(-0.2573634f, 0.1322298f), 8 | vec2(-0.7014769f, -0.4725731f), 9 | vec2(-0.3200464f, -0.7692128f), 10 | vec2(-0.2809053f, -0.4573479f), 11 | vec2(0.05650364f, -0.31673f), 12 | vec2(0.2125987f, -0.7042405f), 13 | vec2(-0.02918595f, 0.4324786f), 14 | vec2(0.3032977f, 0.04405011f), 15 | vec2(-0.3498484f, 0.6452106f), 16 | vec2(0.5781696f, -0.7347485f), 17 | vec2(0.4775517f, -0.4360366f), 18 | vec2(0.2755061f, 0.4496252f), 19 | vec2(0.3199272f, 0.8253915f), 20 | vec2(0.5423012f, 0.6018519f), 21 | vec2(0.6233764f, 0.2808392f), 22 | vec2(-0.0697284f, 0.7628558f), 23 | vec2(0.6238351f, -0.1113141f), 24 | vec2(0.9236017f, 0.1940866f), 25 | vec2(0.8522077f, 0.5117125f), 26 | vec2(0.9106341f, -0.3469071f), 27 | vec2(0.02631534f, -0.981115f), 28 | vec2(-0.8650204f, 0.3735386f), 29 | vec2(-0.6520876f, 0.7390382f) 30 | }; 31 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 * 2 - 1; 5 | vec4 pos = vec4((gl_FragCoord.xy - viewport.xy) / viewport.zw * 2 - 1, depth, 1); 6 | pos = vpInv * pos; 7 | return pos.xyz / pos.w; 8 | } 9 | -------------------------------------------------------------------------------- /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/sampleShadowMap.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include poissonDisk4.glsl 3 | $include randomAngle.glsl 4 | 5 | float sampleShadowMap2d(sampler2DArray texShadow2d, vec3 shadowPos, int cascade) 6 | { 7 | // return float(texture(texShadow2d, vec3(shadowPos.xy, float(cascade))).x > shadowPos.z); 8 | 9 | vec2 radius = 1.3 / textureSize(texShadow2d, 0).xy; 10 | float visibility = 0.0; 11 | for (int i = 0; i < 4; i++) 12 | { 13 | float ra = randomAngle(12000.0, shadowPos); 14 | mat2 rot = mat2(cos(ra), sin(ra), -sin(ra), cos(ra)); 15 | vec2 samp = rot * poissonDisk4[i] * radius; 16 | visibility += float(texture(texShadow2d, vec3(shadowPos.xy + samp, float(cascade))).x > shadowPos.z); 17 | } 18 | visibility /= 4.0; 19 | return visibility; 20 | } 21 | 22 | float sampleShadowMapCube(samplerCube texShadowCube, vec3 shadowPos) 23 | { 24 | return float(texture(texShadowCube, normalize(shadowPos)).x > length(shadowPos)); 25 | } 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/colorPicker.glsl: -------------------------------------------------------------------------------- 1 | 2 | $include ../shaderConventions.h 3 | 4 | $define shader vertex 5 | 6 | $include ../functions/common.glsl 7 | 8 | layout(location = 0) uniform vec4 pos; 9 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 10 | layout(location = CAGE_SHADER_ATTRIB_IN_UV) in vec2 inUv; 11 | out vec2 varUv; 12 | 13 | void main() 14 | { 15 | gl_Position.z = 0; 16 | gl_Position.w = 1; 17 | gl_Position.xy = pos.xy + (pos.zw - pos.xy) * inUv; 18 | varUv = inUv; 19 | } 20 | 21 | $define shader fragment 22 | 23 | $include ../functions/common.glsl 24 | $include ../functions/hsvToRgb.glsl 25 | 26 | $if inputSpec ^ 0 = F 27 | layout(location = 1) uniform vec3 uniColor; 28 | $else 29 | $if inputSpec ^ 0 = H 30 | $else 31 | layout(location = 1) uniform float uniHue; 32 | $end 33 | $end 34 | in vec2 varUv; 35 | out vec4 outColor; 36 | 37 | void main() 38 | { 39 | $if inputSpec ^ 0 = F 40 | outColor = vec4(uniColor, 1); 41 | $else 42 | $if inputSpec ^ 0 = H 43 | outColor = vec4(hsvToRgb(vec3(varUv.x, 1, 1)), 1); 44 | $else 45 | outColor = vec4(hsvToRgb(vec3(uniHue, varUv)), 1); 46 | $end 47 | $end 48 | } 49 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/font.glsl: -------------------------------------------------------------------------------- 1 | $include ../shaderConventions.h 2 | 3 | $define shader vertex 4 | 5 | struct InstanceStruct 6 | { 7 | vec4 wrld; 8 | vec4 text; 9 | }; 10 | layout(std140, binding = CAGE_SHADER_UNIBLOCK_CUSTOMDATA) uniform Instances 11 | { 12 | InstanceStruct instances[512]; 13 | }; 14 | 15 | layout(location = 0) uniform mat4 uniMvp; 16 | layout(location = CAGE_SHADER_ATTRIB_IN_POSITION) in vec3 inPosition; 17 | layout(location = CAGE_SHADER_ATTRIB_IN_UV) in vec2 inUv; 18 | 19 | out vec2 varUv; 20 | 21 | void main() 22 | { 23 | InstanceStruct inst = instances[gl_InstanceID]; 24 | gl_Position = uniMvp * vec4(inPosition.xy * inst.wrld.zw + inst.wrld.xy, 0, 1); 25 | varUv = inPosition.xy * inst.text.zw + inst.text.xy; 26 | } 27 | 28 | $define shader fragment 29 | 30 | layout(binding = 0) uniform sampler2D uniTexture; 31 | layout(location = 4) uniform vec3 uniColor; 32 | layout(location = 15) uniform float uniScreenPxRange; 33 | 34 | in vec2 varUv; 35 | out vec4 outColor; 36 | 37 | float median(vec3 v) 38 | { 39 | return max(min(v.r, v.g), min(max(v.r, v.g), v.b)); 40 | } 41 | 42 | void main() 43 | { 44 | float sd = median(texture(uniTexture, varUv).rgb); 45 | float screenPxDistance = uniScreenPxRange * (sd - 0.5); 46 | float opacity = clamp(screenPxDistance + 0.5, 0, 1); 47 | outColor = vec4(uniColor, opacity); 48 | } 49 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/gui.assets: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | scheme = pack 4 | gui.pack 5 | 6 | [] 7 | scheme = shader 8 | font.glsl 9 | element.glsl 10 | image.glsl 11 | colorPicker.glsl?F # Flat 12 | colorPicker.glsl?H # Hue 13 | colorPicker.glsl?S # Saturation & Value 14 | -------------------------------------------------------------------------------- /data/cage/shaders/gui/gui.pack: -------------------------------------------------------------------------------- 1 | [] 2 | font.glsl 3 | element.glsl 4 | image.glsl 5 | colorPicker.glsl?F # Flat 6 | colorPicker.glsl?H # Hue 7 | colorPicker.glsl?S # Saturation & Value 8 | -------------------------------------------------------------------------------- /data/cage/shaders/shaders.assets: -------------------------------------------------------------------------------- 1 | [] 2 | scheme = pack 3 | shaders.pack 4 | -------------------------------------------------------------------------------- /data/cage/shaders/shaders.pack: -------------------------------------------------------------------------------- 1 | [] 2 | effects/effects.pack 3 | engine/engine.pack 4 | gui/gui.pack 5 | -------------------------------------------------------------------------------- /data/cage/sounds/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/click.wav -------------------------------------------------------------------------------- /data/cage/sounds/comboOpen.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/comboOpen.wav -------------------------------------------------------------------------------- /data/cage/sounds/comboSelect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/comboSelect.wav -------------------------------------------------------------------------------- /data/cage/sounds/hover.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/hover.wav -------------------------------------------------------------------------------- /data/cage/sounds/sliding.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/sliding.wav -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/cage/sounds/tooltipOpen.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/tooltipOpen.wav -------------------------------------------------------------------------------- /data/cage/sounds/typing.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/typing.wav -------------------------------------------------------------------------------- /data/cage/sounds/typingConfirm.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/typingConfirm.wav -------------------------------------------------------------------------------- /data/cage/sounds/typingInvalid.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/sounds/typingInvalid.wav -------------------------------------------------------------------------------- /data/cage/textures/credits.txt: -------------------------------------------------------------------------------- 1 | helper.jpg taken from blender https://www.blender.org/ 2 | -------------------------------------------------------------------------------- /data/cage/textures/gui.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/gui.pdn -------------------------------------------------------------------------------- /data/cage/textures/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/gui.png -------------------------------------------------------------------------------- /data/cage/textures/helper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/helper.jpg -------------------------------------------------------------------------------- /data/cage/textures/keybindAdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/keybindAdd.png -------------------------------------------------------------------------------- /data/cage/textures/keybindClear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/keybindClear.png -------------------------------------------------------------------------------- /data/cage/textures/keybindRemove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/keybindRemove.png -------------------------------------------------------------------------------- /data/cage/textures/keybindReset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/keybindReset.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/0.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/1.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/10.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/2.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/3.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/4.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/5.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/6.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/7.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/8.png -------------------------------------------------------------------------------- /data/cage/textures/progressbar/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/progressbar/9.png -------------------------------------------------------------------------------- /data/cage/textures/readme.md: -------------------------------------------------------------------------------- 1 | tooltips.png 2 | ----------- 3 | made from gui.png 4 | apply sepia: 10 % 5 | apply HSV: lighness 20 6 | -------------------------------------------------------------------------------- /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 = 2dArray 20 | srgb = true 21 | progressbar/$.png 22 | 23 | [] 24 | scheme = pack 25 | textures.pack 26 | -------------------------------------------------------------------------------- /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/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/data/cage/textures/tooltips.png -------------------------------------------------------------------------------- /externals/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | -------------------------------------------------------------------------------- /externals/avir/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "avir") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | 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) 6 | 7 | target_include_directories(avir PUBLIC .) 8 | -------------------------------------------------------------------------------- /externals/avir/dummy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/avir/dummy.cpp -------------------------------------------------------------------------------- /externals/bc7enc_rdo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "bc7enc_rdo") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_library(bc7enc_rdo STATIC 6 | bc7enc_rdo/bc7decomp.cpp bc7enc_rdo/bc7decomp.h 7 | bc7enc_rdo/bc7enc.cpp bc7enc_rdo/bc7enc.h 8 | bc7enc_rdo/rgbcx.cpp bc7enc_rdo/rgbcx.h 9 | ) 10 | 11 | target_include_directories(bc7enc_rdo PRIVATE bc7enc_rdo) 12 | target_include_directories(bc7enc_rdo INTERFACE .) 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /externals/dualmc/dummy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/dualmc/dummy.cpp -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /externals/fastnoise/dummy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/fastnoise/dummy.cpp -------------------------------------------------------------------------------- /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) 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 12 | git submodule update --init --recursive 13 | } 14 | export -f pbranch 15 | git submodule foreach pbranch 16 | 17 | 18 | # restore protobuf - newer versions are incompatible with the protoc compiler 19 | git submodule update protobuf/protobuf 20 | 21 | # restore openxr - newer versions are not supported by hardware 22 | git submodule update openxr-sdk/OpenXR-SDK 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /externals/glad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "glad") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | unset(CMAKE_C_STANDARD) 6 | unset(CMAKE_CXX_STANDARD) 7 | 8 | add_library(glad STATIC glad/src/glad.c) 9 | target_include_directories(glad PUBLIC $) 10 | if(MSVC) 11 | target_compile_definitions(glad PRIVATE "GLAPI=__declspec(dllexport)") 12 | else() 13 | target_compile_definitions(glad PRIVATE "GLAPI=__attribute__((visibility(\"default\")))") 14 | endif() 15 | -------------------------------------------------------------------------------- /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 OFF 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 | 17 | -------------------------------------------------------------------------------- /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 | 8 | cage_gen_module(glm $ "") 9 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /externals/jpeg/yasm/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Yasm 3 | 4 | Acquired at http://yasm.tortall.net/ 5 | 6 | -------------------------------------------------------------------------------- /externals/jpeg/yasm/win32/bin/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/jpeg/yasm/win32/bin/msvcr100.dll -------------------------------------------------------------------------------- /externals/jpeg/yasm/win32/bin/yasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/jpeg/yasm/win32/bin/yasm.exe -------------------------------------------------------------------------------- /externals/jpeg/yasm/win64/bin/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/jpeg/yasm/win64/bin/msvcr100.dll -------------------------------------------------------------------------------- /externals/jpeg/yasm/win64/bin/yasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/jpeg/yasm/win64/bin/yasm.exe -------------------------------------------------------------------------------- /externals/mbedtls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "mbedtls") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | set(ENABLE_PROGRAMS OFF CACHE INTERNAL "") 6 | set(ENABLE_TESTING OFF CACHE INTERNAL "") 7 | 8 | add_subdirectory(mbedtls) 9 | 10 | cage_gen_module(MbedTLS "$;$;$" "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/include") 11 | set(filename "${CAGE_EXTERNALS_MODULE_PATH}/FindMBEDTLS.cmake") 12 | cage_gen_module_helper(${filename} MBEDX509 $ "") 13 | cage_gen_module_helper(${filename} MBEDCRYPTO $ "") 14 | -------------------------------------------------------------------------------- /externals/msdfgen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "msdfgen") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB_RECURSE msdfgen-sources "msdfgen/msdfgen.h" "msdfgen/core/*" "msdfgen/ext/import-font.*") 6 | add_library(lib_msdfgen ${msdfgen-sources}) 7 | target_compile_definitions(lib_msdfgen PUBLIC MSDFGEN_USE_CPP11 MSDFGEN_PUBLIC=) 8 | target_include_directories(lib_msdfgen INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 9 | target_link_libraries(lib_msdfgen PUBLIC freetype) 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /externals/pmp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "pmp") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB SOURCES pmp/src/pmp/*.cpp pmp/src/pmp/algorithms/*.cpp) 6 | file(GLOB HEADERS pmp/src/pmp/*.h pmp/src/pmp/algorithms/*.h) 7 | 8 | add_library(pmp STATIC ${SOURCES} ${HEADERS}) 9 | 10 | target_compile_definitions(pmp PUBLIC _USE_MATH_DEFINES EIGEN_MPL2_ONLY) 11 | target_include_directories(pmp PUBLIC pmp/external/eigen-3.4.0) 12 | target_include_directories(pmp PUBLIC pmp/src) 13 | 14 | if(MSVC) 15 | target_compile_options(pmp PRIVATE /wd4267) 16 | target_compile_options(pmp PRIVATE /wd4244) 17 | target_compile_options(pmp PRIVATE /wd4305) 18 | endif() 19 | 20 | target_precompile_headers(pmp PRIVATE 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | ) 43 | -------------------------------------------------------------------------------- /externals/png/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "png") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | unset(CMAKE_C_STANDARD) 6 | unset(CMAKE_CXX_STANDARD) 7 | 8 | set(PNG_SHARED OFF CACHE INTERNAL "Build shared lib") 9 | set(PNG_FRAMEWORK OFF CACHE INTERNAL "Build libpng as a framework bundle") 10 | set(PNG_TESTS OFF CACHE INTERNAL "Build libpng tests") 11 | set(PNG_TOOLS OFF CACHE INTERNAL "Build libpng tools") 12 | set(SKIP_INSTALL_ALL ON CACHE INTERNAL "SKIP_INSTALL_ALL") 13 | 14 | # prevent using awk for configuration - it causes spurious rebuilds of the entire build 15 | find_program(AWK NAMES gawk awk) 16 | set(AWK "") 17 | 18 | add_subdirectory(png) 19 | 20 | target_include_directories(png_static INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/png") 21 | target_include_directories(png_static INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/png") 22 | target_compile_definitions(png_static PRIVATE WIN32_LEAN_AND_MEAN VC_EXTRALEAN NOMINMAX) 23 | 24 | cage_gen_module(PNG $ $) 25 | -------------------------------------------------------------------------------- /externals/protobuf/protoc/win32/bin/protoc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/protobuf/protoc/win32/bin/protoc.exe -------------------------------------------------------------------------------- /externals/protobuf/protoc/win64/bin/protoc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucpu/cage/fa62e117db64c4a5fd9008a6bcf05f3e24c1ee49/externals/protobuf/protoc/win64/bin/protoc.exe -------------------------------------------------------------------------------- /externals/quickhull/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "quickhull") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | file(GLOB SOURCES quickhull/*.cpp quickhull/*.hpp quickhull/Structs/*) 6 | 7 | add_library(quickhull STATIC ${SOURCES}) 8 | 9 | target_include_directories(quickhull INTERFACE .) 10 | -------------------------------------------------------------------------------- /externals/samplerate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "samplerate") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_subdirectory(libsamplerate) 6 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /externals/stb/stb.c: -------------------------------------------------------------------------------- 1 | 2 | #define STB_RECT_PACK_IMPLEMENTATION 3 | #include 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /externals/uni-algo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "----------------------------------------------------------------") 2 | message(STATUS "uni-algo") 3 | message(STATUS "----------------------------------------------------------------") 4 | 5 | add_subdirectory(uni-algo) 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /schemes/font.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor font 3 | index = 14 4 | -------------------------------------------------------------------------------- /schemes/model.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor model 3 | index = 12 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 | 20 | [uvs] 21 | display = export uvs 22 | type = bool 23 | default = true 24 | 25 | [normals] 26 | display = export normals 27 | type = bool 28 | default = true 29 | 30 | [bones] 31 | display = export bones 32 | type = bool 33 | default = false 34 | 35 | [material] 36 | display = path to cpm material 37 | hint = leave empty to use the material loaded with the mesh 38 | type = string 39 | 40 | [passInvalidNormals] 41 | display = pass invalid normals 42 | hint = issue warning instead of error on invalid normal or (bi)tangent 43 | type = bool 44 | default = false 45 | 46 | [trianglesOnly] 47 | display = triangles only 48 | type = bool 49 | default = false 50 | -------------------------------------------------------------------------------- /schemes/object.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor object 3 | index = 13 4 | 5 | -------------------------------------------------------------------------------- /schemes/pack.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor pack 3 | index = 0 4 | 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /schemes/shader.scheme: -------------------------------------------------------------------------------- 1 | [scheme] 2 | processor = cage-asset-processor shader 3 | index = 10 4 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sources/asset-database/main.cpp: -------------------------------------------------------------------------------- 1 | #include "database.h" 2 | 3 | #include 4 | 5 | extern ConfigBool configListening; 6 | extern bool verdictValue; 7 | 8 | void configParseCmd(int argc, const char *args[]); 9 | void start(); 10 | void listen(); 11 | 12 | bool logFilter(const cage::detail::LoggerInfo &info) 13 | { 14 | return info.severity >= SeverityEnum::Error || String(info.component) == "exception" || String(info.component) == "asset" || String(info.component) == "verdict" || String(info.component) == "help"; 15 | } 16 | 17 | int main(int argc, const char *args[]) 18 | { 19 | initializeConsoleLogger()->filter.bind(); 20 | try 21 | { 22 | configParseCmd(argc, args); 23 | 24 | CAGE_LOG(SeverityEnum::Info, "database", "start"); 25 | start(); 26 | 27 | if (configListening) 28 | { 29 | CAGE_LOG(SeverityEnum::Info, "database", "waiting for changes"); 30 | try 31 | { 32 | listen(); 33 | } 34 | catch (...) 35 | { 36 | CAGE_LOG(SeverityEnum::Info, "database", "stopped"); 37 | } 38 | } 39 | 40 | CAGE_LOG(SeverityEnum::Info, "database", "end"); 41 | 42 | return verdictValue ? 0 : -1; 43 | } 44 | catch (...) 45 | { 46 | detail::logCurrentCaughtException(); 47 | } 48 | return 1; 49 | } 50 | -------------------------------------------------------------------------------- /sources/asset-processor/pack.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "processor.h" 4 | 5 | #include 6 | #include 7 | 8 | void processPack() 9 | { 10 | processor->writeLine(String("use=") + processor->inputFile); 11 | 12 | Holder ini = newIni(); 13 | ini->importFile(processor->inputFileName); 14 | 15 | std::set assets; 16 | for (const String §ion : ini->sections()) 17 | { 18 | for (const String &n : ini->items(section)) 19 | { 20 | if (!isDigitsOnly(n)) 21 | CAGE_THROW_ERROR(Exception, "invalid asset pack definition"); 22 | String v = ini->get(section, n); 23 | v = processor->convertAssetPath(v); 24 | assets.insert(HashString(v)); 25 | } 26 | } 27 | 28 | AssetHeader h = processor->initializeAssetHeader(); 29 | h.dependenciesCount = numeric_cast(assets.size()); 30 | 31 | Holder f = writeFile(processor->outputFileName); 32 | f->write(bufferView(h)); 33 | for (uint32 it : assets) 34 | f->write(bufferView(it)); 35 | f->close(); 36 | } 37 | -------------------------------------------------------------------------------- /sources/asset-processor/processor.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace cage; 14 | 15 | extern Holder processor; 16 | 17 | void processTexture(); 18 | void processShader(); 19 | void processPack(); 20 | void processObject(); 21 | void processModel(); 22 | void processSkeleton(); 23 | void processAnimation(); 24 | void processFont(); 25 | void processTexts(); 26 | void processSound(); 27 | void processCollider(); 28 | void processRaw(); 29 | 30 | int processAnalyze(); 31 | void analyzeTexture(); 32 | void analyzeFont(); 33 | void analyzeSound(); 34 | -------------------------------------------------------------------------------- /sources/asset-processor/raw.cpp: -------------------------------------------------------------------------------- 1 | #include "processor.h" 2 | 3 | void processRaw() 4 | { 5 | processor->writeLine(String("use=") + processor->inputFile); 6 | 7 | Holder> data; 8 | { // load file 9 | Holder f = readFile(processor->inputFile); 10 | data = f->readAll(); 11 | } 12 | 13 | AssetHeader h = processor->initializeAssetHeader(); 14 | h.originalSize = numeric_cast(data.size()); 15 | 16 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "original data size: " + data.size() + " bytes"); 17 | if (data.size() >= toUint32(processor->property("compressThreshold"))) 18 | { 19 | Holder> data2 = memoryCompress(data); 20 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "compressed data size: " + data2.size() + " bytes"); 21 | if (data2.size() < data.size()) 22 | { 23 | std::swap(data, data2); 24 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", "using the compressed data"); 25 | h.compressedSize = numeric_cast(data2.size()); 26 | } 27 | else 28 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", "using the data without compression"); 29 | } 30 | else 31 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", "data are under compression threshold"); 32 | 33 | Holder f = writeFile(processor->outputFileName); 34 | f->write(bufferView(h)); 35 | f->write(data); 36 | f->close(); 37 | } 38 | -------------------------------------------------------------------------------- /sources/asset-processor/skeleton.cpp: -------------------------------------------------------------------------------- 1 | #include "processor.h" 2 | 3 | #include 4 | #include 5 | 6 | MeshImportConfig meshImportConfig(); 7 | void meshImportNotifyUsedFiles(const MeshImportResult &result); 8 | 9 | void processSkeleton() 10 | { 11 | MeshImportResult result = meshImportFiles(processor->inputFileName, meshImportConfig()); 12 | meshImportNotifyUsedFiles(result); 13 | if (!result.skeleton) 14 | CAGE_THROW_ERROR(Exception, "loaded no skeleton"); 15 | 16 | Holder rig = result.skeleton.share(); 17 | Holder> buff = rig->exportBuffer(); 18 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "buffer size (before compression): " + buff.size()); 19 | Holder> comp = memoryCompress(buff); 20 | CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "buffer size (after compression): " + comp.size()); 21 | 22 | AssetHeader h = processor->initializeAssetHeader(); 23 | h.originalSize = buff.size(); 24 | h.compressedSize = comp.size(); 25 | Holder f = writeFile(processor->outputFileName); 26 | f->write(bufferView(h)); 27 | f->write(comp); 28 | f->close(); 29 | } 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/image-info/main.cpp: -------------------------------------------------------------------------------- 1 | #include "imageInfo.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace cage; 11 | 12 | void info(const String &src) 13 | { 14 | CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "opening image: " + src); 15 | ImageImportResult result; 16 | try 17 | { 18 | result = imageImportFiles(src); 19 | } 20 | catch (const Exception &) 21 | { 22 | return; 23 | } 24 | imageInfo(result); 25 | } 26 | 27 | int main(int argc, const char *args[]) 28 | { 29 | initializeConsoleLogger(); 30 | try 31 | { 32 | Holder cmd = newIni(); 33 | cmd->parseCmd(argc, args); 34 | const auto &paths = cmd->cmdArray(0, "--"); 35 | if (cmd->cmdBool('?', "help", false)) 36 | { 37 | cmd->logHelp(); 38 | CAGE_LOG(SeverityEnum::Info, "help", Stringizer() + "examples:"); 39 | CAGE_LOG(SeverityEnum::Info, "help", Stringizer() + args[0] + " image.png"); 40 | return 0; 41 | } 42 | cmd->checkUnusedWithHelp(); 43 | if (paths.empty()) 44 | CAGE_THROW_ERROR(Exception, "no inputs"); 45 | for (const String &path : paths) 46 | { 47 | info(path); 48 | CAGE_LOG(SeverityEnum::Info, "image", ""); 49 | } 50 | CAGE_LOG(SeverityEnum::Info, "image", "done"); 51 | return 0; 52 | } 53 | catch (...) 54 | { 55 | detail::logCurrentCaughtException(); 56 | } 57 | return 1; 58 | } 59 | -------------------------------------------------------------------------------- /sources/include/cage-core/assetContext.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_assetContext_h_4lkjh9sd654gtsdfg 2 | #define guard_assetContext_h_4lkjh9sd654gtsdfg 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct AssetContext; 9 | 10 | using AssetDelegate = Delegate; 11 | 12 | struct CAGE_CORE_API AssetContext : private Immovable 13 | { 14 | detail::StringBase<64> textId; 15 | Holder customData; 16 | Holder> dependencies; 17 | Holder> compressedData; 18 | Holder> originalData; 19 | Holder assetHolder; 20 | const uint32 assetId = 0; 21 | uint32 scheme = m; 22 | 23 | AssetContext(uint32 assetId) : assetId(assetId) {} 24 | }; 25 | 26 | struct CAGE_CORE_API AssetsScheme 27 | { 28 | AssetDelegate fetch; 29 | AssetDelegate decompress; 30 | AssetDelegate load; 31 | uint32 threadIndex = m; 32 | uint32 typeHash = m; 33 | 34 | AssetsScheme(); 35 | }; 36 | } 37 | 38 | #endif // guard_assetContext_h_4lkjh9sd654gtsdfg 39 | -------------------------------------------------------------------------------- /sources/include/cage-core/assetHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_assetHeader_h_k1i7178asdvujhz89jhg14j 2 | #define guard_assetHeader_h_k1i7178asdvujhz89jhg14j 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API AssetHeader 9 | { 10 | // this is the first header found in every asset file 11 | 12 | char cageName[8] = "cageAss"; 13 | uint32 version = 0; 14 | uint32 flags = 0; 15 | char textId[64] = {}; 16 | uint64 compressedSize = 0; 17 | uint64 originalSize = 0; 18 | uint32 unused_ = 0; 19 | uint16 scheme = m; 20 | uint16 dependenciesCount = 0; 21 | 22 | AssetHeader() = default; 23 | explicit AssetHeader(const String &textId, uint16 schemeIndex); 24 | 25 | // follows: 26 | // array of dependency names, each uint32 27 | // any other asset-specific data 28 | }; 29 | } 30 | 31 | #endif // guard_assetHeader_h_k1i7178asdvujhz89jhg14j 32 | -------------------------------------------------------------------------------- /sources/include/cage-core/assetsOnDemand.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_assetsOnDemand_h_wesdxfc74j 2 | #define guard_assetsOnDemand_h_wesdxfc74j 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class AssetsManager; 9 | 10 | class CAGE_CORE_API AssetsOnDemand : private Immovable 11 | { 12 | public: 13 | // begin thread-safe methods 14 | 15 | // returns null if the asset is not yet loaded or has different scheme 16 | template 17 | Holder get(uint32 assetId, bool autoLoad = true) 18 | { 19 | CAGE_ASSERT(detail::typeHash() == schemeTypeHash_(Scheme)) 20 | return get_(Scheme, assetId, autoLoad).template cast(); 21 | } 22 | 23 | void preload(uint32 assetId); 24 | 25 | void process(); 26 | void clear(); 27 | 28 | // end thread-safe methods 29 | 30 | private: 31 | Holder get_(uint32 scheme, uint32 assetId, bool autoLoad); 32 | uint32 schemeTypeHash_(uint32 scheme) const; 33 | }; 34 | 35 | CAGE_CORE_API Holder newAssetsOnDemand(AssetsManager *assets); 36 | } 37 | 38 | #endif // guard_assetsOnDemand_h_wesdxfc74j 39 | -------------------------------------------------------------------------------- /sources/include/cage-core/audioAlgorithms.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_audioAlgorithms_h_sd5rf4g6t5r 2 | #define guard_audioAlgorithms_h_sd5rf4g6t5r 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_CORE_API void audioSetSampleRate(Audio *snd, uint32 sampleRate); // preserve number of frames and change duration 9 | CAGE_CORE_API void audioConvertSampleRate(Audio *snd, uint32 sampleRate, uint32 quality = 4); // preserve duration and change number of frames 10 | CAGE_CORE_API void audioConvertFrames(Audio *snd, uintPtr frames, uint32 quality = 4); // preserve duration and change sample rate 11 | CAGE_CORE_API void audioConvertFormat(Audio *snd, AudioFormatEnum format); 12 | CAGE_CORE_API void audioGain(Audio *snd, Real gain); 13 | 14 | // copies parts of an audio into another audio 15 | // if the target and source audios are the same instance, the source range and target range cannot overlap 16 | // if the target audio is not initialized and the targetFrameOffset is zero, it will be initialized with channels and format of the source audio 17 | // if the audios have different format, transferred samples will be converted to the target format 18 | // both audios must have same number of channels 19 | // sample rate is ignored (except when initializing new audio) 20 | CAGE_CORE_API void audioBlit(const Audio *source, Audio *target, uintPtr sourceFrameOffset, uintPtr targetFrameOffset, uintPtr frames); 21 | } 22 | 23 | #endif // guard_audioAlgorithms_h_sd5rf4g6t5r 24 | -------------------------------------------------------------------------------- /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/include/cage-core/audioDirectionalConverter.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_audioDirectionalConverter_h_dt45rzr6t54uh185 2 | #define guard_audioDirectionalConverter_h_dt45rzr6t54uh185 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API AudioDirectionalProcessConfig 9 | { 10 | Quat listenerOrientation; 11 | Vec3 listenerPosition; 12 | Vec3 sourcePosition; 13 | }; 14 | 15 | class CAGE_CORE_API AudioDirectionalConverter : private Immovable 16 | { 17 | public: 18 | uint32 channels() const; 19 | 20 | void process(PointerRange srcMono, PointerRange dstPoly, const AudioDirectionalProcessConfig &config); 21 | }; 22 | 23 | struct CAGE_CORE_API AudioDirectionalConverterCreateConfig 24 | { 25 | uint32 channels = 0; 26 | 27 | AudioDirectionalConverterCreateConfig(uint32 channels) : channels(channels) {} 28 | }; 29 | 30 | CAGE_CORE_API Holder newAudioDirectionalConverter(const AudioDirectionalConverterCreateConfig &config); 31 | } 32 | 33 | #endif // guard_audioDirectionalConverter_h_dt45rzr6t54uh185 34 | -------------------------------------------------------------------------------- /sources/include/cage-core/color.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_colors_h_FE9390CFCE3E4DF2B955C7AF40FD8978 2 | #define guard_colors_h_FE9390CFCE3E4DF2B955C7AF40FD8978 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | // colors are in range 0 .. 1 in all color spaces 9 | 10 | CAGE_CORE_API uint32 colorRgbToRgbe(const Vec3 &rgb); 11 | CAGE_CORE_API Vec3 colorRgbeToRgb(uint32 rgbe); 12 | CAGE_CORE_API Vec3 colorRgbToHsv(const Vec3 &rgb); 13 | CAGE_CORE_API Vec3 colorHsvToRgb(const Vec3 &hsv); 14 | CAGE_CORE_API Vec3 colorRgbToHsluv(const Vec3 &rgb); 15 | CAGE_CORE_API Vec3 colorHsluvToRgb(const Vec3 &hsluv); 16 | 17 | CAGE_CORE_API Vec3 colorValueToHeatmapRgb(Real value); // 0 < blue < green < red < 1 18 | 19 | CAGE_CORE_API Vec3 colorGammaToLinear(const Vec3 &rgb); // fast approximate for gamma = 2.2 20 | CAGE_CORE_API Vec3 colorGammaToLinear(const Vec3 &rgb, Real gamma); 21 | CAGE_CORE_API Vec3 colorLinearToGamma(const Vec3 &rgb, Real gamma = 2.2); 22 | 23 | CAGE_CORE_API Real distanceColor(const Vec3 &rgb1, const Vec3 &rgb2); 24 | CAGE_CORE_API Vec3 interpolateColor(const Vec3 &rgb1, const Vec3 &rgb2, Real factor); 25 | 26 | CAGE_CORE_API Vec2 colorSpecularToRoughnessMetallic(const Vec3 &specular); 27 | } 28 | 29 | #endif // guard_colors_h_FE9390CFCE3E4DF2B955C7AF40FD8978 30 | -------------------------------------------------------------------------------- /sources/include/cage-core/endianness.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_endianness_h_l4kjhgsa8567fhj4hgfj 2 | #define guard_endianness_h_l4kjhgsa8567fhj4hgfj 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | namespace endianness 9 | { 10 | CAGE_FORCE_INLINE constexpr uint8 change(uint8 val) 11 | { 12 | return val; 13 | } 14 | CAGE_FORCE_INLINE constexpr uint16 change(uint16 val) 15 | { 16 | return (val & 0xff00) >> 8 | (val & 0x00ff) << 8; 17 | } 18 | CAGE_FORCE_INLINE constexpr uint32 change(uint32 val) 19 | { 20 | uint32 a = change(uint16(val)); 21 | uint32 b = change(uint16(val >> 16)); 22 | return a << 16 | b; 23 | } 24 | CAGE_FORCE_INLINE constexpr uint64 change(uint64 val) 25 | { 26 | uint64 a = change(uint32(val)); 27 | uint64 b = change(uint32(val >> 32)); 28 | return a << 32 | b; 29 | } 30 | 31 | template 32 | CAGE_FORCE_INLINE constexpr T change(T val) 33 | { 34 | static_assert(std::is_trivially_copyable_v); 35 | union U 36 | { 37 | T t; 38 | uint8 a[sizeof(T)]; 39 | U() : t(T()) {} 40 | } u; 41 | u.t = val; 42 | for (uint32 i = 0; i < sizeof(T) / 2; i++) 43 | { 44 | uint8 tmp = u.a[i]; 45 | u.a[i] = u.a[sizeof(T) - i - 1]; 46 | u.a[sizeof(T) - i - 1] = tmp; 47 | } 48 | return u.t; 49 | } 50 | } 51 | } 52 | 53 | #endif // guard_endianness_h_l4kjhgsa8567fhj4hgfj 54 | -------------------------------------------------------------------------------- /sources/include/cage-core/entitiesCopy.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_entitiesCopy_4jh1gv89sert74hz 2 | #define guard_entitiesCopy_4jh1gv89sert74hz 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class EntityManager; 9 | class EntityComponent; 10 | class Entity; 11 | 12 | struct CAGE_CORE_API EntitiesCopyConfig 13 | { 14 | const EntityManager *source = nullptr; 15 | EntityManager *destination = nullptr; 16 | bool purge = false; // purge destination instead of destroy 17 | }; 18 | 19 | CAGE_CORE_API void entitiesCopy(const EntitiesCopyConfig &config); 20 | 21 | CAGE_CORE_API Holder> entitiesExportBuffer(PointerRange entities, EntityComponent *component); 22 | CAGE_CORE_API void entitiesImportBuffer(PointerRange buffer, EntityManager *manager); 23 | } 24 | 25 | #endif // guard_entitiesCopy_4jh1gv89sert74hz 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sources/include/cage-core/hashString.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_hashString_h_b051260b_de9f_4127_a5c7_1c6a0d0b6798_ 2 | #define guard_hashString_h_b051260b_de9f_4127_a5c7_1c6a0d0b6798_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | // HashString returns values in upper half of uint32 range 9 | struct CAGE_CORE_API HashString 10 | { 11 | CAGE_FORCE_INLINE constexpr explicit HashString(const char *str) : value(hashRawString(str) | ((uint32)1 << 31)) {} 12 | 13 | CAGE_FORCE_INLINE constexpr explicit HashString(StringPointer str) : value(hashRawString(str) | ((uint32)1 << 31)) {} 14 | 15 | template 16 | CAGE_FORCE_INLINE constexpr explicit HashString(const detail::StringBase &str) : value(hashBuffer(str) | ((uint32)1 << 31)) 17 | {} 18 | 19 | CAGE_FORCE_INLINE constexpr operator uint32() const { return value; } 20 | 21 | private: 22 | uint32 value = 0; 23 | }; 24 | } 25 | 26 | #endif // guard_hashString_h_b051260b_de9f_4127_a5c7_1c6a0d0b6798_ 27 | -------------------------------------------------------------------------------- /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/include/cage-core/imageImport.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_imageImport_h_our98esyd23gh4 2 | #define guard_imageImport_h_our98esyd23gh4 3 | 4 | #include 5 | #include 6 | 7 | namespace cage 8 | { 9 | struct CAGE_CORE_API ImageImportRaw 10 | { 11 | detail::StringBase<64> format; 12 | Holder> data; 13 | ImageColorConfig colorConfig; 14 | Vec2i resolution; 15 | uint32 channels = 0; 16 | }; 17 | 18 | struct CAGE_CORE_API ImageImportPart 19 | { 20 | String fileName; 21 | Holder image; 22 | Holder raw; 23 | uint32 mipmapLevel = 0; // 0 = highest resolution 24 | uint32 cubeFace = 0; // +X, -X, +Y, -Y, +Z, -Z 25 | uint32 layer = 0; // index in an array or slice in 3D image 26 | }; 27 | 28 | struct CAGE_CORE_API ImageImportResult 29 | { 30 | Holder> parts; 31 | }; 32 | 33 | CAGE_CORE_API ImageImportResult imageImportBuffer(PointerRange buffer); 34 | CAGE_CORE_API ImageImportResult imageImportFiles(const String &filesPattern); 35 | 36 | CAGE_CORE_API void imageImportConvertRawToImages(ImageImportResult &result); 37 | CAGE_CORE_API void imageImportConvertImagesToBcn(ImageImportResult &result, bool normals = false); 38 | CAGE_CORE_API void imageImportGenerateMipmaps(ImageImportResult &result); 39 | } 40 | 41 | #endif // guard_imageImport_h_our98esyd23gh4 42 | -------------------------------------------------------------------------------- /sources/include/cage-core/lineReader.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_lineReader_h_09089ef7_374c_4571_85be_3e7de9acc3aa_ 2 | #define guard_lineReader_h_09089ef7_374c_4571_85be_3e7de9acc3aa_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct MemoryBuffer; 9 | 10 | // split first line from the buffer 11 | // correctly handles both CRLF and LF 12 | 13 | namespace detail 14 | { 15 | // set streaming to true if you may expand the buffer with more data later 16 | // returns number of bytes read 17 | CAGE_CORE_API uintPtr readLine(PointerRange &output, PointerRange buffer, bool streaming); 18 | CAGE_CORE_API uintPtr readLine(String &output, PointerRange buffer, bool streaming); 19 | } 20 | 21 | class CAGE_CORE_API LineReader : private Immovable 22 | { 23 | public: 24 | bool readLine(PointerRange &line); 25 | bool readLine(String &line); 26 | 27 | uintPtr remaining() const; // bytes 28 | }; 29 | 30 | CAGE_CORE_API Holder newLineReader(PointerRange buffer); // the buffer must outlive the reader 31 | CAGE_CORE_API Holder newLineReader(MemoryBuffer &&buffer); // the reader takes ownership of the buffer 32 | } 33 | 34 | #endif // guard_lineReader_h_09089ef7_374c_4571_85be_3e7de9acc3aa_ 35 | -------------------------------------------------------------------------------- /sources/include/cage-core/marchingCubes.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_marchingCubes_h_5C676C29C593444FAD41FE48E265E5DA 2 | #define guard_marchingCubes_h_5C676C29C593444FAD41FE48E265E5DA 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class Collider; 9 | class Mesh; 10 | 11 | class CAGE_CORE_API MarchingCubes : private Immovable 12 | { 13 | public: 14 | PointerRange densities(); 15 | PointerRange densities() const; 16 | void densities(const PointerRange &values); 17 | Real density(uint32 x, uint32 y, uint32 z) const; 18 | void density(uint32 x, uint32 y, uint32 z, Real value); 19 | 20 | void updateByCoordinates(const Delegate &generator); 21 | void updateByPosition(const Delegate &generator); 22 | 23 | Holder makeCollider() const; 24 | Holder makeMesh() const; 25 | }; 26 | 27 | struct CAGE_CORE_API MarchingCubesCreateConfig 28 | { 29 | Aabb box = Aabb(Vec3(-1), Vec3(1)); 30 | Vec3i resolution = Vec3i(20); 31 | bool clip = true; 32 | 33 | Vec3 position(uint32 x, uint32 y, uint32 z) const; 34 | uint32 index(uint32 x, uint32 y, uint32 z) const; 35 | }; 36 | 37 | CAGE_CORE_API Holder newMarchingCubes(const MarchingCubesCreateConfig &config); 38 | } 39 | 40 | #endif // guard_marchingCubes_h_5C676C29C593444FAD41FE48E265E5DA 41 | -------------------------------------------------------------------------------- /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/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/include/cage-core/memoryArena.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_memoryArena_h_yysrtdf56hhuio784hg12edr 2 | #define guard_memoryArena_h_yysrtdf56hhuio784hg12edr 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | namespace privat 9 | { 10 | struct CAGE_CORE_API MemoryArenaStub 11 | { 12 | void *(*alloc)(void *, uintPtr, uintPtr); 13 | void (*dealloc)(void *, void *); 14 | void (*fls)(void *); 15 | 16 | template 17 | CAGE_FORCE_INLINE static void *allocate(void *inst, uintPtr size, uintPtr alignment) 18 | { 19 | return ((A *)inst)->allocate(size, alignment); 20 | } 21 | 22 | template 23 | CAGE_FORCE_INLINE static void deallocate(void *inst, void *ptr) 24 | { 25 | ((A *)inst)->deallocate(ptr); 26 | } 27 | 28 | template 29 | CAGE_FORCE_INLINE static void flush(void *inst) 30 | { 31 | ((A *)inst)->flush(); 32 | } 33 | 34 | template 35 | static MemoryArenaStub init() 36 | { 37 | MemoryArenaStub s; 38 | s.alloc = &allocate; 39 | s.dealloc = &deallocate; 40 | s.fls = &flush; 41 | return s; 42 | } 43 | }; 44 | } 45 | 46 | template 47 | inline MemoryArena::MemoryArena(A *a) 48 | { 49 | static privat::MemoryArenaStub stb = privat::MemoryArenaStub::init(); 50 | this->stub = &stb; 51 | inst = a; 52 | } 53 | } 54 | 55 | #endif // guard_memoryArena_h_yysrtdf56hhuio784hg12edr 56 | -------------------------------------------------------------------------------- /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/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/meshExport.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_meshExport_h_n1bv859wrffcg89 2 | #define guard_meshExport_h_n1bv859wrffcg89 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class Image; 9 | 10 | struct CAGE_CORE_API MeshExportObjConfig 11 | { 12 | String materialLibraryName; 13 | String materialName; 14 | String objectName; 15 | const Mesh *mesh = nullptr; 16 | bool verticalFlipUv = true; 17 | }; 18 | 19 | CAGE_CORE_API Holder> meshExportBuffer(const MeshExportObjConfig &config); 20 | CAGE_CORE_API void meshExportFiles(const String &filename, const MeshExportObjConfig &config); 21 | 22 | struct CAGE_CORE_API MeshExportGltfTexture 23 | { 24 | String filename; 25 | const Image *image = nullptr; 26 | }; 27 | 28 | struct CAGE_CORE_API MeshExportGltfConfig 29 | { 30 | String name; 31 | MeshExportGltfTexture albedo, pbr, normal; 32 | // the pbr texture contains: R: unused, G: roughness and B: metallic channels 33 | const Mesh *mesh = nullptr; 34 | MeshRenderFlags renderFlags = MeshRenderFlags::Default; 35 | bool verticalFlipUv = false; 36 | bool parallelize = false; 37 | }; 38 | 39 | CAGE_CORE_API Holder> meshExportBuffer(const MeshExportGltfConfig &config); 40 | CAGE_CORE_API void meshExportFiles(const String &filename, const MeshExportGltfConfig &config); 41 | } 42 | 43 | #endif // guard_meshExport_h_n1bv859wrffcg89 44 | -------------------------------------------------------------------------------- /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-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/include/cage-core/networkDiscovery.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_networkDiscovery_h_ds5gh4q6as5d48 2 | #define guard_networkDiscovery_h_ds5gh4q6as5d48 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API DiscoveryPeer 9 | { 10 | String message; 11 | String address; 12 | uint16 port = 0; 13 | }; 14 | 15 | class CAGE_CORE_API DiscoveryClient : private Immovable 16 | { 17 | public: 18 | void update(); 19 | void addServer(const String &address, uint16 listenPort); 20 | Holder> peers() const; 21 | }; 22 | 23 | CAGE_CORE_API Holder newDiscoveryClient(uint16 listenPort, uint32 gameId); 24 | 25 | class CAGE_CORE_API DiscoveryServer : private Immovable 26 | { 27 | public: 28 | String message; 29 | 30 | void update(); 31 | }; 32 | 33 | CAGE_CORE_API Holder newDiscoveryServer(uint16 listenPort, uint16 gamePort, uint32 gameId); 34 | } 35 | 36 | #endif // guard_networkDiscovery_h_ds5gh4q6as5d48 37 | -------------------------------------------------------------------------------- /sources/include/cage-core/networkHttp.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_networkHttp_h_f254rloiuigfrde 2 | #define guard_networkHttp_h_f254rloiuigfrde 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace cage 11 | { 12 | struct CAGE_CORE_API HttpRequest 13 | { 14 | std::string url; 15 | std::unordered_map headers, parameters, multipart; 16 | std::unordered_map> files; // form-name -> file-name, file-content 17 | }; 18 | 19 | struct CAGE_CORE_API HttpResponse 20 | { 21 | std::string body; 22 | uint32 statusCode = 0; 23 | }; 24 | 25 | CAGE_CORE_API HttpResponse http(HttpRequest &&request); 26 | 27 | struct CAGE_CORE_API HttpError : public Exception 28 | { 29 | using Exception::Exception; 30 | void log() const override; 31 | 32 | std::string url; 33 | std::string response; 34 | uint32 statusCode = 0; 35 | }; 36 | } 37 | 38 | #endif // guard_networkHttp_h_f254rloiuigfrde 39 | -------------------------------------------------------------------------------- /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/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/include/cage-core/networkWebsocket.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_networkWebsocket_h_lkjhgse897drzh4 2 | #define guard_networkWebsocket_h_lkjhgse897drzh4 3 | 4 | #include 5 | #include 6 | 7 | namespace cage 8 | { 9 | struct TcpRemoteInfo; 10 | 11 | // websocket framing is preserved 12 | // full sequence of frames (up to first FIN) will be read before more data are made available 13 | class CAGE_CORE_API WebsocketConnection : public File 14 | { 15 | public: 16 | TcpRemoteInfo remoteInfo() const; 17 | }; 18 | 19 | CAGE_CORE_API Holder newWebsocketConnection(const String &address, uint16 port); // blocking 20 | 21 | class CAGE_CORE_API WebsocketServer : private Immovable 22 | { 23 | public: 24 | uint16 port() const; // local port 25 | 26 | // returns empty holder if no new peer has connected 27 | Holder accept(); // non-blocking when no new connection, but blocking when handshaking 28 | }; 29 | 30 | CAGE_CORE_API Holder newWebsocketServer(uint16 port); 31 | } 32 | 33 | #endif // guard_networkWebsocket_h_lkjhgse897drzh4 34 | -------------------------------------------------------------------------------- /sources/include/cage-core/pointerRangeHolder.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_pointerRangeHolder_h_thgfd564h64fdrht64r6ht4r56th4u7ik 2 | #define guard_pointerRangeHolder_h_thgfd564h64fdrht64r6ht4r56th4u7ik 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace cage 9 | { 10 | // utility struct to simplify creating Holder> 11 | template 12 | struct PointerRangeHolder : public std::vector> 13 | { 14 | using CT = std::remove_const_t; 15 | 16 | PointerRangeHolder() {} 17 | 18 | explicit PointerRangeHolder(std::vector &&other) : std::vector(std::move(other)) {} 19 | 20 | template 21 | explicit PointerRangeHolder(IT a, IT b) : std::vector(a, b) 22 | {} 23 | 24 | template 25 | explicit PointerRangeHolder(const PointerRange &other) : std::vector(other.begin(), other.end()) 26 | {} 27 | 28 | operator Holder>() 29 | { 30 | struct OwnedVector 31 | { 32 | std::vector vec; 33 | PointerRange range; 34 | }; 35 | 36 | Holder h = systemMemory().createHolder(); 37 | std::swap(*this, h->vec); 38 | h->range = h->vec; 39 | return Holder>(&h->range, std::move(h)); 40 | } 41 | }; 42 | } 43 | 44 | #endif // guard_pointerRangeHolder_h_thgfd564h64fdrht64r6ht4r56th4u7ik 45 | -------------------------------------------------------------------------------- /sources/include/cage-core/process.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_program_h_f16ac3b2_6520_4503_a6ad_f4a582216f67_ 2 | #define guard_program_h_f16ac3b2_6520_4503_a6ad_f4a582216f67_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API ProcessPipeEof : public Exception 9 | { 10 | using Exception::Exception; 11 | }; 12 | 13 | struct CAGE_CORE_API ProcessCreateConfig 14 | { 15 | String command; 16 | String workingDirectory; 17 | sint32 priority = 0; // 0 = normal, -1 = lower priority, 1 = higher priority 18 | bool discardStdIn = false; 19 | bool discardStdOut = false; 20 | bool discardStdErr = false; 21 | bool detached = false; 22 | 23 | ProcessCreateConfig(const String &command, const String &workingDirectory = ""); 24 | }; 25 | 26 | class CAGE_CORE_API Process : public File 27 | { 28 | public: 29 | void requestTerminate(); // SIGTERM 30 | void terminate(); // SIGKILL 31 | sint32 wait(); 32 | }; 33 | 34 | CAGE_CORE_API Holder newProcess(const ProcessCreateConfig &config); 35 | 36 | CAGE_CORE_API void installSigTermHandler(Delegate handler); 37 | CAGE_CORE_API void installSigIntHandler(Delegate handler); 38 | 39 | CAGE_CORE_API void openUrl(const String &url); 40 | } 41 | 42 | #endif // guard_program_h_f16ac3b2_6520_4503_a6ad_f4a582216f67_ 43 | -------------------------------------------------------------------------------- /sources/include/cage-core/rectPacking.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_rectPacking_h_CBAB7F4B_90B1_4151_968F_9C5336718D0D 2 | #define guard_rectPacking_h_CBAB7F4B_90B1_4151_968F_9C5336718D0D 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | struct CAGE_CORE_API PackingRect 9 | { 10 | uint32 id = 0; 11 | uint32 width = 0; 12 | uint32 height = 0; 13 | uint32 x = 0; 14 | uint32 y = 0; 15 | }; 16 | 17 | struct CAGE_CORE_API RectPackingSolveConfig 18 | { 19 | uint32 width = 0; 20 | uint32 height = 0; 21 | uint32 margin = 0; 22 | }; 23 | 24 | class CAGE_CORE_API RectPacking : private Immovable 25 | { 26 | public: 27 | void reserve(uint32 cnt); 28 | void resize(uint32 cnt); 29 | void insert(const PackingRect &r); 30 | PointerRange data(); 31 | PointerRange data() const; 32 | 33 | bool solve(const RectPackingSolveConfig &config); 34 | }; 35 | 36 | CAGE_CORE_API Holder newRectPacking(); 37 | } 38 | 39 | #endif // guard_rectPacking_h_CBAB7F4B_90B1_4151_968F_9C5336718D0D 40 | -------------------------------------------------------------------------------- /sources/include/cage-core/sampleRateConverter.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_sampleRateConverter_h_ds54hgz56dse3t544h 2 | #define guard_sampleRateConverter_h_ds54hgz56dse3t544h 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_CORE_API SampleRateConverter : private Immovable 9 | { 10 | public: 11 | uint32 channels() const; 12 | 13 | void convert(PointerRange src, PointerRange dst, double ratio); 14 | void convert(PointerRange src, PointerRange dst, double startRatio, double endRatio); 15 | }; 16 | 17 | struct SampleRateConverterCreateConfig 18 | { 19 | #ifdef CAGE_DEBUG 20 | static constexpr uint32 DefaultQuality = 1; 21 | #else 22 | static constexpr uint32 DefaultQuality = 3; 23 | #endif // CAGE_DEBUG 24 | 25 | uint32 channels = 0; 26 | uint32 quality = DefaultQuality; // 0 = nearest neighbor, 1 = linear, 2 = low, 3 = medium, 4 = high 27 | 28 | SampleRateConverterCreateConfig(uint32 channels) : channels(channels) {} 29 | }; 30 | 31 | CAGE_CORE_API Holder newSampleRateConverter(const SampleRateConverterCreateConfig &config); 32 | } 33 | 34 | #endif // guard_sampleRateConverter_h_ds54hgz56dse3t544h 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/include/cage-core/skeletalAnimationPreparator.h: -------------------------------------------------------------------------------- 1 | #ifndef header_skeletalAnimationPreparator_h_hgj4156rsd 2 | #define header_skeletalAnimationPreparator_h_hgj4156rsd 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class SkeletalAnimation; 9 | 10 | class CAGE_CORE_API SkeletalAnimationPreparatorInstance : private Immovable 11 | { 12 | public: 13 | void prepare(); // thread safe (launches asynchronous task to compute the armature) 14 | PointerRange armature(); // thread safe, blocking 15 | }; 16 | 17 | class CAGE_CORE_API SkeletalAnimationPreparatorCollection : private Immovable 18 | { 19 | public: 20 | Holder create(void *object, Holder animation, Real coefficient, const Mat4 &modelImportTransform, bool animateSkeletonsInsteadOfSkins = false); // thread safe 21 | void clear(); // thread safe 22 | }; 23 | 24 | CAGE_CORE_API Holder newSkeletalAnimationPreparatorCollection(AssetsManager *assets); 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /sources/include/cage-core/spatialStructure.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_spatial_h_9A6D87AF6D4243E990D6E274B56CF578 2 | #define guard_spatial_h_9A6D87AF6D4243E990D6E274B56CF578 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_CORE_API SpatialQuery : private Immovable 9 | { 10 | public: 11 | PointerRange result() const; 12 | 13 | bool intersection(Vec3 shape); 14 | bool intersection(Line shape); 15 | bool intersection(Triangle shape); 16 | bool intersection(Plane shape); 17 | bool intersection(Sphere shape); 18 | bool intersection(Aabb shape); 19 | bool intersection(Cone shape); 20 | bool intersection(const Frustum &shape); 21 | }; 22 | 23 | class CAGE_CORE_API SpatialStructure : private Immovable 24 | { 25 | public: 26 | void update(uint32 name, Vec3 other); 27 | void update(uint32 name, Line other); 28 | void update(uint32 name, Triangle other); 29 | void update(uint32 name, Sphere other); 30 | void update(uint32 name, Aabb other); 31 | void update(uint32 name, Cone other); 32 | void remove(uint32 name); 33 | void clear(); 34 | void rebuild(); 35 | }; 36 | 37 | struct CAGE_CORE_API SpatialStructureCreateConfig 38 | { 39 | uint32 reserve = 0; 40 | }; 41 | 42 | CAGE_CORE_API Holder newSpatialStructure(const SpatialStructureCreateConfig &config); 43 | CAGE_CORE_API Holder newSpatialQuery(Holder data); 44 | } 45 | 46 | #endif // guard_spatial_h_9A6D87AF6D4243E990D6E274B56CF578 47 | -------------------------------------------------------------------------------- /sources/include/cage-core/stdHash.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_stdHash_ik4j1hb8vsaerg 2 | #define guard_stdHash_ik4j1hb8vsaerg 3 | 4 | #include // std::hash 5 | 6 | #include 7 | 8 | namespace cage 9 | { 10 | template 11 | bool operator==(const cage::Holder &a, const cage::Holder &b) 12 | { 13 | return +a == +b; 14 | } 15 | } 16 | 17 | namespace std 18 | { 19 | template 20 | struct hash> 21 | { 22 | std::size_t operator()(const cage::detail::StringBase &s) const { return cage::hashBuffer(s); } 23 | }; 24 | 25 | template 26 | struct hash> 27 | { 28 | std::size_t operator()(const cage::Holder &v) const { return impl(v, 0); } 29 | 30 | private: 31 | template 32 | auto impl(const cage::Holder &v, int) const -> decltype(std::hash()(*v), std::size_t()) 33 | { 34 | if (v) 35 | return std::hash()(*v); 36 | return 0; 37 | } 38 | 39 | template 40 | auto impl(const cage::Holder &v, float) const -> std::size_t 41 | { 42 | return std::hash()(+v); 43 | } 44 | }; 45 | } 46 | 47 | #endif // guard_stdHash_ik4j1hb8vsaerg 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sources/include/cage-core/systemInformation.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_systemInformation_h_dsgdfhtdhsdirgrdht54fd54hj54jz 2 | #define guard_systemInformation_h_dsgdfhtdhsdirgrdht54fd54hj54jz 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_CORE_API String systemName(); // operating system information 9 | CAGE_CORE_API String userName(); // user name running this process 10 | CAGE_CORE_API String hostName(); // name of this computer 11 | 12 | CAGE_CORE_API uint32 processorsCount(); // returns number of threads, that can physically run simultaneously 13 | CAGE_CORE_API String processorName(); 14 | CAGE_CORE_API uint64 processorClockSpeed(); // Hz 15 | 16 | CAGE_CORE_API uint64 memoryCapacity(); // total memory in bytes for use by the operating system 17 | CAGE_CORE_API uint64 memoryAvailable(); // estimated unused memory in bytes 18 | CAGE_CORE_API uint64 memoryUsed(); // memory used by this process alone 19 | } 20 | 21 | #endif // guard_systemInformation_h_dsgdfhtdhsdirgrdht54fd54hj54jz 22 | -------------------------------------------------------------------------------- /sources/include/cage-core/threadPool.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_threadPool_h_85C3A6DCAB82493AB056948639D0AC0A 2 | #define guard_threadPool_h_85C3A6DCAB82493AB056948639D0AC0A 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_CORE_API ThreadPool : private Immovable 9 | { 10 | public: 11 | Delegate function; 12 | 13 | uint32 threadsCount() const; 14 | void run(); 15 | }; 16 | 17 | // threadsCount == 0 -> run in calling thread 18 | // threadsCount == m -> as many threads as there is processors 19 | CAGE_CORE_API Holder newThreadPool(const String &threadNames = "worker_", uint32 threadsCount = m); 20 | 21 | // divide tasks into groups - find begin/end indices for a particular group 22 | CAGE_CORE_API std::pair tasksSplit(uint32 groupIndex, uint32 groupsCount, uint32 tasksCount); 23 | } 24 | 25 | #endif // guard_threadPool_h_85C3A6DCAB82493AB056948639D0AC0A 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 String &str); 9 | CAGE_ENGINE_API String getClipboard(); 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /sources/include/cage-engine/frameBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_frameBuffer_h_mnbv1cw98e7rft 2 | #define guard_frameBuffer_h_mnbv1cw98e7rft 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class Texture; 9 | 10 | class CAGE_ENGINE_API FrameBuffer : private Immovable 11 | { 12 | #ifdef CAGE_DEBUG 13 | detail::StringBase<64> debugName; 14 | #endif // CAGE_DEBUG 15 | 16 | public: 17 | void setDebugName(const String &name); 18 | 19 | uint32 id() const; 20 | uint32 target() const; 21 | void bind() const; 22 | 23 | void depthTexture(Texture *tex); 24 | void depthTexture(Texture *tex, uint32 layer); 25 | void colorTexture(uint32 index, Texture *tex, uint32 mipmapLevel = 0); 26 | void colorTexture(uint32 index, Texture *tex, uint32 mipmapLevel, uint32 layer); 27 | void activeAttachments(uint32 mask); 28 | void clear(); 29 | void checkStatus() const; 30 | }; 31 | 32 | CAGE_ENGINE_API Holder newFrameBufferDraw(); 33 | CAGE_ENGINE_API Holder newFrameBufferRead(); 34 | } 35 | 36 | #endif // guard_frameBuffer_h_mnbv1cw98e7rft 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sources/include/cage-engine/graphicsError.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_graphicsError_h_d776d3a243c7464db721291294b5b1ef_ 2 | #define guard_graphicsError_h_d776d3a243c7464db721291294b5b1ef_ 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | CAGE_ENGINE_API void checkGlError(); 9 | 10 | #ifdef CAGE_DEBUG 11 | #define CAGE_CHECK_GL_ERROR_DEBUG() \ 12 | { \ 13 | try \ 14 | { \ 15 | checkGlError(); \ 16 | } \ 17 | catch (const ::cage::GraphicsError &) \ 18 | { \ 19 | CAGE_LOG(::cage::SeverityEnum::Error, "exception", ::cage::Stringizer() + "caught opengl error"); \ 20 | } \ 21 | } 22 | #else 23 | #define CAGE_CHECK_GL_ERROR_DEBUG() \ 24 | {} 25 | #endif 26 | 27 | struct CAGE_ENGINE_API GraphicsError : public SystemError 28 | { 29 | using SystemError::SystemError; 30 | }; 31 | 32 | struct CAGE_ENGINE_API GraphicsDebugScope : private Immovable 33 | { 34 | [[nodiscard]] GraphicsDebugScope(StringPointer name); 35 | ~GraphicsDebugScope(); 36 | }; 37 | 38 | namespace detail 39 | { 40 | CAGE_ENGINE_API void purgeGlShaderCache(); 41 | } 42 | } 43 | 44 | #endif // guard_graphicsError_h_d776d3a243c7464db721291294b5b1ef_ 45 | -------------------------------------------------------------------------------- /sources/include/cage-engine/highPerformanceGpuHint.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_highPerformanceGpuHint_h_1ds32fg4dhzhh 2 | #define guard_highPerformanceGpuHint_h_1ds32fg4dhzhh 3 | 4 | #include 5 | 6 | extern "C" 7 | { 8 | CAGE_API_EXPORT int NvOptimusEnablement = 1; 9 | CAGE_API_EXPORT int AmdPowerXpressRequestHighPerformance = 1; 10 | } 11 | 12 | #endif // guard_highPerformanceGpuHint_h_1ds32fg4dhzhh 13 | -------------------------------------------------------------------------------- /sources/include/cage-engine/opengl.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_opengl_h_DB5E1C2183FA4991AF766F8ABEFCE93B 2 | #define guard_opengl_h_DB5E1C2183FA4991AF766F8ABEFCE93B 3 | 4 | #define GLAPI CAGE_ENGINE_API extern 5 | #include 6 | 7 | #include 8 | 9 | namespace cage 10 | { 11 | namespace detail 12 | { 13 | CAGE_ENGINE_API void initializeOpengl(); 14 | } 15 | } 16 | 17 | #endif // guard_opengl_h_DB5E1C2183FA4991AF766F8ABEFCE93B 18 | -------------------------------------------------------------------------------- /sources/include/cage-engine/renderObject.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_renderObject_h_sd54fgh1ikuj187j4kuj8i 2 | #define guard_renderObject_h_sd54fgh1ikuj187j4kuj8i 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class CAGE_ENGINE_API RenderObject : private Immovable 9 | { 10 | protected: 11 | detail::StringBase<64> debugName; 12 | 13 | public: 14 | void setDebugName(const String &name); 15 | 16 | // lod selection properties 17 | 18 | Real worldSize; 19 | Real pixelsSize; 20 | void setLods(PointerRange thresholds, PointerRange itemIndices, PointerRange itemNames); 21 | uint32 lodsCount() const; 22 | uint32 lodSelect(Real threshold) const; 23 | PointerRange models(uint32 lod) const; 24 | 25 | // default values for rendering 26 | 27 | Vec3 color = Vec3::Nan(); 28 | Real intensity = Real::Nan(); 29 | Real opacity = Real::Nan(); 30 | uint32 skelAnimId = 0; 31 | }; 32 | 33 | CAGE_ENGINE_API Holder newRenderObject(); 34 | 35 | CAGE_ENGINE_API AssetsScheme genAssetSchemeRenderObject(); 36 | constexpr uint32 AssetSchemeIndexRenderObject = 13; 37 | } 38 | 39 | #endif // guard_renderObject_h_sd54fgh1ikuj187j4kuj8i 40 | -------------------------------------------------------------------------------- /sources/include/cage-engine/sceneScreenSpaceEffects.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_sceneScreenSpaceEffects_h_xcvhj4n85rb 2 | #define guard_sceneScreenSpaceEffects_h_xcvhj4n85rb 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | enum class ScreenSpaceEffectsFlags : uint32 9 | { 10 | None = 0, 11 | AmbientOcclusion = 1 << 0, 12 | DepthOfField = 1 << 1, 13 | Bloom = 1 << 3, 14 | EyeAdaptation = 1 << 4, 15 | ToneMapping = 1 << 5, 16 | GammaCorrection = 1 << 6, 17 | AntiAliasing = 1 << 7, 18 | Sharpening = 1 << 8, 19 | Default = AmbientOcclusion | Bloom | ToneMapping | GammaCorrection | AntiAliasing, 20 | }; 21 | 22 | struct CAGE_ENGINE_API ScreenSpaceEffectsComponent 23 | { 24 | ScreenSpaceAmbientOcclusion ssao; 25 | ScreenSpaceBloom bloom; 26 | ScreenSpaceEyeAdaptation eyeAdaptation; 27 | ScreenSpaceDepthOfField depthOfField; 28 | ScreenSpaceSharpening sharpening; 29 | Real gamma = 2.2; 30 | ScreenSpaceEffectsFlags effects = ScreenSpaceEffectsFlags::Default; 31 | }; 32 | } 33 | 34 | #endif // guard_sceneScreenSpaceEffects_h_xcvhj4n85rb 35 | -------------------------------------------------------------------------------- /sources/include/cage-engine/sceneVirtualReality.h: -------------------------------------------------------------------------------- 1 | #ifndef guard_sceneVirtualReality_h_5es4tuhj 2 | #define guard_sceneVirtualReality_h_5es4tuhj 3 | 4 | #include 5 | 6 | namespace cage 7 | { 8 | class VirtualRealityController; 9 | struct VirtualRealityCamera; 10 | class VirtualReality; 11 | 12 | // the transform of this entity maps the virtual reality coordinates space into the scene coordinates space 13 | struct CAGE_ENGINE_API VrOriginComponent 14 | { 15 | VirtualReality *virtualReality = nullptr; 16 | Transform manualCorrection; 17 | }; 18 | 19 | // the transform of this entity is updated automatically by the virtual reality 20 | struct CAGE_ENGINE_API VrCameraComponent : public CameraCommonProperties 21 | { 22 | VirtualReality *virtualReality = nullptr; 23 | Real near = 0.2, far = 10000; 24 | }; 25 | 26 | // the transform of this entity is updated automatically by the virtual reality 27 | // this entity represents the grip pose of the controller 28 | struct CAGE_ENGINE_API VrControllerComponent 29 | { 30 | VirtualRealityController *controller = nullptr; 31 | Transform aim; // aim pose of the controller in the scene coordinates space 32 | }; 33 | } 34 | 35 | #endif // guard_sceneVirtualReality_h_5es4tuhj 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #ifdef CAGE_DEBUG 13 | detail::StringBase<64> debugName; 14 | #endif // CAGE_DEBUG 15 | 16 | public: 17 | void setDebugName(const String &name); 18 | 19 | void importAudio(Holder