├── .clang-format ├── .devcontainer ├── devcontainer.json └── ubuntu.dockerfile ├── .github ├── actions │ └── linux_setup │ │ └── action.yml └── workflows │ ├── build.yml │ └── pages.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── cmake ├── AddImguiTarget.cmake ├── FetchDependencies.cmake ├── NcEngineConfig.cmake └── Version.h.in ├── docs ├── DocsMainPage.md ├── Doxyfile ├── EngineComponents.md ├── Logo.png ├── animation_export_screenshot.png ├── demo_scene.gif ├── docs-badge.svg ├── doxygen-awesome.css └── nc-convert.md ├── include ├── ncasset │ ├── AssetType.h │ ├── Assets.h │ ├── AssetsFwd.h │ ├── DefaultAssets.h │ ├── Import.h │ └── NcaHeader.h ├── ncengine │ ├── Events.h │ ├── NcEngine.h │ ├── NcFwd.h │ ├── asset │ │ ├── AssetData.h │ │ ├── AssetViews.h │ │ ├── Assets.h │ │ └── NcAsset.h │ ├── audio │ │ ├── AudioSource.h │ │ └── NcAudio.h │ ├── config │ │ ├── Config.h │ │ └── Version.h │ ├── debug │ │ ├── DebugRendering.h │ │ ├── Profile.h │ │ ├── Serialize.h │ │ └── detail │ │ │ └── DebugRenderer.h │ ├── ecs │ │ ├── AccessPolicy.h │ │ ├── AnyComponent.h │ │ ├── Component.h │ │ ├── ComponentPool.h │ │ ├── ComponentRegistry.h │ │ ├── Ecs.h │ │ ├── EcsFilter.h │ │ ├── EcsFwd.h │ │ ├── Entity.h │ │ ├── EntityPool.h │ │ ├── FrameLogic.h │ │ ├── FreeComponentPool.h │ │ ├── Hierarchy.h │ │ ├── InvokeFreeComponent.h │ │ ├── NcEcs.h │ │ ├── Tag.h │ │ ├── Transform.h │ │ └── detail │ │ │ ├── AnyComponentUtility.h │ │ │ ├── FreeComponentGroup.h │ │ │ ├── HandleManager.h │ │ │ ├── PoolUtility.h │ │ │ └── SparseSet.h │ ├── graphics │ │ ├── Camera.h │ │ ├── GraphicsUtility.h │ │ ├── Light.h │ │ ├── Material.h │ │ ├── Mesh.h │ │ ├── NcGraphics.h │ │ ├── ParticleEmitter.h │ │ ├── PostProcess.h │ │ ├── SceneNavigationCamera.h │ │ ├── SkeletalAnimationController.h │ │ └── WireframeRenderer.h │ ├── input │ │ └── Input.h │ ├── math │ │ └── Random.h │ ├── module │ │ ├── Module.h │ │ ├── ModuleProvider.h │ │ └── ModuleRegistry.h │ ├── physics │ │ ├── CollisionListener.h │ │ ├── CollisionQuery.h │ │ ├── CompoundShape.h │ │ ├── Constraints.h │ │ ├── CookedShape.h │ │ ├── HitInfo.h │ │ ├── NcPhysics.h │ │ ├── PhysicsLimits.h │ │ ├── PhysicsSnapshot.h │ │ ├── PhysicsTick.h │ │ ├── PhysicsUtility.h │ │ ├── RigidBody.h │ │ ├── Shape.h │ │ ├── SpringSettings.h │ │ ├── SupportFunctions.h │ │ └── Vehicle.h │ ├── scene │ │ ├── NcScene.h │ │ └── Scene.h │ ├── serialize │ │ └── SceneSerialization.h │ ├── task │ │ ├── AsyncDispatcher.h │ │ ├── ExceptionContext.h │ │ ├── TaskFwd.h │ │ └── TaskGraph.h │ ├── time │ │ └── Time.h │ ├── type │ │ ├── EngineId.h │ │ ├── EngineTypes.h │ │ ├── StableAddress.h │ │ ├── Type.h │ │ └── UIStream.h │ ├── ui │ │ ├── IUI.h │ │ ├── ImGuiConversion.h │ │ ├── ImGuiStyle.h │ │ ├── ImGuiUtility.h │ │ ├── UIElement.h │ │ ├── UIPosition.h │ │ └── editor │ │ │ ├── Editor.h │ │ │ └── EditorContext.h │ ├── utility │ │ ├── EnumUtilities.h │ │ ├── FileLogger.h │ │ ├── Log.h │ │ ├── Signal.h │ │ ├── SparseMap.h │ │ └── detail │ │ │ ├── LogInternal.h │ │ │ └── SignalInternal.h │ └── window │ │ ├── IOnResizeReceiver.h │ │ └── Window.h ├── ncmath │ ├── Geometry.h │ ├── Math.h │ ├── MatrixUtilities.h │ ├── Quaternion.h │ ├── Vector.h │ └── Xoshiro256.h └── ncutility │ ├── Algorithm.h │ ├── BinarySerialization.h │ ├── Compression.h │ ├── Hash.h │ ├── NcError.h │ ├── ScopeExit.h │ ├── detail │ ├── BinarySerializationDetail.h │ ├── EnumerateDetail.h │ └── SerializeCpo.h │ └── platform │ ├── Platform.h │ ├── SourceLocation.h │ └── win32 │ ├── HInstanceForwardDecl.h │ ├── HWNDForwardDecl.h │ ├── NcWin32.h │ ├── NcWin32Filter.h │ └── NcWinDef.h ├── readme.md ├── resources ├── manifest.json ├── nca │ ├── audio_clip │ │ └── default │ │ │ └── silence.nca │ ├── convex_hull │ │ └── default │ │ │ └── cube.nca │ ├── cube_map │ │ └── default │ │ │ └── skybox.nca │ ├── mesh │ │ └── default │ │ │ ├── capsule.nca │ │ │ ├── cube.nca │ │ │ ├── plane.nca │ │ │ ├── skybox.nca │ │ │ ├── sphere.nca │ │ │ └── wheel.nca │ ├── mesh_collider │ │ └── default │ │ │ └── plane.nca │ ├── skeletal_animation │ │ └── default │ │ │ └── cube.nca │ └── texture │ │ └── default │ │ ├── color.nca │ │ ├── normal.nca │ │ └── particle.nca ├── raw │ ├── image │ │ ├── DefaultBaseColor.png │ │ ├── DefaultNormal.png │ │ ├── DefaultParticle.png │ │ └── DefaultSkybox.png │ ├── model │ │ ├── DefaultCapsule.fbx │ │ ├── DefaultCube.fbx │ │ ├── DefaultPlane.fbx │ │ ├── DefaultSkybox.fbx │ │ ├── DefaultSphere.fbx │ │ └── DefaultWheel.fbx │ ├── skeletal_animation │ │ └── DefaultCube.fbx │ └── sound │ │ └── DefaultAudioClip.wav └── shaders │ ├── compiled │ ├── NormalsPixel.spv │ ├── PPEndPixel.spv │ ├── PPFxaaPixel.spv │ ├── PPNoisePixel.spv │ ├── PPOutlinePixel.spv │ ├── ParticlePixel.spv │ ├── ParticleVertex.spv │ ├── PointShadowMapPixel.spv │ ├── PointShadowMapSkinnedVertex.spv │ ├── PointShadowMapVertex.spv │ ├── PostProcessVertex.spv │ ├── SkyboxPixel.spv │ ├── SkyboxVertex.spv │ ├── ToonPixel.spv │ ├── ToonSkinnedVertex.spv │ ├── ToonVertex.spv │ ├── UniShadowMapSkinnedVertex.spv │ ├── UniShadowMapVertex.spv │ ├── WireframePixel.spv │ └── WireframeVertex.spv │ └── source │ ├── Normals.psh │ ├── PPEnd.psh │ ├── PPFxaa.psh │ ├── PPNoise.psh │ ├── PPOutline.psh │ ├── Particle.psh │ ├── Particle.vsh │ ├── PointShadowMap.psh │ ├── PointShadowMap.vsh │ ├── PointShadowMapSkinned.vsh │ ├── PostProcess.vsh │ ├── Skybox.psh │ ├── Skybox.vsh │ ├── Toon.psh │ ├── Toon.vsh │ ├── ToonSkinned.vsh │ ├── UniShadowMap.vsh │ ├── UniShadowMapSkinned.vsh │ ├── Wireframe.psh │ ├── Wireframe.vsh │ └── core │ ├── Animation.fxh │ ├── Lighting.fxh │ ├── PerFrameTypes.fxh │ └── PerPassTypes.fxh ├── sample ├── CMakeLists.txt ├── assets │ ├── font │ │ ├── OFL.txt │ │ └── SourceCodePro-Regular.ttf │ ├── manifest.json │ ├── nca │ │ ├── audio_clip │ │ │ ├── drums.nca │ │ │ └── hit.nca │ │ ├── convex_hull │ │ │ └── ramp.nca │ │ ├── cube_map │ │ │ └── night_sky.nca │ │ ├── mesh │ │ │ ├── cave.nca │ │ │ ├── guy2.nca │ │ │ ├── halfpipe.nca │ │ │ ├── ogre.nca │ │ │ ├── ramp.nca │ │ │ └── skeleton.nca │ │ ├── mesh_collider │ │ │ └── halfpipe.nca │ │ ├── skeletal_animation │ │ │ ├── ogre │ │ │ │ ├── attack.nca │ │ │ │ └── idle.nca │ │ │ └── skeleton │ │ │ │ ├── idle.nca │ │ │ │ ├── jump.nca │ │ │ │ ├── walk_back.nca │ │ │ │ ├── walk_forward.nca │ │ │ │ ├── walk_left.nca │ │ │ │ └── walk_right.nca │ │ └── texture │ │ │ ├── diffuse │ │ │ ├── blue.nca │ │ │ ├── cave.nca │ │ │ ├── green.nca │ │ │ ├── guy.nca │ │ │ ├── ogre.nca │ │ │ ├── orange.nca │ │ │ ├── purple.nca │ │ │ ├── red.nca │ │ │ ├── skeleton.nca │ │ │ ├── teal.nca │ │ │ └── yellow.nca │ │ │ ├── effect │ │ │ ├── linear_hatch.nca │ │ │ └── noise.nca │ │ │ └── normal │ │ │ ├── cave.nca │ │ │ ├── guy.nca │ │ │ ├── ogre.nca │ │ │ └── skeleton.nca │ └── raw │ │ ├── audio │ │ ├── drums.wav │ │ └── hit.wav │ │ ├── image │ │ ├── cube_maps │ │ │ └── night_sky.png │ │ ├── diffuse │ │ │ ├── blue.png │ │ │ ├── cave.png │ │ │ ├── green.png │ │ │ ├── guy.png │ │ │ ├── ogre.png │ │ │ ├── orange.png │ │ │ ├── purple.png │ │ │ ├── red.png │ │ │ ├── skeleton.png │ │ │ ├── teal.png │ │ │ └── yellow.png │ │ ├── effect │ │ │ ├── linear_hatch.png │ │ │ └── noise.png │ │ └── normal │ │ │ ├── cave.png │ │ │ ├── guy.png │ │ │ ├── ogre.png │ │ │ └── skeleton.png │ │ ├── model │ │ ├── cave.fbx │ │ ├── guy2.fbx │ │ ├── halfpipe.fbx │ │ ├── ogre.fbx │ │ ├── ramp.fbx │ │ └── skeleton.fbx │ │ └── skeletal_animation │ │ ├── ogre.fbx │ │ └── skeleton.fbx ├── config.ini └── source │ ├── CMakeLists.txt │ ├── SampleMain.cpp │ ├── scenes │ ├── Benchmarks.cpp │ ├── Benchmarks.h │ ├── CMakeLists.txt │ ├── GraphicsTest.cpp │ ├── GraphicsTest.h │ ├── PhysicsTest.cpp │ ├── PhysicsTest.h │ ├── SmokeTest.cpp │ └── SmokeTest.h │ └── shared │ ├── CMakeLists.txt │ ├── GameLog.cpp │ ├── GameLog.h │ ├── GameLogic.cpp │ ├── GameLogic.h │ ├── GeneratedAssets.cpp │ ├── GeneratedAssets.h │ ├── Prefabs.cpp │ ├── Prefabs.h │ ├── SampleUI.cpp │ ├── SampleUI.h │ └── spawner │ ├── SpawnBehavior.h │ ├── SpawnPropertyGenerator.h │ └── Spawner.h ├── script ├── build_docs.ps1 └── shaders.ps1 ├── source ├── CMakeLists.txt ├── external │ ├── audio_file │ │ ├── AudioFile.h │ │ └── LICENSE │ ├── lz4 │ │ ├── CMakeLists.txt │ │ ├── lz4.c │ │ ├── lz4.h │ │ ├── lz4hc.c │ │ └── lz4hc.h │ ├── nlohmann │ │ ├── json.hpp │ │ └── json_fwd.hpp │ ├── rtaudio │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── RtAudio.cpp │ │ └── RtAudio.h │ ├── stb │ │ ├── stb_dxt.h │ │ ├── stb_image.h │ │ └── stb_image_resize2.h │ └── vma_fallback │ │ └── vma │ │ └── vk_mem_alloc.h ├── ncasset │ ├── CMakeLists.txt │ ├── DefaultAssets.cpp │ ├── Deserialize.cpp │ ├── Deserialize.h │ ├── Import.cpp │ └── NcaHeader.cpp ├── ncconvert │ ├── CMakeLists.txt │ ├── Config.h │ ├── Main.cpp │ ├── ReturnCodes.h │ ├── Usage.h │ ├── analysis │ │ ├── CMakeLists.txt │ │ ├── GeometryAnalysis.cpp │ │ ├── GeometryAnalysis.h │ │ ├── Sanitize.cpp │ │ ├── Sanitize.h │ │ ├── TextureAnalysis.cpp │ │ └── TextureAnalysis.h │ ├── builder │ │ ├── BuildInstructions.cpp │ │ ├── BuildInstructions.h │ │ ├── BuildOrchestrator.cpp │ │ ├── BuildOrchestrator.h │ │ ├── Builder.cpp │ │ ├── Builder.h │ │ ├── CMakeLists.txt │ │ ├── Inspect.cpp │ │ ├── Inspect.h │ │ ├── Manifest.cpp │ │ ├── Manifest.h │ │ ├── Serialize.cpp │ │ ├── Serialize.h │ │ └── Target.h │ ├── code_gen │ │ ├── CMakeLists.txt │ │ ├── PrefabGenerator.cpp │ │ └── PrefabGenerator.h │ ├── converters │ │ ├── AudioConverter.cpp │ │ ├── AudioConverter.h │ │ ├── CMakeLists.txt │ │ ├── GeometryConverter.cpp │ │ ├── GeometryConverter.h │ │ ├── TextureConverter.cpp │ │ └── TextureConverter.h │ ├── optimizer │ │ ├── CMakeLists.txt │ │ ├── MeshOptimization.cpp │ │ └── MeshOptimization.h │ └── utility │ │ ├── CMakeLists.txt │ │ ├── EnumExtensions.cpp │ │ ├── EnumExtensions.h │ │ ├── Image.cpp │ │ ├── Image.h │ │ ├── Log.h │ │ ├── Path.cpp │ │ └── Path.h ├── ncengine │ ├── CMakeLists.txt │ ├── asset │ │ ├── AssetData.cpp │ │ ├── AssetService.h │ │ ├── Assets.cpp │ │ ├── CMakeLists.txt │ │ ├── NcAssetImpl.cpp │ │ ├── NcAssetImpl.h │ │ └── manager │ │ │ ├── AssetUtilities.cpp │ │ │ ├── AssetUtilities.h │ │ │ ├── AudioClipAssetManager.cpp │ │ │ ├── AudioClipAssetManager.h │ │ │ ├── CMakeLists.txt │ │ │ ├── ConvexHullAssetManager.cpp │ │ │ ├── ConvexHullAssetManager.h │ │ │ ├── CubeMapAssetManager.cpp │ │ │ ├── CubeMapAssetManager.h │ │ │ ├── FontAssetManager.cpp │ │ │ ├── FontAssetManager.h │ │ │ ├── MeshAssetManager.cpp │ │ │ ├── MeshAssetManager.h │ │ │ ├── MeshColliderAssetManager.cpp │ │ │ ├── MeshColliderAssetManager.h │ │ │ ├── ShaderAssetManager.cpp │ │ │ ├── ShaderAssetManager.h │ │ │ ├── SkeletalAnimationAssetManager.cpp │ │ │ ├── SkeletalAnimationAssetManager.h │ │ │ ├── TextureAssetManager.cpp │ │ │ └── TextureAssetManager.h │ ├── audio │ │ ├── AudioSource.cpp │ │ ├── CMakeLists.txt │ │ ├── DeviceStream.cpp │ │ ├── DeviceStream.h │ │ ├── NcAudioImpl.cpp │ │ └── NcAudioImpl.h │ ├── config │ │ ├── CMakeLists.txt │ │ ├── Config.cpp │ │ ├── ConfigInternal.h │ │ └── default_config.ini │ ├── debug │ │ ├── CMakeLists.txt │ │ ├── DebugRendering.cpp │ │ └── Serialize.cpp │ ├── ecs │ │ ├── CMakeLists.txt │ │ ├── NcEcsImpl.cpp │ │ ├── NcEcsImpl.h │ │ ├── SoA.cpp │ │ ├── SoA.h │ │ └── Transform.cpp │ ├── engine │ │ ├── CMakeLists.txt │ │ ├── ComponentFactories.cpp │ │ ├── ComponentFactories.h │ │ ├── ModuleFactory.cpp │ │ ├── ModuleFactory.h │ │ ├── NcEngineImpl.cpp │ │ ├── NcEngineImpl.h │ │ ├── RegistryFactory.cpp │ │ ├── RegistryFactory.h │ │ └── registration │ │ │ ├── AudioTypes.cpp │ │ │ ├── AudioTypes.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CoreTypes.cpp │ │ │ ├── CoreTypes.h │ │ │ ├── FactoryCommon.h │ │ │ ├── GraphicsTypes.cpp │ │ │ ├── GraphicsTypes.h │ │ │ ├── LogicTypes.cpp │ │ │ ├── LogicTypes.h │ │ │ ├── PhysicsTypes.cpp │ │ │ └── PhysicsTypes.h │ ├── graphics │ │ ├── CMakeLists.txt │ │ ├── GraphicsConstants.h │ │ ├── GraphicsUtilities.cpp │ │ ├── GraphicsUtilities.h │ │ ├── IGraphics.cpp │ │ ├── IGraphics.h │ │ ├── NcGraphicsImpl.cpp │ │ ├── NcGraphicsImpl.h │ │ ├── PerFrameRenderState.h │ │ ├── api │ │ │ └── vulkan │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── FrameManager.cpp │ │ │ │ ├── FrameManager.h │ │ │ │ ├── GpuAllocator.cpp │ │ │ │ ├── GpuAllocator.h │ │ │ │ ├── ImguiVulkan.cpp │ │ │ │ ├── ImguiVulkan.h │ │ │ │ ├── Initializers.cpp │ │ │ │ ├── Initializers.h │ │ │ │ ├── NcVulkan.cpp │ │ │ │ ├── NcVulkan.h │ │ │ │ ├── PerFrameGpuContext.cpp │ │ │ │ ├── PerFrameGpuContext.h │ │ │ │ ├── QueueFamily.cpp │ │ │ │ ├── QueueFamily.h │ │ │ │ ├── RenderGraph.cpp │ │ │ │ ├── RenderGraph.h │ │ │ │ ├── ShaderBindingManager.cpp │ │ │ │ ├── ShaderBindingManager.h │ │ │ │ ├── ShaderStorage.cpp │ │ │ │ ├── ShaderStorage.h │ │ │ │ ├── ShaderUtilities.cpp │ │ │ │ ├── ShaderUtilities.h │ │ │ │ ├── Swapchain.cpp │ │ │ │ ├── Swapchain.h │ │ │ │ ├── VertexDescriptions.cpp │ │ │ │ ├── VertexDescriptions.h │ │ │ │ ├── VulkanConstants.h │ │ │ │ ├── VulkanGraphics.cpp │ │ │ │ ├── VulkanGraphics.h │ │ │ │ ├── buffers │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CubeMapArrayBuffer.cpp │ │ │ │ ├── CubeMapArrayBuffer.h │ │ │ │ ├── MeshArrayBuffer.cpp │ │ │ │ ├── MeshArrayBuffer.h │ │ │ │ ├── RenderPassSinkBuffer.cpp │ │ │ │ ├── RenderPassSinkBuffer.h │ │ │ │ ├── StorageBuffer.cpp │ │ │ │ ├── StorageBuffer.h │ │ │ │ ├── TextureArrayBuffer.cpp │ │ │ │ ├── TextureArrayBuffer.h │ │ │ │ ├── UniformBuffer.cpp │ │ │ │ └── UniformBuffer.h │ │ │ │ ├── core │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Device.cpp │ │ │ │ ├── Device.h │ │ │ │ ├── GpuOptions.cpp │ │ │ │ ├── GpuOptions.h │ │ │ │ ├── Instance.cpp │ │ │ │ ├── Instance.h │ │ │ │ └── detail │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── PhysicalDevice.cpp │ │ │ │ │ └── PhysicalDevice.h │ │ │ │ ├── pipelines │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── EnvironmentPipeline.cpp │ │ │ │ ├── EnvironmentPipeline.h │ │ │ │ ├── IPipeline.h │ │ │ │ ├── OutlinePipeline.cpp │ │ │ │ ├── OutlinePipeline.h │ │ │ │ ├── ParticlePipeline.cpp │ │ │ │ ├── ParticlePipeline.h │ │ │ │ ├── PbrPipeline.cpp │ │ │ │ ├── PbrPipeline.h │ │ │ │ ├── ShadowMappingPipeline.cpp │ │ │ │ ├── ShadowMappingPipeline.h │ │ │ │ ├── ToonPipeline.cpp │ │ │ │ ├── ToonPipeline.h │ │ │ │ ├── UiPipeline.cpp │ │ │ │ ├── UiPipeline.h │ │ │ │ ├── WireframePipeline.cpp │ │ │ │ └── WireframePipeline.h │ │ │ │ └── renderpasses │ │ │ │ ├── Attachment.cpp │ │ │ │ ├── Attachment.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── RenderPass.cpp │ │ │ │ └── RenderPass.h │ │ ├── components │ │ │ ├── CMakeLists.txt │ │ │ ├── MeshRenderer.cpp │ │ │ ├── SkeletalAnimator.cpp │ │ │ └── ToonRenderer.cpp │ │ ├── shader_resource │ │ │ ├── BufferConcepts.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CubeMapArrayBufferHandle.cpp │ │ │ ├── CubeMapArrayBufferHandle.h │ │ │ ├── MeshArrayBufferHandle.cpp │ │ │ ├── MeshArrayBufferHandle.h │ │ │ ├── RenderPassSinkBufferHandle.cpp │ │ │ ├── RenderPassSinkBufferHandle.h │ │ │ ├── ResourceInstances.cpp │ │ │ ├── ResourceInstances.h │ │ │ ├── ShaderResourceBus.cpp │ │ │ ├── ShaderResourceBus.h │ │ │ ├── ShaderTypes.h │ │ │ ├── SkeletalAnimationData.h │ │ │ ├── StorageBufferHandle.cpp │ │ │ ├── StorageBufferHandle.h │ │ │ ├── TextureArrayBufferHandle.cpp │ │ │ ├── TextureArrayBufferHandle.h │ │ │ ├── UniformBufferHandle.cpp │ │ │ └── UniformBufferHandle.h │ │ └── system │ │ │ ├── CMakeLists.txt │ │ │ ├── CameraSystem.cpp │ │ │ ├── CameraSystem.h │ │ │ ├── EnvironmentSystem.cpp │ │ │ ├── EnvironmentSystem.h │ │ │ ├── LightSystem.cpp │ │ │ ├── LightSystem.h │ │ │ ├── ObjectSystem.cpp │ │ │ ├── ObjectSystem.h │ │ │ ├── ParticleEmitterSystem.cpp │ │ │ ├── ParticleEmitterSystem.h │ │ │ ├── SkeletalAnimationCalculations.cpp │ │ │ ├── SkeletalAnimationCalculations.h │ │ │ ├── SkeletalAnimationSystem.cpp │ │ │ ├── SkeletalAnimationSystem.h │ │ │ ├── SkeletalAnimationTypes.cpp │ │ │ ├── UISystem.cpp │ │ │ ├── UISystem.h │ │ │ ├── WidgetSystem.cpp │ │ │ └── WidgetSystem.h │ ├── graphics2 │ │ ├── CMakeLists.txt │ │ ├── Camera.cpp │ │ ├── GraphicsUtility.cpp │ │ ├── Material.cpp │ │ ├── Mesh.cpp │ │ ├── NcGraphicsImpl2.cpp │ │ ├── NcGraphicsImpl2.h │ │ ├── ParticleEmitter.cpp │ │ ├── PostProcess.cpp │ │ ├── SceneNavigationCamera.cpp │ │ ├── ShaderTypes.h │ │ ├── SkeletalAnimationController.cpp │ │ ├── diligent │ │ │ ├── CMakeLists.txt │ │ │ ├── DiligentEngine.cpp │ │ │ ├── DiligentEngine.h │ │ │ ├── ImGuiImplGLFW.cpp │ │ │ ├── ImGuiImplGLFW.h │ │ │ ├── NativeWindow.h │ │ │ ├── NativeWindowLinux.cpp │ │ │ ├── NativeWindowWin32.cpp │ │ │ ├── ShaderFactory.cpp │ │ │ ├── ShaderFactory.h │ │ │ ├── UIBackend.cpp │ │ │ ├── UIBackend.h │ │ │ ├── pass │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── MaterialPass.cpp │ │ │ │ ├── MaterialPass.h │ │ │ │ ├── ParticlePass.cpp │ │ │ │ ├── ParticlePass.h │ │ │ │ ├── Pass.cpp │ │ │ │ ├── Pass.h │ │ │ │ ├── PassBackend.cpp │ │ │ │ ├── PassBackend.h │ │ │ │ ├── PassManifest.cpp │ │ │ │ ├── PassManifest.h │ │ │ │ ├── PassTypes.h │ │ │ │ ├── PassUtilities.cpp │ │ │ │ ├── PassUtilities.h │ │ │ │ ├── PipelineShaders.cpp │ │ │ │ ├── PipelineShaders.h │ │ │ │ ├── PostProcessPass.cpp │ │ │ │ ├── PostProcessPass.h │ │ │ │ ├── SkyboxPass.cpp │ │ │ │ ├── SkyboxPass.h │ │ │ │ ├── WireframePass.cpp │ │ │ │ └── WireframePass.h │ │ │ └── resource │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CubeMapBufferResource.cpp │ │ │ │ ├── CubeMapBufferResource.h │ │ │ │ ├── CubeSinkBufferResource.cpp │ │ │ │ ├── CubeSinkBufferResource.h │ │ │ │ ├── EnvironmentBufferResource.cpp │ │ │ │ ├── EnvironmentBufferResource.h │ │ │ │ ├── MeshBuffer.cpp │ │ │ │ ├── MeshBuffer.h │ │ │ │ ├── PerFrameResourceSignature.cpp │ │ │ │ ├── PerFrameResourceSignature.h │ │ │ │ ├── PerPassResourceSignature.cpp │ │ │ │ ├── PerPassResourceSignature.h │ │ │ │ ├── PostProcessPropertyBufferResource.cpp │ │ │ │ ├── PostProcessPropertyBufferResource.h │ │ │ │ ├── ResourceTypes.cpp │ │ │ │ ├── ResourceTypes.h │ │ │ │ ├── ShaderBindings.cpp │ │ │ │ ├── ShaderBindings.h │ │ │ │ ├── SinkBufferResource.cpp │ │ │ │ ├── SinkBufferResource.h │ │ │ │ ├── SinkIndexBufferResource.cpp │ │ │ │ ├── SinkIndexBufferResource.h │ │ │ │ ├── TextureBufferResource.cpp │ │ │ │ ├── TextureBufferResource.h │ │ │ │ ├── WireframeBufferResource.cpp │ │ │ │ ├── WireframeBufferResource.h │ │ │ │ └── base │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DynamicUniformBuffer.cpp │ │ │ │ ├── DynamicUniformBuffer.h │ │ │ │ ├── StructuredBuffer.cpp │ │ │ │ └── StructuredBuffer.h │ │ └── frontend │ │ │ ├── CMakeLists.txt │ │ │ ├── FrontendRenderState.h │ │ │ ├── GraphicsFrontend.cpp │ │ │ ├── GraphicsFrontend.h │ │ │ └── subsystem │ │ │ ├── AssetDispatch.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CameraRenderState.h │ │ │ ├── CameraSubsystem.cpp │ │ │ ├── CameraSubsystem.h │ │ │ ├── EnvironmentRenderState.h │ │ │ ├── EnvironmentSubsystem.h │ │ │ ├── HostStructuredBuffer.h │ │ │ ├── InstanceCache.h │ │ │ ├── InstanceCache.inl │ │ │ ├── LightRenderState.h │ │ │ ├── LightSubsystem.cpp │ │ │ ├── LightSubsystem.h │ │ │ ├── MaterialRegistry.cpp │ │ │ ├── MaterialRegistry.h │ │ │ ├── MeshRenderState.h │ │ │ ├── MeshSubsystem.cpp │ │ │ ├── MeshSubsystem.h │ │ │ ├── PostProcessState.h │ │ │ ├── PostProcessSubsystem.cpp │ │ │ ├── PostProcessSubsystem.h │ │ │ ├── TransformCache.cpp │ │ │ ├── TransformCache.h │ │ │ ├── UISubsystem.cpp │ │ │ ├── UISubsystem.h │ │ │ ├── WireframeRendererState.h │ │ │ ├── WireframeRendererSubsystem.cpp │ │ │ ├── WireframeRendererSubsystem.h │ │ │ ├── animation │ │ │ ├── AnimationStateOrchestrator.cpp │ │ │ ├── AnimationStateOrchestrator.h │ │ │ ├── BoneCache.cpp │ │ │ ├── BoneCache.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Rig.cpp │ │ │ ├── Rig.h │ │ │ ├── SkeletalAnimationCalculator.cpp │ │ │ ├── SkeletalAnimationCalculator.h │ │ │ ├── SkeletalAnimationRenderState.h │ │ │ ├── SkeletalAnimationStorage.cpp │ │ │ ├── SkeletalAnimationStorage.h │ │ │ ├── SkeletalAnimationSubsystem.cpp │ │ │ └── SkeletalAnimationSubsystem.h │ │ │ └── particle │ │ │ ├── CMakeLists.txt │ │ │ ├── EmitterState.cpp │ │ │ ├── EmitterState.h │ │ │ ├── ParticleRenderState.h │ │ │ ├── ParticleSubsystem.cpp │ │ │ └── ParticleSubsystem.h │ ├── input │ │ ├── CMakeLists.txt │ │ ├── Input.cpp │ │ └── InputInternal.h │ ├── physics │ │ ├── CMakeLists.txt │ │ ├── CollisionQuery.cpp │ │ ├── CollisionQueryImpl.h │ │ ├── Constraints.cpp │ │ ├── DeferredPhysicsCreateState.h │ │ ├── EventDispatch.cpp │ │ ├── EventDispatch.h │ │ ├── NcPhysicsImpl.cpp │ │ ├── NcPhysicsImpl.h │ │ ├── PhysicsUtility.cpp │ │ ├── RigidBody.cpp │ │ ├── Shape.cpp │ │ ├── Vehicle.cpp │ │ └── jolt │ │ │ ├── BodyFactory.cpp │ │ │ ├── BodyFactory.h │ │ │ ├── BodyManager.cpp │ │ │ ├── BodyManager.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CollisionQueryContext.h │ │ │ ├── CollisionQueryManager.h │ │ │ ├── CollisionQueryUtility.h │ │ │ ├── ComponentContext.h │ │ │ ├── CompoundShape.cpp │ │ │ ├── ConstraintFactory.cpp │ │ │ ├── ConstraintFactory.h │ │ │ ├── ConstraintManager.cpp │ │ │ ├── ConstraintManager.h │ │ │ ├── ContactListener.cpp │ │ │ ├── ContactListener.h │ │ │ ├── Conversion.h │ │ │ ├── CookedShape.cpp │ │ │ ├── CookedShapeUtility.h │ │ │ ├── JobSystem.cpp │ │ │ ├── JobSystem.h │ │ │ ├── JoltPhysics.cpp │ │ │ ├── JoltPhysics.h │ │ │ ├── Layers.h │ │ │ ├── PhysicsSnapshot.cpp │ │ │ ├── ShapeFactory.cpp │ │ │ ├── ShapeFactory.h │ │ │ ├── SupportFunctions.cpp │ │ │ ├── VehicleAnimator.cpp │ │ │ ├── VehicleAnimator.h │ │ │ ├── VehicleManager.cpp │ │ │ └── VehicleManager.h │ ├── scene │ │ ├── CMakeLists.txt │ │ ├── NcSceneImpl.cpp │ │ └── NcSceneImpl.h │ ├── serialize │ │ ├── CMakeLists.txt │ │ ├── ComponentSerialization.cpp │ │ ├── ComponentSerialization.h │ │ ├── EntitySerializationUtility.cpp │ │ ├── EntitySerializationUtility.h │ │ └── SceneSerialization.cpp │ ├── service │ │ └── ServiceLocator.h │ ├── task │ │ ├── AsyncDispatcher.cpp │ │ ├── CMakeLists.txt │ │ ├── Executor.cpp │ │ └── Executor.h │ ├── time │ │ ├── CMakeLists.txt │ │ ├── StepTimer.h │ │ ├── TimeImpl.cpp │ │ └── TimeImpl.h │ ├── ui │ │ ├── CMakeLists.txt │ │ ├── ImGuiStyle.cpp │ │ ├── UIElement.cpp │ │ ├── UIPosition.cpp │ │ └── editor │ │ │ ├── CMakeLists.txt │ │ │ ├── ComponentWidgets.h │ │ │ ├── impl │ │ │ ├── CMakeLists.txt │ │ │ ├── ComponentWidgets.cpp │ │ │ ├── EditorCamera.cpp │ │ │ ├── EditorCamera.h │ │ │ ├── EditorImpl.cpp │ │ │ ├── EditorUI.cpp │ │ │ ├── EditorUI.h │ │ │ ├── SandboxScene.cpp │ │ │ ├── SandboxScene.h │ │ │ ├── assets │ │ │ │ ├── AssetWrapper.cpp │ │ │ │ ├── AssetWrapper.h │ │ │ │ └── CMakeLists.txt │ │ │ └── windows │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── EntityContextMenu.cpp │ │ │ │ ├── EntityContextMenu.h │ │ │ │ ├── FpsOverlay.h │ │ │ │ ├── Inspector.cpp │ │ │ │ ├── Inspector.h │ │ │ │ ├── SceneGraph.cpp │ │ │ │ ├── SceneGraph.h │ │ │ │ └── dialogs │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CreateEntityDialog.cpp │ │ │ │ ├── CreateEntityDialog.h │ │ │ │ ├── EnvironmentDialog.cpp │ │ │ │ ├── EnvironmentDialog.h │ │ │ │ ├── ModalDialog.cpp │ │ │ │ ├── ModalDialog.h │ │ │ │ ├── PostProcessDialog.cpp │ │ │ │ ├── PostProcessDialog.h │ │ │ │ ├── SceneDialogs.cpp │ │ │ │ └── SceneDialogs.h │ │ │ └── stub │ │ │ ├── CMakeLists.txt │ │ │ ├── ComponentWidgetsStub.cpp │ │ │ └── EditorStub.cpp │ ├── utility │ │ ├── CMakeLists.txt │ │ ├── FileLogger.cpp │ │ ├── Log.cpp │ │ ├── Memory.h │ │ └── StringMap.h │ └── window │ │ ├── CMakeLists.txt │ │ ├── NcWindowImpl.cpp │ │ └── NcWindowImpl.h ├── ncjolt │ ├── CMakeLists.txt │ ├── JoltApi.cpp │ ├── ShapeUtility.cpp │ └── ncjolt │ │ ├── Allocator.h │ │ ├── ByteArrayStream.h │ │ ├── JoltApi.h │ │ ├── Profiler.inl │ │ └── ShapeUtility.h ├── ncmath │ ├── CMakeLists.txt │ └── Quaternion.cpp └── ncutility │ ├── CMakeLists.txt │ └── Compression.cpp └── test ├── CMakeLists.txt ├── integration_test ├── CMakeLists.txt └── ncengine │ ├── CMakeLists.txt │ └── graphics2 │ ├── CMakeLists.txt │ ├── CubeMapBufferResource_tests.cpp │ ├── DiligentEngineFixture.inl │ ├── DiligentEngine_tests.cpp │ ├── DynamicUniformBuffer_tests.cpp │ ├── EnvironmentBufferResource_tests.cpp │ ├── MeshBuffer_tests.cpp │ ├── NcWindowStub.inl │ ├── PassManifest_tests.cpp │ ├── ShaderFactory_tests.cpp │ ├── StructuredBuffer_tests.cpp │ ├── TextureBufferResource_tests.cpp │ ├── UIBackend_tests.cpp │ └── collateral │ ├── test.frag │ └── test.spv ├── ncasset ├── CMakeLists.txt ├── GetAssetType_unit_tests.cpp └── Version_unit_tests.cpp ├── ncconvert ├── AssetSerialization_integration_tests.cpp ├── AudioConverter_unit_tests.cpp ├── BuildAndImport_integration_tests.cpp ├── CMakeLists.txt ├── EnumExtensions_unit_tests.cpp ├── GeometryAnalysis_tests.cpp ├── GeometryConverter_unit_tests.cpp ├── GeometryTestUtility.h ├── Image_unit_tests.cpp ├── NcConvert_integration_tests.cpp ├── TextureAnalysis_unit_tests.cpp ├── TextureConverter_unit_tests.cpp ├── TextureTestUtility.h └── collateral │ ├── CollateralAudio.h │ ├── CollateralCommon.h │ ├── CollateralGeometry.h │ ├── CollateralTexture.h │ ├── cube.fbx │ ├── cube_map_horizontal_array.png │ ├── cube_map_horizontal_cross.png │ ├── cube_map_vertical_array.png │ ├── cube_map_vertical_cross.png │ ├── five_bones_per_vertex.fbx │ ├── four_bone_four_vertex.fbx │ ├── four_bones_neq100.fbx │ ├── four_bones_one_bone_70_percent.fbx │ ├── manifest.json │ ├── manifest_mesh_not_present.json │ ├── multicube.fbx │ ├── plane.fbx │ ├── plane_and_cube.fbx │ ├── real_world_model.fbx │ ├── rgb_corners_4x8.bmp │ ├── rgb_corners_4x8.jpg │ ├── rgb_corners_4x8.png │ ├── simple_cube_animation.fbx │ ├── sine_c_e.wav │ └── single_bone_four_vertex.fbx ├── ncengine ├── AssetServiceStub.h ├── CMakeLists.txt ├── EcsFixture.inl ├── asset │ ├── AssetUtilities_tests.cpp │ ├── AudioClipAssetManager_tests.cpp │ ├── CMakeLists.txt │ ├── ConvexHullAssetManager_tests.cpp │ ├── CubeMapAssetManager_tests.cpp │ ├── FontAssetManager_tests.cpp │ ├── MeshAssetManager_tests.cpp │ ├── MeshColliderAssetManager_tests.cpp │ ├── NcAsset_tests.cpp │ ├── ShaderAssetManager_tests.cpp │ ├── SkeletalAnimationAssetManager_tests.cpp │ ├── TextureAssetManager_tests.cpp │ └── collateral │ │ ├── concave_collider1.fbx │ │ ├── concave_collider1.nca │ │ ├── concave_collider2.fbx │ │ ├── concave_collider2.nca │ │ ├── font.ttf │ │ ├── hull_collider1.fbx │ │ ├── hull_collider1.nca │ │ ├── hull_collider2.fbx │ │ ├── hull_collider2.nca │ │ ├── manifest.json │ │ ├── mesh1.fbx │ │ ├── mesh1.nca │ │ ├── mesh2.fbx │ │ ├── mesh2.nca │ │ ├── mesh3.fbx │ │ ├── mesh3.nca │ │ ├── shader1 │ │ ├── fragment.spv │ │ ├── shader.nca │ │ └── vertex.spv │ │ ├── shader2 │ │ ├── fragment.spv │ │ ├── shader.nca │ │ └── vertex.spv │ │ ├── skybox1.nca │ │ ├── skybox1.png │ │ ├── skybox2.nca │ │ ├── skybox2.png │ │ ├── skybox3.nca │ │ ├── skybox3.png │ │ ├── sound1.nca │ │ ├── sound1.wav │ │ ├── sound2.nca │ │ ├── sound2.wav │ │ ├── test_animation.fbx │ │ ├── test_animation.nca │ │ ├── test_animation_2.fbx │ │ ├── test_animation_2.nca │ │ ├── texture_base.nca │ │ ├── texture_base.png │ │ ├── texture_normal.nca │ │ ├── texture_normal.png │ │ ├── texture_roughness.nca │ │ └── texture_roughness.png ├── audio │ ├── AudioSource_tests.cpp │ └── CMakeLists.txt ├── config │ ├── CMakeLists.txt │ ├── Config_tests.cpp │ └── collateral │ │ └── config.ini ├── ecs │ ├── AccessPolicy_unit_tests.cpp │ ├── AnyComponent_unit_tests.cpp │ ├── CMakeLists.txt │ ├── ComponentPool_unit_tests.cpp │ ├── ComponentRegistry_unit_tests.cpp │ ├── EcsInterface_unit_tests.cpp │ ├── EntityPool_unit_tests.cpp │ ├── Entity_unit_tests.cpp │ ├── FreeComponentGroup_unit_tests.cpp │ ├── SparseSet_unit_tests.cpp │ └── Transform_unit_tests.cpp ├── graphics2 │ ├── AnimationStateOrchestrator_tests.cpp │ ├── BoneCache_tests.cpp │ ├── CMakeLists.txt │ ├── CameraSubsystem_tests.cpp │ ├── GraphicsUtility_tests.cpp │ ├── HostStructuredBuffer_tests.cpp │ ├── InstanceCache_tests.cpp │ ├── MaterialRegistry_tests.cpp │ ├── MeshSubsystem_tests.cpp │ ├── PostProcessSubsystem_tests.cpp │ ├── PostProcess_tests.cpp │ ├── SkeletalAnimationCalculator_tests.cpp │ ├── SkeletalAnimationController_tests.cpp │ ├── SkeletalAnimationStorage_tests.cpp │ └── TransformCache_tests.cpp ├── math │ ├── CMakeLists.txt │ └── Random_unit_tests.cpp ├── module │ ├── CMakeLists.txt │ └── ModuleRegistry_unit_tests.cpp ├── physics │ ├── CMakeLists.txt │ ├── CollisionQuery_integration_tests.cpp │ ├── Constraints_unit_tests.cpp │ ├── Contacts_unit_tests.cpp │ ├── PhysicsUtility_unit_tests.cpp │ ├── RigidBody_unit_tests.cpp │ ├── Shape_unit_tests.cpp │ ├── Vehicle_unit_tests.cpp │ └── jolt │ │ ├── BodyFactory_unit_tests.cpp │ │ ├── BodyManager_integration_tests.cpp │ │ ├── CMakeLists.txt │ │ ├── CollisionQueryUtility_unit_tests.cpp │ │ ├── CompoundShape_unit_tests.cpp │ │ ├── ConstraintFactory_unit_tests.cpp │ │ ├── ConstraintManager_unit_tests.cpp │ │ ├── ContactListener_integration_tests.cpp │ │ ├── ContactListener_stub.inl │ │ ├── CookedShape_unit_tests.cpp │ │ ├── JobSystem_stub.inl │ │ ├── JoltApiFixture.inl │ │ ├── JoltConversion_unit_tests.cpp │ │ ├── JoltPhysics_unit_tests.cpp │ │ ├── Layers_unit_tests.cpp │ │ ├── PhysicsSnapshot_unit_tests.cpp │ │ ├── ShapeFactory_unit_tests.cpp │ │ ├── SupportFunctions_unit_tests.cpp │ │ └── VehicleManager_unit_tests.cpp ├── scene │ ├── CMakeLists.txt │ └── NcScene_unit_tests.cpp ├── serialize │ ├── CMakeLists.txt │ ├── ComponentSerialization_integration_tests.cpp │ └── SceneSerialization_unit_tests.cpp ├── task │ ├── CMakeLists.txt │ ├── ExceptionContext_unit_tests.cpp │ ├── Executor_unit_tests.cpp │ └── TaskGraph_unit_tests.cpp ├── time │ ├── CMakeLists.txt │ └── StepTimer_unit_tests.cpp └── utility │ ├── CMakeLists.txt │ ├── Log_tests.cpp │ ├── Signal_unit_tests.cpp │ ├── SparseMap_unit_tests.cpp │ └── collateral │ └── word_list.txt ├── ncjolt ├── ByteArrayStream_unit_tests.cpp ├── CMakeLists.txt └── PhysicsAllocator_unit_tests.cpp ├── ncmath ├── CMakeLists.txt ├── Math_unit_test.cpp └── Vector_unit_test.cpp ├── ncutility ├── Algorithm_unit_test.cpp ├── BinarySerialization_unit_test.cpp ├── CMakeLists.txt ├── Compression_unit_test.cpp ├── ScopeExit_unit_test.cpp ├── StringHash_unit_test.cpp └── collateral │ └── word_list.txt └── smoke_test ├── run_smoke_test.sh ├── smoke_test_config.ini └── vk_layer_settings.txt /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ubuntu", 3 | "build": { 4 | "dockerfile": "ubuntu.dockerfile" 5 | }, 6 | "customizations": { 7 | "vscode": { 8 | "extensions": [ 9 | "ms-vscode.cpptools-extension-pack", 10 | "twxs.cmake" 11 | ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #standard stuff 2 | *.obj 3 | *.o 4 | *.pch 5 | *.dll 6 | *.a 7 | *.lib 8 | *.pdb 9 | *.so 10 | *.exe 11 | *.out 12 | *.log 13 | *.DS_store 14 | 15 | #directories 16 | .vs/ 17 | .vscode/ 18 | .idea/ 19 | build/ 20 | install/ 21 | scratch/ 22 | 23 | #debug shaders 24 | resources/shaders/compiled/debug/ 25 | 26 | #gprof analysis 27 | analysis.txt 28 | 29 | #imgui state file 30 | imgui.ini 31 | 32 | #external libs 33 | !nc/lib/libOptickCore.dll 34 | !nc/lib/libOptickCore.dll.a 35 | /.clang-format 36 | /Folder.DotSettings.user 37 | /.editorconfig 38 | /CMakeSettings.json 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/.gitmodules -------------------------------------------------------------------------------- /cmake/AddImguiTarget.cmake: -------------------------------------------------------------------------------- 1 | add_library(imgui STATIC 2 | ${imgui_SOURCE_DIR}/imgui.cpp 3 | ${imgui_SOURCE_DIR}/imgui_draw.cpp 4 | ${imgui_SOURCE_DIR}/imgui_tables.cpp 5 | ${imgui_SOURCE_DIR}/imgui_widgets.cpp 6 | ${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp 7 | ${imgui_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp # only needed for old gfx impl 8 | ) 9 | 10 | if(WIN32) 11 | target_sources(imgui 12 | PRIVATE 13 | ${imgui_SOURCE_DIR}/backends/imgui_impl_win32.cpp 14 | ) 15 | endif() 16 | 17 | target_compile_definitions(imgui 18 | PUBLIC 19 | WIN32_LEAN_AND_MEAN 20 | ) 21 | 22 | target_include_directories(imgui 23 | PUBLIC 24 | "${imgui_SOURCE_DIR}" 25 | ) 26 | 27 | target_link_libraries(imgui 28 | PRIVATE 29 | Vulkan::Vulkan 30 | glfw 31 | ) 32 | -------------------------------------------------------------------------------- /cmake/NcEngineConfig.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | find_dependency(Vulkan REQUIRED) 3 | include("${CMAKE_CURRENT_LIST_DIR}/NcEngineTargets.cmake") -------------------------------------------------------------------------------- /cmake/Version.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NC_PROJECT_VERSION "@PROJECT_VERSION@" 4 | #define NC_PROJECT_VERSION_MAJOR "@PROJECT_VERSION_MAJOR@" 5 | #define NC_PROJECT_VERISION_MINOR "@PROJECT_VERSION_MINOR@" 6 | #define NC_PROJECT_VERSION_PATCH "@PROJECT_VERSION_PATCH@" -------------------------------------------------------------------------------- /docs/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/docs/Logo.png -------------------------------------------------------------------------------- /docs/animation_export_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/docs/animation_export_screenshot.png -------------------------------------------------------------------------------- /docs/demo_scene.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/docs/demo_scene.gif -------------------------------------------------------------------------------- /include/ncasset/AssetsFwd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file AssetsFwd.h 3 | * @copyright Jaremie Romer and McCallister Romer 2025 4 | */ 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace nc::asset 10 | { 11 | struct AudioClip; 12 | struct BonesData; 13 | struct ConvexHull; 14 | struct CubeMap; 15 | struct Mesh; 16 | struct MeshCollider; 17 | struct MeshVertex; 18 | struct SkeletalAnimation; 19 | struct Texture; 20 | struct TextureSubResource; 21 | 22 | enum class AssetType : int; 23 | enum class TextureFormat : uint8_t; 24 | } // namespace nc::asset 25 | -------------------------------------------------------------------------------- /include/ncengine/Events.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Events.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "ncengine/type/StableAddress.h" 8 | #include "ncengine/utility/Signal.h" 9 | 10 | namespace nc 11 | { 12 | /** @brief Signals for internal engine events. */ 13 | struct SystemEvents : public StableAddress 14 | { 15 | /** 16 | * @brief Notify NcEngine to quit after completion of the current frame. 17 | * @note NcEngine subscribes to this event with SignalPriority::Lowest. Subscribing 18 | * with a higher priority allows being notified of the event prior to any state 19 | * being cleared. 20 | */ 21 | Signal<> quit; 22 | 23 | /** 24 | * @brief Event fired when static Entity data is made stale. 25 | * @note This operation may be expensive and is intended for editor and debug purposes. 26 | */ 27 | Signal<> rebuildStatics; 28 | }; 29 | } // namespace nc 30 | -------------------------------------------------------------------------------- /include/ncengine/config/Version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NC_PROJECT_VERSION "0.1.0" 4 | #define NC_PROJECT_VERSION_MAJOR "0" 5 | #define NC_PROJECT_VERISION_MINOR "1" 6 | #define NC_PROJECT_VERSION_PATCH "0" 7 | -------------------------------------------------------------------------------- /include/ncengine/debug/DebugRendering.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NC_DEBUG_RENDERING_INCLUDE_TOKEN 4 | 5 | namespace nc::debug 6 | { 7 | enum class WireframeType 8 | { 9 | Cube, 10 | Plane, 11 | Sphere, 12 | Count 13 | }; 14 | } // namespace nc::debug 15 | 16 | #ifdef NC_DEBUG_RENDERING_ENABLED 17 | #include "ncengine/debug/detail/DebugRenderer.h" 18 | #define NC_DEBUG_DRAW_WIREFRAME(type, matrix) nc::debug::DebugRendererAddWireframe(type, matrix); 19 | #else 20 | #define NC_DEBUG_DRAW_WIREFRAME(type, matrix); 21 | #endif 22 | 23 | #undef NC_DEBUG_RENDERING_INCLUDE_TOKEN 24 | -------------------------------------------------------------------------------- /include/ncengine/debug/Serialize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncmath/Vector.h" 4 | #include "DirectXMath.h" 5 | 6 | #include 7 | 8 | namespace nc 9 | { 10 | std::ostream& operator << (std::ostream& os, const Vector2& v); 11 | std::ostream& operator << (std::ostream& os, const Vector3& v); 12 | std::ostream& operator << (std::ostream& os, const Vector4& v); 13 | std::ostream& operator << (std::ostream& os, DirectX::FXMMATRIX matrix); 14 | std::ostream& operator << (std::ostream& os, DirectX::XMVECTOR vector); 15 | } // namespace nc -------------------------------------------------------------------------------- /include/ncengine/debug/detail/DebugRenderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef NC_DEBUG_RENDERING_INCLUDE_TOKEN 4 | #error __FILE__ should not be directly included. Use DebugRendering.h instead. 5 | #endif 6 | 7 | #include "ncengine/ecs/Ecs.h" 8 | #include "ncengine/graphics/WireframeRenderer.h" 9 | 10 | #include 11 | 12 | namespace nc::debug 13 | { 14 | void DebugRendererInitialize(ecs::BasicEcs gameState); 15 | void DebugRendererNewFrame(); 16 | void DebugRendererAddWireframe(WireframeType type, DirectX::FXMMATRIX matrix); 17 | } // namespace nc::debug 18 | -------------------------------------------------------------------------------- /include/ncengine/ecs/EcsFwd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EcsFwd.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "ncengine/ecs/EcsFilter.h" 8 | 9 | namespace nc::ecs 10 | { 11 | template 12 | class EcsInterface; 13 | 14 | using Ecs = EcsInterface; 15 | 16 | template 17 | using BasicEcs = EcsInterface; 18 | 19 | template 20 | using ExplicitEcs = EcsInterface; 21 | } // namespace nc::ecs 22 | -------------------------------------------------------------------------------- /include/ncengine/ecs/Hierarchy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Hierarchy.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "ncengine/ecs/Entity.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace nc 13 | { 14 | /** 15 | * @brief Component managing an Entity's scene graph relationships. 16 | * @note Ecs::SetParent() offers a simpler method for updating Hierarchies compared to direct component modification. 17 | * 18 | * A Hierarchy component is automatically attached to an Entity on creation, with its initial parent value taken from 19 | * the EntityInfo struct. Root Entities have their parent set to Entity::Null(). A Hierarchy may be directly modified, 20 | * but care must be taken to ensure related Hierarchy objects are updated accordingly. Ecs::SetParent() automatically 21 | * handles this and should be preferred over direct modifications. 22 | */ 23 | struct Hierarchy 24 | { 25 | Entity parent; 26 | std::vector children; 27 | }; 28 | } // namespace nc 29 | -------------------------------------------------------------------------------- /include/ncengine/ecs/InvokeFreeComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/FrameLogic.h" 4 | 5 | namespace nc 6 | { 7 | /** Helper for invoking a FreeComponent's Run method from one of the logic components. */ 8 | template T> 9 | struct InvokeFreeComponent 10 | { 11 | /** The default constructor expects the component to be added externally. */ 12 | InvokeFreeComponent() = default; 13 | 14 | /** The user-defined constructor attaches an instance of the component to be invoked. */ 15 | template 16 | InvokeFreeComponent(Entity self, ecs::Ecs world, Args&&... args) 17 | { 18 | world.Emplace(self, std::forward(args)...); 19 | } 20 | 21 | /** FrameLogic call operator */ 22 | void operator()(Entity self, ecs::Ecs world, float dt) const 23 | { 24 | if(world.Contains(self)) 25 | world.Get(self).Run(self, world, dt); 26 | } 27 | }; 28 | } // namespace nc 29 | -------------------------------------------------------------------------------- /include/ncengine/ecs/Tag.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Tag.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "Component.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace nc 13 | { 14 | /** 15 | * @brief Component with a string tag. 16 | * 17 | * @note Tags are automatically added and removed with their parent 18 | * Entity. They do not need to be explicity created. 19 | * 20 | * A Tag's initial value can be set in EntityInfo when adding an Entity. 21 | */ 22 | struct Tag 23 | { 24 | std::string value; 25 | }; 26 | } // namespace nc 27 | -------------------------------------------------------------------------------- /include/ncengine/physics/PhysicsUtility.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PhysicsUtility.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "ncengine/physics/RigidBody.h" 8 | #include "ncengine/physics/Shape.h" 9 | 10 | #include 11 | #include 12 | 13 | namespace nc 14 | { 15 | auto ToString(BodyType type) -> std::string_view; 16 | auto ToBodyType(std::string_view bodyType) -> BodyType; 17 | auto GetBodyTypeNames() -> std::span; 18 | 19 | auto ToString(ShapeType type) -> std::string_view; 20 | auto ToShapeType(std::string_view shapeType) -> ShapeType; 21 | auto GetShapeTypeNames() -> std::span; 22 | 23 | auto ToString(ConstraintType type) -> std::string_view; 24 | auto ToConstraintType(std::string_view constraintType) -> ConstraintType; 25 | auto GetConstraintTypeNames() -> std::span; 26 | } // namespace nc 27 | -------------------------------------------------------------------------------- /include/ncengine/task/TaskFwd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file TaskFwd.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace nc::task 10 | { 11 | template 12 | class TaskGraph; 13 | 14 | class AsyncDispatcher; 15 | struct UpdatePhase; 16 | struct RenderPhase; 17 | using UpdateTasks = TaskGraph; 18 | using RenderTasks = TaskGraph; 19 | } // namespace nc::task 20 | -------------------------------------------------------------------------------- /include/ncengine/time/Time.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nc::time 4 | { 5 | /** @brief The number of seconds between the previous frame and the current one. */ 6 | auto DeltaTime() noexcept -> float; 7 | } -------------------------------------------------------------------------------- /include/ncengine/type/StableAddress.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nc 4 | { 5 | /** @brief Base class for non-copyable non-movable types. */ 6 | class StableAddress 7 | { 8 | public: 9 | StableAddress() noexcept = default; 10 | StableAddress(const StableAddress&) = delete; 11 | StableAddress(StableAddress&&) = delete; 12 | StableAddress& operator=(const StableAddress&) = delete; 13 | StableAddress& operator=(StableAddress&&) = delete; 14 | 15 | protected: 16 | ~StableAddress() noexcept = default; 17 | }; 18 | } // namespace nc 19 | -------------------------------------------------------------------------------- /include/ncengine/ui/IUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "UIElement.h" 4 | 5 | namespace nc::ui 6 | { 7 | /** @note For internal use only. Derived classes should 8 | * inherit from UIFlexible or UIFixed. */ 9 | class IUI 10 | { 11 | public: 12 | virtual ~IUI() = default; 13 | virtual void Draw() = 0; 14 | virtual bool IsHovered() = 0; 15 | }; 16 | 17 | class UIFlexible : public IUI, public UIElement 18 | { 19 | public: 20 | UIFlexible() 21 | : UIElement(true) 22 | { 23 | } 24 | }; 25 | 26 | class UIFixed : public IUI, public UIFixedElement 27 | { 28 | public: 29 | UIFixed(UIPosition position, Vector2 dimensions) 30 | : UIFixedElement(true, position, dimensions) 31 | { 32 | } 33 | }; 34 | } -------------------------------------------------------------------------------- /include/ncengine/ui/UIPosition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncmath/Vector.h" 4 | 5 | namespace nc::ui 6 | { 7 | enum class UIPosition 8 | { 9 | TopLeft, 10 | TopCenter, 11 | TopRight, 12 | LeftCenter, 13 | Center, 14 | RightCenter, 15 | BottomLeft, 16 | BottomCenter, 17 | BottomRight 18 | }; 19 | 20 | namespace utils 21 | { 22 | Vector2 GetTopLeftCoords(UIPosition position, const Vector2& screenDimensions, const Vector2& elementDimensions); 23 | } 24 | } -------------------------------------------------------------------------------- /include/ncengine/window/IOnResizeReceiver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncmath/Vector.h" 4 | 5 | namespace nc::window 6 | { 7 | class IOnResizeReceiver 8 | { 9 | public: 10 | virtual void OnResize(Vector2 dimensions) = 0; 11 | 12 | protected: 13 | ~IOnResizeReceiver() = default; 14 | }; 15 | } -------------------------------------------------------------------------------- /include/ncmath/Geometry.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Geometry.h 3 | * @copyright Jaremie Romer and McCallister Romer 2024 4 | */ 5 | #pragma once 6 | 7 | #include "Vector.h" 8 | 9 | #include 10 | 11 | namespace nc 12 | { 13 | struct Sphere 14 | { 15 | Vector3 center; 16 | float radius; 17 | }; 18 | 19 | struct Box 20 | { 21 | Vector3 center; 22 | Vector3 extents; 23 | float maxExtent; 24 | }; 25 | 26 | struct Capsule 27 | { 28 | Vector3 pointA, pointB; 29 | float radius; 30 | float maxExtent; 31 | }; 32 | 33 | struct ConvexHull 34 | { 35 | std::span vertices; 36 | Vector3 extents; 37 | float maxExtent; 38 | }; 39 | 40 | struct Triangle 41 | { 42 | Vector3 a, b, c; 43 | }; 44 | 45 | struct Plane 46 | { 47 | Vector3 normal; 48 | float d; 49 | }; 50 | 51 | struct Frustum 52 | { 53 | Plane left; 54 | Plane right; 55 | Plane bottom; 56 | Plane top; 57 | Plane front; 58 | Plane back; 59 | }; 60 | } // namespace nc 61 | -------------------------------------------------------------------------------- /include/ncutility/Algorithm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "detail/EnumerateDetail.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace nc::algo 10 | { 11 | /** @brief Wrapper around std::transform that returns transformed data in a new vector. */ 12 | template UnaryOperation> 13 | auto Transform(const std::vector& container, UnaryOperation op) 14 | { 15 | using transformed_t = std::remove_cvref_t>; 16 | auto out = std::vector{}; 17 | out.reserve(container.size()); 18 | std::transform(std::cbegin(container), std::cend(container), std::back_inserter(out), op); 19 | return out; 20 | } 21 | 22 | /** @brief Implementation of std::enumerate. Obtain a view of [index, value] pairs from a range. */ 23 | inline detail::enumerate_view_fn Enumerate; 24 | } // namespace nc::algo 25 | -------------------------------------------------------------------------------- /include/ncutility/platform/win32/HInstanceForwardDecl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _WINDEF_ 4 | class HINSTANCE__; 5 | typedef HINSTANCE__* HINSTANCE; 6 | #endif -------------------------------------------------------------------------------- /include/ncutility/platform/win32/HWNDForwardDecl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _WINDEF_ 4 | class HWND__; 5 | typedef HWND__* HWND; 6 | #endif -------------------------------------------------------------------------------- /include/ncutility/platform/win32/NcWin32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "NcWin32Filter.h" 3 | #include -------------------------------------------------------------------------------- /include/ncutility/platform/win32/NcWinDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "NcWin32Filter.h" 3 | #include -------------------------------------------------------------------------------- /resources/nca/audio_clip/default/silence.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/audio_clip/default/silence.nca -------------------------------------------------------------------------------- /resources/nca/convex_hull/default/cube.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/convex_hull/default/cube.nca -------------------------------------------------------------------------------- /resources/nca/cube_map/default/skybox.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/cube_map/default/skybox.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/capsule.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/capsule.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/cube.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/cube.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/plane.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/plane.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/skybox.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/skybox.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/sphere.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/sphere.nca -------------------------------------------------------------------------------- /resources/nca/mesh/default/wheel.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh/default/wheel.nca -------------------------------------------------------------------------------- /resources/nca/mesh_collider/default/plane.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/mesh_collider/default/plane.nca -------------------------------------------------------------------------------- /resources/nca/skeletal_animation/default/cube.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/skeletal_animation/default/cube.nca -------------------------------------------------------------------------------- /resources/nca/texture/default/color.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/texture/default/color.nca -------------------------------------------------------------------------------- /resources/nca/texture/default/normal.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/texture/default/normal.nca -------------------------------------------------------------------------------- /resources/nca/texture/default/particle.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/nca/texture/default/particle.nca -------------------------------------------------------------------------------- /resources/raw/image/DefaultBaseColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/image/DefaultBaseColor.png -------------------------------------------------------------------------------- /resources/raw/image/DefaultNormal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/image/DefaultNormal.png -------------------------------------------------------------------------------- /resources/raw/image/DefaultParticle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/image/DefaultParticle.png -------------------------------------------------------------------------------- /resources/raw/image/DefaultSkybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/image/DefaultSkybox.png -------------------------------------------------------------------------------- /resources/raw/model/DefaultCapsule.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultCapsule.fbx -------------------------------------------------------------------------------- /resources/raw/model/DefaultCube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultCube.fbx -------------------------------------------------------------------------------- /resources/raw/model/DefaultPlane.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultPlane.fbx -------------------------------------------------------------------------------- /resources/raw/model/DefaultSkybox.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultSkybox.fbx -------------------------------------------------------------------------------- /resources/raw/model/DefaultSphere.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultSphere.fbx -------------------------------------------------------------------------------- /resources/raw/model/DefaultWheel.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/model/DefaultWheel.fbx -------------------------------------------------------------------------------- /resources/raw/skeletal_animation/DefaultCube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/skeletal_animation/DefaultCube.fbx -------------------------------------------------------------------------------- /resources/raw/sound/DefaultAudioClip.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/raw/sound/DefaultAudioClip.wav -------------------------------------------------------------------------------- /resources/shaders/compiled/NormalsPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/NormalsPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PPEndPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PPEndPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PPFxaaPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PPFxaaPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PPNoisePixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PPNoisePixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PPOutlinePixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PPOutlinePixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/ParticlePixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/ParticlePixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/ParticleVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/ParticleVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PointShadowMapPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PointShadowMapPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PointShadowMapSkinnedVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PointShadowMapSkinnedVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PointShadowMapVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PointShadowMapVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/PostProcessVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/PostProcessVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/SkyboxPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/SkyboxPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/SkyboxVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/SkyboxVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/ToonPixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/ToonPixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/ToonSkinnedVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/ToonSkinnedVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/ToonVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/ToonVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/UniShadowMapSkinnedVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/UniShadowMapSkinnedVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/UniShadowMapVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/UniShadowMapVertex.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/WireframePixel.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/WireframePixel.spv -------------------------------------------------------------------------------- /resources/shaders/compiled/WireframeVertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/resources/shaders/compiled/WireframeVertex.spv -------------------------------------------------------------------------------- /resources/shaders/source/PPEnd.psh: -------------------------------------------------------------------------------- 1 | #include "core/PerPassTypes.fxh" 2 | 3 | struct PSInput 4 | { 5 | float4 Pos : SV_POSITION; 6 | float2 UV : TEX_COORD; 7 | }; 8 | 9 | struct PSOutput 10 | { 11 | float4 Color : SV_TARGET; 12 | }; 13 | 14 | Texture2D ColorSinks[]; 15 | Texture2D DepthSinks[]; 16 | Texture2D PostProcessSinks[]; 17 | SamplerState ColorSinks_sampler; // By convention, texture samplers must use the '_sampler' suffix 18 | 19 | void main(in PSInput PSIn, out PSOutput PSOut) 20 | { 21 | if (hasPostProcess == 1) 22 | { 23 | PSOut.Color = PostProcessSinks[0].Sample(ColorSinks_sampler, PSIn.UV); 24 | } 25 | else 26 | { 27 | PSOut.Color = ColorSinks[colorRT1].Sample(ColorSinks_sampler, PSIn.UV); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /resources/shaders/source/Particle.psh: -------------------------------------------------------------------------------- 1 | struct PSInput 2 | { 3 | float4 Pos : SV_POSITION; 4 | float2 UV : TEX_COORD; 5 | uint TextureIndex; 6 | }; 7 | 8 | struct PSOutput 9 | { 10 | float4 Color : SV_TARGET; 11 | }; 12 | 13 | Texture2D Textures[]; 14 | SamplerState Textures_sampler; 15 | 16 | void main(in PSInput PSIn, out PSOutput PSOut) 17 | { 18 | PSOut.Color = Textures[PSIn.TextureIndex].Sample(Textures_sampler, PSIn.UV); 19 | } 20 | -------------------------------------------------------------------------------- /resources/shaders/source/Particle.vsh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | 3 | struct VSInput 4 | { 5 | float3 Pos : ATTRIB0; 6 | float2 UV : ATTRIB1; 7 | }; 8 | 9 | struct PSOutput 10 | { 11 | float4 Pos : SV_POSITION; 12 | float2 UV : TEX_COORD; 13 | uint TextureIndex; 14 | }; 15 | 16 | StructuredBuffer Particles; 17 | 18 | void main(in VSInput VSIn, uint InstanceID : SV_InstanceID, out PSOutput PSOut) 19 | { 20 | ParticleData particle = Particles[InstanceID]; 21 | float4 TransformedPos = mul(float4(VSIn.Pos, 1.0), particle.model); 22 | PSOut.Pos = mul(TransformedPos, cameraViewProjection); 23 | PSOut.UV = VSIn.UV; 24 | PSOut.TextureIndex = particle.textureIndex; 25 | } 26 | -------------------------------------------------------------------------------- /resources/shaders/source/PointShadowMap.psh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | #include "core/PerPassTypes.fxh" 3 | #include "core/Lighting.fxh" 4 | 5 | struct PSInput 6 | { 7 | float4 Pos : SV_POSITION; 8 | float4 WorldPos; 9 | }; 10 | 11 | struct PSOutput 12 | { 13 | float4 Color : SV_TARGET; 14 | }; 15 | 16 | StructuredBuffer Transforms; 17 | StructuredBuffer StaticInstances; 18 | 19 | void main(in PSInput PSIn, out PSOutput PSOut) 20 | { 21 | float3 lightVec = PSIn.WorldPos.xyz - Lights[lightIndex].position; 22 | PSOut.Color = length(lightVec) / 150.0f; 23 | } 24 | -------------------------------------------------------------------------------- /resources/shaders/source/PointShadowMap.vsh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | #include "core/PerPassTypes.fxh" 3 | #include "core/Lighting.fxh" 4 | 5 | struct VSInput 6 | { 7 | float3 Pos : ATTRIB0; 8 | }; 9 | 10 | struct PSInput 11 | { 12 | float4 Pos : SV_POSITION; 13 | float4 WorldPos; 14 | }; 15 | 16 | StructuredBuffer Transforms; 17 | StructuredBuffer StaticInstances; 18 | 19 | void main(in VSInput VSIn, uint InstanceID : SV_InstanceID, out PSInput PSIn) 20 | { 21 | uint transformIndex = StaticInstances[InstanceID].transformIndex; 22 | float4 TransformedPos = mul(float4(VSIn.Pos, 1.0), Transforms[transformIndex].model); 23 | PSIn.WorldPos = TransformedPos; 24 | 25 | LightData light = Lights[lightIndex]; 26 | PSIn.Pos = mul(TransformedPos, LightMatrices[light.lightMatrixIndex + lightFaceIndex].viewProjection); 27 | } 28 | -------------------------------------------------------------------------------- /resources/shaders/source/PostProcess.vsh: -------------------------------------------------------------------------------- 1 | struct VSInput 2 | { 3 | uint VertexID : SV_VertexID; 4 | }; 5 | 6 | struct PSInput 7 | { 8 | float4 Pos : SV_POSITION; 9 | float2 UV : TEX_COORD; 10 | }; 11 | 12 | void main(in VSInput VSIn, 13 | out PSInput PSIn) 14 | { 15 | float4 Pos[4]; 16 | Pos[0] = float4(-1.0, -1.0, 0.0, 1.0); 17 | Pos[1] = float4(-1.0, +1.0, 0.0, 1.0); 18 | Pos[2] = float4(+1.0, -1.0, 0.0, 1.0); 19 | Pos[3] = float4(+1.0, +1.0, 0.0, 1.0); 20 | 21 | float2 UV[4]; 22 | UV[0] = float2(+0.0, +1.0); 23 | UV[1] = float2(+0.0, +0.0); 24 | UV[2] = float2(+1.0, +1.0); 25 | UV[3] = float2(+1.0, +0.0); 26 | 27 | PSIn.Pos = Pos[VSIn.VertexID]; 28 | PSIn.UV = UV[VSIn.VertexID]; 29 | } 30 | -------------------------------------------------------------------------------- /resources/shaders/source/Skybox.psh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | 3 | TextureCube Skyboxes[]; 4 | SamplerState Textures_sampler; // By convention, texture samplers must use the '_sampler' suffix 5 | 6 | struct PSInput 7 | { 8 | float4 Pos : SV_POSITION; 9 | float3 UVW; 10 | }; 11 | 12 | struct PSOutput 13 | { 14 | float4 Color : SV_TARGET; 15 | }; 16 | 17 | void main(in PSInput PSIn, out PSOutput PSOut) 18 | { 19 | if (useSkybox == 1) 20 | { 21 | TextureCube skyboxTex = Skyboxes[skyboxIndex]; 22 | PSOut.Color = skyboxTex.Sample(Textures_sampler, PSIn.UVW); 23 | } 24 | else 25 | { 26 | PSOut.Color = float4(0.0f, 0.0f, 1.0f, 1.0f); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/shaders/source/Skybox.vsh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | 3 | struct VSInput 4 | { 5 | float3 Pos : ATTRIB0; 6 | }; 7 | 8 | struct PSInput 9 | { 10 | float4 Pos : SV_POSITION; 11 | float3 UVW; 12 | }; 13 | 14 | static float4x4 localModelMatrix = float4x4( 15 | 100.0f, 0.0f, 0.0f, 0.0f, 16 | 0.0f, 100.0f, 0.0f, 0.0f, 17 | 0.0f, 0.0f, 100.0f, 0.0f, 18 | 0.0f, 0.0f, 0.0f, 1.0f 19 | ); 20 | 21 | void main(in VSInput VSIn, uint InstanceID : SV_InstanceID, out PSInput PSIn) 22 | { 23 | float4 TransformedPos = mul(float4(VSIn.Pos, 1.0), localModelMatrix); 24 | TransformedPos += float4(cameraPosition, 0.0); 25 | PSIn.Pos = mul(TransformedPos, cameraViewProjection); 26 | PSIn.Pos.z = PSIn.Pos.w; // Set z (depth) to equal w so depth becomes 1.0 when doing perspective divide (z/w). (Maximum possible depth) 27 | PSIn.UVW = VSIn.Pos; 28 | } 29 | -------------------------------------------------------------------------------- /resources/shaders/source/UniShadowMap.vsh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | #include "core/PerPassTypes.fxh" 3 | #include "core/Lighting.fxh" 4 | 5 | struct VSInput 6 | { 7 | float3 Pos : ATTRIB0; 8 | }; 9 | 10 | struct PSInput 11 | { 12 | float4 Pos : SV_POSITION; 13 | }; 14 | 15 | StructuredBuffer Transforms; 16 | StructuredBuffer StaticInstances; 17 | 18 | void main(in VSInput VSIn, uint InstanceID : SV_InstanceID, out PSInput PSIn) 19 | { 20 | uint transformIndex = StaticInstances[InstanceID].transformIndex; 21 | float4 TransformedPos = mul(float4(VSIn.Pos, 1.0), Transforms[transformIndex].model); 22 | LightData light = Lights[lightIndex]; 23 | PSIn.Pos = mul(TransformedPos, LightMatrices[light.lightMatrixIndex].viewProjection); 24 | } 25 | -------------------------------------------------------------------------------- /resources/shaders/source/Wireframe.psh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | 3 | struct PSInput 4 | { 5 | float4 Pos : SV_POSITION; 6 | }; 7 | 8 | struct PSOutput 9 | { 10 | float4 Color : SV_TARGET; 11 | }; 12 | 13 | void main(in PSInput PSIn, out PSOutput PSOut) 14 | { 15 | PSOut.Color = wireframeColor; 16 | } 17 | -------------------------------------------------------------------------------- /resources/shaders/source/Wireframe.vsh: -------------------------------------------------------------------------------- 1 | #include "core/PerFrameTypes.fxh" 2 | 3 | struct VSInput 4 | { 5 | float3 Pos : ATTRIB0; 6 | }; 7 | 8 | struct PSInput 9 | { 10 | float4 Pos : SV_POSITION; 11 | }; 12 | 13 | void main(in VSInput VSIn, uint InstanceID : SV_InstanceID, out PSInput PSIn) 14 | { 15 | float4 transformedPos = mul(float4(VSIn.Pos, 1.0), wireframeModelMatrix); 16 | PSIn.Pos = mul(transformedPos, cameraViewProjection); 17 | } 18 | -------------------------------------------------------------------------------- /resources/shaders/source/core/Animation.fxh: -------------------------------------------------------------------------------- 1 | bool IsValidBoneIndex(uint boneIndex) 2 | { 3 | return boneIndex != 4294967295; 4 | } 5 | 6 | bool IsValidAnimationTransform(float4x4 mat) 7 | { 8 | // Check for zero matrix, ignoring homogenous coord 9 | return all(mat[0] != 0.0) || 10 | all(mat[1] != 0.0) || 11 | all(mat[2] != 0.0) || 12 | mat[3].xyz != float3(0.0, 0.0, 0.0); 13 | } 14 | 15 | float4x4 CombineBoneMatrices(uint base, uint4 boneOffsets, float4 boneWeights) 16 | { 17 | float4x4 boneTransform = float4x4(0.0); 18 | for (int i = 0; i < 4; i++) 19 | { 20 | if (boneWeights[i] > 0.0f) 21 | { 22 | boneTransform += Bones[base + boneOffsets[i]].animatedBoneMatrix * boneWeights[i]; 23 | } 24 | } 25 | 26 | return boneTransform; 27 | } 28 | -------------------------------------------------------------------------------- /resources/shaders/source/core/PerPassTypes.fxh: -------------------------------------------------------------------------------- 1 | cbuffer SinkIndices 2 | { 3 | int colorRT1; 4 | int colorRT2; 5 | int colorRT3; 6 | int colorRT4; 7 | int depthRT1; 8 | int depthRT2; 9 | int depthRT3; 10 | uint hasPostProcess; 11 | uint lightIndex; 12 | uint lightFaceIndex; 13 | }; 14 | -------------------------------------------------------------------------------- /sample/assets/font/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/font/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /sample/assets/nca/audio_clip/drums.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/audio_clip/drums.nca -------------------------------------------------------------------------------- /sample/assets/nca/audio_clip/hit.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/audio_clip/hit.nca -------------------------------------------------------------------------------- /sample/assets/nca/convex_hull/ramp.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/convex_hull/ramp.nca -------------------------------------------------------------------------------- /sample/assets/nca/cube_map/night_sky.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/cube_map/night_sky.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/cave.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/cave.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/guy2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/guy2.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/halfpipe.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/halfpipe.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/ogre.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/ogre.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/ramp.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/ramp.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh/skeleton.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh/skeleton.nca -------------------------------------------------------------------------------- /sample/assets/nca/mesh_collider/halfpipe.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/mesh_collider/halfpipe.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/ogre/attack.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/ogre/attack.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/ogre/idle.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/ogre/idle.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/idle.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/idle.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/jump.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/jump.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/walk_back.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/walk_back.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/walk_forward.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/walk_forward.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/walk_left.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/walk_left.nca -------------------------------------------------------------------------------- /sample/assets/nca/skeletal_animation/skeleton/walk_right.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/skeletal_animation/skeleton/walk_right.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/blue.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/blue.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/cave.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/cave.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/green.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/green.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/guy.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/guy.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/ogre.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/ogre.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/orange.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/orange.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/purple.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/purple.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/red.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/red.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/skeleton.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/skeleton.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/teal.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/teal.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/diffuse/yellow.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/diffuse/yellow.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/effect/linear_hatch.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/effect/linear_hatch.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/effect/noise.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/effect/noise.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/normal/cave.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/normal/cave.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/normal/guy.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/normal/guy.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/normal/ogre.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/normal/ogre.nca -------------------------------------------------------------------------------- /sample/assets/nca/texture/normal/skeleton.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/nca/texture/normal/skeleton.nca -------------------------------------------------------------------------------- /sample/assets/raw/audio/drums.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/audio/drums.wav -------------------------------------------------------------------------------- /sample/assets/raw/audio/hit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/audio/hit.wav -------------------------------------------------------------------------------- /sample/assets/raw/image/cube_maps/night_sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/cube_maps/night_sky.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/blue.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/cave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/cave.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/green.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/guy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/guy.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/ogre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/ogre.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/orange.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/purple.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/red.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/skeleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/skeleton.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/teal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/teal.png -------------------------------------------------------------------------------- /sample/assets/raw/image/diffuse/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/diffuse/yellow.png -------------------------------------------------------------------------------- /sample/assets/raw/image/effect/linear_hatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/effect/linear_hatch.png -------------------------------------------------------------------------------- /sample/assets/raw/image/effect/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/effect/noise.png -------------------------------------------------------------------------------- /sample/assets/raw/image/normal/cave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/normal/cave.png -------------------------------------------------------------------------------- /sample/assets/raw/image/normal/guy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/normal/guy.png -------------------------------------------------------------------------------- /sample/assets/raw/image/normal/ogre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/normal/ogre.png -------------------------------------------------------------------------------- /sample/assets/raw/image/normal/skeleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/image/normal/skeleton.png -------------------------------------------------------------------------------- /sample/assets/raw/model/cave.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/cave.fbx -------------------------------------------------------------------------------- /sample/assets/raw/model/guy2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/guy2.fbx -------------------------------------------------------------------------------- /sample/assets/raw/model/halfpipe.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/halfpipe.fbx -------------------------------------------------------------------------------- /sample/assets/raw/model/ogre.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/ogre.fbx -------------------------------------------------------------------------------- /sample/assets/raw/model/ramp.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/ramp.fbx -------------------------------------------------------------------------------- /sample/assets/raw/model/skeleton.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/model/skeleton.fbx -------------------------------------------------------------------------------- /sample/assets/raw/skeletal_animation/ogre.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/skeletal_animation/ogre.fbx -------------------------------------------------------------------------------- /sample/assets/raw/skeletal_animation/skeleton.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/sample/assets/raw/skeletal_animation/skeleton.fbx -------------------------------------------------------------------------------- /sample/source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_SAMPLE_EXE} 2 | PRIVATE 3 | SampleMain.cpp 4 | ) 5 | 6 | add_subdirectory(scenes) 7 | add_subdirectory(shared) -------------------------------------------------------------------------------- /sample/source/scenes/Benchmarks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shared/SampleUI.h" 4 | 5 | #include "ncengine/scene/Scene.h" 6 | 7 | namespace nc::sample 8 | { 9 | class Benchmarks : public Scene 10 | { 11 | public: 12 | Benchmarks(SampleUI* ui); 13 | void Load(ecs::Ecs world, ModuleProvider modules) override; 14 | void Unload() override; 15 | 16 | private: 17 | SampleUI* m_sampleUI; 18 | }; 19 | } // namespace nc::sample 20 | -------------------------------------------------------------------------------- /sample/source/scenes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_SAMPLE_EXE} 2 | PRIVATE 3 | Benchmarks.cpp 4 | GraphicsTest.cpp 5 | PhysicsTest.cpp 6 | SmokeTest.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /sample/source/scenes/GraphicsTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shared/SampleUI.h" 4 | 5 | #include "ncengine/scene/Scene.h" 6 | 7 | namespace nc::sample 8 | { 9 | class GraphicsTest : public Scene 10 | { 11 | public: 12 | static const nc::Vector3 Extents; 13 | GraphicsTest(SampleUI* ui, Vector3 extents); 14 | void Load(ecs::Ecs world, ModuleProvider modules) override; 15 | void Unload() override; 16 | 17 | private: 18 | SampleUI* m_sampleUI; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /sample/source/scenes/PhysicsTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shared/SampleUI.h" 4 | 5 | #include "ncengine/scene/Scene.h" 6 | 7 | namespace nc::sample 8 | { 9 | class PhysicsTest : public Scene 10 | { 11 | public: 12 | PhysicsTest(SampleUI* ui); 13 | void Load(ecs::Ecs world, ModuleProvider modules) override; 14 | void Unload() override; 15 | 16 | private: 17 | SampleUI* m_sampleUI; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /sample/source/scenes/SmokeTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/scene/Scene.h" 4 | 5 | #include 6 | 7 | namespace nc::sample 8 | { 9 | class SmokeTest : public Scene 10 | { 11 | public: 12 | SmokeTest(std::function quitEngineCallback); 13 | 14 | void Load(ecs::Ecs world, ModuleProvider modules) override; 15 | 16 | private: 17 | std::function m_quitEngine; 18 | }; 19 | } // nc::sample 20 | -------------------------------------------------------------------------------- /sample/source/shared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_SAMPLE_EXE} 2 | PRIVATE 3 | GameLog.cpp 4 | GameLogic.cpp 5 | GeneratedAssets.cpp 6 | Prefabs.cpp 7 | SampleUI.cpp 8 | ) 9 | -------------------------------------------------------------------------------- /sample/source/shared/GameLog.cpp: -------------------------------------------------------------------------------- 1 | #include "GameLog.h" 2 | 3 | namespace nc::sample 4 | { 5 | GameLog* GameLog::m_instance = nullptr; 6 | 7 | GameLog::GameLog() 8 | { 9 | GameLog::m_instance = this; 10 | } 11 | 12 | GameLog::~GameLog() noexcept 13 | { 14 | GameLog::m_instance = nullptr; 15 | } 16 | 17 | void GameLog::SetItemCount(unsigned count) 18 | { 19 | m_itemCount = count; 20 | while(m_items.size() > m_itemCount) 21 | m_items.pop_front(); 22 | } 23 | 24 | void GameLog::Clear() 25 | { 26 | m_items.clear(); 27 | } 28 | 29 | const std::deque& GameLog::GetItems() 30 | { 31 | return m_items; 32 | } 33 | 34 | void GameLog::Log(std::string item) 35 | { 36 | auto& items = GameLog::m_instance->m_items; 37 | auto itemCount = GameLog::m_instance->m_itemCount; 38 | items.push_back(std::move(item)); 39 | if(items.size() > itemCount) 40 | items.pop_front(); 41 | } 42 | } -------------------------------------------------------------------------------- /sample/source/shared/GameLog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace nc::sample 7 | { 8 | class GameLog 9 | { 10 | public: 11 | static const unsigned DefaultItemCount = 10u; // SampleUI needs to initialize from same value 12 | 13 | GameLog(); 14 | ~GameLog() noexcept; 15 | void SetItemCount(unsigned count); 16 | void Clear(); 17 | const std::deque& GetItems(); 18 | static void Log(std::string item); 19 | 20 | private: 21 | static GameLog* m_instance; 22 | std::deque m_items; 23 | unsigned m_itemCount = DefaultItemCount; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /sample/source/shared/GameLogic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Ecs.h" 4 | 5 | namespace nc::sample 6 | { 7 | /** Frame Logic */ 8 | void WasdBasedMovement(Entity self, ecs::Ecs world, float dt); 9 | void WasdBasedSimulatedBodyMovement(Entity self, ecs::Ecs world, float dt); 10 | } // namespace nc::sample 11 | -------------------------------------------------------------------------------- /sample/source/shared/spawner/SpawnBehavior.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Entity.h" 4 | #include "ncmath/Vector.h" 5 | 6 | namespace nc::sample 7 | { 8 | /** Options for configuring spawners. Use Vector3::Zero() to disable kinematic 9 | * options. If enabled, additional components will be attached. */ 10 | struct SpawnBehavior 11 | { 12 | // Initial conditions 13 | Vector3 minPosition = Vector3::Zero(); 14 | Vector3 maxPosition = Vector3::Zero(); 15 | Vector3 minRotation = Vector3::Zero(); 16 | Vector3 maxRotation = Vector3::Zero(); 17 | 18 | // Kinematic properties 19 | Vector3 minVelocity = Vector3::Zero(); 20 | Vector3 maxVelocity = Vector3::Zero(); 21 | Vector3 rotationAxis = Vector3::Zero(); 22 | float rotationTheta = 0.0f; 23 | 24 | // Object properties 25 | Entity::layer_type layer = 1u; 26 | Entity::flags_type flags = Entity::Flags::None; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /script/build_docs.ps1: -------------------------------------------------------------------------------- 1 | Push-Location -Path "$PSScriptRoot/../" 2 | doxygen docs/Doxyfile 3 | Pop-Location -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(external/lz4) 2 | add_subdirectory(external/rtaudio) 3 | add_subdirectory(ncutility) 4 | add_subdirectory(ncmath) 5 | add_subdirectory(ncjolt) 6 | add_subdirectory(ncasset) 7 | 8 | if(NC_BUILD_NCCONVERT) 9 | add_subdirectory(ncconvert) 10 | endif() 11 | 12 | add_subdirectory(ncengine) 13 | -------------------------------------------------------------------------------- /source/external/lz4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lz4 OBJECT 2 | lz4.c 3 | lz4hc.c 4 | ) 5 | -------------------------------------------------------------------------------- /source/external/rtaudio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(RtAudio 2 | STATIC 3 | RtAudio.cpp 4 | ) 5 | 6 | if(WIN32) 7 | target_compile_definitions(RtAudio 8 | PRIVATE 9 | __WINDOWS_WASAPI__ 10 | -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING # RtAudio uses deprecated wchar_t conversion 11 | ) 12 | elseif(APPLE) 13 | target_compile_definitions(RtAudio 14 | PRIVATE 15 | __MACOSX_CORE__ 16 | ) 17 | endif() 18 | 19 | target_compile_options(RtAudio 20 | PRIVATE 21 | ${NC_COMPILER_FLAGS} 22 | ) 23 | -------------------------------------------------------------------------------- /source/ncasset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NcAsset STATIC) 2 | 3 | target_compile_options(NcAsset 4 | PRIVATE 5 | ${NC_COMPILER_FLAGS} 6 | ) 7 | 8 | target_compile_definitions(NcAsset 9 | PRIVATE 10 | ${NC_COMPILE_DEFINITIONS} 11 | ) 12 | 13 | target_include_directories(NcAsset 14 | PUBLIC 15 | $ 16 | $ 17 | PRIVATE 18 | $ 19 | $ 20 | ) 21 | 22 | target_sources(NcAsset 23 | PRIVATE 24 | ${PROJECT_SOURCE_DIR}/source/ncasset/DefaultAssets.cpp 25 | ${PROJECT_SOURCE_DIR}/source/ncasset/Deserialize.cpp 26 | ${PROJECT_SOURCE_DIR}/source/ncasset/Import.cpp 27 | ${PROJECT_SOURCE_DIR}/source/ncasset/NcaHeader.cpp 28 | ) 29 | 30 | target_link_libraries(NcAsset 31 | PUBLIC 32 | NcMath 33 | NcUtility 34 | ) 35 | -------------------------------------------------------------------------------- /source/ncconvert/ReturnCodes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct ResultCode 4 | { 5 | static constexpr auto Success = 0; 6 | static constexpr auto RuntimeError = 1; 7 | static constexpr auto ArgumentError = 2; 8 | }; 9 | -------------------------------------------------------------------------------- /source/ncconvert/analysis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/analysis/GeometryAnalysis.cpp 4 | ${PROJECT_SOURCE_DIR}/source/ncconvert/analysis/Sanitize.cpp 5 | ${PROJECT_SOURCE_DIR}/source/ncconvert/analysis/TextureAnalysis.cpp 6 | ) 7 | -------------------------------------------------------------------------------- /source/ncconvert/analysis/GeometryAnalysis.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc 6 | { 7 | struct Triangle; 8 | struct Vector3; 9 | 10 | namespace asset 11 | { 12 | struct MeshVertex; 13 | } // namespace asset 14 | 15 | namespace convert 16 | { 17 | auto FindFurthestDistanceFromOrigin(std::span data) -> float; 18 | auto FindFurthestDistanceFromOrigin(std::span data) -> float; 19 | auto FindFurthestDistanceFromOrigin(std::span data) -> float; 20 | auto GetMeshVertexExtents(std::span data) -> Vector3; 21 | auto GetMeshVertexExtents(std::span data) -> Vector3; 22 | auto GetMeshVertexExtents(std::span data) -> Vector3; 23 | } // namespace convert 24 | } // namespace nc 25 | -------------------------------------------------------------------------------- /source/ncconvert/analysis/Sanitize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/Assets.h" 4 | 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | auto Sanitize(float* in) -> size_t; 10 | auto Sanitize(Vector2* in) -> size_t; 11 | auto Sanitize(Vector3* in) -> size_t; 12 | auto Sanitize(asset::MeshVertex* in) -> size_t; 13 | auto Sanitize(std::span in) -> size_t; 14 | auto Sanitize(std::span in) -> size_t; 15 | auto Sanitize(std::span in) -> size_t; 16 | auto Sanitize(std::span in) -> size_t; 17 | } // namespace nc::convert 18 | -------------------------------------------------------------------------------- /source/ncconvert/builder/BuildInstructions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetType.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace nc::convert 10 | { 11 | struct Config; 12 | struct Target; 13 | 14 | /** @brief A collection of all targets that need to be built. */ 15 | class BuildInstructions 16 | { 17 | public: 18 | /** @brief Construct a new BuildInstructions object from the data in Config. */ 19 | BuildInstructions(const Config& config); 20 | 21 | /** @brief Get the collection of targets to build matching an AssetType. */ 22 | auto GetTargetsForType(asset::AssetType type) const -> const std::vector&; 23 | 24 | private: 25 | std::unordered_map> m_instructions; 26 | 27 | void ReadTargets(const Config& config); 28 | }; 29 | } // namespace nc::convert 30 | -------------------------------------------------------------------------------- /source/ncconvert/builder/BuildOrchestrator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Config.h" 4 | 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | class Builder; 10 | 11 | /** @brief Manager that handles dispatching instructions to the Builder. */ 12 | class BuildOrchestrator 13 | { 14 | public: 15 | BuildOrchestrator(Config config); 16 | ~BuildOrchestrator() noexcept; 17 | 18 | /** @brief Build all required nca files. */ 19 | void RunBuild(); 20 | 21 | private: 22 | Config m_config; 23 | std::unique_ptr m_builder; 24 | }; 25 | } // namespace nc::convert 26 | -------------------------------------------------------------------------------- /source/ncconvert/builder/Builder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetType.h" 4 | 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | struct Target; 10 | class AudioConverter; 11 | class GeometryConverter; 12 | class TextureConverter; 13 | 14 | /** @brief Manager that handles nca conversion and serialization. */ 15 | class Builder 16 | { 17 | public: 18 | Builder(); 19 | ~Builder() noexcept; 20 | 21 | /** @brief Create a new .nca file. */ 22 | auto Build(asset::AssetType type, const Target& target) -> bool; 23 | 24 | private: 25 | std::unique_ptr m_audioConverter; 26 | std::unique_ptr m_geometryConverter; 27 | std::unique_ptr m_textureConverter; 28 | }; 29 | } // namespace nc::convert 30 | -------------------------------------------------------------------------------- /source/ncconvert/builder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/Builder.cpp 4 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/BuildInstructions.cpp 5 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/BuildOrchestrator.cpp 6 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/Inspect.cpp 7 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/Manifest.cpp 8 | ${PROJECT_SOURCE_DIR}/source/ncconvert/builder/Serialize.cpp 9 | ) 10 | -------------------------------------------------------------------------------- /source/ncconvert/builder/Inspect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc::convert 6 | { 7 | /** @brief Print details about an asset. */ 8 | void Inspect(const std::filesystem::path& ncaPath); 9 | } // namespace nc::convert 10 | -------------------------------------------------------------------------------- /source/ncconvert/code_gen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/code_gen/PrefabGenerator.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /source/ncconvert/code_gen/PrefabGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetType.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace nc::convert 10 | { 11 | struct Target; 12 | 13 | void GeneratePrefabFile(const std::filesystem::path& manifestPath, 14 | const std::filesystem::path& outputDirectory, 15 | const std::string& rootNamespace); 16 | 17 | } // namespace nc::convert 18 | -------------------------------------------------------------------------------- /source/ncconvert/converters/AudioConverter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetsFwd.h" 4 | 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | class AudioConverter 10 | { 11 | public: 12 | auto ImportAudioClip(const std::filesystem::path& path) -> asset::AudioClip; 13 | }; 14 | } // namespace nc::convert 15 | -------------------------------------------------------------------------------- /source/ncconvert/converters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/converters/AudioConverter.cpp 4 | ${PROJECT_SOURCE_DIR}/source/ncconvert/converters/GeometryConverter.cpp 5 | ${PROJECT_SOURCE_DIR}/source/ncconvert/converters/TextureConverter.cpp 6 | ) -------------------------------------------------------------------------------- /source/ncconvert/converters/TextureConverter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetsFwd.h" 4 | 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | class TextureConverter 10 | { 11 | public: 12 | auto ImportCubeMap(const std::filesystem::path& path, 13 | asset::TextureFormat format) -> asset::CubeMap; 14 | 15 | auto ImportTexture(const std::filesystem::path& path, 16 | asset::TextureFormat format, 17 | bool generateMips) -> asset::Texture; 18 | }; 19 | } // namespace nc::convert 20 | -------------------------------------------------------------------------------- /source/ncconvert/optimizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/optimizer/MeshOptimization.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /source/ncconvert/optimizer/MeshOptimization.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/Assets.h" 4 | 5 | namespace nc::convert 6 | { 7 | struct OptimizedMesh 8 | { 9 | std::vector vertices; 10 | std::vector indices; 11 | }; 12 | 13 | auto OptimizeMesh(const std::vector& vertices, 14 | const std::vector& indices) -> OptimizedMesh; 15 | } // namespace nc::convert 16 | -------------------------------------------------------------------------------- /source/ncconvert/utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nc-convert 2 | PRIVATE 3 | ${PROJECT_SOURCE_DIR}/source/ncconvert/utility/EnumExtensions.cpp 4 | ${PROJECT_SOURCE_DIR}/source/ncconvert/utility/Image.cpp 5 | ${PROJECT_SOURCE_DIR}/source/ncconvert/utility/Path.cpp 6 | ) 7 | -------------------------------------------------------------------------------- /source/ncconvert/utility/EnumExtensions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetType.h" 4 | 5 | #include 6 | #include 7 | 8 | namespace nc::convert 9 | { 10 | auto CanOutputMany(asset::AssetType type) -> bool; 11 | auto ToAssetType(std::string type) -> asset::AssetType; 12 | auto ToString(asset::AssetType type) -> std::string_view; 13 | 14 | auto IsCompressedTextureFormat(asset::TextureFormat format) -> bool; 15 | auto TextureFormatHasAlpha(asset::TextureFormat format) -> bool; 16 | auto GetMinimumDimension(asset::TextureFormat format) -> uint32_t; 17 | auto ToTextureFormat(const std::string& type) -> asset::TextureFormat; 18 | auto ToString(asset::TextureFormat format) -> std::string_view; 19 | } 20 | -------------------------------------------------------------------------------- /source/ncconvert/utility/Log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fmt/format.h" 4 | 5 | #include 6 | 7 | #define LOG(...) std::cout << fmt::format(__VA_ARGS__) << '\n'; 8 | -------------------------------------------------------------------------------- /source/ncconvert/utility/Path.cpp: -------------------------------------------------------------------------------- 1 | #include "Path.h" 2 | 3 | #include 4 | 5 | namespace nc::convert 6 | { 7 | auto ValidateInputFileExtension(const std::filesystem::path& path, std::span validExtensions) -> bool 8 | { 9 | if (!std::filesystem::is_regular_file(path)) 10 | { 11 | return false; 12 | } 13 | 14 | const auto extension = path.extension().string(); 15 | return std::ranges::find(validExtensions, extension) != validExtensions.end(); 16 | } 17 | 18 | auto AssetNameToNcaPath(const std::filesystem::path& assetName, const std::filesystem::path& outDir) -> std::filesystem::path 19 | { 20 | return (outDir / assetName).replace_extension(".nca").make_preferred(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ncconvert/utility/Path.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace nc::convert 8 | { 9 | auto ValidateInputFileExtension(const std::filesystem::path& path, std::span validExtensions) -> bool; 10 | auto AssetNameToNcaPath(const std::filesystem::path& assetName, const std::filesystem::path& outDir) -> std::filesystem::path; 11 | } 12 | -------------------------------------------------------------------------------- /source/ncengine/asset/AssetData.cpp: -------------------------------------------------------------------------------- 1 | #include "asset/AssetData.h" 2 | 3 | #include "ncutility/NcError.h" 4 | 5 | namespace nc::asset 6 | { 7 | TextureUpdateEventData::TextureUpdateEventData(UpdateAction updateAction_, std::span data_) 8 | : data{data_}, 9 | updateAction{updateAction_} 10 | { 11 | if (updateAction == UpdateAction::Load && data.empty()) 12 | { 13 | throw NcError("Cannot load texture. Texture data is empty."); 14 | } 15 | } 16 | 17 | CubeMapUpdateEventData::CubeMapUpdateEventData(UpdateAction updateAction_, std::span data_) 18 | : data{data_}, 19 | updateAction{updateAction_} 20 | { 21 | if (updateAction == UpdateAction::Load && data.empty()) 22 | { 23 | throw NcError("Cannot load Cubemap. CubeMap data is empty."); 24 | } 25 | } 26 | 27 | } // namespace nc::asset 28 | -------------------------------------------------------------------------------- /source/ncengine/asset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AssetData.cpp 4 | Assets.cpp 5 | NcAssetImpl.cpp 6 | ) 7 | 8 | add_subdirectory(manager) 9 | -------------------------------------------------------------------------------- /source/ncengine/asset/manager/AssetUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "AssetUtilities.h" 2 | 3 | namespace nc::asset 4 | { 5 | auto HasValidAssetExtension(const std::string& path) -> bool 6 | { 7 | const auto periodPosition = path.rfind('.'); 8 | if (periodPosition == std::string::npos) 9 | { 10 | return false; 11 | } 12 | 13 | const auto fileExtension = path.substr(periodPosition+1); 14 | return fileExtension == "nca" ? true : false; 15 | } 16 | } // namespace nc::asset 17 | -------------------------------------------------------------------------------- /source/ncengine/asset/manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AssetUtilities.cpp 4 | AudioClipAssetManager.cpp 5 | ConvexHullAssetManager.cpp 6 | CubeMapAssetManager.cpp 7 | FontAssetManager.cpp 8 | MeshAssetManager.cpp 9 | MeshColliderAssetManager.cpp 10 | ShaderAssetManager.cpp 11 | SkeletalAnimationAssetManager.cpp 12 | TextureAssetManager.cpp 13 | ) 14 | -------------------------------------------------------------------------------- /source/ncengine/audio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AudioSource.cpp 4 | DeviceStream.cpp 5 | NcAudioImpl.cpp 6 | ) 7 | -------------------------------------------------------------------------------- /source/ncengine/config/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Config.cpp 4 | ) -------------------------------------------------------------------------------- /source/ncengine/config/ConfigInternal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nc::config 4 | { 5 | struct Config; 6 | 7 | void SetConfig(const Config& config); 8 | auto Read(std::istream& stream) -> Config; 9 | void Write(std::ostream& stream, const Config& in, bool writeSections = true); 10 | } 11 | -------------------------------------------------------------------------------- /source/ncengine/debug/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | DebugRendering.cpp 4 | Serialize.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/ecs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | NcEcsImpl.cpp 4 | SoA.cpp 5 | Transform.cpp 6 | ) 7 | -------------------------------------------------------------------------------- /source/ncengine/ecs/NcEcsImpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/NcEcs.h" 4 | #include "ncengine/utility/Signal.h" 5 | 6 | #include 7 | 8 | namespace nc 9 | { 10 | struct SystemEvents; 11 | class Registry; 12 | } 13 | 14 | namespace nc::ecs 15 | { 16 | /** Module for updating FrameLogic components and synchronizing the Registry. */ 17 | class EcsModule : public NcEcs 18 | { 19 | public: 20 | EcsModule(ComponentRegistry& registry, SystemEvents& events) noexcept; 21 | 22 | void OnBuildTaskGraph(task::UpdateTasks& update, task::RenderTasks&) override; 23 | void RunFrameLogic(); 24 | 25 | private: 26 | ComponentRegistry* m_registry; 27 | Connection m_rebuildStaticConnection; 28 | 29 | void UpdateWorldSpaceMatrices(); 30 | void UpdateStaticWorldSpaceMatrices(); 31 | }; 32 | 33 | auto BuildEcsModule(ComponentRegistry* registry, SystemEvents& events) -> std::unique_ptr; 34 | } // namespace nc::ecs 35 | -------------------------------------------------------------------------------- /source/ncengine/ecs/SoA.cpp: -------------------------------------------------------------------------------- 1 | #include "SoA.h" 2 | 3 | namespace nc::ecs 4 | { 5 | SoAIndex::SoAIndex(size_t begin, size_t end, GapIterator gapBegin, GapIterator gapEnd) 6 | : m_current{begin}, 7 | m_end{end}, 8 | m_gapCurrent{gapBegin}, 9 | m_gapEnd{gapEnd} 10 | { 11 | } 12 | 13 | SoAIndex::operator size_t() const 14 | { 15 | return m_current; 16 | } 17 | 18 | bool SoAIndex::Valid() const 19 | { 20 | return m_current < m_end; 21 | } 22 | 23 | SoAIndex& SoAIndex::operator++() 24 | { 25 | while(++m_current < m_end) 26 | { 27 | if(m_gapCurrent != m_gapEnd && m_current == *m_gapCurrent) 28 | { 29 | ++m_gapCurrent; continue; 30 | } 31 | 32 | break; 33 | } 34 | 35 | return *this; 36 | } 37 | } // namespace nc::ecs 38 | -------------------------------------------------------------------------------- /source/ncengine/engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | ComponentFactories.cpp 4 | ModuleFactory.cpp 5 | NcEngineImpl.cpp 6 | RegistryFactory.cpp 7 | ) 8 | 9 | add_subdirectory(registration) 10 | -------------------------------------------------------------------------------- /source/ncengine/engine/ComponentFactories.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/NcFwd.h" 4 | 5 | #include 6 | 7 | namespace nc 8 | { 9 | auto CreateAudioSource(Entity entity, const std::any&) -> AudioSource; 10 | auto CreateFrameLogic(Entity entity, const std::any&) -> FrameLogic; 11 | auto CreateParticleEmitter(Entity entity, const std::any&) -> ParticleEmitter; 12 | auto CreatePointLight(Entity entity, const std::any&) -> PointLight; 13 | auto CreateSkinnedMesh(Entity entity, const std::any&) -> SkinnedMesh; 14 | auto CreateStaticMesh(Entity entity, const std::any&) -> StaticMesh; 15 | auto CreateSpotLight(Entity entity, const std::any&) -> SpotLight; 16 | auto CreateRigidBody(Entity entity, const std::any&) -> RigidBody; 17 | auto CreateDirectionalLight(Entity entity, const std::any&) -> DirectionalLight; 18 | } // namespace nc 19 | -------------------------------------------------------------------------------- /source/ncengine/engine/ModuleFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc 6 | { 7 | struct SystemEvents; 8 | class ModuleRegistry; 9 | class Registry; 10 | 11 | namespace ecs 12 | { 13 | class ComponentRegistry; 14 | } // namespace ecs 15 | 16 | namespace config 17 | { 18 | struct Config; 19 | } // namespace config 20 | 21 | namespace task 22 | { 23 | class AsyncDispatcher; 24 | } // namespace task 25 | 26 | // Create a module registry and register all engine modules 27 | auto BuildModuleRegistry(ecs::ComponentRegistry& registry, 28 | const task::AsyncDispatcher& dispatcher, 29 | SystemEvents& events, 30 | const config::Config& config) -> std::unique_ptr; 31 | } // namespace nc 32 | -------------------------------------------------------------------------------- /source/ncengine/engine/RegistryFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "RegistryFactory.h" 2 | #include "registration/AudioTypes.h" 3 | #include "registration/CoreTypes.h" 4 | #include "registration/GraphicsTypes.h" 5 | #include "registration/LogicTypes.h" 6 | #include "registration/PhysicsTypes.h" 7 | #include "ncengine/ecs/ComponentRegistry.h" 8 | #include "ncengine/utility/Log.h" 9 | 10 | namespace nc 11 | { 12 | auto BuildRegistry(size_t maxEntities) -> std::unique_ptr 13 | { 14 | NC_LOG_INFO("Building registry"); 15 | auto registry = std::make_unique(maxEntities); 16 | // We break up registration into separate object files to support mingw linker limitations 17 | RegisterCoreTypes(*registry, maxEntities); 18 | RegisterGraphicsTypes(*registry, maxEntities); 19 | RegisterPhysicsTypes(*registry, maxEntities); 20 | RegisterLogicTypes(*registry, maxEntities); 21 | RegisterAudioTypes(*registry, maxEntities); 22 | return registry; 23 | } 24 | } // namespace nc 25 | -------------------------------------------------------------------------------- /source/ncengine/engine/RegistryFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace nc 7 | { 8 | namespace ecs 9 | { 10 | class ComponentRegistry; 11 | } // namespace ecs 12 | 13 | // Create a registry instance and register all engine components 14 | auto BuildRegistry(size_t maxEntities) -> std::unique_ptr; 15 | } // namespace nc 16 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/AudioTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "AudioTypes.h" 2 | #include "ncengine/audio/AudioSource.h" 3 | 4 | namespace nc 5 | { 6 | void RegisterAudioTypes(ecs::ComponentRegistry& registry, size_t maxEntities) 7 | { 8 | Register( 9 | registry, 10 | maxEntities, 11 | AudioSourceId, 12 | "AudioSource", 13 | ui::editor::AudioSourceUIWidget, 14 | CreateAudioSource, 15 | SerializeAudioSource, 16 | DeserializeAudioSource 17 | ); 18 | } 19 | } // namespace nc 20 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/AudioTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FactoryCommon.h" 4 | 5 | namespace nc 6 | { 7 | void RegisterAudioTypes(ecs::ComponentRegistry& registry, size_t maxEntities); 8 | } // namespace nc 9 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AudioTypes.cpp 4 | CoreTypes.cpp 5 | GraphicsTypes.cpp 6 | LogicTypes.cpp 7 | PhysicsTypes.cpp 8 | ) 9 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/CoreTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "CoreTypes.h" 2 | #include "ncengine/ecs/Hierarchy.h" 3 | #include "ncengine/ecs/Tag.h" 4 | #include "ncengine/ecs/Transform.h" 5 | 6 | namespace nc 7 | { 8 | void RegisterCoreTypes(ecs::ComponentRegistry& registry, size_t maxEntities) 9 | { 10 | Register( 11 | registry, 12 | maxEntities, 13 | TagId, 14 | "Tag", 15 | ui::editor::TagUIWidget 16 | ); 17 | 18 | Register( 19 | registry, 20 | maxEntities, 21 | TransformId, 22 | "Transform", 23 | ui::editor::TransformUIWidget 24 | ); 25 | 26 | Register( 27 | registry, 28 | maxEntities, 29 | HierarchyId, 30 | "Hierarchy" 31 | ); 32 | } 33 | } // namespace nc 34 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/CoreTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FactoryCommon.h" 4 | 5 | namespace nc 6 | { 7 | void RegisterCoreTypes(ecs::ComponentRegistry& registry, size_t maxEntities); 8 | } // namespace nc 9 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/GraphicsTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FactoryCommon.h" 4 | 5 | namespace nc 6 | { 7 | void RegisterGraphicsTypes(ecs::ComponentRegistry& registry, size_t maxEntities); 8 | } // namespace nc 9 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/LogicTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "LogicTypes.h" 2 | #include "ncengine/ecs/FrameLogic.h" 3 | 4 | namespace nc 5 | { 6 | void RegisterLogicTypes(ecs::ComponentRegistry& registry, size_t maxEntities) 7 | { 8 | Register( 9 | registry, 10 | maxEntities, 11 | FrameLogicId, 12 | "FrameLogic", 13 | ui::editor::FrameLogicUIWidget, 14 | CreateFrameLogic 15 | ); 16 | } 17 | } // namespace nc 18 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/LogicTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FactoryCommon.h" 4 | 5 | namespace nc 6 | { 7 | void RegisterLogicTypes(ecs::ComponentRegistry& registry, size_t maxEntities); 8 | } // namespace nc 9 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/PhysicsTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "PhysicsTypes.h" 2 | #include "ncengine/physics/CollisionListener.h" 3 | #include "ncengine/physics/Constraints.h" 4 | #include "ncengine/physics/RigidBody.h" 5 | 6 | namespace nc 7 | { 8 | void RegisterPhysicsTypes(ecs::ComponentRegistry& registry, size_t maxEntities) 9 | { 10 | Register( 11 | registry, 12 | maxEntities, 13 | RigidBodyId, 14 | "RigidBody", 15 | ui::editor::RigidBodyUIWidget, 16 | CreateRigidBody, 17 | SerializeRigidBody, 18 | DeserializeRigidBody 19 | // has user data, but is set during NcPhysics initialization 20 | ); 21 | 22 | Register( 23 | registry, 24 | maxEntities, 25 | CollisionListenerId, 26 | "CollisionListener", 27 | ui::editor::CollisionListenerUIWidget 28 | ); 29 | } 30 | } // namespace nc 31 | -------------------------------------------------------------------------------- /source/ncengine/engine/registration/PhysicsTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FactoryCommon.h" 4 | 5 | namespace nc 6 | { 7 | void RegisterPhysicsTypes(ecs::ComponentRegistry& registry, size_t maxEntities); 8 | } // namespace nc 9 | -------------------------------------------------------------------------------- /source/ncengine/graphics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | GraphicsUtilities.cpp 4 | IGraphics.cpp 5 | NcGraphicsImpl.cpp 6 | ) 7 | 8 | add_subdirectory(api/vulkan) 9 | add_subdirectory(components) 10 | add_subdirectory(shader_resource) 11 | add_subdirectory(system) 12 | -------------------------------------------------------------------------------- /source/ncengine/graphics/GraphicsConstants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc::graphics 6 | { 7 | /** How many frames can be rendered concurrently. Controls count of buffers, images, descriptor sets, synchronization constants, etc. */ 8 | constexpr uint32_t MaxFramesInFlight = 2u; 9 | 10 | /** Starting point for how many resources can be bound per shader. Arrays, for example, count as a single slot. */ 11 | constexpr uint32_t DefaultResourceSlotsPerShader = 10u; 12 | 13 | /** Max for how many resources can be bound per shader. Arrays, for example, count as a single slot. */ 14 | constexpr uint32_t MaxResourceSlotsPerShader = 100u; 15 | } -------------------------------------------------------------------------------- /source/ncengine/graphics/GraphicsUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "GraphicsUtilities.h" 2 | 3 | namespace nc::graphics 4 | { 5 | auto AdjustDimensionsToAspectRatio(const nc::Vector2& dimensions) -> nc::Vector2 6 | { 7 | auto width = dimensions.x; 8 | auto height = dimensions.y; 9 | 10 | if (FloatEqual(height, 0.0f)) 11 | { 12 | height = 0.00000001f; 13 | } 14 | 15 | auto currentAspectRatio = width / height; 16 | if (currentAspectRatio > AspectRatio) 17 | { 18 | width = AspectRatio * height; 19 | } 20 | else 21 | { 22 | height = width / AspectRatio; 23 | } 24 | return nc::Vector2{width, height}; 25 | } 26 | } // namespace nc::graphics 27 | -------------------------------------------------------------------------------- /source/ncengine/graphics/GraphicsUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncmath/Vector.h" 4 | 5 | namespace nc::graphics 6 | { 7 | constexpr auto AspectRatio = 16.0f / 9.0f; 8 | auto AdjustDimensionsToAspectRatio(const nc::Vector2& dimensions) -> nc::Vector2; 9 | } // namespace nc::graphics 10 | -------------------------------------------------------------------------------- /source/ncengine/graphics/IGraphics.cpp: -------------------------------------------------------------------------------- 1 | #include "IGraphics.h" 2 | #include "api/vulkan/VulkanGraphics.h" 3 | #include "utility/Log.h" 4 | #include "window/Window.h" 5 | 6 | #include "ncutility/NcError.h" 7 | 8 | namespace nc::graphics 9 | { 10 | auto GraphicsFactory(const config::ProjectSettings& projectSettings, 11 | const config::GraphicsSettings& graphicsSettings, 12 | asset::NcAsset* assetModule, 13 | window::NcWindow& window) -> std::unique_ptr 14 | { 15 | // TODO: #343 Provide an API/version switch in GraphicsSettings. Continue using Vulkan v1.3 for now. 16 | constexpr auto apiVersion = VK_API_VERSION_1_3; 17 | NC_LOG_TRACE("Creating VulkanGraphics"); 18 | return std::make_unique(projectSettings, graphicsSettings, assetModule, apiVersion, 19 | window.GetWindowHandle(), window.GetDimensions(), window.GetScreenExtent() 20 | ); 21 | } 22 | } // namespace nc::graphics 23 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | FrameManager.cpp 4 | GpuAllocator.cpp 5 | ImguiVulkan.cpp 6 | Initializers.cpp 7 | NcVulkan.cpp 8 | PerFrameGpuContext.cpp 9 | QueueFamily.cpp 10 | RenderGraph.cpp 11 | ShaderBindingManager.cpp 12 | ShaderStorage.cpp 13 | ShaderUtilities.cpp 14 | Swapchain.cpp 15 | VertexDescriptions.cpp 16 | VulkanGraphics.cpp 17 | ) 18 | 19 | add_subdirectory(buffers) 20 | add_subdirectory(core) 21 | add_subdirectory(renderpasses) 22 | add_subdirectory(pipelines) 23 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/ImguiVulkan.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "NcVulkan.h" 4 | 5 | #include "ncengine/utility/Signal.h" 6 | 7 | struct GLFWwindow; 8 | 9 | namespace nc::graphics::vulkan 10 | { 11 | class Device; 12 | class Instance; 13 | 14 | class Imgui 15 | { 16 | public: 17 | explicit Imgui(const Device& device, 18 | const Instance& instance, 19 | GLFWwindow* window, 20 | vk::RenderPass renderPass, 21 | Signal<>& onFontUpdate); 22 | ~Imgui() noexcept; 23 | 24 | void FrameBegin(); 25 | void Frame(); 26 | 27 | private: 28 | vk::UniqueDescriptorPool m_imguiDescriptorPool; 29 | Connection m_buildFonts; 30 | }; 31 | } // namespace nc::graphics::vulkan 32 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/NcVulkan.cpp: -------------------------------------------------------------------------------- 1 | #define VMA_IMPLEMENTATION 2 | #define VMA_STATIC_VULKAN_FUNCTIONS 0 3 | #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 4 | 5 | #include "NcVulkan.h" 6 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/NcVulkan.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncutility/platform/win32/NcWin32Filter.h" 4 | #include "vma/vk_mem_alloc.h" 5 | #include "vulkan/vulkan.hpp" 6 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/ShaderUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/NcVulkan.h" 4 | #include "graphics/shader_resource/ShaderTypes.h" 5 | 6 | #include 7 | #include 8 | 9 | namespace nc::graphics::vulkan 10 | { 11 | vk::ShaderModule CreateShaderModule(vk::Device device, const std::vector& code); 12 | std::vector ReadShader(const std::string& filename); 13 | auto GetStageFlags(shader_stage stage) -> vk::ShaderStageFlags; 14 | } // namespace nc::graphics::vulkan 15 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/VertexDescriptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/NcVulkan.h" 4 | 5 | namespace nc::graphics::vulkan 6 | { 7 | auto GetVertexBindingDescription() -> vk::VertexInputBindingDescription; 8 | auto GetVertexAttributeDescriptions() -> std::array; 9 | } // namespace nc::graphics::vulkan 10 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CubeMapArrayBuffer.cpp 4 | MeshArrayBuffer.cpp 5 | RenderPassSinkBuffer.cpp 6 | StorageBuffer.cpp 7 | TextureArrayBuffer.cpp 8 | UniformBuffer.cpp 9 | ) 10 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/CubeMapArrayBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "CubeMapArrayBuffer.h" 2 | #include "asset/AssetData.h" 3 | #include "graphics/api/vulkan/Initializers.h" 4 | 5 | namespace nc::graphics::vulkan 6 | { 7 | CubeMap::CubeMap(GpuAllocator* allocator, const asset::CubeMapWithId& data) 8 | : m_image{allocator->CreateCubeMapTexture(data.cubeMap.pixelData.data(), static_cast(data.cubeMap.pixelData.size()), data.cubeMap.faceSideLength)}, 9 | m_cubeMapView{allocator->CreateCubeMapTextureView(m_image)}{} 10 | 11 | void CubeMap::Clear() noexcept 12 | { 13 | m_image.Release(); 14 | m_cubeMapView.reset(); 15 | } 16 | 17 | CubeMapArrayBuffer::CubeMapArrayBuffer(vk::Device device) 18 | : sampler{CreateTextureSampler(device, vk::SamplerAddressMode::eRepeat)} 19 | {} 20 | } // namespace nc::graphics::vulkan 21 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/MeshArrayBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/GpuAllocator.h" 4 | 5 | #include "ncasset/AssetsFwd.h" 6 | 7 | #include 8 | 9 | namespace nc::graphics::vulkan 10 | { 11 | class MeshBuffer 12 | { 13 | public: 14 | MeshBuffer(); 15 | MeshBuffer(GpuAllocator* allocator, std::span data); 16 | MeshBuffer(GpuAllocator* allocator, std::span data); 17 | MeshBuffer(MeshBuffer&&) = default; 18 | MeshBuffer& operator=(MeshBuffer&&) = default; 19 | MeshBuffer& operator=(const MeshBuffer&) = delete; 20 | MeshBuffer(const MeshBuffer&) = delete; 21 | 22 | auto GetBuffer() const noexcept -> vk::Buffer { return m_buffer; } 23 | void Clear() noexcept; 24 | 25 | private: 26 | GpuAllocation m_buffer; 27 | }; 28 | 29 | struct MeshArrayBuffer 30 | { 31 | MeshBuffer vertices; 32 | MeshBuffer indices; 33 | }; 34 | } // namespace nc::graphics::vulkan 35 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/RenderPassSinkBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderPassSinkBuffer.h" 2 | #include "graphics/api/vulkan/Initializers.h" 3 | 4 | namespace nc::graphics::vulkan 5 | { 6 | RenderPassSinkBuffer::RenderPassSinkBuffer(vk::Device device) 7 | : sampler{CreateShadowMapSampler(device)} 8 | { 9 | } 10 | 11 | void RenderPassSinkBuffer::Clear() noexcept 12 | { 13 | views.clear(); 14 | imageInfos.clear(); 15 | } 16 | } // namespace nc::graphics::vulkan 17 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/RenderPassSinkBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/NcVulkan.h" 4 | #include "graphics/shader_resource/ShaderTypes.h" 5 | 6 | namespace nc::graphics::vulkan 7 | { 8 | struct RenderPassSinkBuffer 9 | { 10 | RenderPassSinkBuffer(vk::Device device); 11 | 12 | void Clear() noexcept; 13 | 14 | vk::UniqueSampler sampler; 15 | std::vector views; 16 | std::vector imageInfos; 17 | }; 18 | } // namespace nc::graphics::vulkan 19 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/StorageBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/GpuAllocator.h" 4 | 5 | namespace nc::graphics::vulkan 6 | { 7 | class StorageBuffer 8 | { 9 | public: 10 | StorageBuffer(GpuAllocator* allocator, uint32_t size); 11 | StorageBuffer(StorageBuffer&&) noexcept; 12 | StorageBuffer& operator=(StorageBuffer&&) noexcept; 13 | StorageBuffer& operator=(const StorageBuffer&) = delete; 14 | StorageBuffer(const StorageBuffer&) = delete; 15 | 16 | void Clear() noexcept; 17 | void Bind(const void* dataToMap, uint32_t dataSize); 18 | auto GetInfo() noexcept -> vk::DescriptorBufferInfo* {return &m_info;} 19 | 20 | private: 21 | GpuAllocator* m_allocator; 22 | uint32_t m_alignedSize; 23 | GpuAllocation m_buffer; 24 | vk::DescriptorBufferInfo m_info; 25 | uint32_t m_previousDataSize; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/buffers/UniformBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/GpuAllocator.h" 4 | 5 | namespace nc::graphics::vulkan 6 | { 7 | // Buffer that is intended for frequent writes on the CPU, and frequent reads on the GPU. 8 | class UniformBuffer 9 | { 10 | public: 11 | UniformBuffer(GpuAllocator* allocator, const void* data, uint32_t size); 12 | UniformBuffer(UniformBuffer&&) noexcept; 13 | UniformBuffer& operator=(UniformBuffer&&) noexcept; 14 | UniformBuffer& operator=(const UniformBuffer&) = delete; 15 | UniformBuffer(const UniformBuffer&) = delete; 16 | 17 | void Bind(const void* data, uint32_t size); 18 | void Clear(); 19 | auto GetInfo() noexcept -> vk::DescriptorBufferInfo* {return &m_info;} 20 | 21 | private: 22 | GpuAllocator* m_allocator; 23 | uint32_t m_alignedSize; 24 | GpuAllocation m_buffer; 25 | vk::DescriptorBufferInfo m_info; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Device.cpp 4 | GpuOptions.cpp 5 | Instance.cpp 6 | ) 7 | 8 | add_subdirectory(detail) 9 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/core/GpuOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc::graphics::vulkan 6 | { 7 | /** This class deals with rendering options that are dependent on properties of the GPU (the physical device). */ 8 | class GpuOptions 9 | { 10 | public: 11 | GpuOptions(vk::PhysicalDevice physicalDevice); 12 | 13 | auto GetDepthFormat() const noexcept -> vk::Format 14 | { 15 | return m_depthFormat; 16 | } 17 | 18 | auto GetMaxSamplesCount() const noexcept -> vk::SampleCountFlagBits 19 | { 20 | return m_samplesCount; 21 | } 22 | 23 | private: 24 | vk::Format m_depthFormat; 25 | vk::SampleCountFlagBits m_samplesCount; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/core/Instance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | struct GLFWwindow; 9 | 10 | namespace nc::graphics::vulkan 11 | { 12 | class Instance 13 | { 14 | public: 15 | Instance(std::string_view appName, uint32_t appVersion, 16 | uint32_t apiVersion, bool enableValidationLayers); 17 | 18 | Instance(const Instance&) = delete; 19 | Instance(Instance&&) = delete; 20 | Instance& operator=(const Instance&) = delete; 21 | Instance& operator=(Instance&&) = delete; 22 | 23 | auto VkInstance() const noexcept -> vk::Instance 24 | { 25 | return m_instance.get(); 26 | } 27 | 28 | auto CreateSurface(GLFWwindow* window) const -> vk::UniqueSurfaceKHR; 29 | auto GetPhysicalDevices() const -> std::vector; 30 | 31 | private: 32 | vk::UniqueInstance m_instance; 33 | }; 34 | } // nc::graphics::vulkan 35 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/core/detail/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | PhysicalDevice.cpp 4 | ) -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/core/detail/PhysicalDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/api/vulkan/QueueFamily.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace nc::graphics::vulkan::detail 10 | { 11 | struct PhysicalDeviceInfo 12 | { 13 | vk::PhysicalDevice physicalDevice; 14 | QueueFamilyIndices queueFamilyIndices; 15 | }; 16 | 17 | auto SelectPhysicalDevice(std::span physicalDevices, 18 | vk::SurfaceKHR surface, 19 | std::span requiredExtensions) -> PhysicalDeviceInfo; 20 | } // namespace nc::graphics::vulkan::detail 21 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | EnvironmentPipeline.cpp 4 | OutlinePipeline.cpp 5 | ParticlePipeline.cpp 6 | PbrPipeline.cpp 7 | ShadowMappingPipeline.cpp 8 | ToonPipeline.cpp 9 | UiPipeline.cpp 10 | WireframePipeline.cpp 11 | ) 12 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/IPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc::graphics 6 | { 7 | struct PerFrameRenderState; 8 | struct PerFrameInstanceData; 9 | 10 | namespace vulkan 11 | { 12 | class IPipeline 13 | { 14 | public: 15 | virtual ~IPipeline() = default; 16 | 17 | virtual void Bind(uint32_t frameIndex, vk::CommandBuffer* cmd) = 0; 18 | virtual void Record(vk::CommandBuffer* cmd, const PerFrameRenderState& frameData, const PerFrameInstanceData& instanceData) = 0; 19 | }; 20 | } // namespace nc::graphics 21 | } // namespace vulkan 22 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/OutlinePipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IPipeline.h" 4 | #include "graphics/api/vulkan/NcVulkan.h" 5 | #include "graphics/api/vulkan/ShaderBindingManager.h" 6 | 7 | namespace nc::graphics::vulkan 8 | { 9 | class Device; 10 | class ShaderBindingManager; 11 | 12 | class OutlinePipeline : public IPipeline 13 | { 14 | public: 15 | OutlinePipeline(const Device& device, ShaderBindingManager* shaderBindingManager, vk::RenderPass renderPass); 16 | ~OutlinePipeline() noexcept; 17 | 18 | void Bind(uint32_t frameIndex, vk::CommandBuffer* cmd) override; 19 | void Record(vk::CommandBuffer* cmd, const PerFrameRenderState& frameData, const PerFrameInstanceData&) override; 20 | void Clear() noexcept; 21 | 22 | private: 23 | ShaderBindingManager* m_shaderBindingManager; 24 | vk::UniquePipeline m_pipeline; 25 | vk::UniquePipelineLayout m_pipelineLayout; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/PbrPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IPipeline.h" 4 | #include "graphics/api/vulkan/NcVulkan.h" 5 | #include "graphics/api/vulkan/ShaderBindingManager.h" 6 | 7 | namespace nc::graphics::vulkan 8 | { 9 | class Device; 10 | class ShaderBindingManager; 11 | 12 | class PbrPipeline : public IPipeline 13 | { 14 | public: 15 | PbrPipeline(const Device& device, ShaderBindingManager* shaderBindingManager, vk::RenderPass renderPass); 16 | ~PbrPipeline() noexcept; 17 | 18 | void Bind(uint32_t frameIndex, vk::CommandBuffer* cmd) override; 19 | void Record(vk::CommandBuffer* cmd, const PerFrameRenderState& frameData, const PerFrameInstanceData&) override; 20 | void Clear() noexcept; 21 | 22 | private: 23 | ShaderBindingManager* m_shaderBindingManager; 24 | vk::UniquePipeline m_pipeline; 25 | vk::UniquePipelineLayout m_pipelineLayout; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/ToonPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IPipeline.h" 4 | #include "graphics/api/vulkan/NcVulkan.h" 5 | #include "graphics/api/vulkan/ShaderBindingManager.h" 6 | 7 | namespace nc::graphics::vulkan 8 | { 9 | class Device; 10 | class ShaderBindingManager; 11 | 12 | class ToonPipeline : public IPipeline 13 | { 14 | public: 15 | ToonPipeline(const Device& device, ShaderBindingManager* shaderBindingManager, vk::RenderPass renderPass); 16 | ~ToonPipeline() noexcept; 17 | 18 | void Bind(uint32_t frameIndex, vk::CommandBuffer* cmd) override; 19 | void Record(vk::CommandBuffer* cmd, const PerFrameRenderState& frameData, const PerFrameInstanceData&) override; 20 | void Clear() noexcept; 21 | 22 | private: 23 | ShaderBindingManager* m_shaderBindingManager; 24 | vk::UniquePipeline m_pipeline; 25 | vk::UniquePipelineLayout m_pipelineLayout; 26 | }; 27 | } // namespace nc::graphics::vulkan 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/pipelines/UiPipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IPipeline.h" 4 | #include "graphics/api/vulkan/NcVulkan.h" 5 | 6 | namespace nc::graphics::vulkan 7 | { 8 | class Device; 9 | class ShaderBindingManager; 10 | 11 | class UiPipeline : public IPipeline 12 | { 13 | public: 14 | UiPipeline(const Device& device, ShaderBindingManager*, vk::RenderPass renderPass); 15 | ~UiPipeline() noexcept; 16 | 17 | void Bind(uint32_t frameIndex, vk::CommandBuffer* cmd) override; 18 | void Record(vk::CommandBuffer* cmd, const PerFrameRenderState& frameData, const PerFrameInstanceData&) override; 19 | 20 | private: 21 | vk::UniquePipeline m_pipeline; 22 | vk::UniquePipelineLayout m_pipelineLayout; 23 | }; 24 | } // namespace nc::graphics::vulkan 25 | -------------------------------------------------------------------------------- /source/ncengine/graphics/api/vulkan/renderpasses/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Attachment.cpp 4 | RenderPass.cpp 5 | ) -------------------------------------------------------------------------------- /source/ncengine/graphics/components/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Camera.cpp 4 | MeshRenderer.cpp 5 | ParticleEmitter.cpp 6 | SceneNavigationCamera.cpp 7 | SkeletalAnimator.cpp 8 | ToonRenderer.cpp 9 | ) 10 | -------------------------------------------------------------------------------- /source/ncengine/graphics/shader_resource/BufferConcepts.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace nc::graphics 7 | { 8 | template 9 | concept TriviallyCopyableRange = 10 | std::ranges::contiguous_range && 11 | std::ranges::sized_range && 12 | std::is_trivially_copyable_v>; 13 | } // namespace nc::graphics 14 | -------------------------------------------------------------------------------- /source/ncengine/graphics/shader_resource/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CubeMapArrayBufferHandle.cpp 4 | MeshArrayBufferHandle.cpp 5 | RenderPassSinkBufferHandle.cpp 6 | ResourceInstances.cpp 7 | ShaderResourceBus.cpp 8 | StorageBufferHandle.cpp 9 | TextureArrayBufferHandle.cpp 10 | UniformBufferHandle.cpp 11 | ) 12 | -------------------------------------------------------------------------------- /source/ncengine/graphics/shader_resource/ShaderTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nc::graphics 6 | { 7 | using shader_stage = uint8_t; 8 | 9 | struct ShaderStage 10 | { 11 | static constexpr shader_stage Vertex = 0b00000001; // Resources using this stage will bind to the vertex shader. 12 | static constexpr shader_stage Fragment = 0b00000010; // Resources using this stage will bind to the fragment shader. 13 | }; 14 | } // namespace nc::graphics 15 | -------------------------------------------------------------------------------- /source/ncengine/graphics/shader_resource/SkeletalAnimationData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "DirectXMath.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct SkeletalAnimationData 8 | { 9 | DirectX::XMMATRIX finalBoneTransform; 10 | }; 11 | } // namespace nc::graphics 12 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CameraSystem.cpp 4 | EnvironmentSystem.cpp 5 | ObjectSystem.cpp 6 | ParticleEmitterSystem.cpp 7 | SkeletalAnimationCalculations.cpp 8 | SkeletalAnimationTypes.cpp 9 | SkeletalAnimationSystem.cpp 10 | LightSystem.cpp 11 | UISystem.cpp 12 | WidgetSystem.cpp 13 | ) 14 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/CameraSystem.cpp: -------------------------------------------------------------------------------- 1 | #include "CameraSystem.h" 2 | #include "ecs/Registry.h" 3 | #include "graphics/Camera.h" 4 | 5 | namespace nc::graphics 6 | { 7 | auto CameraSystem::Execute(Registry* registry) -> CameraState 8 | { 9 | if (!m_mainCamera) 10 | { 11 | return CameraState 12 | { 13 | .view = DirectX::XMMatrixIdentity(), 14 | .projection = DirectX::XMMatrixIdentity(), 15 | .position = Vector3::Zero(), 16 | .frustum = Frustum{} 17 | }; 18 | } 19 | 20 | const auto transform = registry->Get(m_mainCamera->ParentEntity()); 21 | m_mainCamera->UpdateViewMatrix(transform->TransformationMatrix()); 22 | 23 | return CameraState 24 | { 25 | .view = m_mainCamera->ViewMatrix(), 26 | .projection = m_mainCamera->ProjectionMatrix(), 27 | .position = transform->Position(), 28 | .frustum = m_mainCamera->CalculateFrustum() 29 | }; 30 | } 31 | } // namespace nc::graphics 32 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/CameraSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "DirectXMath.h" 4 | #include "ncmath/Geometry.h" 5 | #include "ncmath/Vector.h" 6 | 7 | namespace nc 8 | { 9 | class Registry; 10 | 11 | namespace graphics 12 | { 13 | class Camera; 14 | 15 | struct CameraState 16 | { 17 | DirectX::XMMATRIX view; 18 | DirectX::XMMATRIX projection; 19 | Vector3 position; 20 | Frustum frustum; 21 | }; 22 | 23 | class CameraSystem final 24 | { 25 | public: 26 | void Set(Camera* camera) noexcept 27 | { 28 | m_mainCamera = camera; 29 | } 30 | 31 | auto Get() noexcept -> Camera* 32 | { 33 | return m_mainCamera; 34 | } 35 | 36 | void Clear() noexcept 37 | { 38 | m_mainCamera = nullptr; 39 | } 40 | 41 | auto Execute(Registry* registry) -> CameraState; 42 | 43 | private: 44 | Camera* m_mainCamera = nullptr; 45 | }; 46 | } // namespace graphics 47 | } // namespace nc 48 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/UISystem.cpp: -------------------------------------------------------------------------------- 1 | #include "UISystem.h" 2 | #include "ui/IUI.h" 3 | #include "ui/editor/Editor.h" 4 | 5 | namespace nc::graphics 6 | { 7 | UISystem::UISystem(ecs::Ecs world, ModuleProvider modules, SystemEvents& events) 8 | : m_editor{ui::editor::BuildEditor(world, modules, events)} 9 | { 10 | } 11 | 12 | UISystem::~UISystem() noexcept = default; 13 | 14 | auto UISystem::IsHovered() const noexcept -> bool 15 | { 16 | return m_clientUI ? m_clientUI->IsHovered() : false; 17 | } 18 | 19 | void UISystem::SetClientUI(ui::IUI* ui) noexcept 20 | { 21 | m_clientUI = ui; 22 | } 23 | 24 | void UISystem::Execute(ecs::Ecs world) 25 | { 26 | m_editor->Draw(world); 27 | 28 | if (m_clientUI) 29 | { 30 | m_clientUI->Draw(); 31 | } 32 | } 33 | } // nc::graphics 34 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/UISystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Ecs.h" 4 | #include "ncengine/module/ModuleProvider.h" 5 | 6 | #include 7 | 8 | namespace nc 9 | { 10 | struct SystemEvents; 11 | 12 | namespace asset 13 | { 14 | class NcAsset; 15 | } // namespace asset 16 | 17 | namespace ui 18 | { 19 | class IUI; 20 | 21 | namespace editor 22 | { 23 | class Editor; 24 | } // namespace editor 25 | } // namespace ui 26 | 27 | namespace graphics 28 | { 29 | class UISystem 30 | { 31 | public: 32 | UISystem(ecs::Ecs world, ModuleProvider modules, SystemEvents& events); 33 | ~UISystem() noexcept; 34 | 35 | auto IsHovered() const noexcept -> bool; 36 | void SetClientUI(ui::IUI* ui) noexcept; 37 | void Execute(ecs::Ecs world); 38 | 39 | private: 40 | std::unique_ptr m_editor; 41 | ui::IUI* m_clientUI = nullptr; 42 | }; 43 | } // namespace graphics 44 | } // namespace nc 45 | -------------------------------------------------------------------------------- /source/ncengine/graphics/system/WidgetSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/EcsFwd.h" 4 | #include "ncengine/asset/AssetViews.h" 5 | 6 | #include "DirectXMath.h" 7 | 8 | #include 9 | 10 | namespace nc 11 | { 12 | class Transform; 13 | class RigidBody; 14 | 15 | namespace graphics 16 | { 17 | class MeshRenderer; 18 | class ToonRenderer; 19 | struct WireframeRenderer; 20 | 21 | struct WireframeRenderState 22 | { 23 | DirectX::XMMATRIX matrix; 24 | asset::MeshView mesh; 25 | Vector4 color; 26 | }; 27 | 28 | struct WidgetState 29 | { 30 | std::vector wireframeData; 31 | }; 32 | 33 | class WidgetSystem 34 | { 35 | public: 36 | auto Execute(ecs::ExplicitEcs worldView) -> WidgetState; 41 | }; 42 | } // namespace graphics 43 | } // namespace nc 44 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Camera.cpp 4 | GraphicsUtility.cpp 5 | Material.cpp 6 | Mesh.cpp 7 | NcGraphicsImpl2.cpp 8 | ParticleEmitter.cpp 9 | PostProcess.cpp 10 | SceneNavigationCamera.cpp 11 | SkeletalAnimationController.cpp 12 | ) 13 | 14 | add_subdirectory(diligent) 15 | add_subdirectory(frontend) 16 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (WIN32) 2 | target_sources(${NC_ENGINE_LIB} 3 | PRIVATE 4 | NativeWindowWin32.cpp 5 | ) 6 | elseif (UNIX AND NOT APPLE) 7 | target_sources(${NC_ENGINE_LIB} 8 | PRIVATE 9 | NativeWindowLinux.cpp 10 | ) 11 | endif() 12 | 13 | target_sources(${NC_ENGINE_LIB} 14 | PRIVATE 15 | DiligentEngine.cpp 16 | ImGuiImplGLFW.cpp 17 | ShaderFactory.cpp 18 | UIBackend.cpp 19 | ) 20 | 21 | add_subdirectory(pass) 22 | add_subdirectory(resource) 23 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/ImGuiImplGLFW.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImGuiImplDiligent.hpp" 4 | 5 | #include 6 | 7 | struct GLFWwindow; 8 | 9 | namespace nc::graphics 10 | { 11 | class ImGuiImplGLFW final : public Diligent::ImGuiImplDiligent 12 | { 13 | public: 14 | ImGuiImplGLFW(Diligent::IRenderDevice& device, 15 | const Diligent::SwapChainDesc& swapChainDesc, 16 | GLFWwindow* window); 17 | 18 | ~ImGuiImplGLFW() noexcept; 19 | 20 | void NewFrame(Diligent::Uint32 RenderSurfaceWidth, 21 | Diligent::Uint32 RenderSurfaceHeight, 22 | Diligent::SURFACE_TRANSFORM SurfacePreTransform) override final; 23 | }; 24 | } // namespace nc::graphics 25 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/NativeWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Platforms/interface/NativeWindow.h" 4 | 5 | struct GLFWwindow; 6 | 7 | namespace nc::graphics 8 | { 9 | auto GetNativeWindow(GLFWwindow* window) -> Diligent::NativeWindow; 10 | } // namespace nc::graphics 11 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/NativeWindowLinux.cpp: -------------------------------------------------------------------------------- 1 | #include "NativeWindow.h" 2 | 3 | #include "ncutility/NcError.h" 4 | 5 | #define GLFW_EXPOSE_NATIVE_X11 1 6 | 7 | #include "GLFW/glfw3.h" 8 | #include "GLFW/glfw3native.h" 9 | 10 | namespace nc::graphics 11 | { 12 | auto GetNativeWindow(GLFWwindow* window) -> Diligent::NativeWindow 13 | { 14 | auto x11Handle = glfwGetX11Window(window); 15 | auto x11Display = glfwGetX11Display(); 16 | NC_ASSERT(x11Handle, "Error getting the X11 window handle."); 17 | NC_ASSERT(x11Display, "Error getting the X11 display from the GLFW window."); 18 | return Diligent::LinuxNativeWindow{ 19 | static_cast(x11Handle), 20 | x11Display, 21 | nullptr 22 | }; 23 | } 24 | } // namespace nc::graphics 25 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/NativeWindowWin32.cpp: -------------------------------------------------------------------------------- 1 | #include "NativeWindow.h" 2 | 3 | #include "ncutility/NcError.h" 4 | 5 | #define GLFW_EXPOSE_NATIVE_WIN32 1 6 | #ifdef GetObject 7 | #undef GetObject 8 | #endif 9 | #ifdef CreateWindow 10 | #undef CreateWindow 11 | #endif 12 | 13 | #include "GLFW/glfw3.h" 14 | #include "GLFW/glfw3native.h" 15 | 16 | namespace nc::graphics 17 | { 18 | auto GetNativeWindow(GLFWwindow* window) -> Diligent::NativeWindow 19 | { 20 | auto glfwWindowHandle = glfwGetWin32Window(window); 21 | NC_ASSERT(glfwWindowHandle, "Error getting the Win32 window handle from the GLFW window."); 22 | return Diligent::Win32NativeWindow{glfwWindowHandle}; 23 | } 24 | } // namespace nc::graphics 25 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/UIBackend.cpp: -------------------------------------------------------------------------------- 1 | #include "UIBackend.h" 2 | 3 | namespace nc::graphics 4 | { 5 | UIBackend::UIBackend(Diligent::IRenderDevice& device, 6 | const Diligent::SwapChainDesc& swapChainDesc, 7 | GLFWwindow* window, 8 | Signal<>& onFontUpdate) 9 | : m_imguiBackend{device, swapChainDesc, window}, 10 | m_fontConnetion{onFontUpdate.Connect(this, &UIBackend::OnFontUpdate)} 11 | { 12 | } 13 | 14 | void UIBackend::FrameBegin(Diligent::ISwapChain& swapChain) 15 | { 16 | const auto& scDesc = swapChain.GetDesc(); 17 | m_imguiBackend.NewFrame(scDesc.Width, scDesc.Height, scDesc.PreTransform); 18 | } 19 | 20 | void UIBackend::Render(Diligent::IDeviceContext& context) 21 | { 22 | m_imguiBackend.Render(&context); 23 | } 24 | 25 | void UIBackend::OnFontUpdate() 26 | { 27 | m_imguiBackend.UpdateFontsTexture(); 28 | } 29 | } // namespace nc::graphics 30 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/UIBackend.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImGuiImplGLFW.h" 4 | 5 | #include "ncengine/utility/Signal.h" 6 | 7 | #include "Graphics/GraphicsEngine/interface/SwapChain.h" 8 | 9 | namespace nc::graphics 10 | { 11 | class UIBackend 12 | { 13 | public: 14 | UIBackend(Diligent::IRenderDevice& device, 15 | const Diligent::SwapChainDesc& swapChainDesc, 16 | GLFWwindow* window, 17 | Signal<>& onFontUpdate); 18 | 19 | void FrameBegin(Diligent::ISwapChain& swapChain); 20 | void Render(Diligent::IDeviceContext& context); 21 | 22 | private: 23 | ImGuiImplGLFW m_imguiBackend; 24 | Connection m_fontConnetion; 25 | 26 | void OnFontUpdate(); 27 | }; 28 | } // namespace nc::graphics 29 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | MaterialPass.cpp 4 | ParticlePass.cpp 5 | Pass.cpp 6 | PassBackend.cpp 7 | PassManifest.cpp 8 | PassUtilities.cpp 9 | PipelineShaders.cpp 10 | PostProcessPass.cpp 11 | SkyboxPass.cpp 12 | WireframePass.cpp 13 | ) 14 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/MaterialPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Pass.h" 4 | #include "PassManifest.h" 5 | #include "ncengine/graphics/Material.h" 6 | 7 | #include "Common/interface/RefCntAutoPtr.hpp" 8 | #include "Graphics/GraphicsEngine/interface/RenderDevice.h" 9 | #include "Graphics/GraphicsEngine/interface/DeviceContext.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace nc::graphics 15 | { 16 | class ShaderBindings; 17 | 18 | struct MaterialPass : public Pass 19 | { 20 | explicit MaterialPass(Diligent::IRenderDevice& device, 21 | const PipelineShaders& shaders, 22 | ShaderBindings& shaderBindings, 23 | const PassManifest& passManifest, 24 | const PassDesc& passDesc, 25 | uint32_t numSamples); 26 | MaterialPassFlag::type flag; 27 | bool isMsaa; 28 | }; 29 | } // namespace nc::graphics 30 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/ParticlePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Pass.h" 4 | #include "PassManifest.h" 5 | 6 | #include "Common/interface/RefCntAutoPtr.hpp" 7 | #include "Graphics/GraphicsEngine/interface/RenderDevice.h" 8 | #include "Graphics/GraphicsEngine/interface/DeviceContext.h" 9 | 10 | namespace nc::graphics 11 | { 12 | class ShaderBindings; 13 | class ShaderFactory; 14 | 15 | struct ParticlePass : public Pass 16 | { 17 | explicit ParticlePass(Diligent::IRenderDevice& device, 18 | const PipelineShaders& shaders, 19 | ShaderBindings& shaderBindings, 20 | const PassManifest& passManifest, 21 | const PassDesc& passDesc, 22 | uint32_t numSamples); 23 | bool isMsaa; 24 | }; 25 | } // namespace nc::graphics 26 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/Pass.cpp: -------------------------------------------------------------------------------- 1 | #include "Pass.h" 2 | 3 | #include "ncutility/NcError.h" 4 | 5 | namespace nc::graphics 6 | { 7 | Pass::Pass(Diligent::RefCntAutoPtr pso_, 8 | Sinks sinks_, 9 | Sources sources_) 10 | : pso{std::move(pso_)}, 11 | sinks{std::move(sinks_)}, 12 | sources{std::move(sources_)} 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/Pass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PassTypes.h" 4 | 5 | #include "Common/interface/RefCntAutoPtr.hpp" 6 | #include "Graphics/GraphicsEngine/interface/RenderDevice.h" 7 | #include "Graphics/GraphicsEngine/interface/DeviceContext.h" 8 | 9 | namespace nc::graphics 10 | { 11 | struct Pass 12 | { 13 | explicit Pass(Diligent::RefCntAutoPtr pso_, 14 | Sinks sinks_, 15 | Sources sources_); 16 | Diligent::RefCntAutoPtr pso; 17 | Sinks sinks; 18 | Sources sources; 19 | }; 20 | } -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/SkyboxPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Pass.h" 4 | #include "PassManifest.h" 5 | #include "ncengine/graphics/Material.h" 6 | 7 | #include "Common/interface/RefCntAutoPtr.hpp" 8 | #include "Graphics/GraphicsEngine/interface/RenderDevice.h" 9 | #include "Graphics/GraphicsEngine/interface/DeviceContext.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace nc::graphics 15 | { 16 | class ShaderBindings; 17 | class ShaderFactory; 18 | 19 | struct SkyboxPass : public Pass 20 | { 21 | explicit SkyboxPass(Diligent::IRenderDevice& device, 22 | const PipelineShaders& shaders, 23 | ShaderBindings& shaderBindings, 24 | const PassManifest& passManifest, 25 | const PassDesc& passDesc); 26 | }; 27 | } // namespace nc::graphics 28 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/pass/WireframePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/frontend/subsystem/WireframeRendererState.h" 4 | #include "Pass.h" 5 | #include "PassManifest.h" 6 | 7 | #include "Common/interface/RefCntAutoPtr.hpp" 8 | #include "Graphics/GraphicsEngine/interface/RenderDevice.h" 9 | #include "Graphics/GraphicsEngine/interface/DeviceContext.h" 10 | 11 | namespace nc::graphics 12 | { 13 | class ShaderBindings; 14 | class ShaderFactory; 15 | class WireframeBufferResource; 16 | 17 | struct WireframePass : public Pass 18 | { 19 | explicit WireframePass(Diligent::IRenderDevice& device, 20 | const PipelineShaders& shaders, 21 | ShaderBindings& shaderBindings, 22 | const PassManifest& passManifest, 23 | const PassDesc& passDesc, 24 | uint32_t numSamples = 1u); 25 | WireframeBufferResource* buffer; 26 | bool isMsaa; 27 | }; 28 | } // namespace nc::graphics 29 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/resource/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CubeMapBufferResource.cpp 4 | CubeSinkBufferResource.cpp 5 | EnvironmentBufferResource.cpp 6 | MeshBuffer.cpp 7 | PerFrameResourceSignature.cpp 8 | PerPassResourceSignature.cpp 9 | PostProcessPropertyBufferResource.cpp 10 | ResourceTypes.cpp 11 | ShaderBindings.cpp 12 | SinkBufferResource.cpp 13 | SinkIndexBufferResource.cpp 14 | TextureBufferResource.cpp 15 | WireframeBufferResource.cpp 16 | ) 17 | 18 | add_subdirectory(base) 19 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/resource/WireframeBufferResource.cpp: -------------------------------------------------------------------------------- 1 | #include "WireframeBufferResource.h" 2 | 3 | namespace nc::graphics 4 | { 5 | WireframeBufferResource::WireframeBufferResource(Diligent::IDeviceContext& context, 6 | Diligent::IRenderDevice& device, 7 | Diligent::IShaderResourceVariable& variable) 8 | : m_buffer{ 9 | context, 10 | device, 11 | WireframeData{}, 12 | "WireframeDataUniformBuffer" 13 | }, 14 | m_variable{&variable} 15 | { 16 | m_variable->Set(&m_buffer.GetBuffer()); 17 | } 18 | 19 | void WireframeBufferResource::Update(Diligent::IDeviceContext& context, 20 | const WireframeData& data) 21 | { 22 | m_buffer.Write(context, data); 23 | } 24 | } // namespace nc::graphics 25 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/resource/WireframeBufferResource.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "base/DynamicUniformBuffer.h" 4 | #include "graphics2/ShaderTypes.h" 5 | 6 | namespace nc::graphics 7 | { 8 | class WireframeBufferResource 9 | { 10 | public: 11 | explicit WireframeBufferResource(Diligent::IDeviceContext& context, 12 | Diligent::IRenderDevice& device, 13 | Diligent::IShaderResourceVariable& variable); 14 | 15 | void Update(Diligent::IDeviceContext& context, 16 | const WireframeData& data); 17 | 18 | private: 19 | DynamicUniformBuffer m_buffer; 20 | Diligent::IShaderResourceVariable* m_variable; 21 | }; 22 | } // namespace nc::graphics 23 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/diligent/resource/base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | StructuredBuffer.cpp 4 | DynamicUniformBuffer.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | GraphicsFrontend.cpp 4 | ) 5 | 6 | add_subdirectory(subsystem) 7 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/FrontendRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "subsystem/animation/SkeletalAnimationRenderState.h" 4 | #include "subsystem/CameraRenderState.h" 5 | #include "subsystem/EnvironmentRenderState.h" 6 | #include "subsystem/LightRenderState.h" 7 | #include "subsystem/MeshRenderState.h" 8 | #include "subsystem/particle/ParticleRenderState.h" 9 | #include "subsystem/PostProcessState.h" 10 | #include "subsystem/WireframeRendererState.h" 11 | 12 | namespace nc::graphics 13 | { 14 | struct FrontendRenderState 15 | { 16 | CameraRenderState cameraState; 17 | EnvironmentRenderState environmentRenderState; 18 | MeshRenderState meshRenderState; 19 | SkeletalAnimationRenderState animationRenderState; 20 | BufferUpdateInfo materialRenderState; 21 | ParticleRenderState particleRenderState; 22 | LightRenderState lightRenderState; 23 | PostProcessState postProcessState; 24 | WireframeRendererRenderState wireframeRenderState; 25 | }; 26 | } // namespace nc::graphics 27 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/GraphicsFrontend.cpp: -------------------------------------------------------------------------------- 1 | #include "GraphicsFrontend.h" 2 | #include "FrontendRenderState.h" 3 | #include "ncengine/ecs/Ecs.h" 4 | 5 | namespace nc::graphics 6 | { 7 | auto GraphicsFrontend::BuildRenderState(ecs::Ecs world) -> FrontendRenderState 8 | { 9 | return FrontendRenderState{ 10 | .cameraState = m_cameraSystem.BuildState(world), 11 | .environmentRenderState = m_environmentSystem.BuildState(), 12 | .meshRenderState = m_meshSystem.BuildState(world), 13 | .animationRenderState = m_animationSystem.BuildState(), 14 | .materialRenderState = m_materialRegistry.BuildState(), 15 | .particleRenderState = m_particleSystem.BuildState(), 16 | .lightRenderState = m_lightSubsystem.BuildState(world), 17 | .postProcessState = m_postProcessSystem.BuildState(), 18 | .wireframeRenderState = m_wireframeSystem.BuildState(world) 19 | }; 20 | } 21 | } // namespace nc::graphics 22 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CameraSubsystem.cpp 4 | LightSubsystem.cpp 5 | MaterialRegistry.cpp 6 | MeshSubsystem.cpp 7 | PostProcessSubsystem.cpp 8 | TransformCache.cpp 9 | UISubsystem.cpp 10 | WireframeRendererSubsystem.cpp 11 | ) 12 | 13 | add_subdirectory(animation) 14 | add_subdirectory(particle) 15 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/CameraRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "DirectXMath.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct CameraRenderState 8 | { 9 | DirectX::XMMATRIX viewProjection = DirectX::XMMatrixIdentity(); 10 | DirectX::XMMATRIX invProjection = DirectX::XMMatrixIdentity(); 11 | Vector3 position = Vector3::Zero(); 12 | float nearClip = 0.1f; 13 | float farClip = 400.0f; 14 | }; 15 | } // namespace nc::graphics 16 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/CameraSubsystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ncengine/ecs/EcsFwd.h" 3 | 4 | namespace nc 5 | { 6 | class Camera; 7 | class Transform; 8 | 9 | namespace graphics 10 | { 11 | struct CameraRenderState; 12 | 13 | class CameraSubsystem final 14 | { 15 | public: 16 | void Set(Camera* camera) noexcept 17 | { 18 | m_mainCamera = camera; 19 | } 20 | auto Get() noexcept -> Camera* 21 | { 22 | return m_mainCamera; 23 | } 24 | void Clear() noexcept 25 | { 26 | m_mainCamera = nullptr; 27 | } 28 | auto BuildState(ecs::ExplicitEcs ecs) -> CameraRenderState; 29 | 30 | private: 31 | Camera* m_mainCamera = nullptr; 32 | }; 33 | } // namespace graphics 34 | } // namespace nc 35 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/EnvironmentRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/asset/AssetViews.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct EnvironmentRenderState 8 | { 9 | uint32_t skyboxIndex = 0u; 10 | uint32_t useSkybox = 0u; 11 | }; 12 | } // namespace nc::graphics 13 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/LightRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/ShaderTypes.h" 4 | 5 | #include 6 | 7 | namespace nc::graphics 8 | { 9 | struct LightRenderState 10 | { 11 | std::span lights; 12 | std::span lightMatrices; 13 | }; 14 | } // namespace nc::graphics 15 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/LightSubsystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "LightRenderState.h" 4 | 5 | #include "graphics2/ShaderTypes.h" 6 | 7 | #include "ncengine/ecs/EcsFwd.h" 8 | 9 | #include 10 | 11 | namespace nc 12 | { 13 | struct DirectionalLight; 14 | struct PointLight; 15 | struct SpotLight; 16 | class Transform; 17 | 18 | namespace graphics 19 | { 20 | class LightSubsystem 21 | { 22 | public: 23 | auto BuildState(ecs::ExplicitEcs ecs) -> LightRenderState; 24 | void OnBeforeSceneLoad(const nc::Vector3& extents); 25 | 26 | private: 27 | std::vector m_lightData; 28 | std::vector m_lightMatrixData; 29 | DirectX::XMMATRIX m_directionalLightProjection; 30 | DirectX::XMMATRIX m_pointLightProjection; 31 | float m_sceneExtentY; 32 | }; 33 | } // namespace graphics 34 | } // namespace nc 35 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/MeshRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/ShaderTypes.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct Batch 8 | { 9 | explicit Batch(uint32_t instanceIndex, const asset::MeshView& mesh) 10 | : firstInstance{instanceIndex}, 11 | instanceCount{0}, 12 | firstIndex{mesh.firstIndex}, 13 | indexCount{mesh.indexCount}, 14 | vertexOffset{mesh.firstVertex} 15 | { 16 | } 17 | 18 | uint32_t firstInstance; 19 | uint32_t instanceCount; 20 | uint32_t firstIndex; 21 | uint32_t indexCount; 22 | uint32_t vertexOffset; 23 | }; 24 | 25 | struct MeshRenderState 26 | { 27 | BufferUpdateInfo transformData; 28 | BufferUpdateInfo staticMeshInstanceData; 29 | BufferUpdateInfo skinnedMeshInstanceData; 30 | std::vector> staticMeshBatches; 31 | std::vector> skinnedMeshBatches; 32 | }; 33 | } // namespace nc::graphics 34 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/PostProcessState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/graphics/PostProcess.h" 4 | 5 | #include 6 | 7 | namespace nc::graphics 8 | { 9 | struct PostProcessToggle 10 | { 11 | PostProcessEffectId effectId = NullPostProcessEffectId; 12 | PostProcessEffectPassFlags passes = PostProcessPassFlag::None; 13 | bool enabled = false; 14 | }; 15 | 16 | struct PostProcessPropertyUpdate 17 | { 18 | PostProcessEffectId effectId = NullPostProcessEffectId; 19 | PostProcessPassFlag::type pass = PostProcessPassFlag::None; 20 | PostProcessPassProperties properties = EmptyPassProperties{}; 21 | }; 22 | 23 | struct PostProcessState 24 | { 25 | std::vector toggledEffects; 26 | std::vector modifiedProperties; 27 | }; 28 | } // namespace nc::graphics 29 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/UISubsystem.cpp: -------------------------------------------------------------------------------- 1 | #include "UISubsystem.h" 2 | 3 | #include "ncengine/ui/IUI.h" 4 | #include "ncengine/ui/editor/Editor.h" 5 | 6 | namespace nc::graphics 7 | { 8 | UISubsystem::UISubsystem(ecs::Ecs world, 9 | ModuleProvider modules, 10 | SystemEvents& events) 11 | : m_editor{ui::editor::BuildEditor(world, modules, events)} 12 | { 13 | } 14 | 15 | UISubsystem::~UISubsystem() noexcept = default; 16 | 17 | auto UISubsystem::IsHovered() const noexcept -> bool 18 | { 19 | return m_clientUI ? m_clientUI->IsHovered() : false; 20 | } 21 | 22 | void UISubsystem::SetClientUI(ui::IUI* ui) noexcept 23 | { 24 | m_clientUI = ui; 25 | } 26 | 27 | void UISubsystem::UpdateUI(ecs::Ecs world) 28 | { 29 | m_editor->Draw(world); 30 | if (m_clientUI) 31 | { 32 | m_clientUI->Draw(); 33 | } 34 | } 35 | } // namespace nc::graphics 36 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/UISubsystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Ecs.h" 4 | #include "ncengine/module/ModuleProvider.h" 5 | 6 | namespace nc 7 | { 8 | struct SystemEvents; 9 | 10 | namespace ui 11 | { 12 | class IUI; 13 | 14 | namespace editor 15 | { 16 | class Editor; 17 | } // namespace editor 18 | } // namespace ui 19 | 20 | namespace graphics 21 | { 22 | class UISubsystem 23 | { 24 | public: 25 | UISubsystem(ecs::Ecs world, 26 | ModuleProvider modules, 27 | SystemEvents& events); 28 | 29 | ~UISubsystem() noexcept; 30 | 31 | auto IsHovered() const noexcept -> bool; 32 | void SetClientUI(ui::IUI* ui) noexcept; 33 | void UpdateUI(ecs::Ecs world); 34 | 35 | private: 36 | std::unique_ptr m_editor; 37 | ui::IUI* m_clientUI = nullptr; 38 | }; 39 | } // namespace graphics 40 | } // namespace nc 41 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/WireframeRendererState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/ShaderTypes.h" 4 | #include "ncengine/asset/AssetViews.h" 5 | 6 | #include "DirectXMath.h" 7 | 8 | #include 9 | 10 | namespace nc::graphics 11 | { 12 | struct WireframeInstanceState 13 | { 14 | WireframeData data; 15 | asset::MeshView mesh; 16 | }; 17 | 18 | struct WireframeRendererRenderState 19 | { 20 | std::vector wireframeData; 21 | }; 22 | } // namespace nc::graphics 23 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/WireframeRendererSubsystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "WireframeRendererState.h" 4 | 5 | #include "ncengine/ecs/EcsFwd.h" 6 | 7 | namespace nc 8 | { 9 | class StaticMesh; 10 | class Transform; 11 | class RigidBody; 12 | struct WireframeRenderer; 13 | 14 | namespace graphics 15 | { 16 | class WireframeRendererSubsystem 17 | { 18 | public: 19 | auto BuildState(ecs::ExplicitEcs worldView) -> WireframeRendererRenderState; 23 | }; 24 | } // namespace graphics 25 | } // namespace nc 26 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/animation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AnimationStateOrchestrator.cpp 4 | BoneCache.cpp 5 | Rig.cpp 6 | SkeletalAnimationCalculator.cpp 7 | SkeletalAnimationSubsystem.cpp 8 | SkeletalAnimationStorage.cpp 9 | ) 10 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/animation/Rig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/Assets.h" 4 | 5 | #include "DirectXMath.h" 6 | 7 | #include 8 | #include 9 | 10 | namespace nc::graphics 11 | { 12 | // Used to traverse the flattened offsets tree. 13 | struct OffsetChildren 14 | { 15 | uint32_t indexOfFirstChild; 16 | uint32_t numChildren; 17 | }; 18 | 19 | // An SoA representation of nc::asset::BonesData. 20 | struct Rig 21 | { 22 | explicit Rig(const nc::asset::BonesData& bonesData); 23 | 24 | std::vector vertexToBone; 25 | std::vector boneToParent; 26 | DirectX::XMMATRIX globalInverseTransform; 27 | std::vector boneNames; 28 | std::vector offsetChildren; 29 | std::vector offsetsMap; 30 | }; 31 | } // namespace nc::graphics 32 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/animation/SkeletalAnimationRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/ShaderTypes.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct SkeletalAnimationRenderState 8 | { 9 | BufferUpdateInfo boneData; 10 | }; 11 | } // namespace nc::graphics 12 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/particle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | EmitterState.cpp 4 | ParticleSubsystem.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/graphics2/frontend/subsystem/particle/ParticleRenderState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics2/ShaderTypes.h" 4 | 5 | namespace nc::graphics 6 | { 7 | struct ParticleRenderState 8 | { 9 | BufferUpdateInfo particleData; 10 | asset::MeshView mesh; 11 | }; 12 | } // namespace nc::graphics 13 | -------------------------------------------------------------------------------- /source/ncengine/input/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | Input.cpp 4 | ) -------------------------------------------------------------------------------- /source/ncengine/input/InputInternal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "input/Input.h" 4 | 5 | struct GLFWwindow; 6 | 7 | namespace nc::input 8 | { 9 | struct InputItem 10 | { 11 | KeyCode_t keyCode; 12 | int action; 13 | 14 | InputItem(KeyCode_t kCode, int kAction) : keyCode(kCode), action(kAction) {} 15 | }; 16 | 17 | void UpdateMousePosition(int mouseX, int mouseY); 18 | void SetMouseWheel(int yOffset); 19 | void AddKeyToQueue(KeyCode_t keyCode, int action); 20 | void ResetMouseState(); 21 | void Flush(); 22 | } -------------------------------------------------------------------------------- /source/ncengine/physics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CollisionQuery.cpp 4 | Constraints.cpp 5 | EventDispatch.cpp 6 | NcPhysicsImpl.cpp 7 | PhysicsUtility.cpp 8 | RigidBody.cpp 9 | Shape.cpp 10 | Vehicle.cpp 11 | ) 12 | 13 | add_subdirectory(jolt) 14 | -------------------------------------------------------------------------------- /source/ncengine/physics/EventDispatch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/EcsFwd.h" 4 | 5 | namespace nc::physics 6 | { 7 | class ContactListener; 8 | 9 | void DispatchPhysicsEvents(ContactListener& events, ecs::Ecs world); 10 | } // namespace nc::physics 11 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/BodyFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncmath/MatrixUtilities.h" 4 | 5 | namespace JPH 6 | { 7 | class Body; 8 | class BodyInterface; 9 | } // namespace JPH 10 | 11 | namespace nc 12 | { 13 | class RigidBody; 14 | 15 | namespace physics 16 | { 17 | class ShapeFactory; 18 | 19 | struct BodyResult 20 | { 21 | JPH::Body* body = nullptr; 22 | Vector3 adjustedScale = Vector3::One(); 23 | bool wasScaleAdjusted = false; 24 | }; 25 | 26 | class BodyFactory 27 | { 28 | public: 29 | explicit BodyFactory(JPH::BodyInterface& bodyInterface, 30 | ShapeFactory& shapeFactory); 31 | 32 | auto MakeBody(const RigidBody& rigidBody, 33 | DirectX::FXMMATRIX transform) -> BodyResult; 34 | 35 | private: 36 | JPH::BodyInterface* m_interface; 37 | ShapeFactory* m_shapeFactory; 38 | }; 39 | } // namespace physics 40 | } // namespace nc 41 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | BodyFactory.cpp 4 | BodyManager.cpp 5 | CompoundShape.cpp 6 | ContactListener.cpp 7 | ConstraintFactory.cpp 8 | ConstraintManager.cpp 9 | CookedShape.cpp 10 | JoltPhysics.cpp 11 | JobSystem.cpp 12 | PhysicsSnapshot.cpp 13 | ShapeFactory.cpp 14 | SupportFunctions.cpp 15 | VehicleAnimator.cpp 16 | VehicleManager.cpp 17 | ) 18 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/CollisionQueryContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace JPH 4 | { 5 | class BodyInterface; 6 | class BodyLockInterfaceNoLock; 7 | class NarrowPhaseQuery; 8 | } // namespapce JPH 9 | 10 | namespace nc::physics 11 | { 12 | class ShapeFactory; 13 | 14 | // State needed by CollisionQuery 15 | struct CollisionQueryContext 16 | { 17 | const JPH::NarrowPhaseQuery& query; 18 | const JPH::BodyLockInterfaceNoLock& lock; 19 | ShapeFactory& shapeFactory; 20 | }; 21 | } // namespace nc::physics 22 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/CollisionQueryManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CollisionQueryContext.h" 4 | #include "physics/CollisionQueryImpl.h" 5 | 6 | #include "ncengine/type/StableAddress.h" 7 | 8 | namespace nc::physics 9 | { 10 | // Simple manager for CollisionQuery - just owns and sets the context. 11 | class CollisionQueryManager : public StableAddress 12 | { 13 | public: 14 | explicit CollisionQueryManager(const JPH::NarrowPhaseQuery& query, 15 | const JPH::BodyLockInterfaceNoLock& lock, 16 | ShapeFactory& shapeFactory) 17 | : m_ctx{query, lock, shapeFactory} 18 | { 19 | CollisionQueryImpl::SetContext(&m_ctx); 20 | } 21 | 22 | private: 23 | CollisionQueryContext m_ctx; 24 | }; 25 | } // namespace nc::physics 26 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/ComponentContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ConstraintManager.h" 4 | #include "ShapeFactory.h" 5 | #include "VehicleManager.h" 6 | 7 | #include "Jolt/Jolt.h" 8 | #include "Jolt/Physics/Body/BodyInterface.h" 9 | 10 | namespace nc::physics 11 | { 12 | struct ComponentContext 13 | { 14 | JPH::BodyInterface& interface; 15 | ShapeFactory& shapeFactory; 16 | ConstraintManager& constraintManager; 17 | VehicleManager& vehicleManager; 18 | }; 19 | } // namespace nc::physics 20 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/JobSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/task/TaskFwd.h" 4 | 5 | #include 6 | 7 | namespace JPH 8 | { 9 | class JobSystem; 10 | } // namespace JPH 11 | 12 | namespace nc::physics 13 | { 14 | auto BuildJobSystem(const task::AsyncDispatcher& dispatcher) -> std::unique_ptr; 15 | } // namespace nc::physics 16 | -------------------------------------------------------------------------------- /source/ncengine/physics/jolt/VehicleAnimator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Transform.h" 4 | #include "ncengine/ecs/ComponentPool.h" 5 | #include "ncengine/physics/Vehicle.h" 6 | 7 | namespace JPH 8 | { 9 | class VehicleConstraint; 10 | } // namespace JPH 11 | 12 | namespace nc::physics 13 | { 14 | void AnimateVehicle(std::span assemblies, 15 | const JPH::VehicleConstraint& constraint, 16 | ecs::ComponentPool& transformPool); 17 | 18 | void AnimateVehicle(std::span assemblies, 19 | const JPH::VehicleConstraint& constraint, 20 | ecs::ComponentPool& transformPool, 21 | float lerpFactor); 22 | } // namespace nc::physics 23 | -------------------------------------------------------------------------------- /source/ncengine/scene/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | NcSceneImpl.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /source/ncengine/scene/NcSceneImpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/scene/NcScene.h" 4 | 5 | #include 6 | 7 | namespace nc 8 | { 9 | class SceneManager : public NcScene 10 | { 11 | public: 12 | auto Queue(std::unique_ptr scene) noexcept -> size_t override; 13 | void DequeueScene(size_t queuePosition) override; 14 | auto GetNumberOfScenesInQueue() const noexcept -> size_t override; 15 | void ScheduleTransition() noexcept override; 16 | auto IsTransitionScheduled() const noexcept -> bool override; 17 | auto UnloadActiveScene() -> bool override; 18 | auto LoadQueuedScene(ecs::Ecs world, ModuleRegistry& modules) -> bool override; 19 | private: 20 | std::unique_ptr m_activeScene; 21 | std::vector> m_sceneQueue; 22 | bool m_transitionScheduled = false; 23 | }; 24 | } // namespace nc 25 | -------------------------------------------------------------------------------- /source/ncengine/serialize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | ComponentSerialization.cpp 4 | EntitySerializationUtility.cpp 5 | SceneSerialization.cpp 6 | ) 7 | -------------------------------------------------------------------------------- /source/ncengine/service/ServiceLocator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncutility/NcError.h" 4 | 5 | namespace nc 6 | { 7 | template 8 | class ServiceLocator 9 | { 10 | public: 11 | using service_type = Service; 12 | 13 | static void Register(service_type* service) 14 | { 15 | m_service = service; 16 | } 17 | 18 | static auto Get() -> service_type* 19 | { 20 | if(!m_service) 21 | throw NcError("No service registered"); 22 | 23 | return m_service; 24 | } 25 | 26 | private: 27 | inline static service_type* m_service = nullptr; 28 | }; 29 | } -------------------------------------------------------------------------------- /source/ncengine/task/AsyncDispatcher.cpp: -------------------------------------------------------------------------------- 1 | #include "ncengine/task/AsyncDispatcher.h" 2 | 3 | // ODR paranoia - AsyncDispatcher is defined in tests to avoid taking a dependency on taskflow and setting up an 4 | // executor. Those cases shall shall use the pragma below with an alternative value to force link failures if this 5 | // implementation is accidentally linked in. 6 | #ifdef _MSC_VER 7 | #pragma detect_mismatch("AsyncDispatcher", "Implementation") 8 | #endif 9 | 10 | namespace nc::task 11 | { 12 | AsyncDispatcher::AsyncDispatcher(tf::Executor* executor) 13 | : m_executor{executor} 14 | { 15 | } 16 | } // namespace nc::task 17 | -------------------------------------------------------------------------------- /source/ncengine/task/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AsyncDispatcher.cpp 4 | Executor.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | TimeImpl.cpp 4 | ) -------------------------------------------------------------------------------- /source/ncengine/time/TimeImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "TimeImpl.h" 2 | #include "time/Time.h" 3 | 4 | namespace 5 | { 6 | float g_dt = 0.0f; 7 | } 8 | 9 | namespace nc::time 10 | { 11 | /** From time/Time.h */ 12 | auto DeltaTime() noexcept -> float 13 | { 14 | return g_dt; 15 | } 16 | 17 | void SetDeltaTime(float dt) noexcept 18 | { 19 | g_dt = dt; 20 | } 21 | } // namespace nc::time 22 | -------------------------------------------------------------------------------- /source/ncengine/time/TimeImpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nc::time 4 | { 5 | void SetDeltaTime(float dt) noexcept; 6 | } // namespace nc::time 7 | -------------------------------------------------------------------------------- /source/ncengine/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | ImGuiStyle.cpp 4 | UIElement.cpp 5 | UIPosition.cpp 6 | ) 7 | 8 | add_subdirectory(editor) 9 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # TODO: #465 Add CMake option for NC_EDITOR_ENABLED 2 | if (NC_PROD_BUILD) 3 | add_subdirectory(stub) 4 | else() 5 | add_subdirectory(impl) 6 | endif() 7 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | ComponentWidgets.cpp 4 | EditorCamera.cpp 5 | EditorImpl.cpp 6 | EditorUI.cpp 7 | SandboxScene.cpp 8 | ) 9 | 10 | add_subdirectory(assets) 11 | add_subdirectory(windows) 12 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/EditorCamera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncengine/ecs/Component.h" 4 | #include "ncengine/ecs/EcsFwd.h" 5 | #include "ncengine/module/ModuleProvider.h" 6 | #include "ncengine/input/Input.h" 7 | #include "ncengine/graphics/SceneNavigationCamera.h" 8 | 9 | namespace nc 10 | { 11 | namespace ui::editor 12 | { 13 | class EditorCamera : public SceneNavigationCamera 14 | { 15 | public: 16 | explicit EditorCamera(Entity self, ModuleProvider modules, input::KeyCode hotkey) 17 | : SceneNavigationCamera{self}, m_modules{modules}, m_hotkey{hotkey} 18 | { 19 | } 20 | 21 | void Run(Entity, ecs::Ecs world, float dt); 22 | void Enable(); 23 | void Disable(ecs::Ecs world); 24 | 25 | private: 26 | ModuleProvider m_modules; 27 | input::KeyCode m_hotkey; 28 | Entity m_handleToRestore; 29 | bool m_enabled = false; 30 | }; 31 | } // namespace ui::editor 32 | } // namespace nc 33 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/SandboxScene.cpp: -------------------------------------------------------------------------------- 1 | #include "SandboxScene.h" 2 | #include "EditorCamera.h" 3 | #include "ncengine/serialize/SceneSerialization.h" 4 | 5 | #include 6 | 7 | namespace nc::ui::editor 8 | { 9 | void SandboxScene::Load(ecs::Ecs world, ModuleProvider modules) 10 | { 11 | world.Get(m_editorCamera).Enable(); 12 | if (!m_fragmentPath.empty()) 13 | { 14 | auto file = std::ifstream{m_fragmentPath, std::ios::binary}; 15 | NC_ASSERT(file.is_open(), fmt::format("Failed to open scene fragment file '{}'", m_fragmentPath)); 16 | LoadSceneFragment(file, world, modules); 17 | return; 18 | } 19 | } 20 | } // namespace nc::ui::editor 21 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/assets/AssetWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ncasset/AssetType.h" 4 | 5 | #include 6 | #include 7 | 8 | namespace nc::ui::editor 9 | { 10 | auto GetLoadedAssets(asset::AssetType type) -> std::vector; 11 | } // namespace nc::ui::editor 12 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/assets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | AssetWrapper.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | EntityContextMenu.cpp 4 | Inspector.cpp 5 | SceneGraph.cpp 6 | ) 7 | 8 | add_subdirectory(dialogs) 9 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/EntityContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "dialogs/CreateEntityDialog.h" 4 | #include "ncengine/ecs/Ecs.h" 5 | #include "ncengine/ecs/Entity.h" 6 | 7 | namespace nc::ui::editor 8 | { 9 | auto EntityContextMenu(Entity entity, ecs::Ecs world, CreateEntityDialog& createEntityDialog) -> Entity; 10 | void ModifyComponentList(Entity entity, ecs::Ecs world); 11 | } // namespace nc::ui::editor 12 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/Inspector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ui/editor/Editor.h" 4 | #include "dialogs/CreateEntityDialog.h" 5 | #include "ncengine/ecs/Ecs.h" 6 | #include "ncengine/ecs/Entity.h" 7 | 8 | namespace nc::ui::editor 9 | { 10 | class Inspector 11 | { 12 | public: 13 | void Draw(EditorContext& ctx, CreateEntityDialog& createEntity); 14 | }; 15 | } // namespace nc::ui::editor 16 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/dialogs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | CreateEntityDialog.cpp 4 | EnvironmentDialog.cpp 5 | PostProcessDialog.cpp 6 | SceneDialogs.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/dialogs/EnvironmentDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ModalDialog.h" 4 | #include "ncengine/NcFwd.h" 5 | 6 | namespace nc 7 | { 8 | namespace asset 9 | { 10 | class NcAsset; 11 | } 12 | struct NcGraphics; 13 | 14 | namespace ui::editor 15 | { 16 | class EnvironmentDialog : public ModalDialog 17 | { 18 | static constexpr auto DialogSize = Vector2{600.0f, 400.0f}; 19 | 20 | public: 21 | explicit EnvironmentDialog() noexcept 22 | : ModalDialog{DialogSize}, m_ncAsset{}, m_ncGraphics{} {} 23 | 24 | void Open(NcGraphics* ncGraphics, asset::NcAsset* ncAsset) noexcept 25 | { 26 | m_ncAsset = ncAsset; 27 | m_ncGraphics = ncGraphics; 28 | OpenPopup(); 29 | } 30 | 31 | void Draw(const ImVec2& dimensions); 32 | 33 | private: 34 | asset::NcAsset* m_ncAsset = nullptr; 35 | NcGraphics* m_ncGraphics = nullptr; 36 | }; 37 | } // namespace ui::editor 38 | } // namespace nc 39 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/dialogs/ModalDialog.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/source/ncengine/ui/editor/impl/windows/dialogs/ModalDialog.cpp -------------------------------------------------------------------------------- /source/ncengine/ui/editor/impl/windows/dialogs/PostProcessDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ModalDialog.h" 4 | #include "ncengine/NcFwd.h" 5 | 6 | namespace nc 7 | { 8 | namespace asset 9 | { 10 | class NcAsset; 11 | } 12 | struct NcGraphics; 13 | 14 | namespace ui::editor 15 | { 16 | class PostProcessDialog : public ModalDialog 17 | { 18 | static constexpr auto DialogSize = Vector2{600.0f, 400.0f}; 19 | 20 | public: 21 | explicit PostProcessDialog() noexcept 22 | : ModalDialog{DialogSize}, m_ncAsset{}, m_ncGraphics{} {} 23 | 24 | void Open(NcGraphics* ncGraphics, asset::NcAsset* ncAsset) noexcept 25 | { 26 | m_ncAsset = ncAsset; 27 | m_ncGraphics = ncGraphics; 28 | OpenPopup(); 29 | } 30 | 31 | void Draw(const ImVec2& dimensions); 32 | 33 | private: 34 | asset::NcAsset* m_ncAsset = nullptr; 35 | NcGraphics* m_ncGraphics = nullptr; 36 | }; 37 | } // namespace ui::editor 38 | } // namespace nc 39 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/stub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | ComponentWidgetsStub.cpp 4 | EditorStub.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/ui/editor/stub/EditorStub.cpp: -------------------------------------------------------------------------------- 1 | #include "ncengine/ui/editor/Editor.h" 2 | 3 | namespace nc::ui::editor 4 | { 5 | struct EditorStub : public Editor 6 | { 7 | EditorStub(const EditorContext& ctx) 8 | : Editor{ctx} 9 | { 10 | } 11 | 12 | void Draw(ecs::Ecs) override {} 13 | }; 14 | 15 | auto BuildEditor(ecs::Ecs world, ModuleProvider modules, SystemEvents&, const EditorHotkeys& hotkeys) -> std::unique_ptr 16 | { 17 | return std::make_unique(EditorContext 18 | { 19 | .world = world, 20 | .modules = modules, 21 | .events = nullptr, 22 | .selectedEntity = Entity::Null(), 23 | .openState = OpenState::ClosePersisted, 24 | .dimensions = ImVec2{}, 25 | .objectBucket = Entity::Null(), 26 | .editorCamera = Entity::Null(), 27 | .hotkeys = hotkeys 28 | }); 29 | } 30 | } // namespace nc::ui::editor 31 | -------------------------------------------------------------------------------- /source/ncengine/utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | FileLogger.cpp 4 | Log.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /source/ncengine/utility/Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace nc 7 | { 8 | template 9 | using unique_c_ptr = std::unique_ptr; 10 | } -------------------------------------------------------------------------------- /source/ncengine/window/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${NC_ENGINE_LIB} 2 | PRIVATE 3 | NcWindowImpl.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /source/ncjolt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NcJolt STATIC 2 | JoltApi.cpp 3 | ShapeUtility.cpp 4 | ) 5 | 6 | target_compile_options(NcJolt 7 | PRIVATE 8 | ${NC_COMPILER_FLAGS} 9 | ) 10 | 11 | target_compile_definitions(NcJolt 12 | PRIVATE 13 | ${NC_COMPILE_DEFINITIONS} 14 | ) 15 | 16 | target_include_directories(NcJolt 17 | PUBLIC 18 | ${PROJECT_SOURCE_DIR}/source/ncjolt 19 | ) 20 | 21 | target_link_libraries(NcJolt 22 | PUBLIC 23 | NcMath 24 | NcUtility 25 | Jolt 26 | ) 27 | -------------------------------------------------------------------------------- /source/ncjolt/ncjolt/JoltApi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace JPH 6 | { 7 | class Factory; 8 | } // namespace JPH 9 | 10 | namespace nc::jolt 11 | { 12 | // Function type for handling Jolt asserts. Should return true to trigger breakpoint. 13 | using AssertFailedCallback = bool(*)(const char* expression, 14 | const char* message, 15 | const char* file, 16 | unsigned line); 17 | 18 | // Base Jolt initialization shared by NcEngine + NcConvert 19 | class JoltApi 20 | { 21 | public: 22 | explicit JoltApi(AssertFailedCallback assertCB = nullptr); 23 | ~JoltApi() noexcept; 24 | 25 | private: 26 | std::unique_ptr m_factory; 27 | }; 28 | } // namespace nc::jolt 29 | -------------------------------------------------------------------------------- /source/ncjolt/ncjolt/ShapeUtility.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace JPH 8 | { 9 | template 10 | class Ref; 11 | 12 | class Shape; 13 | } // namespace JPH 14 | 15 | namespace nc 16 | { 17 | struct Triangle; 18 | struct Vector3; 19 | 20 | namespace jolt 21 | { 22 | /** @note Functions in this file require an instance of JoltApi to be initialized somewhere in the executable. */ 23 | 24 | // Build a ConvexHull Shape from a list of vertices. 25 | auto BuildConvexHull(std::span vertices) -> JPH::Ref; 26 | 27 | // Build a MeshShape from a list of triangles. 28 | auto BuildMeshShape(std::span triangles) -> JPH::Ref; 29 | 30 | // Save a Shape to a binary blob. 31 | auto SerializeShape(const JPH::Shape& shape) -> std::vector; 32 | 33 | // Load a shape from a binary blob. 34 | auto DeserializeShape(std::vector blob) -> JPH::Ref; 35 | } // namespace jolt 36 | } // namespace nc 37 | -------------------------------------------------------------------------------- /source/ncmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NcMath STATIC) 2 | 3 | target_compile_definitions(NcMath 4 | PRIVATE 5 | ${NC_COMPILE_DEFINITIONS} 6 | ) 7 | 8 | target_compile_options(NcMath 9 | PRIVATE 10 | ${NC_COMPILER_FLAGS} 11 | ) 12 | 13 | target_link_libraries(NcMath 14 | PUBLIC 15 | DirectXMath 16 | fmt::fmt 17 | ) 18 | 19 | target_include_directories(NcMath 20 | PUBLIC 21 | $ 22 | $ 23 | ) 24 | 25 | target_sources(NcMath 26 | PRIVATE 27 | Quaternion.cpp 28 | ) 29 | -------------------------------------------------------------------------------- /source/ncutility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NcUtility STATIC) 2 | 3 | target_sources(NcUtility 4 | PRIVATE 5 | Compression.cpp 6 | $ 7 | ) 8 | 9 | target_compile_definitions(NcUtility 10 | PRIVATE 11 | ${NC_COMPILE_DEFINITIONS} 12 | ) 13 | 14 | target_compile_options(NcUtility 15 | PRIVATE 16 | ${NC_COMPILER_FLAGS} 17 | ) 18 | 19 | target_link_libraries(NcUtility 20 | PUBLIC 21 | fmt::fmt 22 | ) 23 | 24 | target_include_directories(NcUtility 25 | PUBLIC 26 | $ 27 | $ 28 | $ 29 | ) 30 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_testing() 2 | include(GoogleTest) 3 | 4 | add_definitions(-DNC_ASSERT_ENABLED) 5 | 6 | add_subdirectory(ncasset) 7 | add_subdirectory(ncengine) 8 | add_subdirectory(ncjolt) 9 | add_subdirectory(ncmath) 10 | add_subdirectory(ncutility) 11 | 12 | if(NC_BUILD_INTEGRATION_TESTS) 13 | add_subdirectory(integration_test) 14 | endif() 15 | 16 | if(NC_BUILD_NCCONVERT) 17 | add_subdirectory(ncconvert) 18 | endif() 19 | -------------------------------------------------------------------------------- /test/integration_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ncengine) 2 | -------------------------------------------------------------------------------- /test/integration_test/ncengine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(graphics2) 2 | -------------------------------------------------------------------------------- /test/integration_test/ncengine/graphics2/collateral/test.frag: -------------------------------------------------------------------------------- 1 | #version 460 2 | layout(location = 0) out vec4 Color; 3 | 4 | void main() 5 | { 6 | Color = vec4(0.0, 0.0, 0.0, 0.0); 7 | } 8 | -------------------------------------------------------------------------------- /test/integration_test/ncengine/graphics2/collateral/test.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/integration_test/ncengine/graphics2/collateral/test.spv -------------------------------------------------------------------------------- /test/ncasset/Version_unit_tests.cpp: -------------------------------------------------------------------------------- 1 | #include "NcaHeader.h" 2 | #include "gtest/gtest.h" 3 | 4 | TEST(VersionTests, IsVersionSupported_version4_returnsTrue) 5 | { 6 | EXPECT_TRUE(nc::asset::IsVersionSupported(nc::asset::version4)); 7 | } 8 | 9 | TEST(VersionTests, IsVersionSupported_currentVersion_returnsTrue) 10 | { 11 | EXPECT_TRUE(nc::asset::IsVersionSupported(nc::asset::currentVersion)); 12 | } 13 | 14 | TEST(VersionTests, IsVersionSupported_badVersion_returnsFalse) 15 | { 16 | EXPECT_FALSE(nc::asset::IsVersionSupported(1ull)); 17 | } 18 | -------------------------------------------------------------------------------- /test/ncconvert/AudioConverter_unit_tests.cpp: -------------------------------------------------------------------------------- 1 | #include "gtest/gtest.h" 2 | #include "CollateralAudio.h" 3 | #include "converters/AudioConverter.h" 4 | #include "ncasset/Assets.h" 5 | 6 | #include 7 | 8 | TEST(AudioConverterTest, ImportAudioClip_convertsToNca) 9 | { 10 | namespace test_data = collateral::sine; 11 | auto uut = nc::convert::AudioConverter{}; 12 | const auto actual = uut.ImportAudioClip(test_data::filePath); 13 | 14 | EXPECT_EQ(actual.samplesPerChannel, test_data::samplesPerChannel); 15 | ASSERT_EQ(actual.leftChannel.size(), test_data::leftChannel.size()); 16 | ASSERT_EQ(actual.rightChannel.size(), test_data::rightChannel.size()); 17 | EXPECT_TRUE(std::equal(actual.leftChannel.cbegin(), 18 | actual.leftChannel.cend(), 19 | test_data::leftChannel.cbegin())); 20 | EXPECT_TRUE(std::equal(actual.rightChannel.cbegin(), 21 | actual.rightChannel.cend(), 22 | test_data::rightChannel.cbegin())); 23 | } 24 | -------------------------------------------------------------------------------- /test/ncconvert/TextureTestUtility.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | inline auto ReadPixel(const unsigned char* data, size_t position) -> uint32_t 6 | { 7 | const auto r = uint32_t{data[position++]} << 24; 8 | const auto g = uint32_t{data[position++]} << 16; 9 | const auto b = uint32_t{data[position++]} << 8; 10 | const auto a = uint32_t{data[position]}; 11 | return r | g | b | a; 12 | } 13 | -------------------------------------------------------------------------------- /test/ncconvert/collateral/CollateralAudio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CollateralCommon.h" 4 | 5 | #include "audio_file/AudioFile.h" 6 | 7 | namespace collateral 8 | { 9 | namespace sine 10 | { 11 | const auto filePath = collateralDirectory / "sine_c_e.wav"; 12 | const auto rawAsset = AudioFile{filePath.string()}; 13 | const auto samplesPerChannel = rawAsset.samples.at(0).size(); 14 | const auto& leftChannel = rawAsset.samples.at(0); 15 | const auto& rightChannel = rawAsset.samples.at(1); 16 | } // namespace sine 17 | } // namespace collateral -------------------------------------------------------------------------------- /test/ncconvert/collateral/CollateralCommon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef TEST_COLLATERAL_DIR 4 | #error TEST_COLLATERAL_DIR must be defined for tests that use collateral 5 | #endif 6 | 7 | #include 8 | 9 | namespace collateral 10 | { 11 | const auto collateralDirectory = std::filesystem::path{TEST_COLLATERAL_DIR}; 12 | } 13 | -------------------------------------------------------------------------------- /test/ncconvert/collateral/cube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/cube.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/cube_map_horizontal_array.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/cube_map_horizontal_array.png -------------------------------------------------------------------------------- /test/ncconvert/collateral/cube_map_horizontal_cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/cube_map_horizontal_cross.png -------------------------------------------------------------------------------- /test/ncconvert/collateral/cube_map_vertical_array.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/cube_map_vertical_array.png -------------------------------------------------------------------------------- /test/ncconvert/collateral/cube_map_vertical_cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/cube_map_vertical_cross.png -------------------------------------------------------------------------------- /test/ncconvert/collateral/five_bones_per_vertex.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/five_bones_per_vertex.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/four_bone_four_vertex.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/four_bone_four_vertex.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/four_bones_neq100.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/four_bones_neq100.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/four_bones_one_bone_70_percent.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/four_bones_one_bone_70_percent.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/multicube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/multicube.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/plane.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/plane.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/plane_and_cube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/plane_and_cube.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/real_world_model.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/real_world_model.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/rgb_corners_4x8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/rgb_corners_4x8.bmp -------------------------------------------------------------------------------- /test/ncconvert/collateral/rgb_corners_4x8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/rgb_corners_4x8.jpg -------------------------------------------------------------------------------- /test/ncconvert/collateral/rgb_corners_4x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/rgb_corners_4x8.png -------------------------------------------------------------------------------- /test/ncconvert/collateral/simple_cube_animation.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/simple_cube_animation.fbx -------------------------------------------------------------------------------- /test/ncconvert/collateral/sine_c_e.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/sine_c_e.wav -------------------------------------------------------------------------------- /test/ncconvert/collateral/single_bone_four_vertex.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncconvert/collateral/single_bone_four_vertex.fbx -------------------------------------------------------------------------------- /test/ncengine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(asset) 2 | add_subdirectory(audio) 3 | add_subdirectory(config) 4 | add_subdirectory(ecs) 5 | add_subdirectory(graphics2) 6 | add_subdirectory(math) 7 | add_subdirectory(module) 8 | add_subdirectory(physics) 9 | add_subdirectory(scene) 10 | add_subdirectory(serialize) 11 | add_subdirectory(task) 12 | add_subdirectory(time) 13 | add_subdirectory(utility) 14 | -------------------------------------------------------------------------------- /test/ncengine/EcsFixture.inl: -------------------------------------------------------------------------------- 1 | #include "ncengine/ecs/Ecs.h" 2 | #include "ncengine/ecs/Hierarchy.h" 3 | #include "ncengine/ecs/Tag.h" 4 | 5 | class EcsFixture 6 | { 7 | public: 8 | explicit EcsFixture(size_t maxEntities) 9 | : m_entityCapacity{maxEntities}, 10 | m_registry{maxEntities}, 11 | m_world{m_registry} 12 | { 13 | m_registry.RegisterType(maxEntities); 14 | m_registry.RegisterType(maxEntities); 15 | m_registry.RegisterType(maxEntities); 16 | } 17 | 18 | auto GetTestEntityCapacity() const { return m_entityCapacity; } 19 | auto GetTestComponentRegistry() -> nc::ecs::ComponentRegistry& { return m_registry; } 20 | auto GetTestWorld() -> nc::ecs::Ecs { return m_world; } 21 | 22 | private: 23 | size_t m_entityCapacity; 24 | nc::ecs::ComponentRegistry m_registry; 25 | nc::ecs::Ecs m_world; 26 | }; 27 | -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/concave_collider1.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/concave_collider1.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/concave_collider1.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/concave_collider1.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/concave_collider2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/concave_collider2.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/concave_collider2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/concave_collider2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/font.ttf -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/hull_collider1.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/hull_collider1.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/hull_collider1.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/hull_collider1.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/hull_collider2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/hull_collider2.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/hull_collider2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/hull_collider2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh1.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh1.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh1.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh1.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh2.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh3.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh3.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/mesh3.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/mesh3.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader1/fragment.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/shader1/fragment.spv -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader1/shader.nca: -------------------------------------------------------------------------------- 1 | vertex.spv 2 | fragment.spv 3 | 6 4 | 0 5 | 0 6 | StorageBuffer 7 | Vertex,Fragment 8 | 0 9 | 1 10 | StorageBuffer 11 | Vertex,Fragment 12 | 0 13 | 2 14 | CombinedImageSampler 15 | Fragment 16 | 0 17 | 3 18 | CombinedImageSampler 19 | Fragment 20 | 0 21 | 4 22 | CombinedImageSampler 23 | Fragment 24 | 0 25 | 5 26 | UniformBuffer 27 | Fragment -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader1/vertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/shader1/vertex.spv -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader2/fragment.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/shader2/fragment.spv -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader2/shader.nca: -------------------------------------------------------------------------------- 1 | vertex.spv 2 | fragment.spv 3 | 6 4 | 0 5 | 0 6 | StorageBuffer 7 | Vertex,Fragment 8 | 0 9 | 1 10 | StorageBuffer 11 | Vertex,Fragment 12 | 0 13 | 2 14 | CombinedImageSampler 15 | Fragment 16 | 0 17 | 3 18 | CombinedImageSampler 19 | Fragment 20 | 0 21 | 4 22 | CombinedImageSampler 23 | Fragment 24 | 0 25 | 5 26 | UniformBuffer 27 | Fragment -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/shader2/vertex.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/shader2/vertex.spv -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox1.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox1.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox1.png -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox2.png -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox3.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox3.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/skybox3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/skybox3.png -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/sound1.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/sound1.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/sound1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/sound1.wav -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/sound2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/sound2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/sound2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/sound2.wav -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/test_animation.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/test_animation.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/test_animation.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/test_animation.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/test_animation_2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/test_animation_2.fbx -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/test_animation_2.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/test_animation_2.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_base.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_base.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_base.png -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_normal.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_normal.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_normal.png -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_roughness.nca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_roughness.nca -------------------------------------------------------------------------------- /test/ncengine/asset/collateral/texture_roughness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NcStudios/NcEngine/e7f52455e106eac65a32cf5eed8f817f811edc54/test/ncengine/asset/collateral/texture_roughness.png -------------------------------------------------------------------------------- /test/ncengine/audio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### Config Tests ### 2 | add_executable(AudioSource_tests 3 | AudioSource_tests.cpp 4 | ${NC_SOURCE_DIR}/audio/AudioSource.cpp 5 | ) 6 | 7 | target_include_directories(AudioSource_tests 8 | PRIVATE 9 | ${NC_INCLUDE_DIR} 10 | ) 11 | 12 | target_compile_options(AudioSource_tests 13 | PUBLIC 14 | ${NC_COMPILER_FLAGS} 15 | ) 16 | 17 | target_link_libraries(AudioSource_tests 18 | PRIVATE 19 | NcUtility 20 | NcMath 21 | gtest_main 22 | ) 23 | 24 | add_test(AudioSource_tests AudioSource_tests) 25 | -------------------------------------------------------------------------------- /test/ncengine/config/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### Config Tests ### 2 | add_executable(Config_tests 3 | Config_tests.cpp 4 | ${NC_SOURCE_DIR}/config/Config.cpp 5 | ) 6 | 7 | target_include_directories(Config_tests 8 | PRIVATE 9 | ${NC_INCLUDE_DIR} 10 | ${NC_SOURCE_DIR} 11 | ) 12 | 13 | target_compile_options(Config_tests 14 | PUBLIC 15 | ${NC_COMPILER_FLAGS} 16 | ) 17 | 18 | target_compile_definitions(Config_tests 19 | PRIVATE 20 | NC_TEST_COLLATERAL_DIR="${CMAKE_CURRENT_SOURCE_DIR}/collateral" 21 | ) 22 | 23 | target_link_libraries(Config_tests 24 | PRIVATE 25 | NcUtility 26 | gtest_main 27 | ) 28 | 29 | add_test(Config_tests Config_tests) 30 | -------------------------------------------------------------------------------- /test/ncengine/math/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### Random Tests ### 2 | add_executable(Random_unit_tests 3 | Random_unit_tests.cpp 4 | ) 5 | 6 | target_include_directories(Random_unit_tests 7 | PRIVATE 8 | ${NC_INCLUDE_DIR} 9 | ${NC_INCLUDE_DIR}/ncengine 10 | ${NC_SOURCE_DIR} 11 | ) 12 | 13 | target_compile_options(Random_unit_tests 14 | PUBLIC 15 | ${NC_COMPILER_FLAGS} 16 | ) 17 | 18 | target_link_libraries(Random_unit_tests 19 | PRIVATE 20 | NcMath 21 | Taskflow 22 | gtest 23 | ) 24 | 25 | add_test(Random_unit_tests Random_unit_tests) 26 | -------------------------------------------------------------------------------- /test/ncengine/module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### ModuleRegistry Tests ### 2 | add_executable(ModuleRegistry_unit_tests 3 | ModuleRegistry_unit_tests.cpp 4 | ) 5 | 6 | target_include_directories(ModuleRegistry_unit_tests 7 | PRIVATE 8 | ${NC_INCLUDE_DIR} 9 | ${NC_INCLUDE_DIR}/ncengine 10 | ${NC_SOURCE_DIR} 11 | ) 12 | 13 | target_compile_options(ModuleRegistry_unit_tests 14 | PUBLIC 15 | ${NC_COMPILER_FLAGS} 16 | ) 17 | 18 | target_link_libraries(ModuleRegistry_unit_tests 19 | PRIVATE 20 | gtest_main 21 | Taskflow 22 | NcUtility 23 | ) 24 | 25 | add_test(ModuleRegistry_unit_tests ModuleRegistry_unit_tests) 26 | -------------------------------------------------------------------------------- /test/ncengine/physics/jolt/ContactListener_stub.inl: -------------------------------------------------------------------------------- 1 | #include "physics/jolt/ContactListener.h" 2 | 3 | namespace nc::physics 4 | { 5 | void ContactListener::OnContactAdded(const JPH::Body&, 6 | const JPH::Body&, 7 | const JPH::ContactManifold&, 8 | JPH::ContactSettings&) 9 | { 10 | } 11 | 12 | void ContactListener::OnContactRemoved(const JPH::SubShapeIDPair&) 13 | { 14 | } 15 | 16 | void ContactListener::CommitPendingChanges() 17 | { 18 | } 19 | } // namespace nc::physics 20 | -------------------------------------------------------------------------------- /test/ncengine/physics/jolt/JobSystem_stub.inl: -------------------------------------------------------------------------------- 1 | #include "physics/jolt/JobSystem.h" 2 | 3 | #include "Jolt/Jolt.h" 4 | #include "Jolt/Core/JobSystemSingleThreaded.h" 5 | 6 | // Ensure real AsyncDispatcher isn't also linked 7 | #ifdef _MSC_VER 8 | #pragma detect_mismatch("AsyncDispatcher", "Stub") 9 | #endif 10 | 11 | namespace nc 12 | { 13 | namespace task 14 | { 15 | class AsyncDispatcher{}; 16 | } // namespace task 17 | 18 | namespace physics 19 | { 20 | // Use Jolt-provided system for tests to limit dependencies + setup 21 | auto BuildJobSystem(const task::AsyncDispatcher&) -> std::unique_ptr 22 | { 23 | return std::make_unique(128); 24 | } 25 | } // namespace physics 26 | } // namespace nc 27 | -------------------------------------------------------------------------------- /test/ncengine/scene/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### NcScene Tests ### 2 | add_executable(NcScene_unit_tests 3 | NcScene_unit_tests.cpp 4 | ${NC_SOURCE_DIR}/scene/NcSceneImpl.cpp 5 | ) 6 | 7 | target_include_directories(NcScene_unit_tests 8 | PRIVATE 9 | ${NC_INCLUDE_DIR} 10 | ${NC_INCLUDE_DIR}/ncengine 11 | ${NC_SOURCE_DIR} 12 | ${NC_EXTERNAL_DIR} 13 | ) 14 | 15 | target_compile_options(NcScene_unit_tests 16 | PUBLIC 17 | ${NC_COMPILER_FLAGS} 18 | ) 19 | 20 | target_link_libraries(NcScene_unit_tests 21 | PRIVATE 22 | gtest_main 23 | NcMath 24 | NcUtility 25 | ) 26 | 27 | add_test(NcScene_unit_tests NcScene_unit_tests) 28 | -------------------------------------------------------------------------------- /test/ncengine/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### StepTimer Tests ### 2 | add_executable(StepTimer_unit_tests 3 | StepTimer_unit_tests.cpp 4 | ) 5 | 6 | target_include_directories(StepTimer_unit_tests 7 | PRIVATE 8 | ${NC_SOURCE_DIR} 9 | ) 10 | 11 | target_compile_options(StepTimer_unit_tests 12 | PUBLIC 13 | ${NC_COMPILER_FLAGS} 14 | ) 15 | 16 | target_link_libraries(StepTimer_unit_tests 17 | PRIVATE 18 | gtest_main 19 | ) 20 | 21 | add_test(StepTimer_unit_tests StepTimer_unit_tests) 22 | -------------------------------------------------------------------------------- /test/ncmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### Math Tests ### 2 | add_executable(Math_unit_tests 3 | Math_unit_test.cpp 4 | ) 5 | 6 | target_include_directories(Math_unit_tests 7 | PRIVATE 8 | ${PROJECT_SOURCE_DIR}/include 9 | ) 10 | 11 | target_compile_options(Math_unit_tests 12 | PRIVATE 13 | ${NC_COMPILER_FLAGS} 14 | ) 15 | 16 | target_link_libraries(Math_unit_tests 17 | PRIVATE 18 | gtest 19 | ) 20 | 21 | add_test(Math_unit_tests Math_unit_tests) 22 | 23 | ### Vector Tests ### 24 | add_executable(Vector_unit_tests 25 | Vector_unit_test.cpp 26 | ) 27 | 28 | target_include_directories(Vector_unit_tests 29 | PRIVATE 30 | ${PROJECT_SOURCE_DIR}/include 31 | ) 32 | 33 | target_compile_options(Vector_unit_tests 34 | PUBLIC 35 | ${NC_COMPILER_FLAGS} 36 | ) 37 | 38 | target_link_libraries(Vector_unit_tests 39 | PRIVATE 40 | gtest 41 | ) 42 | 43 | add_test(Vector_unit_tests Vector_unit_tests) 44 | -------------------------------------------------------------------------------- /test/smoke_test/run_smoke_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -ne 1 ]; then 4 | echo "usage: $0 " 5 | exit 1 6 | fi 7 | 8 | ENGINE_INSTALL_DIR="${1//\\//}" 9 | SMOKE_TEST_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 10 | 11 | echo "ENGINE_INSTALL_DIR: $ENGINE_INSTALL_DIR" 12 | echo "SMOKE_TEST_DIR: $SMOKE_TEST_DIR" 13 | 14 | cd "$ENGINE_INSTALL_DIR/sample" 15 | cp "$SMOKE_TEST_DIR/vk_layer_settings.txt" "./" 16 | 17 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 18 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ENGINE_INSTALL_DIR/sample" 19 | fi 20 | 21 | ./Sample --run-test --config-path "$SMOKE_TEST_DIR/smoke_test_config.ini" --log-path "SmokeTest.log" 22 | EXIT_CODE=$? 23 | echo "smoke test exit code: $EXIT_CODE" 24 | 25 | # todo #850 Add back once issues are resolved 26 | # if [ -s "ValidationLayers.log" ]; then 27 | # echo "errors detected in ValidationLayers.log" 28 | # exit 1 29 | # fi 30 | 31 | exit $EXIT_CODE 32 | --------------------------------------------------------------------------------