├── .github
└── workflows
│ └── cmake.yml
├── .gitmodules
├── .pre-commit-config.yaml
├── CMakeLists.txt
├── Jenkinsfile
├── LICENSE
├── README.md
├── RcEditor
├── Assets
│ ├── Config
│ │ └── imgui.ini
│ ├── Fonts
│ │ └── FiraSans
│ │ │ ├── FiraSans-Black.ttf
│ │ │ ├── FiraSans-BlackItalic.ttf
│ │ │ ├── FiraSans-Bold.ttf
│ │ │ ├── FiraSans-BoldItalic.ttf
│ │ │ ├── FiraSans-ExtraBold.ttf
│ │ │ ├── FiraSans-ExtraBoldItalic.ttf
│ │ │ ├── FiraSans-ExtraLight.ttf
│ │ │ ├── FiraSans-ExtraLightItalic.ttf
│ │ │ ├── FiraSans-Italic.ttf
│ │ │ ├── FiraSans-Light.ttf
│ │ │ ├── FiraSans-LightItalic.ttf
│ │ │ ├── FiraSans-Medium.ttf
│ │ │ ├── FiraSans-MediumItalic.ttf
│ │ │ ├── FiraSans-Regular.ttf
│ │ │ ├── FiraSans-SemiBold.ttf
│ │ │ ├── FiraSans-SemiBoldItalic.ttf
│ │ │ ├── FiraSans-Thin.ttf
│ │ │ ├── FiraSans-ThinItalic.ttf
│ │ │ └── OFL.txt
│ ├── Game
│ │ └── Textures
│ │ │ ├── CC_City_Exterior_A2.png
│ │ │ ├── CC_City_Exterior_B.png
│ │ │ └── TILESET-LICENCE.txt
│ ├── Icons
│ │ ├── ContentBrowser
│ │ │ ├── DirectoryIcon.png
│ │ │ └── FileIcon.png
│ │ └── Menu
│ │ │ ├── playicon.png
│ │ │ ├── simplay.png
│ │ │ ├── simstop.png
│ │ │ └── stopicon.png
│ ├── Shaders
│ │ ├── CircleCombined.glsl
│ │ ├── MeshCombined.glsl
│ │ ├── Metal
│ │ │ ├── TextureFragment.metal
│ │ │ └── TextureVertex.metal
│ │ ├── SPIRV
│ │ │ ├── Fragment.spv
│ │ │ ├── TextureShader.spv
│ │ │ └── Vertex.spv
│ │ ├── TextureCombined.glsl
│ │ └── Vulkan
│ │ │ ├── TextureFragment.frag
│ │ │ └── TextureVertex.vert
│ └── textures
│ │ ├── Default.jpg
│ │ ├── Texture.png
│ │ └── Tiles.png
├── CMakeLists.txt
├── media
│ ├── AppImage.icns
│ ├── AppImage.ico
│ └── AppImage.png
└── src
│ ├── EditorLayer.cpp
│ ├── EditorLayer.h
│ ├── Panels
│ ├── ContentBrowserPanel.cpp
│ ├── ContentBrowserPanel.h
│ ├── SceneHierarchyPanel.cpp
│ └── SceneHierarchyPanel.h
│ ├── RcEditorApp.cpp
│ ├── ViewPanel.cpp
│ └── ViewPanel.h
├── RcEngine
├── CMakeLists.txt
├── external
│ ├── RcNetwork
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ ├── steam
│ │ │ └── mod.rs
│ │ │ └── util
│ │ │ ├── client.rs
│ │ │ ├── logger.rs
│ │ │ ├── mod.rs
│ │ │ └── server.rs
│ ├── entt
│ │ ├── LICENSE
│ │ └── include
│ │ │ └── entt.hpp
│ └── glad
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ ├── KHR
│ │ │ └── khrplatform.h
│ │ └── glad
│ │ │ └── glad.h
│ │ └── src
│ │ └── glad.c
├── macros.cmake
├── sndfile.cmake
└── src
│ ├── Platform
│ ├── Mac
│ │ ├── MacInput.cpp
│ │ ├── MacInput.h
│ │ ├── MacUtils.mm
│ │ ├── MacWindow.cpp
│ │ ├── MacWindow.h
│ │ └── processordetection.cpp
│ ├── MacUtils.h
│ ├── Metal
│ │ ├── MetalBuffer.h
│ │ ├── MetalBuffer.mm
│ │ ├── MetalImplementation.h
│ │ ├── MetalResource.h
│ │ ├── MetalShader.cpp
│ │ ├── MetalShader.h
│ │ └── metal-cpp
│ │ │ ├── Foundation
│ │ │ ├── Foundation.hpp
│ │ │ ├── NSArray.hpp
│ │ │ ├── NSAutoreleasePool.hpp
│ │ │ ├── NSBundle.hpp
│ │ │ ├── NSData.hpp
│ │ │ ├── NSDate.hpp
│ │ │ ├── NSDefines.hpp
│ │ │ ├── NSDictionary.hpp
│ │ │ ├── NSEnumerator.hpp
│ │ │ ├── NSError.hpp
│ │ │ ├── NSLock.hpp
│ │ │ ├── NSNotification.hpp
│ │ │ ├── NSNumber.hpp
│ │ │ ├── NSObjCRuntime.hpp
│ │ │ ├── NSObject.hpp
│ │ │ ├── NSPrivate.hpp
│ │ │ ├── NSProcessInfo.hpp
│ │ │ ├── NSRange.hpp
│ │ │ ├── NSString.hpp
│ │ │ ├── NSTypes.hpp
│ │ │ └── NSURL.hpp
│ │ │ ├── LICENSE.txt
│ │ │ └── Metal
│ │ │ ├── MTLAccelerationStructure.hpp
│ │ │ ├── MTLAccelerationStructureCommandEncoder.hpp
│ │ │ ├── MTLAccelerationStructureTypes.hpp
│ │ │ ├── MTLArgument.hpp
│ │ │ ├── MTLArgumentEncoder.hpp
│ │ │ ├── MTLBinaryArchive.hpp
│ │ │ ├── MTLBlitCommandEncoder.hpp
│ │ │ ├── MTLBlitPass.hpp
│ │ │ ├── MTLBuffer.hpp
│ │ │ ├── MTLCaptureManager.hpp
│ │ │ ├── MTLCaptureScope.hpp
│ │ │ ├── MTLCommandBuffer.hpp
│ │ │ ├── MTLCommandEncoder.hpp
│ │ │ ├── MTLCommandQueue.hpp
│ │ │ ├── MTLComputeCommandEncoder.hpp
│ │ │ ├── MTLComputePass.hpp
│ │ │ ├── MTLComputePipeline.hpp
│ │ │ ├── MTLCounters.hpp
│ │ │ ├── MTLDefines.hpp
│ │ │ ├── MTLDepthStencil.hpp
│ │ │ ├── MTLDevice.hpp
│ │ │ ├── MTLDrawable.hpp
│ │ │ ├── MTLDynamicLibrary.hpp
│ │ │ ├── MTLEvent.hpp
│ │ │ ├── MTLFence.hpp
│ │ │ ├── MTLFunctionConstantValues.hpp
│ │ │ ├── MTLFunctionDescriptor.hpp
│ │ │ ├── MTLFunctionHandle.hpp
│ │ │ ├── MTLFunctionLog.hpp
│ │ │ ├── MTLFunctionStitching.hpp
│ │ │ ├── MTLHeaderBridge.hpp
│ │ │ ├── MTLHeap.hpp
│ │ │ ├── MTLIndirectCommandBuffer.hpp
│ │ │ ├── MTLIndirectCommandEncoder.hpp
│ │ │ ├── MTLIntersectionFunctionTable.hpp
│ │ │ ├── MTLLibrary.hpp
│ │ │ ├── MTLLinkedFunctions.hpp
│ │ │ ├── MTLParallelRenderCommandEncoder.hpp
│ │ │ ├── MTLPipeline.hpp
│ │ │ ├── MTLPixelFormat.hpp
│ │ │ ├── MTLPrivate.hpp
│ │ │ ├── MTLRasterizationRate.hpp
│ │ │ ├── MTLRenderCommandEncoder.hpp
│ │ │ ├── MTLRenderPass.hpp
│ │ │ ├── MTLRenderPipeline.hpp
│ │ │ ├── MTLResource.hpp
│ │ │ ├── MTLResourceStateCommandEncoder.hpp
│ │ │ ├── MTLResourceStatePass.hpp
│ │ │ ├── MTLSampler.hpp
│ │ │ ├── MTLStageInputOutputDescriptor.hpp
│ │ │ ├── MTLTexture.hpp
│ │ │ ├── MTLTypes.hpp
│ │ │ ├── MTLVertexDescriptor.hpp
│ │ │ ├── MTLVisibleFunctionTable.hpp
│ │ │ └── Metal.hpp
│ ├── OpenGL
│ │ ├── OpenGLBuffer.cpp
│ │ ├── OpenGLBuffer.h
│ │ ├── OpenGLContext.cpp
│ │ ├── OpenGLContext.h
│ │ ├── OpenGLFrameBuffer.cpp
│ │ ├── OpenGLFrameBuffer.h
│ │ ├── OpenGLRenderAPI.cpp
│ │ ├── OpenGLRenderAPI.h
│ │ ├── OpenGLShader.cpp
│ │ ├── OpenGLShader.h
│ │ ├── OpenGLTexture.cpp
│ │ ├── OpenGLTexture.h
│ │ ├── OpenGLUniformBuffer.cpp
│ │ ├── OpenGLUniformBuffer.h
│ │ ├── OpenGLUtils.cpp
│ │ ├── OpenGLUtils.h
│ │ ├── OpenGLVertexArray.cpp
│ │ └── OpenGLVertexArray.h
│ ├── Vulkan
│ │ ├── VKBuffer.cpp
│ │ ├── VKBuffer.h
│ │ ├── VKTexture.cpp
│ │ ├── VKTexture.h
│ │ ├── VKUniformBuffer.cpp
│ │ ├── VKUniformBuffer.h
│ │ ├── VKUtils.cpp
│ │ └── VKUtils.h
│ ├── Windows
│ │ ├── WindowsWindow.cpp
│ │ ├── WindowsWindow.h
│ │ └── processordetection.cpp
│ └── processordetection.h
│ ├── RcEngine.h
│ ├── RcEngine
│ ├── Core
│ │ ├── Application.cpp
│ │ ├── Application.h
│ │ ├── Assert.h
│ │ ├── Core.h
│ │ ├── EntryPoint.h
│ │ ├── Input.h
│ │ ├── Layer.cpp
│ │ ├── Layer.h
│ │ ├── LayerStack.cpp
│ │ ├── LayerStack.h
│ │ ├── Log.cpp
│ │ ├── Log.h
│ │ ├── MouseButtonCodes.h
│ │ ├── Timestep.h
│ │ ├── UUID.cpp
│ │ ├── UUID.h
│ │ ├── Window.cpp
│ │ ├── Window.h
│ │ └── keycodes.h
│ ├── Debug
│ │ └── Instrumentor.h
│ ├── Editor
│ │ ├── EditorConsole
│ │ │ └── EditorConsoleSink.h
│ │ └── EditorConsolePanel.h
│ ├── Events
│ │ ├── ApplicationEvent.h
│ │ ├── Event.h
│ │ ├── KeyEvent.h
│ │ └── MouseEvent.h
│ ├── ImGui
│ │ ├── ImGuiBuild.cpp
│ │ ├── ImGuiLayer.cpp
│ │ └── ImGuiLayer.h
│ ├── Lua
│ │ ├── luastate.cpp
│ │ ├── luastate.h
│ │ ├── luautil.cpp
│ │ └── luautil.h
│ ├── Math
│ │ ├── Math.cpp
│ │ └── Math.h
│ ├── Network
│ │ └── Network.h
│ ├── Renderer
│ │ ├── Buffer.cpp
│ │ ├── Buffer.h
│ │ ├── Camera.h
│ │ ├── EditorCamera.cpp
│ │ ├── EditorCamera.h
│ │ ├── FrameBuffer.cpp
│ │ ├── FrameBuffer.h
│ │ ├── GraphicsContext.cpp
│ │ ├── GraphicsContext.h
│ │ ├── IsoCameraController.cpp
│ │ ├── IsoCameraController.h
│ │ ├── MeshLoader.cpp
│ │ ├── MeshLoader.h
│ │ ├── OrthoCamera.cpp
│ │ ├── OrthoCamera.h
│ │ ├── OrthoCameraController.cpp
│ │ ├── OrthoCameraController.h
│ │ ├── ProjectionCamera.cpp
│ │ ├── ProjectionCamera.h
│ │ ├── RenderAPI.cpp
│ │ ├── RenderAPI.h
│ │ ├── RenderCommand.cpp
│ │ ├── RenderCommand.h
│ │ ├── Renderer.cpp
│ │ ├── Renderer.h
│ │ ├── Renderer2D.cpp
│ │ ├── Renderer2D.h
│ │ ├── Renderer3D.cpp
│ │ ├── Renderer3D.h
│ │ ├── Shader.cpp
│ │ ├── Shader.h
│ │ ├── SubTexture2D.cpp
│ │ ├── SubTexture2D.h
│ │ ├── Texture.cpp
│ │ ├── Texture.h
│ │ ├── UniformBuffer.cpp
│ │ ├── UniformBuffer.h
│ │ ├── VertexArray.cpp
│ │ └── VertexArray.h
│ ├── Scene
│ │ ├── Component.h
│ │ ├── Entity.cpp
│ │ ├── Entity.h
│ │ ├── Scene.cpp
│ │ ├── Scene.h
│ │ ├── SceneCamera.cpp
│ │ ├── SceneCamera.h
│ │ ├── SceneSerializer.cpp
│ │ ├── SceneSerializer.h
│ │ └── ScriptableEntity.h
│ ├── Sound
│ │ ├── SoundBuffer.cpp
│ │ ├── SoundBuffer.h
│ │ ├── SoundDevice.cpp
│ │ └── SoundDevice.h
│ └── Utils
│ │ └── PlatformUtils.h
│ ├── rcpch.cpp
│ └── rcpch.h
├── RcGame
├── Assets
│ ├── Fonts
│ │ └── FiraSans
│ │ │ ├── FiraSans-Black.ttf
│ │ │ ├── FiraSans-BlackItalic.ttf
│ │ │ ├── FiraSans-Bold.ttf
│ │ │ ├── FiraSans-BoldItalic.ttf
│ │ │ ├── FiraSans-ExtraBold.ttf
│ │ │ ├── FiraSans-ExtraBoldItalic.ttf
│ │ │ ├── FiraSans-ExtraLight.ttf
│ │ │ ├── FiraSans-ExtraLightItalic.ttf
│ │ │ ├── FiraSans-Italic.ttf
│ │ │ ├── FiraSans-Light.ttf
│ │ │ ├── FiraSans-LightItalic.ttf
│ │ │ ├── FiraSans-Medium.ttf
│ │ │ ├── FiraSans-MediumItalic.ttf
│ │ │ ├── FiraSans-Regular.ttf
│ │ │ ├── FiraSans-SemiBold.ttf
│ │ │ ├── FiraSans-SemiBoldItalic.ttf
│ │ │ ├── FiraSans-Thin.ttf
│ │ │ ├── FiraSans-ThinItalic.ttf
│ │ │ └── OFL.txt
│ ├── Game
│ │ └── Textures
│ │ │ ├── CC_City_Exterior_A2.png
│ │ │ ├── CC_City_Exterior_B.png
│ │ │ └── TILESET-LICENCE.txt
│ ├── Shaders
│ │ ├── FlatColor.glsl
│ │ ├── FlatColorFrag.glsl
│ │ ├── FlatColorShader.glsl
│ │ ├── FragShader.glsl
│ │ ├── TextureCombined.glsl
│ │ ├── TextureShader.glsl
│ │ ├── TextureShaderFrag.glsl
│ │ └── VertShader.glsl
│ └── textures
│ │ ├── Default.jpg
│ │ └── Tiles.png
├── CMakeLists.txt
├── ParticleSystem.cpp
├── ParticleSystem.h
├── RcApp.cpp
├── RcGame2D.cpp
├── RcGame2D.h
└── media
│ ├── AppImage.icns
│ ├── AppImage.ico
│ └── AppImage.png
├── cmake
├── FindFLAC.cmake
├── FindOgg.cmake
├── FindOpus.cmake
└── FindVorbis.cmake
└── scripts
├── generate-VSproj.bat
├── generate-cmake.sh
├── generate-xcode.sh
└── jenkins
└── jenkins-cmake.sh
/.github/workflows/cmake.yml:
--------------------------------------------------------------------------------
1 | name: CMake
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | pull_request:
7 | branches: [ "master" ]
8 |
9 | env:
10 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11 | BUILD_TYPE: Release
12 |
13 | jobs:
14 | build:
15 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
16 | # You can convert this to a matrix build if you need cross-platform coverage.
17 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
18 | runs-on: self-hosted
19 |
20 | steps:
21 | - uses: actions/checkout@v3
22 | with:
23 | submodules: recursive
24 |
25 | - name: Brew packages
26 | run: brew install lua@5.1 && brew install molten-vk && brew install openal-soft && brew install pkg-config && brew install glslang && brew install openal-soft && brew install libsndfile
27 | - name: Install Vulkan SDK
28 | uses: humbletim/install-vulkan-sdk@v1.1.1
29 | with:
30 | version: latest
31 | cache: true
32 | - name: Debug GitHub Workspace
33 | run: echo ${{github.workspace}}
34 | - name: Configure CMake
35 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
36 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
37 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
38 |
39 | - name: Build
40 | # Build your program with the given configuration
41 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
42 |
43 | - name: Saving Artifacts
44 | uses: actions/upload-artifact@v3
45 | with:
46 | name: cmake build
47 | path: ${{github.workspace}}/build
48 |
49 |
50 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "RcEngine/external/GLFW"]
2 | path = RcEngine/external/GLFW
3 | url = https://github.com/glfw/glfw.git
4 | branch = 3.3-stable
5 | [submodule "RcEngine/external/imgui"]
6 | path = RcEngine/external/imgui
7 | url = https://github.com/triscuitcircuit/imgui.git
8 | branch = docking
9 | [submodule "RcEngine/external/spdlog"]
10 | path = RcEngine/external/spdlog
11 | url = https://github.com/gabime/spdlog.git
12 | branch = v1.x
13 | [submodule "RcEngine/external/glm"]
14 | path = RcEngine/external/glm
15 | url = https://github.com/g-truc/glm.git
16 | [submodule "RcEngine/external/GL"]
17 | path = RcEngine/external/GL
18 | url = https://github.com/nigels-com/glew.git
19 | [submodule "RcEngine/external/corrosion"]
20 | path = RcEngine/external/corrosion
21 | url = https://github.com/AndrewGaspar/corrosion.git
22 | [submodule "RcEngine/external/SOIL2"]
23 | path = RcEngine/external/SOIL2
24 | url = https://github.com/triscuitcircuit/SOIL2
25 | [submodule "RcEngine/external/yaml-cpp"]
26 | path = RcEngine/external/yaml-cpp
27 | url = https://github.com/jbeder/yaml-cpp
28 | [submodule "RcEngine/external/imguizmo"]
29 | path = RcEngine/external/imguizmo
30 | url = https://github.com/triscuitcircuit/ImGuizmo
31 | [submodule "RcEngine/external/box2d"]
32 | path = RcEngine/external/box2d
33 | url = https://github.com/triscuitcircuit/box2d
34 | [submodule "RcEngine/external/sol2"]
35 | path = RcEngine/external/sol2
36 | url = https://github.com/triscuitcircuit/sol2
37 | [submodule "RcEngine/external/lua"]
38 | path = RcEngine/external/lua
39 | url = https://github.com/triscuitcircuit/lua-cmake
40 | [submodule "RcEngine/external/openal-soft"]
41 | path = RcEngine/external/openal-soft
42 | url = https://github.com/triscuitcircuit/openal-soft
43 | [submodule "RcEngine/external/sndfile"]
44 | path = RcEngine/external/sndfile
45 | url = https://github.com/triscuitcircuit/libsndfile
46 | [submodule "RcEngine/external/ios-cmake"]
47 | path = RcEngine/external/ios-cmake
48 | url = https://github.com/leetal/ios-cmake
49 | [submodule "RcEngine/external/tinyobj"]
50 | path = RcEngine/external/tinyobj
51 | url = https://github.com/triscuitcircuit/tinyobjloader
52 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | fail_fast: false
2 |
3 | repos:
4 | - repo: https://github.com/pre-commit/pre-commit-hooks
5 | rev: v2.3.0
6 | hooks:
7 | - id: check-yaml
8 | - id: clang-format
9 | args: [--style=Google]
10 | - id: clang-tidy
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.19)
2 |
3 | project(RCGameEngine)
4 |
5 |
6 | add_subdirectory(RcEngine)
7 | #add_subdirectory(RcGame)
8 | add_subdirectory(RcEditor)
9 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline{
2 | agent any
3 | options{
4 | skipDefaultCheckout(true)
5 | }
6 | stages {
7 | stage('Build'){
8 | steps {
9 | cleanWs()
10 | checkout scm
11 | sh 'echo "Running Cmake build script...."'
12 | sh 'chmod +x scripts/jenkins/jenkins-cmake.sh'
13 | sh 'scripts/jenkins/jenkins-cmake.sh'
14 | archiveArtifacts artifacts: 'cmake-build/*', fingerprint: true
15 | }
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Assets included DO NOT fall under the RcEngine MIT License and have their own license.
2 | If you wish to use the assets for your own project, please buy the assets from the appropriate vendors as listed on their readme or pdf.
3 |
4 |
5 |
6 | RcEngine MIT License
7 |
8 | Copyright (c) 2021 Tristan Zippert
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all
18 | copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 | SOFTWARE.
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | RC-Engine
3 | =============================
4 | A game engine made using both Rust and C++.
5 | The Rust language is used for the networking side of the engine, while C++ is used for standard rendering
6 |
7 | ## Compiling
8 | Compilations are tested and ran on a Macintosh, so Windows compilation results may vary.
9 | Make sure Rust Language is installed, as the RcNetwork library won't compile.
10 |
11 | To make sure the Rust library compiles correctly, please make sure to
12 | put the source sdk folder for [steamworks sdk](https://partner.steamgames.com/doc/sdk) within `RcEngine/external/RcNetwork/external`
13 | , or you can compile without it by deleting the steam folder within `RcNetwork`and removing the reference in `Cargo.toml`
14 |
15 | Work in progress
16 |
17 | Clone the project with git clone recursive
18 | ```shell
19 | git clone --recurse-submodules -j8 https:///github.com/triscuitcircuit/rcengine.git
20 | cd rcengine
21 | ```
22 | Standard Cmake build
23 | 1. make a "build" directory within the main directory
24 |
25 | ```shell
26 | mkdir build
27 | cd build
28 | ```
29 | 2. run cmake within the build directory
30 | ```shell
31 | cmake ..
32 | ```
33 |
34 |
35 |
36 | Xcode build from script
37 |
38 |
39 | 1. Go to the scripts directory and run the "generate-xcode.sh" script
40 |
41 | OR
42 | 2. Run the script through the MacOS terminal
43 | ```shell
44 | bash generate-xcode.sh
45 | ```
46 | Then open up the Xcode project that was generated in the "xcode-build" folder
47 |
48 |
49 |
50 | Visual Studio build from .bat
51 |
52 | On Windows, you can run the "generate-VSproj.bat" file located in the "scripts" folder.
53 |
54 | This will generate a Visual Studio project within a Visual Studio 2019 project within a folder called "visual-studio-build".
55 |
56 |
57 |
58 | While very early in development, feel free to comment changes you would
59 | want in a simple game engine. This engine isn't meant to be a AAA engine by any means, and the scope
60 | is to make a 2.5D editor and engine with network capabilities.
61 | # Special Thanks
62 | - Special thanks to TheCherno for his guide on game engine design!
63 | - A special shout-out to 0x (https://github.com/0xworks) for helping with my OpenGL questions (And help with `OpenGLTexture.cpp`)!!
64 | - A special thanks to [Light3039](https://github.com/Light3039) on github for texture debug help( and for the `Tiles.png` debug texture)!!!!
65 |
--------------------------------------------------------------------------------
/RcEditor/Assets/Config/imgui.ini:
--------------------------------------------------------------------------------
1 | [Window][DockSpace Demo]
2 | Pos=0,0
3 | Size=1280,720
4 | Collapsed=0
5 |
6 | [Window][Debug##Default]
7 | Pos=60,60
8 | Size=400,400
9 | Collapsed=0
10 |
11 | [Window][ViewPort]
12 | Pos=316,64
13 | Size=729,400
14 | Collapsed=0
15 | DockId=0x0000000D,0
16 |
17 | [Window][Scene Hierarchy]
18 | Pos=0,22
19 | Size=314,375
20 | Collapsed=0
21 | DockId=0x00000006,0
22 |
23 | [Window][Properties]
24 | Pos=0,399
25 | Size=314,321
26 | Collapsed=0
27 | DockId=0x00000008,0
28 |
29 | [Window][Renderer 2D Stats]
30 | Pos=1047,500
31 | Size=233,220
32 | Collapsed=0
33 | DockId=0x00000004,0
34 |
35 | [Window][Console]
36 | Pos=316,466
37 | Size=729,254
38 | Collapsed=0
39 | DockId=0x0000000A,0
40 |
41 | [Window][Dear ImGui Demo]
42 | Pos=1047,22
43 | Size=233,476
44 | Collapsed=0
45 | DockId=0x00000003,1
46 |
47 | [Window][##toolbar]
48 | Pos=316,22
49 | Size=729,40
50 | Collapsed=0
51 | DockId=0x0000000C,0
52 |
53 | [Window][Content Browser]
54 | Pos=316,466
55 | Size=729,254
56 | Collapsed=0
57 | DockId=0x0000000A,1
58 |
59 | [Window][Renderer]
60 | Pos=1047,22
61 | Size=233,476
62 | Collapsed=0
63 | DockId=0x00000003,0
64 |
65 | [Docking][Data]
66 | DockSpace ID=0x3BC79352 Window=0x4647B76E Pos=80,93 Size=1280,698 Split=X
67 | DockNode ID=0x00000005 Parent=0x3BC79352 SizeRef=314,698 Split=Y Selected=0x9A68760C
68 | DockNode ID=0x00000006 Parent=0x00000005 SizeRef=241,352 Selected=0x9A68760C
69 | DockNode ID=0x00000008 Parent=0x00000005 SizeRef=241,302 Selected=0xC89E3217
70 | DockNode ID=0x00000009 Parent=0x3BC79352 SizeRef=964,698 Split=X
71 | DockNode ID=0x00000001 Parent=0x00000009 SizeRef=729,698 Split=Y
72 | DockNode ID=0x00000007 Parent=0x00000001 SizeRef=714,415 Split=Y Selected=0x3969A3C6
73 | DockNode ID=0x0000000C Parent=0x00000007 SizeRef=686,40 HiddenTabBar=1 Selected=0x28257B55
74 | DockNode ID=0x0000000D Parent=0x00000007 SizeRef=686,400 CentralNode=1 Selected=0x3969A3C6
75 | DockNode ID=0x0000000A Parent=0x00000001 SizeRef=714,239 Selected=0xF9BEF62A
76 | DockNode ID=0x00000002 Parent=0x00000009 SizeRef=233,698 Split=Y Selected=0xE927CF2F
77 | DockNode ID=0x00000003 Parent=0x00000002 SizeRef=322,447 Selected=0x08EFC3CA
78 | DockNode ID=0x00000004 Parent=0x00000002 SizeRef=322,207 Selected=0x8427B473
79 |
80 |
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Black.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-BlackItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Bold.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraBold.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraLight.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-ExtraLightItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Italic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Light.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-LightItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Medium.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-MediumItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Regular.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-SemiBold.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-Thin.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Fonts/FiraSans/FiraSans-ThinItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Fonts/FiraSans/FiraSans-ThinItalic.ttf
--------------------------------------------------------------------------------
/RcEditor/Assets/Game/Textures/CC_City_Exterior_A2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Game/Textures/CC_City_Exterior_A2.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Game/Textures/CC_City_Exterior_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Game/Textures/CC_City_Exterior_B.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Game/Textures/TILESET-LICENCE.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Game/Textures/TILESET-LICENCE.txt
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/ContentBrowser/DirectoryIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/ContentBrowser/DirectoryIcon.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/ContentBrowser/FileIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/ContentBrowser/FileIcon.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/Menu/playicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/Menu/playicon.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/Menu/simplay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/Menu/simplay.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/Menu/simstop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/Menu/simstop.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Icons/Menu/stopicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Icons/Menu/stopicon.png
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/CircleCombined.glsl:
--------------------------------------------------------------------------------
1 | #type vertex
2 | #version 410 core
3 |
4 | layout(location = 0) in vec3 a_WorldPosition;
5 | layout(location = 1) in vec3 a_LocalPosition;
6 | layout(location = 2) in vec4 a_Color;
7 | layout(location = 3) in float a_Thickness;
8 | layout(location = 4) in float a_Fade;
9 | layout(location = 5) in int a_EntityID;
10 |
11 |
12 | uniform mat4 u_ViewProjection;
13 |
14 | struct VertexOutput
15 | {
16 | vec3 LocalPosition;
17 | vec4 Color;
18 | float Thickness;
19 | float Fade;
20 | };
21 |
22 | layout (location = 0) out VertexOutput Input;
23 | layout (location = 4) flat out int v_EntityID;
24 |
25 | void main()
26 | {
27 |
28 | Input.Color = a_Color;
29 | Input.LocalPosition = a_LocalPosition;
30 | Input.Thickness = a_Thickness;
31 | Input.Fade = a_Fade;
32 | v_EntityID = a_EntityID;
33 |
34 | gl_Position = u_ViewProjection * vec4(a_WorldPosition, 1.0);
35 | }
36 |
37 | #type fragment
38 | #version 410 core
39 |
40 | layout(location = 0) out vec4 o_Color;
41 | layout(location = 4) out int o_EntityID;
42 |
43 | struct VertexOutput
44 | {
45 | vec3 LocalPosition;
46 | vec4 Color;
47 | float Thickness;
48 | float Fade;
49 | };
50 |
51 | layout(location = 0) in VertexOutput Input;
52 | layout(location = 4) flat in int v_EntityID;
53 |
54 | void main(){
55 | // Calculate distance and fill circle with white
56 | float distance = 1.0 - length(Input.LocalPosition);
57 | float circle = smoothstep(0.0, Input.Fade, distance);
58 | circle *= smoothstep(Input.Thickness + Input.Fade, Input.Thickness, distance);
59 |
60 | if (circle == 0.0)
61 | discard;
62 |
63 | // Set output color
64 | o_Color = Input.Color;
65 | o_Color.a *= circle;
66 |
67 | o_EntityID = v_EntityID;
68 | }
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/MeshCombined.glsl:
--------------------------------------------------------------------------------
1 | #type vertex
2 | #version 410 core
3 |
4 | layout(location = 0) in vec3 a_WorldPosition;
5 | layout(location = 1) in vec3 a_LocalPosition;
6 | layout(location = 2) in vec4 a_Color;
7 | layout(location = 5) in int a_EntityID;
8 |
9 | uniform mat4 u_ViewProjection;
10 | uniform mat4 u_mv_Matrix;
11 |
12 | struct VertexOutput{
13 | vec3 LocalPosition;
14 | vec4 Color;
15 | };
16 |
17 | layout (location = 0) out VertexOutput Input;
18 | layout (location = 2) flat out int v_EntityID;
19 |
20 | void main(void) {
21 | Input.LocalPosition = a_LocalPosition;
22 | Input.Color = a_Color;
23 |
24 | gl_Position = u_ViewProjection * u_mv_Matrix * vec4(a_WorldPosition,1.0);
25 | }
26 |
27 | #type fragment
28 | #version 410 core
29 |
30 | layout(location = 0) out vec4 o_Color;
31 | layout(location = 2) out int o_EntityID;
32 |
33 | struct VertexOutput{
34 | vec3 LocalPosition;
35 | vec4 Color;
36 | };
37 |
38 | layout(location = 0) in VertexOutput Input;
39 | layout(location = 2) flat in int v_EntityID;
40 |
41 | void main(void){
42 | o_Color = Input.Color;
43 | o_EntityID = v_EntityID;
44 | }
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/Metal/TextureVertex.metal:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | using namespace metal;
5 |
6 | struct VertexOutput
7 | {
8 | float4 Color;
9 | float2 TexCoord;
10 | float TexIndex;
11 | float TilingFactor;
12 | };
13 |
14 | struct Camera
15 | {
16 | float4x4 u_ViewProjection;
17 | };
18 |
19 | struct main0_out
20 | {
21 | float4 VertexOutput_Color [[user(locn0)]];
22 | float2 VertexOutput_TexCoord [[user(locn1)]];
23 | float VertexOutput_TexIndex [[user(locn2)]];
24 | float VertexOutput_TilingFactor [[user(locn3)]];
25 | int v_EntityID [[user(locn4)]];
26 | float4 gl_Position [[position]];
27 | };
28 |
29 | struct main0_in
30 | {
31 | float3 a_Position [[attribute(0)]];
32 | float4 a_Color [[attribute(1)]];
33 | float2 a_TexCoord [[attribute(2)]];
34 | float a_TexIndex [[attribute(3)]];
35 | float a_TilingFactor [[attribute(4)]];
36 | int a_EntityID [[attribute(5)]];
37 | };
38 |
39 | vertex main0_out main0(main0_in in [[stage_in]], constant Camera& _49 [[buffer(0)]])
40 | {
41 | main0_out out = {};
42 | VertexOutput Input = {};
43 | Input.Color = in.a_Color;
44 | Input.TexCoord = in.a_TexCoord;
45 | Input.TexIndex = in.a_TexIndex;
46 | Input.TilingFactor = in.a_TilingFactor;
47 | out.v_EntityID = in.a_EntityID;
48 | out.gl_Position = _49.u_ViewProjection * float4(in.a_Position, 1.0);
49 | out.VertexOutput_Color = Input.Color;
50 | out.VertexOutput_TexCoord = Input.TexCoord;
51 | out.VertexOutput_TexIndex = Input.TexIndex;
52 | out.VertexOutput_TilingFactor = Input.TilingFactor;
53 | return out;
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/SPIRV/Fragment.spv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Shaders/SPIRV/Fragment.spv
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/SPIRV/TextureShader.spv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Shaders/SPIRV/TextureShader.spv
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/SPIRV/Vertex.spv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/Shaders/SPIRV/Vertex.spv
--------------------------------------------------------------------------------
/RcEditor/Assets/Shaders/Vulkan/TextureVertex.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 | #extension GL_ARB_separate_shader_objects : enable
3 |
4 | layout(location = 0) in vec3 a_Position;
5 | layout(location = 1) in vec4 a_Color;
6 | layout(location = 2) in vec2 a_TexCoord;
7 | layout(location = 3) in float a_TexIndex;
8 | layout(location = 4) in float a_TilingFactor;
9 | layout(location = 5) in int a_EntityID;
10 |
11 | layout(std140, binding = 0) uniform Camera
12 | {
13 | mat4 u_ViewProjection;
14 | };
15 |
16 | struct VertexOutput
17 | {
18 | vec4 Color;
19 | vec2 TexCoord;
20 | float TexIndex;
21 | float TilingFactor;
22 | };
23 |
24 | layout (location = 0) out VertexOutput Input;
25 | layout (location = 4) flat out int v_EntityID;
26 |
27 | void main()
28 | {
29 |
30 | Input.Color = a_Color;
31 | Input.TexCoord = a_TexCoord;
32 | Input.TexIndex = a_TexIndex;
33 | Input.TilingFactor = a_TilingFactor;
34 | v_EntityID = a_EntityID;
35 |
36 | gl_Position = u_ViewProjection * vec4(a_Position, 1.0);
37 | }
38 |
--------------------------------------------------------------------------------
/RcEditor/Assets/textures/Default.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/textures/Default.jpg
--------------------------------------------------------------------------------
/RcEditor/Assets/textures/Texture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/textures/Texture.png
--------------------------------------------------------------------------------
/RcEditor/Assets/textures/Tiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/Assets/textures/Tiles.png
--------------------------------------------------------------------------------
/RcEditor/media/AppImage.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/media/AppImage.icns
--------------------------------------------------------------------------------
/RcEditor/media/AppImage.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/media/AppImage.ico
--------------------------------------------------------------------------------
/RcEditor/media/AppImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/triscuitcircuit/rcengine/aed79bf7c3a035adbf30cc7be9abd223608b4a80/RcEditor/media/AppImage.png
--------------------------------------------------------------------------------
/RcEditor/src/EditorLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/6/21.
3 | //
4 | #pragma once
5 | #include "RcEngine.h"
6 | #include "Panels/SceneHierarchyPanel.h"
7 | #include "Panels/ContentBrowserPanel.h"
8 |
9 | #ifndef RCENGINE_CLION_EDITORLAYER_H
10 | #define RCENGINE_CLION_EDITORLAYER_H
11 | namespace RcEngine{
12 | class EditorLayer : public Layer{
13 | public:
14 | EditorLayer();
15 | virtual ~EditorLayer() = default;
16 |
17 | virtual void OnAttach() override;
18 | virtual void OnDetach() override;
19 |
20 | void OnUpdate(Timestep ts) override;
21 | virtual void OnImGuiRender() override;
22 | void OnEvent(Event& e) override;
23 | private:
24 | bool OnKeyPressed(KeyPressedEvent& e );
25 | bool OnMouseScroll(MouseScrolledEvent& e);
26 |
27 | void NewScene();
28 | void OpenScene();
29 | void OpenScene(const std::filesystem::path& path);
30 | void SaveAs();
31 |
32 | void OnScenePlay();
33 | void OnSceneStop();
34 | void OnSceneEdit();
35 |
36 | void OnSceneSimulation();
37 |
38 |
39 | //UI specific functions
40 | void UI_Toolbar();
41 |
42 |
43 |
44 | private:
45 | OrthoCameraController m_CameraController;
46 |
47 | Ref m_FrameBuffer;
48 |
49 | glm::vec4 m_SquareColor = {0.8f,0.0f,0.0f,1.0f};
50 | glm::vec4 m_TextureColor = {0.2f,0.3f,0.8f,1.0f};
51 |
52 | EditorCamera m_EditorCamera;
53 |
54 | bool m_ViewportFocused = false, m_ViewportHovered = false;
55 | glm::vec2 m_ViewportSize = { 0.0f, 0.0f };
56 | glm::vec2 m_ViewportBounds[2];
57 |
58 | Entity m_SquareEntity;
59 | Entity m_CameraEntity;
60 | Entity m_SecondCamera;
61 | Ref m_ActiveScene;
62 | Ref m_EditorScene;
63 | std::filesystem::path m_EditorScenePath;
64 |
65 | struct ProfileResult{
66 | const char* Name;
67 | float time;
68 | };
69 | std::vector m_Profiler;
70 |
71 |
72 | glm::vec2 m_ViewPortSize = {1264,666};
73 |
74 | //panels
75 | SceneHierarchyPanel m_Panel;
76 | ContentBrowserPanel m_ContentBrowserPanel;
77 |
78 | //editor menu
79 | Ref m_IconPlay,m_StopPlay, m_IconSimulate, m_IconSimulateStop;
80 |
81 | //Script
82 | std::string m_ScriptString;
83 |
84 | int m_GizmoType = -1;
85 |
86 | enum class SceneState{
87 | Edit =0, Play =1, Simulate=2
88 | };
89 | SceneState m_SceneState = SceneState::Edit;
90 |
91 |
92 |
93 | };
94 | }
95 | #endif //RCENGINE_CLION_EDITORLAYER_H
96 |
--------------------------------------------------------------------------------
/RcEditor/src/Panels/ContentBrowserPanel.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/30/21.
3 | //
4 | #pragma once
5 | #include
6 | #include "RcEngine/Renderer/Texture.h"
7 |
8 | #ifndef RCENGINE_CONTENTBROWSERPANEL_H
9 | #define RCENGINE_CONTENTBROWSERPANEL_H
10 | namespace RcEngine{
11 | class ContentBrowserPanel{
12 | public:
13 | ContentBrowserPanel();
14 | void OnImGuiRender();
15 | private:
16 | std::filesystem::path m_CurrentDirectory;
17 |
18 | Ref m_DirectoryIcon;
19 | Ref m_FileIcon;
20 |
21 |
22 | };
23 | }
24 | #endif //RCENGINE_CONTENTBROWSERPANEL_H
25 |
--------------------------------------------------------------------------------
/RcEditor/src/Panels/SceneHierarchyPanel.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/8/21.
3 | //
4 | #pragma once
5 |
6 | #include "RcEngine/Core/Core.h"
7 |
8 | #include "RcEngine/Core/Log.h"
9 | #include "RcEngine/Scene/Entity.h"
10 |
11 |
12 | #ifndef RCENGINE_CLION_SCENEHIERARCHYPANEL_H
13 | #define RCENGINE_CLION_SCENEHIERARCHYPANEL_H
14 | #include "RcEngine/Scene/Scene.h"
15 | namespace RcEngine{
16 | class SceneHierarchyPanel{
17 | public:
18 | SceneHierarchyPanel()= default;
19 | SceneHierarchyPanel(const Ref& scene);
20 |
21 | void SetContext(const Ref& scene);
22 |
23 | void OnImGuiRender();
24 |
25 | Entity GetSelectedEntity() const{return m_Selected;};
26 |
27 | private:
28 | void DrawEntityNode(Entity entity);
29 | void DrawComponents(Entity entitySelection);
30 | private:
31 | Ref m_Scene;
32 | Entity m_Selected;
33 | friend class Scene;
34 | };
35 | }
36 | #endif //RCENGINE_CLION_SCENEHIERARCHYPANEL_H
37 |
--------------------------------------------------------------------------------
/RcEditor/src/RcEditorApp.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/6/21.
3 | //
4 |
5 | #include
6 |
7 | #include "EditorLayer.h"
8 |
9 | namespace RcEngine {
10 | class RcEditor : public Application {
11 | public:
12 | RcEditor()
13 | : Application("Rc Engine Editor"){
14 | PushLayer(new EditorLayer());
15 | };
16 |
17 | ~RcEditor() {};
18 | };
19 |
20 | Application *CreateApplication() {
21 | return new RcEditor();
22 | }
23 | }
--------------------------------------------------------------------------------
/RcEditor/src/ViewPanel.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 10/29/21.
3 | //
4 |
5 | #include "ViewPanel.h"
6 |
--------------------------------------------------------------------------------
/RcEditor/src/ViewPanel.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 10/29/21.
3 | //
4 | #pragma once
5 | #include "RcEngine.h"
6 | #include "Panels/SceneHierarchyPanel.h"
7 | #include "Panels/ContentBrowserPanel.h"
8 | #include "EditorLayer.h"
9 |
10 | #ifndef RCENGINE_VIEWPORT_H
11 | #define RCENGINE_VIEWPORT_H
12 | namespace RcEngine{
13 | class ViewPanel : public Layer{
14 | public:
15 | ViewPanel(const Ref& scene = nullptr);
16 | virtual ~ViewPanel() = default;
17 |
18 | virtual void OnAttach() override;
19 | virtual void OnDetach() override;
20 |
21 | void ProcessInput();
22 | void DrawGizmos();
23 |
24 | void OnUpdate(Timestep ts) override;
25 | virtual void OnImGuiRender() override;
26 | void OnEvent(Event& e) override;
27 |
28 | bool isFocused(){return m_isFocused;}
29 |
30 | void SetContext(const Ref cxt);
31 | Ref& GetContext(){return m_Context;}
32 | private:
33 | bool m_isFocused = true;
34 | Ref m_Context;
35 | };
36 | }
37 | #endif //RCENGINE_VIEWPORT_H
38 |
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "rc_network"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | tokio = "1.6.0"
10 | libc = "0.2.0"
11 | #steamworks = "0.7.0"
12 | simplelog = "0.7.5"
13 | serde = "1.0.126"
14 | log = "0.4.14"
15 | chrono = "0.4.19"
16 |
17 | [lib]
18 | crate-type = ["staticlib"]
19 |
20 | [profile.dev]
21 | opt-level = 3
22 |
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod util;
2 |
3 | extern crate libc;
4 | use libc::{c_int, size_t};
5 | use crate::util::client::tcp_client;
6 | use crate::util::server::tcp_server;
7 |
8 | //Entry point
9 | #[no_mangle]
10 | pub extern "C" fn rc_entry(){
11 | println!("Entrypoint rc_network");
12 | }
13 | #[no_mangle]
14 | pub extern "C" fn rc_tcp_client(){
15 | tcp_client();
16 | }
17 | #[no_mangle]
18 | pub extern "C" fn rc_tcp_server(){
19 | tcp_server();
20 | }
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/steam/mod.rs:
--------------------------------------------------------------------------------
1 | use steamworks::AppId;
2 | use steamworks::Client;
3 | use steamworks::FriendFlags;
4 | use steamworks::PersonaStateChange;
5 |
6 |
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/util/client.rs:
--------------------------------------------------------------------------------
1 | use std::net::TcpStream;
2 | use std::str;
3 | use std::io::{self, BufRead, BufReader,Write};
4 |
5 | pub fn tcp_client(){
6 | let mut stream = TcpStream::connect("127.0.0.1:8888")
7 | .expect("Could not connect to server");
8 | loop{
9 | let mut input = String::new();
10 | let mut buffer: Vec = Vec::new();
11 |
12 | io::stdin().read_line(&mut input)
13 | .expect("failed to read from stdin");
14 |
15 | stream.write(input.as_bytes())
16 | .expect("Failed to write to server");
17 |
18 | let mut reader = BufReader::new(&stream);
19 |
20 | reader.read_until(b'\n', &mut buffer)
21 | .expect("Could not read into buffer");
22 | print!("{}", str::from_utf8(&buffer)
23 | .expect("Could not write buffer as string"));
24 | }
25 | }
26 |
27 |
28 |
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/util/logger.rs:
--------------------------------------------------------------------------------
1 | extern crate chrono;
2 | extern crate log;
3 |
4 |
5 | use std::fs;
6 | use std::io::{Write, Error};
7 | use log::{Record, LevelFilter, Metadata};
8 | use std::fs::File;
9 | use self::log::Log;
10 | use simplelog::Config;
11 |
12 |
13 | pub struct FileLogger{
14 | log_file: String,
15 | filter_level: LevelFilter,
16 | }
17 |
18 | impl FileLogger{
19 | pub fn new(log_file: &str, filter_level: LevelFilter)-> Self{
20 | Self{
21 | log_file: log_file.to_owned(),
22 | filter_level,
23 | }
24 | }
25 | }
26 |
27 | impl log::Log for FileLogger{
28 | fn enabled(&self, metadata:&Metadata)->bool{
29 | metadata.level() <= self.filter_level
30 | }
31 |
32 | fn log(&self, record: &Record) {
33 | if self.enabled(record.metadata()){
34 | let mut retries = 0;
35 | let mut file = loop{
36 | let file = fs::OpenOptions::new()
37 | .create(true)
38 | .append(true)
39 | .open(&self.log_file);
40 | let file = match file {
41 | Ok(f) => f,
42 | Err(e)=>{
43 | if retries >= 10{
44 | eprintln!("Could not write to log file: {}",retries);
45 | return;
46 | }
47 | retries+=1;
48 | std::thread::sleep(std::time::Duration::from_micros(5));
49 | continue;
50 | },
51 | };
52 | break file;
53 | };
54 | let dt = chrono::Local::now();
55 | let time = dt.format("%Y-%m-%d %H:%M:%S");
56 |
57 | if let Err(e) = writeln!(file, "[{}] [{}] {}", time, record.level(),record.args()){
58 | eprintln!("Couldn't write to log file: {}",e);
59 | }
60 |
61 | }
62 | }
63 |
64 | fn flush(&self) {}
65 | }
66 | impl simplelog::SharedLogger for FileLogger{
67 | fn level(&self) -> LevelFilter {
68 | todo!()
69 | }
70 |
71 | fn config(&self) -> Option<&Config> {
72 | todo!()
73 | }
74 |
75 | fn as_log(self: Box) -> Box {
76 | todo!()
77 | }
78 | }
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/util/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod client;
2 | pub mod server;
3 | pub mod logger;
--------------------------------------------------------------------------------
/RcEngine/external/RcNetwork/src/util/server.rs:
--------------------------------------------------------------------------------
1 | use std::net::{TcpListener,TcpStream};
2 | use std::thread;
3 |
4 | use std::io::{Read,Write,Error};
5 | use std::collections::HashMap;
6 |
7 | fn handle_client(mut stream: TcpStream) -> Result<(), Error>{
8 | println!("Incoming connection from: {}", stream.peer_addr()?);
9 | let mut buf = [0;512];
10 | loop{
11 | let bytes_read = stream.read(&mut buf)?;
12 | if bytes_read ==0 {return Ok(());}
13 | stream.write(&buf[..bytes_read])?;
14 | }
15 | }
16 | pub fn tcp_server(){
17 |
18 | let listener = TcpListener::bind("0.0.0.0:8888")
19 | .expect("Could not bind socket");
20 | // new thread here to prevent lockup
21 | thread::spawn(move||{
22 | println!("server activated");
23 | for stream in listener.incoming(){
24 | match stream{
25 | Err(e) => {
26 | eprintln!("failed: {}", e)
27 | }
28 | Ok(stream)=>{
29 |
30 | thread::spawn(move||{
31 | handle_client(stream)
32 | .unwrap_or_else(|error|eprintln!("{:?}",error))
33 | });
34 | }
35 | };
36 | }
37 | });
38 | }
--------------------------------------------------------------------------------
/RcEngine/external/entt/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017-2021 Michele Caini
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copy of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copy or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/RcEngine/external/glad/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.19)
2 | project(glad)
3 |
4 | add_library(glad include/glad/glad.h src/glad.c)
5 | target_include_directories(glad PUBLIC $(CMAKE_CURRENT_SOURCE_DIR))
--------------------------------------------------------------------------------
/RcEngine/macros.cmake:
--------------------------------------------------------------------------------
1 | # finds and adds sources files in a folder
2 | macro(addPath dir)
3 | set(tmp_files "")
4 | set(glob_config GLOB)
5 | if(${ARGC} GREATER 1 AND "${ARGV1}" STREQUAL "REC")
6 | set(glob_config GLOB_RECURSE)
7 | endif()
8 | set(mac_files "")
9 | if(APPLE)
10 | set(mac_files ${dir}/*.mm ${dir}/*.m)
11 | endif()
12 | file(${glob_config} tmp_files
13 | ${dir}/*.cpp
14 | ${dir}/*.c
15 | ${dir}/*.cc
16 | ${dir}/*.h
17 | ${mac_files}
18 | #${dir}/*.asm
19 | )
20 | foreach(entry ${BLACKLIST})
21 | list(REMOVE_ITEM tmp_files ${dir}/${entry})
22 | endforeach()
23 | LIST(APPEND ${PROJECT_NAME}_files "${tmp_files}")
24 | LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
25 | message(STATUS "addPath ${PROJECT_NAME} : ${tmp_files}")
26 | endmacro()
27 |
28 | macro(addFile filename)
29 | LIST(APPEND ${PROJECT_NAME}_files "${filename}")
30 | message(STATUS "addFile ${PROJECT_NAME} : ${filename}")
31 | endmacro()
32 |
33 | # finds and adds sources files in a folder recursively
34 | macro(addPathRec dir)
35 | addPath("${dir}" "REC")
36 | endmacro()
37 |
38 | macro(addFramework framework)
39 | if (APPLE)
40 | addLib("-framework ${framework}")
41 | endif()
42 | endmacro()
43 |
44 | macro(addLibPath dir)
45 | link_directories(${dir})
46 | endmacro()
47 |
48 | macro(addInclude incPath)
49 | if(TARGET ${PROJECT_NAME})
50 | set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${incPath}")
51 | else()
52 | list(APPEND ${PROJECT_NAME}_includes ${incPath})
53 | endif()
54 | endmacro()
55 |
56 | macro(addLib libs)
57 | foreach(lib ${libs})
58 | # check if we can build it ourselfs
59 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake")
60 | addLibSrc("${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake")
61 | endif()
62 | # then link against it
63 | # two possibilities: a) target already known, so add it directly, or b) target not yet known, so add it to its cache
64 | if(TARGET ${PROJECT_NAME})
65 | target_link_libraries(${PROJECT_NAME} "${lib}")
66 | else()
67 | list(APPEND ${PROJECT_NAME}_libs ${lib})
68 | endif()
69 | endforeach()
70 | endmacro()
--------------------------------------------------------------------------------
/RcEngine/sndfile.cmake:
--------------------------------------------------------------------------------
1 |
2 | # - Try to find libsndfile
3 | # Once done, this will define
4 | #
5 | # LIBSNDFILE_FOUND - system has libsndfile
6 | # LIBSNDFILE_INCLUDE_DIRS - the libsndfile include directories
7 | # LIBSNDFILE_LIBRARIES - link these to use libsndfile
8 |
9 | # Use pkg-config to get hints about paths
10 | find_package(PkgConfig QUIET)
11 | if(PKG_CONFIG_FOUND)
12 | pkg_check_modules(LIBSNDFILE_PKGCONF sndfile)
13 | endif(PKG_CONFIG_FOUND)
14 |
15 | # Include dir
16 | find_path(LIBSNDFILE_INCLUDE_DIR
17 | NAMES sndfile.h
18 | PATHS ${LIBSNDFILE_PKGCONF_INCLUDE_DIRS}
19 | )
20 |
21 | # Library
22 | find_library(LIBSNDFILE_LIBRARY
23 | NAMES sndfile libsndfile-1
24 | PATHS ${LIBSNDFILE_PKGCONF_LIBRARY_DIRS}
25 | )
26 |
27 | find_package(PackageHandleStandardArgs)
28 | find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
29 |
30 | if(LIBSNDFILE_FOUND)
31 | set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
32 | set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
33 | message(STATUS "sndfile include dirs path: ${LIBSNDFILE_INCLUDE_DIRS}")
34 | message(STATUS "sndfile libs path: ${LIBSNDFILE_LIBRARIES}")
35 | endif(LIBSNDFILE_FOUND)
36 |
37 | mark_as_advanced(LIBSNDFILE_LIBRARY LIBSNDFILE_LIBRARIES LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIRS)
38 |
39 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Mac/MacInput.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/24/21.
3 | //
4 |
5 | #include "MacInput.h"
6 | #include "rcpch.h"
7 | #include "RcEngine/Core/Application.h"
8 |
9 | #include
10 |
11 | namespace RcEngine{
12 |
13 | Input* Input::s_Instance = new MacInput();
14 |
15 | bool MacInput::IsKeyPressedImpl(int keycode) {
16 | auto window = static_cast(Application::Get().GetWindow().GetNativeWindow());
17 |
18 | auto state = glfwGetKey(window, keycode);
19 |
20 | return state == GLFW_PRESS || state == GLFW_REPEAT;
21 | }
22 |
23 | float MacInput::GetMouseXImpl() {
24 | auto window = static_cast(Application::Get().GetWindow().GetNativeWindow());
25 | double xpos, ypos = 0.0;
26 | glfwGetCursorPos(window,&xpos,&ypos);
27 | return (float)xpos;
28 | }
29 | float MacInput::GetMouseYImpl() {
30 | auto window = static_cast(Application::Get().GetWindow().GetNativeWindow());
31 | double xpos, ypos = 0.0;
32 | glfwGetCursorPos(window,&xpos,&ypos);
33 | return (float)ypos;
34 | }
35 | std::pair MacInput::GetMousePosImpl() {
36 | auto window = static_cast(Application::Get().GetWindow().GetNativeWindow());
37 | double xpos, ypos = 0.0;
38 | glfwGetCursorPos(window,&xpos,&ypos);
39 | return {(float)xpos, (float)ypos};
40 | }
41 | bool MacInput::IsMouseButtonPressedImpl(int button) {
42 | auto window = static_cast(Application::Get().GetWindow().GetNativeWindow());
43 |
44 | auto state = glfwGetMouseButton(window, button);
45 | return state == GLFW_PRESS;
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Mac/MacInput.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/24/21.
3 | //
4 |
5 | #pragma once
6 | #include "RcEngine/Core/Input.h"
7 | namespace RcEngine{
8 | class MacInput: public Input{
9 | protected:
10 | virtual bool IsKeyPressedImpl(int keycode) override;
11 |
12 |
13 | virtual float GetMouseXImpl() override;
14 | virtual float GetMouseYImpl() override;
15 | virtual std::pair GetMousePosImpl() override;
16 |
17 | virtual bool IsMouseButtonPressedImpl(int button) override;
18 | };
19 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Mac/MacUtils.mm:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/10/21.
3 | //
4 | #include "Platform/MacUtils.h"
5 | #import
6 |
7 | namespace RcEngine{
8 | std::string FileDialogs::OpenFile(const char *filter) {
9 | @autoreleasepool {
10 | NSString *convertedString = [[NSString alloc] initWithCString:filter encoding:NSUTF8StringEncoding];
11 |
12 | // Sets modal properties before window is shown
13 | // Generic NSOpenPanel is being used to pick files
14 | NSOpenPanel *panel = [NSOpenPanel openPanel];
15 | panel.canChooseFiles = YES;
16 | panel.canChooseDirectories = YES;
17 | panel.canCreateDirectories = YES;
18 |
19 | // Captures response value from "modal" window
20 | NSModalResponse response = [panel runModal];
21 |
22 | //[convertedString release];
23 | if (response == NSModalResponseOK) {
24 | //If okay response return filepath
25 | return std::string([[panel.URL path] UTF8String]);
26 | } else {
27 | // else return empty string
28 | return std::string([@"" UTF8String]);
29 | }
30 | }
31 | }
32 | std::string FileDialogs::SaveFile(const char *filter) {
33 | @autoreleasepool {
34 |
35 | NSString *convertedString = [[NSString alloc] initWithCString:filter encoding:NSUTF8StringEncoding];
36 |
37 | // Sets modal properties before window is shown
38 | //The window type specifically is a NSSavePanel
39 | NSSavePanel *panel = [NSSavePanel savePanel];
40 | panel.title = @"Save Scene As...";
41 | panel.nameFieldStringValue = @"Scene1.rc";
42 | panel.showsHiddenFiles = YES;
43 | panel.canCreateDirectories = YES;
44 |
45 | // Captures response value from "modal" window
46 | NSModalResponse response = [panel runModal];
47 |
48 | //[convertedString release];
49 | if (response == NSModalResponseOK) {
50 | //If okay response return filepath
51 | return std::string([[panel.URL path] UTF8String]);
52 | } else {
53 | // else return empty string
54 | return std::string([@"" UTF8String]);
55 | }
56 | }
57 |
58 | }
59 | void FileDialogs::OpenExplorer(const char *path) {
60 | //convert input path to NSString
61 | NSString *convertedString = [[NSString alloc] initWithCString: path encoding:NSUTF8StringEncoding];
62 | //convert NSString to NSURL filepath for NSWorkspace to open in finder
63 | NSURL *xmlURL =[NSURL fileURLWithPath: convertedString];
64 | // create NSWorkspace panel
65 | [[NSWorkspace sharedWorkspace] openURL:xmlURL];
66 | }
67 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Mac/MacWindow.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 |
5 | #define GLFW_INCLUDE_VULKAN
6 | #include "RcEngine/Core/Window.h"
7 | #include "RcEngine/Renderer/GraphicsContext.h"
8 |
9 | #include
10 | #include
11 |
12 | namespace RcEngine{
13 | class MacWindow: public Window{
14 | public:
15 | MacWindow(const WindowProps & props);
16 | virtual ~MacWindow();
17 |
18 | void OnUpdate() override;
19 |
20 | inline unsigned int GetWidth() const override {return m_Data.Width; }
21 | inline unsigned int GetHeight() const override {return m_Data.Height; }
22 |
23 | //Window attributes
24 |
25 | inline void SetEventCallback(const EventCallbackfn& callback) override {m_Data.EventCallback = callback; }
26 | void SetVSync(bool enabled) override;
27 | bool IsVsync() const override ;
28 |
29 | virtual void* GetNativeWindow() const override{ return m_Window; }
30 | private:
31 | virtual void Init(const WindowProps& props);
32 | virtual void Shutdown();
33 | private:
34 | GLFWwindow* m_Window;
35 | Scope m_Context;
36 |
37 | struct WindowData{
38 | std::string Title;
39 | unsigned int Width, Height;
40 | bool VSync;
41 |
42 | EventCallbackfn EventCallback;
43 | };
44 | WindowData m_Data;
45 | };
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Mac/processordetection.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/12/21.
3 | //
4 | #pragma once
5 |
6 | #include "Platform/processordetection.h"
7 | #include
8 | namespace RcEngine{
9 | template< typename T>
10 | int getCTLValue(const char key[], T * dest){
11 | size_t len =0;
12 | int err;
13 |
14 | err = sysctlbyname(key,nullptr,&len, nullptr,0);
15 | if(!err){
16 | RC_CORE_ASSERT((len == sizeof(T)), "Mis-matched destination type for SYSCTL() read.\n");
17 | err = sysctlbyname(key,dest,&len, nullptr,0);
18 | }
19 | return err;
20 | }
21 |
22 | std::string ProcessorDetectionBase::getCPUString() {
23 | char buffer[64];
24 | size_t bufferlen = 64;
25 | sysctlbyname("machdep.cpu.brand_string", &buffer, &bufferlen, nullptr, 0);
26 | return buffer;
27 | }
28 |
29 | int32_t ProcessorDetectionBase::getCPUMaxFreq() {
30 | int32_t freq;
31 | size_t bufferlen = sizeof(freq);
32 | // TODO: deal with M1 issue
33 | sysctlbyname("hw.cpufrequency_max", &freq, &bufferlen, nullptr, 0);
34 | return freq;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/MacUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/10/21.
3 | //
4 | #pragma once
5 | #include "rcpch.h"
6 | #include "RcEngine/Utils/PlatformUtils.h"
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/MetalBuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Created by Tristan Zippert on 7/13/21.
3 |
4 | Header for C++ Metal buffer wrapper
5 | */
6 | #pragma once
7 | #include "MetalResource.h"
8 | #include "RcEngine/Core/Core.h"
9 | #include "RcEngine/Renderer/Buffer.h"
10 |
11 | namespace RcEngine{
12 | class MetalVertexBuffer: public VertexBuffer{
13 | public:
14 | MetalVertexBuffer(float* vertices, uint32_t size);
15 | MetalVertexBuffer(uint32_t count);
16 |
17 | ~MetalVertexBuffer() override;
18 |
19 | void Bind() const override;
20 |
21 | void Unbind() const override;
22 |
23 | void SetData(const void *data, uint32_t size) override;
24 |
25 | void SetLayout(const BufferLayout &layout) override;
26 |
27 | const BufferLayout &GetLayout() const override;
28 | public:
29 |
30 | CPPMetalInternal::Buffer objCObj() const;
31 | private:
32 | id m_device;
33 | BufferLayout m_Layout;
34 |
35 | void *m_contentsPtr;
36 | id m_VertexBuffer;
37 | id m_IndexBuffer;
38 | };
39 |
40 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/MetalBuffer.mm:
--------------------------------------------------------------------------------
1 | #include "MetalBuffer.h"
2 |
3 |
4 | namespace RcEngine {
5 |
6 | MetalVertexBuffer::MetalVertexBuffer(float *vertices, uint32_t size) {
7 |
8 | }
9 |
10 | MetalVertexBuffer::MetalVertexBuffer(uint32_t count) {
11 |
12 | }
13 |
14 | MetalVertexBuffer::~MetalVertexBuffer() {
15 |
16 | }
17 |
18 | void MetalVertexBuffer::Bind() const {
19 |
20 | }
21 |
22 | void MetalVertexBuffer::Unbind() const {
23 |
24 | }
25 |
26 | void MetalVertexBuffer::SetData(const void *data, uint32_t size) {
27 |
28 | }
29 |
30 | void MetalVertexBuffer::SetLayout(const BufferLayout &layout) {
31 |
32 | }
33 |
34 | const BufferLayout &MetalVertexBuffer::GetLayout() const {
35 | return m_Layout;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/MetalShader.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/21/22.
3 | //
4 |
5 | #include "MetalShader.h"
6 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/MetalShader.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/21/22.
3 | //
4 |
5 | #ifndef RCGAMEENGINE_METALSHADER_H
6 | #define RCGAMEENGINE_METALSHADER_H
7 |
8 | #endif //RCGAMEENGINE_METALSHADER_H
9 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/Foundation.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/Foundation.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #include "NSArray.hpp"
26 | #include "NSAutoreleasePool.hpp"
27 | #include "NSBundle.hpp"
28 | #include "NSData.hpp"
29 | #include "NSDate.hpp"
30 | #include "NSDefines.hpp"
31 | #include "NSDictionary.hpp"
32 | #include "NSEnumerator.hpp"
33 | #include "NSError.hpp"
34 | #include "NSLock.hpp"
35 | #include "NSNotification.hpp"
36 | #include "NSNumber.hpp"
37 | #include "NSObject.hpp"
38 | #include "NSPrivate.hpp"
39 | #include "NSProcessInfo.hpp"
40 | #include "NSRange.hpp"
41 | #include "NSString.hpp"
42 | #include "NSTypes.hpp"
43 | #include "NSURL.hpp"
44 |
45 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
46 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/NSData.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/NSData.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #include "NSObject.hpp"
26 | #include "NSTypes.hpp"
27 |
28 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
29 |
30 | namespace NS
31 | {
32 | class Data : public Copying
33 | {
34 | public:
35 | void* mutableBytes() const;
36 | UInteger length() const;
37 | };
38 | }
39 |
40 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
41 |
42 | _NS_INLINE void* NS::Data::mutableBytes() const
43 | {
44 | return Object::sendMessage(this, _NS_PRIVATE_SEL(mutableBytes));
45 | }
46 |
47 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
48 |
49 | _NS_INLINE NS::UInteger NS::Data::length() const
50 | {
51 | return Object::sendMessage(this, _NS_PRIVATE_SEL(length));
52 | }
53 |
54 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
55 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/NSDate.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/NSDate.hpp
4 | //
5 | // See LICENSE.txt for this project licensing information.
6 | //
7 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
8 |
9 | #pragma once
10 |
11 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
12 |
13 | #include "NSDefines.hpp"
14 | #include "NSObject.hpp"
15 | #include "NSPrivate.hpp"
16 | #include "NSTypes.hpp"
17 |
18 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
19 |
20 | namespace NS
21 | {
22 |
23 | using TimeInterval = double;
24 |
25 | class Date : public Copying
26 | {
27 | public:
28 | static Date* dateWithTimeIntervalSinceNow(TimeInterval secs);
29 | };
30 |
31 | } // NS
32 |
33 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
34 |
35 | _NS_INLINE NS::Date* NS::Date::dateWithTimeIntervalSinceNow(NS::TimeInterval secs)
36 | {
37 | return NS::Object::sendMessage(_NS_PRIVATE_CLS(NSDate), _NS_PRIVATE_SEL(dateWithTimeIntervalSinceNow_), secs);
38 | }
39 |
40 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/NSDefines.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/NSDefines.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #define _NS_WEAK_IMPORT __attribute__((weak_import))
26 | #define _NS_EXPORT __attribute__((visibility("default")))
27 | #define _NS_EXTERN extern "C" _NS_EXPORT
28 | #define _NS_INLINE inline __attribute__((always_inline))
29 | #define _NS_PACKED __attribute__((packed))
30 |
31 | #define _NS_CONST(type, name) _NS_EXTERN type const name;
32 | #define _NS_ENUM(type, name) enum name : type
33 | #define _NS_OPTIONS(type, name) \
34 | using name = type; \
35 | enum : name
36 |
37 | #define _NS_CAST_TO_UINT(value) static_cast(value)
38 | #define _NS_VALIDATE_SIZE(ns, name) static_assert(sizeof(ns::name) == sizeof(ns##name), "size mismatch " #ns "::" #name)
39 | #define _NS_VALIDATE_ENUM(ns, name) static_assert(_NS_CAST_TO_UINT(ns::name) == _NS_CAST_TO_UINT(ns##name), "value mismatch " #ns "::" #name)
40 |
41 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
42 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/NSObjCRuntime.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/NSObjCRuntime.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #include "NSDefines.hpp"
26 | #include "NSTypes.hpp"
27 |
28 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
29 |
30 | namespace NS
31 | {
32 |
33 | _NS_ENUM(Integer, ComparisonResult) {
34 | OrderedAscending = -1,
35 | OrderedSame = 0,
36 | OrderedDescending = 1,
37 | };
38 |
39 | const Integer NotFound = IntegerMax;
40 |
41 | }
42 |
43 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
44 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Foundation/NSTypes.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Foundation/NSTypes.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #include "NSDefines.hpp"
26 |
27 | #include
28 | #include
29 |
30 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
31 |
32 | namespace NS
33 | {
34 | using TimeInterval = double;
35 |
36 | using Integer = std::intptr_t;
37 | using UInteger = std::uintptr_t;
38 |
39 | const Integer IntegerMax = INTPTR_MAX;
40 | const Integer IntegerMin = INTPTR_MIN;
41 | const UInteger UIntegerMax = UINTPTR_MAX;
42 |
43 | struct OperatingSystemVersion
44 | {
45 | Integer majorVersion;
46 | Integer minorVersion;
47 | Integer patchVersion;
48 | } _NS_PACKED;
49 | }
50 |
51 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
52 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Metal/MTLDefines.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Metal/MTLDefines.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24 |
25 | #include "../Foundation/NSDefines.hpp"
26 |
27 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
28 |
29 | #define _MTL_EXPORT _NS_EXPORT
30 | #define _MTL_EXTERN _NS_EXTERN
31 | #define _MTL_INLINE _NS_INLINE
32 | #define _MTL_PACKED _NS_PACKED
33 |
34 | #define _MTL_CONST(type, name) _NS_CONST(type, name)
35 | #define _MTL_ENUM(type, name) _NS_ENUM(type, name)
36 | #define _MTL_OPTIONS(type, name) _NS_OPTIONS(type, name)
37 |
38 | #define _MTL_VALIDATE_SIZE(ns, name) _NS_VALIDATE_SIZE(ns, name)
39 | #define _MTL_VALIDATE_ENUM(ns, name) _NS_VALIDATE_ENUM(ns, name)
40 |
41 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
42 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Metal/MTLFence.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Metal/MTLFence.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | #include "MTLDefines.hpp"
24 | #include "MTLHeaderBridge.hpp"
25 | #include "MTLPrivate.hpp"
26 |
27 | #include
28 |
29 | namespace MTL
30 | {
31 | class Fence : public NS::Referencing
32 | {
33 | public:
34 | class Device* device() const;
35 |
36 | NS::String* label() const;
37 | void setLabel(const NS::String* label);
38 | };
39 |
40 | }
41 |
42 | // property: device
43 | _MTL_INLINE MTL::Device* MTL::Fence::device() const
44 | {
45 | return Object::sendMessage(this, _MTL_PRIVATE_SEL(device));
46 | }
47 |
48 | // property: label
49 | _MTL_INLINE NS::String* MTL::Fence::label() const
50 | {
51 | return Object::sendMessage(this, _MTL_PRIVATE_SEL(label));
52 | }
53 |
54 | _MTL_INLINE void MTL::Fence::setLabel(const NS::String* label)
55 | {
56 | Object::sendMessage(this, _MTL_PRIVATE_SEL(setLabel_), label);
57 | }
58 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Metal/metal-cpp/Metal/MTLFunctionHandle.hpp:
--------------------------------------------------------------------------------
1 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | //
3 | // Metal/MTLFunctionHandle.hpp
4 | //
5 | // Copyright 2020-2021 Apple Inc.
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20 |
21 | #pragma once
22 |
23 | #include "MTLDefines.hpp"
24 | #include "MTLHeaderBridge.hpp"
25 | #include "MTLPrivate.hpp"
26 |
27 | #include
28 |
29 | #include "MTLLibrary.hpp"
30 |
31 | namespace MTL
32 | {
33 | class FunctionHandle : public NS::Referencing
34 | {
35 | public:
36 | MTL::FunctionType functionType() const;
37 |
38 | NS::String* name() const;
39 |
40 | class Device* device() const;
41 | };
42 |
43 | }
44 |
45 | // property: functionType
46 | _MTL_INLINE MTL::FunctionType MTL::FunctionHandle::functionType() const
47 | {
48 | return Object::sendMessage(this, _MTL_PRIVATE_SEL(functionType));
49 | }
50 |
51 | // property: name
52 | _MTL_INLINE NS::String* MTL::FunctionHandle::name() const
53 | {
54 | return Object::sendMessage(this, _MTL_PRIVATE_SEL(name));
55 | }
56 |
57 | // property: device
58 | _MTL_INLINE MTL::Device* MTL::FunctionHandle::device() const
59 | {
60 | return Object::sendMessage(this, _MTL_PRIVATE_SEL(device));
61 | }
62 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLBuffer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/27/21.
3 | //
4 | #include "OpenGLBuffer.h"
5 | #include "rcpch.h"
6 |
7 | #include <../include/glad/glad.h>
8 |
9 | namespace RcEngine{
10 | OpenGLVertexBuffer::OpenGLVertexBuffer(uint32_t count) {
11 | RC_PROFILE_FUNCTION();
12 | glShadeModel(GL_FLAT);
13 | glGenBuffers(1, &m_RendererID);
14 | glBindBuffer(GL_ARRAY_BUFFER,m_RendererID);
15 | glBufferData(GL_ARRAY_BUFFER, count, nullptr, GL_DYNAMIC_DRAW);
16 | }
17 | OpenGLVertexBuffer::OpenGLVertexBuffer(float* vertices, uint32_t size)
18 | {
19 | RC_PROFILE_FUNCTION();
20 | glGenBuffers(1, &m_RendererID);
21 | glBindBuffer(GL_ARRAY_BUFFER,m_RendererID);
22 | glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);
23 |
24 | }
25 | OpenGLVertexBuffer::~OpenGLVertexBuffer(){
26 | RC_PROFILE_FUNCTION();
27 | glDeleteBuffers(1, &m_RendererID);
28 | }
29 | void OpenGLVertexBuffer::SetData(const void *data, uint32_t size) {
30 | glBindBuffer(GL_ARRAY_BUFFER, m_RendererID);
31 | glBufferSubData(GL_ARRAY_BUFFER,0, size ,data);
32 | }
33 | void OpenGLVertexBuffer::Bind() const {
34 | RC_PROFILE_FUNCTION();
35 | glBindBuffer(GL_ARRAY_BUFFER,m_RendererID);
36 | }
37 | void OpenGLVertexBuffer::Unbind() const {
38 | RC_PROFILE_FUNCTION();
39 | glBindBuffer(GL_ARRAY_BUFFER,0);
40 | }
41 |
42 | //-----------------------------------------------------------------------------------
43 | //Index Buffer-----------------------------------------------------------------------
44 | //-----------------------------------------------------------------------------------
45 |
46 | OpenGLIndexBuffer::OpenGLIndexBuffer(uint32_t *indices, uint32_t count)
47 | :m_Count(count){
48 | RC_PROFILE_FUNCTION();
49 | glGenBuffers(1, &m_RendererID);
50 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,m_RendererID);
51 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(uint32_t), indices, GL_STATIC_DRAW);
52 | }
53 | OpenGLIndexBuffer::~OpenGLIndexBuffer() {
54 | RC_PROFILE_FUNCTION();
55 | glDeleteBuffers(1, &m_RendererID);
56 | }
57 | void OpenGLIndexBuffer::Bind() const {
58 | RC_PROFILE_FUNCTION();
59 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID);
60 | }
61 | void OpenGLIndexBuffer::Unbind() const {
62 | RC_PROFILE_FUNCTION();
63 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
64 | }
65 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/27/21.
3 | //
4 | #pragma once
5 |
6 | #include "RcEngine/Renderer/Buffer.h"
7 | #define GL_SILENCE_DEPRECATION
8 |
9 | namespace RcEngine{
10 | class OpenGLVertexBuffer: public VertexBuffer{
11 | public:
12 | OpenGLVertexBuffer(float* vertices, uint32_t size);
13 | OpenGLVertexBuffer(uint32_t count);
14 | virtual ~OpenGLVertexBuffer();
15 |
16 | virtual void Bind() const override;
17 | virtual void Unbind() const override;
18 |
19 | virtual void SetData(const void* data, uint32_t size) override;
20 |
21 | virtual void SetLayout(const BufferLayout& layout) override { m_Layout = layout; }
22 | virtual const BufferLayout& GetLayout() const override{return m_Layout;}
23 | private:
24 | uint32_t m_RendererID;
25 | BufferLayout m_Layout;
26 | };
27 |
28 | class OpenGLIndexBuffer: public IndexBuffer{
29 | public:
30 | OpenGLIndexBuffer(uint32_t* indices, uint32_t count);
31 | virtual ~OpenGLIndexBuffer();
32 |
33 | virtual void Bind() const override;
34 | virtual void Unbind() const override;
35 | virtual uint32_t GetCount() const override{return m_Count; }
36 | private:
37 | uint32_t m_RendererID;
38 | uint32_t m_Count;
39 | };
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLContext.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/25/21.
3 | //
4 | #include "rcpch.h"
5 | #include "OpenGLContext.h"
6 |
7 |
8 | #include <../external/GLFW/include/GLFW/glfw3.h>
9 | #include <../include/glad/glad.h>
10 |
11 | namespace RcEngine{
12 | OpenGLContext::OpenGLContext(GLFWwindow *windowHandle)
13 | :m_WindowHandle(windowHandle)
14 | {
15 | RC_CORE_ASSERT(m_WindowHandle, "Window is null");
16 |
17 | }
18 | void OpenGLContext::Init() {
19 | RC_PROFILE_FUNCTION();
20 |
21 | glfwMakeContextCurrent(m_WindowHandle);
22 | int status = gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
23 | RC_CORE_ASSERT(status, "failed to init glad loader");
24 |
25 | RC_CORE_INFO(" Opengl Renderer: {0}",glGetString(GL_VENDOR));
26 | RC_CORE_INFO(" Vendor {0}", glGetString(GL_VERSION));
27 | }
28 | void OpenGLContext::SwapBuffers() {
29 | RC_PROFILE_FUNCTION();
30 | glfwSwapBuffers(m_WindowHandle);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/25/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Renderer/GraphicsContext.h"
6 |
7 |
8 | struct GLFWwindow;
9 |
10 | namespace RcEngine{
11 |
12 | class OpenGLContext: public GraphicsContext{
13 | public:
14 | OpenGLContext(GLFWwindow* windowHandle);
15 |
16 |
17 | virtual void Init() override;
18 | virtual void SwapBuffers() override;
19 | private:
20 | GLFWwindow* m_WindowHandle;
21 | };
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLFrameBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/5/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Renderer/FrameBuffer.h"
6 |
7 | #ifndef RCENGINE_CLION_OPENGLFRAMEBUFFER_H
8 | #define RCENGINE_CLION_OPENGLFRAMEBUFFER_H
9 | namespace RcEngine {
10 | class OpenGLFramebuffer : public FrameBuffer {
11 | public:
12 | OpenGLFramebuffer(const FrameBufferSpec &spec);
13 |
14 | virtual ~OpenGLFramebuffer();
15 |
16 | void Invalidate();
17 |
18 | virtual void Bind() override;
19 |
20 | virtual void UnBind() override;
21 |
22 | virtual int ReadPixel(uint32_t attachmentidx, int x, int y) override;
23 |
24 |
25 | virtual void Resize(uint32_t width, uint32_t height) override;
26 |
27 | virtual uint32_t GetColorAttachmentRendererID(uint32_t index) const override {
28 | RC_CORE_ASSERT(index < m_ColorAttachments.size(),"");
29 | return m_ColorAttachments[index]; }
30 |
31 | virtual uint32_t GetRendererID() const override{return m_RendererID;}
32 |
33 | virtual const FrameBufferSpec &GetSpecification() const override { return m_Specification; }
34 |
35 | private:
36 | uint32_t m_RendererID =0;
37 | FrameBufferSpec m_Specification;
38 |
39 | std::vector m_ColorAttachmentSpecs;
40 | FramebufferTextureSpec m_DepthAttachmentSpec = FrameBufferTextureFormat::None;
41 |
42 | std::vector m_ColorAttachments;
43 | uint32_t m_DepthAttachment = 0;
44 | };
45 |
46 | }
47 | #endif //RCENGINE_CLION_OPENGLFRAMEBUFFER_H
48 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLRenderAPI.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/30/21.
3 | //
4 |
5 | #include "rcpch.h"
6 | #include "OpenGLRenderAPI.h"
7 |
8 | #include <../include/glad/glad.h>
9 |
10 | namespace RcEngine{
11 | void OpenGLRenderAPI::Init() {
12 | RC_PROFILE_FUNCTION();
13 |
14 | glEnable(GL_DEBUG_OUTPUT);
15 |
16 | glEnable(GL_DEPTH_TEST);
17 | glEnable(GL_BLEND);
18 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
19 |
20 | }
21 | void OpenGLRenderAPI::SetViewport(uint32_t x, uint32_t y,uint32_t width,uint32_t height) {
22 | glViewport(x,y,width, height);
23 | }
24 |
25 | void OpenGLRenderAPI::SetClearColor(const glm::vec4 &color) {
26 | glClearColor(color.r,color.g,color.b,color.a);
27 | }
28 | void OpenGLRenderAPI::Clear() {
29 | glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
30 | }
31 | void OpenGLRenderAPI::DrawIndexed(const Ref& vertexArray, uint32_t indexCount) {
32 | uint32_t count = indexCount ? vertexArray->GetIndexBuffer()->GetCount() : indexCount;
33 | glDrawElements(GL_TRIANGLES,
34 | count,GL_UNSIGNED_INT,nullptr);
35 | glBindTexture(GL_TEXTURE_2D,0);
36 | }
37 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLRenderAPI.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/30/21.
3 | //
4 | #pragma once
5 |
6 | #include "RcEngine/Renderer/RenderAPI.h"
7 |
8 | #ifndef RCENGINE_CLION_OPENGLRENDERAPI_H
9 | #define RCENGINE_CLION_OPENGLRENDERAPI_H
10 |
11 | namespace RcEngine{
12 | class OpenGLRenderAPI: public RenderAPI{
13 | virtual void Init() override;
14 |
15 | virtual void SetViewport(uint32_t x, uint32_t y,uint32_t width,uint32_t height) override;
16 |
17 | virtual void Clear() override;
18 | virtual void SetClearColor(const glm::vec4& color)override;
19 |
20 | virtual void DrawIndexed(const Ref& vertexArray, uint32_t indexCount =0) override;
21 | };
22 | }
23 |
24 | #endif //RCENGINE_CLION_OPENGLRENDERAPI_H
25 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLShader.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 6/17/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Renderer/Shader.h"
6 | #include
7 | //#include
8 | typedef unsigned int GLenum;
9 |
10 | #ifndef RCENGINE_CLION_OPENGLSHADER_H
11 | #define RCENGINE_CLION_OPENGLSHADER_H
12 |
13 | typedef uint32_t RendererID;
14 | namespace RcEngine{
15 |
16 | class OpenGLShader:public Shader{
17 | public:
18 | OpenGLShader(const std::string& name, const std::string& vertexSrc, const std::string& fragmentSrc);
19 | OpenGLShader(const std::string& filepath);
20 |
21 | virtual ~OpenGLShader();
22 |
23 | virtual const std::string& GetName() const override{
24 | return m_Name;
25 | };
26 |
27 | virtual void Bind() const override;
28 | virtual void Unbind() const override;
29 |
30 | virtual void SetFloat(const std::string& name, const float value) override;
31 | virtual void SetInt(const std::string& name, const int value) override;
32 | virtual void SetIntArray(const std::string& name, int* values, uint32_t count) override;
33 |
34 | virtual void SetFloat3(const std::string& name, const glm::vec3& value) override;
35 | virtual void SetFloat4(const std::string& name, const glm::vec4& value) override;
36 | virtual void SetMat4(const std::string& name, const glm::mat4& value) override;
37 |
38 | void UploadUniformInt(const std::string& name, const int value);
39 | void UploadUniformIntArray(const std::string &name, int* values, uint32_t count);
40 |
41 | void UploadUniformMat3(const std::string& name, const glm::mat3& matrix);
42 | void UploadUniformMat4(const std::string& name, const glm::mat4& matrix);
43 |
44 | void UploadUniformFloat(const std::string& name, const float values);
45 | void UploadUniformFloat2(const std::string& name, const glm::vec2& values);
46 | void UploadUniformFloat3(const std::string& name, const glm::vec3& values);
47 | void UploadUniformFloat4(const std::string& name, const glm::vec4& values);
48 |
49 | void UploadSampler(const char* name);
50 | private:
51 | std::string ReadFile(const std::string& filepath);
52 | std::unordered_map PreProcess(const std::string& source);
53 | void Compile(const std::unordered_map& shaderSource);
54 | private:
55 | RendererID m_RendererID;
56 | std::string m_Name;
57 | };
58 | }
59 |
60 | #endif //RCENGINE_CLION_OPENGLSHADER_H
61 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLTexture.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 6/19/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Renderer/Texture.h"
6 | #include
7 |
8 | #ifndef RCENGINE_CLION_OPENGLTEXTURE_H
9 | #define RCENGINE_CLION_OPENGLTEXTURE_H
10 |
11 |
12 | namespace RcEngine{
13 | class OpenGLTexture2D: public Texture2D {
14 | public:
15 | OpenGLTexture2D(uint32_t width, uint32_t height);
16 | OpenGLTexture2D(const char* path);
17 |
18 | void CreateCubeMap(bool with_mipmap);
19 |
20 | virtual ~OpenGLTexture2D();
21 |
22 | virtual void SetData(void* data, uint32_t size, uint32_t slot =0) const override;
23 |
24 | virtual uint32_t GetHeight() const override{return m_Height;}
25 | virtual uint32_t GetWidth() const override{return m_Width;}
26 | virtual uint32_t GetRendererID() const override {return m_RendererID;}
27 |
28 | virtual void Bind(uint32_t slot = 0) const override;
29 |
30 | virtual bool operator==(const Texture& other) const override{
31 | return m_RendererID == ((OpenGLTexture2D&)other).m_RendererID;
32 | }
33 | virtual std::string getPath() const override{return m_Path;}
34 |
35 | private:
36 | std::string m_Path;
37 | uint32_t m_Width, m_Height;
38 | uint32_t m_RendererID;
39 | GLenum m_InternalFormat, m_DataFormat;
40 | };
41 | }
42 |
43 |
44 | #endif //RCENGINE_CLION_OPENGLTEXTURE_H
45 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLUniformBuffer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/2/21.
3 | //
4 | #include "rcpch.h"
5 | #include "OpenGLUniformBuffer.h"
6 |
7 | #include
8 |
9 | namespace RcEngine{
10 |
11 | OpenGlUniformBuffer::OpenGlUniformBuffer(uint32_t size, uint32_t binding) {
12 | glGenBuffers(1, &m_RendererID);
13 | glBindBuffer(GL_UNIFORM_BUFFER,m_RendererID);
14 | glBufferData(GL_UNIFORM_BUFFER,size,nullptr,GL_DYNAMIC_DRAW);
15 | glBindBufferBase(GL_UNIFORM_BUFFER,binding,m_RendererID);
16 |
17 | }
18 |
19 | OpenGlUniformBuffer::~OpenGlUniformBuffer() {
20 | glDeleteBuffers(1,&m_RendererID);
21 | }
22 |
23 | void OpenGlUniformBuffer::SetData(const void *data, uint32_t size, uint32_t offset) {
24 | glBufferSubData(m_RendererID,offset,size,data);
25 | }
26 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLUniformBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/2/21.
3 | //
4 | #pragma once
5 |
6 | #include "RcEngine/Renderer/UniformBuffer.h"
7 |
8 | #ifndef RCENGINE_OPENGLUNIFORMBUFFER_H
9 | #define RCENGINE_OPENGLUNIFORMBUFFER_H
10 | namespace RcEngine{
11 | class OpenGlUniformBuffer: public UniformBuffer{
12 | public:
13 | OpenGlUniformBuffer(uint32_t size, uint32_t binding);
14 | virtual ~OpenGlUniformBuffer();
15 |
16 | virtual void SetData(const void* data, uint32_t size, uint32_t offset =0) override;
17 | private:
18 | uint32_t m_RendererID =0;
19 | };
20 | }
21 | #endif //RCENGINE_OPENGLUNIFORMBUFFER_H
22 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/28/21.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "rcpch.h"
8 | #include
9 |
10 | #include <../external/GLFW/include/GLFW/glfw3.h>
11 |
12 | namespace RcEngine{
13 | class FileDialog{
14 | public:
15 | static std::string OpenFile(const char* filter);
16 | static std::string SaveFile(const char* filter);
17 | };
18 | class OpenGLUtils{
19 | public:
20 | OpenGLUtils();
21 | static void displayComputerShaderLimits();
22 | static bool CheckOpenGLError();
23 |
24 | static void checkOpenGLErrors();
25 |
26 | static void PrintShaderLog(unsigned int shader);
27 | static void printProgramLog(int prog);
28 |
29 | static unsigned int loadTexture(const char *texImagePath);
30 | static unsigned int loadCubeMap(const char *mapDir);
31 |
32 | static std::string readShaderFile(const char* filepath);
33 |
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/OpenGL/OpenGLVertexArray.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/29/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Renderer/VertexArray.h"
6 |
7 | #ifndef RCENGINE_CLION_OPENGLVERTEXARRAY_H
8 | #define RCENGINE_CLION_OPENGLVERTEXARRAY_H
9 |
10 | namespace RcEngine{
11 | class OpenGLVertexArray: public VertexArray{
12 | public:
13 | OpenGLVertexArray();
14 | virtual ~OpenGLVertexArray();
15 |
16 | virtual void Bind() const override;
17 |
18 | virtual void Unbind() const override;
19 |
20 | virtual void AddVertexBuffer(const Ref& vertexBuffer)override ;
21 | virtual void SetIndexBuffer(const Ref& indexBuffer)override ;
22 |
23 | virtual const std::vector[> & GetVertexBuffers() const override{return m_VertexBuffers;};
24 | virtual const Ref & GetIndexBuffer() const override{return m_IndexBuffer;};
25 |
26 | private:
27 | RendererID m_RendererID;
28 | uint32_t m_VertexBufferIndex = 0;
29 | std::vector][> m_VertexBuffers;
30 | std::shared_ptr m_IndexBuffer;
31 |
32 | };
33 | }
34 |
35 |
36 | #endif //RCENGINE_CLION_OPENGLVERTEXARRAY_H
37 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKBuffer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/18/21.
3 | //
4 | #include "Platform/Vulkan/VKBuffer.h"
5 | #include "vulkan/vulkan_core.h"
6 |
7 | const std::vector validationLayers = {
8 | "VK_LAYER_KHRONOS_validation"
9 | };
10 |
11 | #ifdef NDEBUG
12 | const bool enableValidationLayers = false;
13 | #else
14 | const bool enableValidationLayers = true;
15 | #endif
16 |
17 | namespace RcEngine{
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/18/21.
3 | //
4 |
5 | #ifndef RCENGINE_VKBUFFER_H
6 | #define RCENGINE_VKBUFFER_H
7 | #include "RcEngine/Renderer/Buffer.h"
8 |
9 |
10 |
11 | namespace RcEngine{
12 | class VKVertexBuffer: public VertexBuffer{
13 |
14 | };
15 | class VKIndexBuffer: public IndexBuffer{
16 |
17 | };
18 | }
19 |
20 | #endif //RCENGINE_VKBUFFER_H
21 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKTexture.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 1/23/22.
3 | //
4 |
5 | #include "VKTexture.h"
6 | #include
7 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKTexture.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 1/23/22.
3 | //
4 |
5 | #ifndef RCENGINE_VKTEXTURE_H
6 | #define RCENGINE_VKTEXTURE_H
7 | #pragma once
8 | #include "vulkan/vulkan_core.h"
9 | #include "RcEngine/Renderer/Texture.h"
10 |
11 |
12 | namespace RcEngine{
13 | struct UploadContext{
14 | VkFence _uploadFence;
15 | VkCommandPool _commandPool;
16 | VkCommandBuffer _commandBuffer;
17 | };
18 | class VKTexture2D : Texture2D{
19 | public:
20 | VKTexture2D(uint32_t width, uint32_t height);
21 | VKTexture2D(const char* path);
22 |
23 |
24 | virtual ~VKTexture2D();
25 |
26 | virtual void SetData(void* data, uint32_t size, uint32_t slot =0) const override;
27 |
28 | virtual uint32_t GetHeight() const override{return m_Height;}
29 | virtual uint32_t GetWidth() const override{return m_Width;}
30 | virtual uint32_t GetRendererID() const override {return m_RendererID;}
31 |
32 | virtual void Bind(uint32_t slot = 0) const override;
33 |
34 | virtual bool operator==(const Texture& other) const override{
35 | return m_RendererID == ((VKTexture2D&)other).m_RendererID;
36 | }
37 | virtual std::string getPath() const override{return m_Path;}
38 |
39 | private:
40 | std::string m_Path;
41 | uint32_t m_Width, m_Height;
42 | uint32_t m_RendererID;
43 | UploadContext _uploadContext;
44 | };
45 | }
46 | #endif //RCENGINE_VKTEXTURE_H
47 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKUniformBuffer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 11/24/21.
3 | //
4 |
5 | #include "VKUniformBuffer.h"
6 |
7 | namespace RcEngine{
8 | VulkanUniformBuffer::VulkanUniformBuffer(uint32_t size, uint32_t binding) {
9 | bindingDescription.binding = binding;
10 | bindingDescription.stride = size;
11 | bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
12 |
13 |
14 |
15 | }
16 | VulkanUniformBuffer::~VulkanUniformBuffer() {
17 |
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKUniformBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 11/24/21.
3 | //
4 |
5 | #ifndef RCENGINE_VKUNIFORMBUFFER_H
6 | #define RCENGINE_VKUNIFORMBUFFER_H
7 |
8 | #include "RcEngine/Renderer/UniformBuffer.h"
9 | #include
10 |
11 | namespace RcEngine{
12 | class VulkanUniformBuffer: public UniformBuffer{
13 | VulkanUniformBuffer(uint32_t size, uint32_t binding);
14 | virtual ~VulkanUniformBuffer();
15 |
16 | virtual void SetData(const void* data, uint32_t size, uint32_t offset =0) override;
17 |
18 | private:
19 | VkVertexInputBindingDescription bindingDescription;
20 | };
21 | }
22 | #endif //RCENGINE_VKUNIFORMBUFFER_H
23 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKUtils.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 11/24/21.
3 | //
4 |
5 | #include "VKUtils.h"
6 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Vulkan/VKUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 11/24/21.
3 | //
4 |
5 | #ifndef RCENGINE_VKUTILS_H
6 | #define RCENGINE_VKUTILS_H
7 |
8 | #endif //RCENGINE_VKUTILS_H
9 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Windows/WindowsWindow.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 | //
5 | // Created by Tristan Zippert on 5/22/21.
6 | //
7 |
8 |
9 | #include "RcEngine/Core/Window.h"
10 | #include "RcEngine/Renderer//GraphicsContext.h"
11 |
12 | #include
13 | #include
14 |
15 | namespace RcEngine{
16 | class WindowsWindow: public Window{
17 | public:
18 | WindowsWindow(const WindowProps & props);
19 | virtual ~WindowsWindow();
20 |
21 | void OnUpdate() override;
22 |
23 | inline unsigned int GetWidth() const override {return m_Data.Width; }
24 | inline unsigned int GetHeight() const override {return m_Data.Height; }
25 |
26 | //Window attributes
27 |
28 | inline void SetEventCallback(const EventCallbackfn& callback) override {m_Data.EventCallback = callback; }
29 | void SetVSync(bool enabled) override;
30 | bool IsVsync() const override;
31 |
32 | virtual void* GetNativeWindow() const { return m_Window; }
33 | private:
34 | virtual void Init(const WindowProps& props);
35 | virtual void Shutdown();
36 | private:
37 | GLFWwindow* m_Window;
38 | Scope m_Context;
39 |
40 | struct WindowData{
41 | std::string Title;
42 | unsigned int Width, Height;
43 | bool VSync;
44 |
45 | EventCallbackfn EventCallback;
46 | };
47 | WindowData m_Data;
48 | };
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/RcEngine/src/Platform/Windows/processordetection.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/13/21.
3 | //
4 |
5 | #pragma once
6 | #include "Platform/processordetection.h"
7 |
8 | namespace RcEngine{
9 | std::string ProcessorDetectionBase::getCPUString() {
10 | std::string vendor;
11 | int reg[4];
12 | __asm__ __volatile__ ("mov $0x80000002 , %eax\n\t");
13 | __asm__ __volatile__ (
14 | "cpuid"
15 | : "=a"(reg[0]),"=b"(reg[1]),"=c"(reg[2]),"=d"(reg[3])
16 | );
17 | for (int & i : reg) {
18 | vendor += std::string((const char *)&i, 4);
19 | }
20 | return vendor;
21 | }
22 |
23 | int32_t ProcessorDetectionBase::getCPUMaxFreq() {
24 | return 0;
25 | }
26 | }
--------------------------------------------------------------------------------
/RcEngine/src/Platform/processordetection.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/11/21.
3 | //
4 | #pragma once
5 | #ifndef RCENGINE_PROCESSORDETECTION_H
6 | #define RCENGINE_PROCESSORDETECTION_H
7 | namespace RcEngine{
8 | class ProcessorDetectionBase{
9 | public:
10 | static std::string getCPUString();
11 | static int32_t getCPUMaxFreq() ;
12 | };
13 | }
14 | #endif //RCENGINE_PROCESSORDETECTION_H
15 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/20/21.
3 | //
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 |
21 | #include
22 | #include
23 | #include
24 |
25 |
26 | #include "RcEngine/Scene/Scene.h"
27 | #include "RcEngine/Scene/Entity.h"
28 | #include "RcEngine/Scene/ScriptableEntity.h"
29 | #include "RcEngine/Scene/Component.h"
30 |
31 | ///CORE////////////////////////////////
32 | #include "RcEngine/Core/Application.h"
33 | #include "RcEngine/Core/Log.h"
34 | #include "RcEngine/Core/Layer.h"
35 |
36 | #include "RcEngine/Core/Timestep.h"
37 | #include "RcEngine/Core/MouseButtonCodes.h"
38 | #include "RcEngine/Core/keycodes.h"
39 | #include "RcEngine/Core/Input.h"
40 | ///////////////////////////////////////
41 |
42 | #include "RcEngine/ImGui/ImGuiLayer.h"
43 |
44 | ///Renderer////////////////////////////
45 | #include "RcEngine/Renderer/Renderer.h"
46 | #include "RcEngine/Renderer/RenderCommand.h"
47 | #include "RcEngine/Renderer/RenderAPI.h"
48 | #include "RcEngine/Renderer/Buffer.h"
49 | #include "RcEngine/Renderer/FrameBuffer.h"
50 |
51 | #include "RcEngine/Renderer/Shader.h"
52 | #include "RcEngine/Renderer/VertexArray.h"
53 | #include "RcEngine/Renderer/GraphicsContext.h"
54 | #include "RcEngine/Renderer/OrthoCamera.h"
55 | #include "RcEngine/Renderer/Texture.h"
56 | #include "RcEngine/Renderer/SubTexture2D.h"
57 | #include "RcEngine/Renderer/OrthoCameraController.h"
58 | #include "RcEngine/Renderer/IsoCameraController.h"
59 | #include "RcEngine/Renderer/Renderer2D.h"
60 | #include "Platform/processordetection.h"
61 | ///////////////////////////////////////
62 |
63 | ///OPENGL//////////////////////////////
64 | #include "Platform/OpenGL/OpenGLUtils.h"
65 | ///////////////////////////////////////
66 |
67 | ///Network/////////////////////////////
68 | #include "RcEngine/Network/Network.h"
69 | ///////////////////////////////////////
70 |
71 | ///LUA/////////////////////////////////
72 | #include "RcEngine/Lua/luastate.h"
73 | ///////////////////////////////////////
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Application.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #pragma once
5 |
6 | #include "Core.h"
7 | #include "LayerStack.h"
8 | #include "Window.h"
9 | #include "RcEngine/Events/ApplicationEvent.h"
10 |
11 | #include "RcEngine/ImGui/ImGuiLayer.h"
12 |
13 | #include "RcEngine/Renderer/Shader.h"
14 | #include "RcEngine/Renderer/Buffer.h"
15 | #include "RcEngine/Renderer/VertexArray.h"
16 |
17 | #include "RcEngine/Renderer/OrthoCamera.h"
18 |
19 | #include "RcEngine/Core/Timestep.h"
20 |
21 | namespace RcEngine{
22 | class RC_API Application{
23 | public:
24 | Application(const std::string& name = "RcEngine");
25 | virtual ~Application();
26 |
27 | void Run();
28 |
29 | void OnEvent(Event& e);
30 | bool OnWindowClosed(WindowCloseEvent& e);
31 | bool OnWindowResize(WindowResizeEvent& e );
32 |
33 | void PushLayer(Layer* layer);
34 | void PushOverlay(Layer* layer);
35 |
36 | inline static Application& Get() {return *s_Instance;}
37 | inline Window& GetWindow(){return *m_Window;}
38 |
39 | void Close();
40 |
41 | ImGuiLayer* GetImGuiLayer() { return m_ImGuiLayer; }
42 | private:
43 | static Application* s_Instance;
44 |
45 | ImGuiLayer* m_ImGuiLayer;
46 |
47 | Ref m_Window;
48 | bool m_Running = true;
49 | LayerStack m_LayerStack;
50 | bool m_Minimized = false;
51 | float m_LastFrameTime= 0.0f;
52 |
53 |
54 | };
55 | // Client defined
56 | Application* CreateApplication();
57 | }
58 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Assert.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #pragma once
5 | #include
6 |
7 | #ifdef RC_ENABLE_ASSERT
8 | #define RC_ASSERT(...)
9 | #define RC_CORE_ASSERT(...)
10 | #else
11 | #define RC_ASSERT(...)
12 | #define RC_CORE_ASSERT(...)
13 | #endif
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Core.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #pragma once
5 | #include
6 |
7 | #ifdef _MSC_VER
8 | #define DEBUG_BREAK __debugbreak()
9 | #elif defined( __clang__ )
10 | #if __has_builtin(__builtin_debugtrap)
11 | #define DEBUG_BREAK __builtin_debugtrap()
12 | #else
13 | #define DEBUG_BREAK __builtin_trap()
14 | #endif
15 | #elif defined( __GNUC__ )
16 | #define DEBUG_BREAK __builtin_trap()
17 | #else
18 | #error "OS not recognized"
19 | #endif
20 |
21 | #ifdef _WIN32
22 | #ifdef _WIN64
23 | #define RC_PLATFORM_WINDOWS
24 | #else
25 | #error "x32-86 bit builds not supported"
26 | #endif
27 | #elif defined(__APPLE__) || defined(__MACH__)
28 | #include
29 |
30 | #if TARGET_IPHONE_SIMULATOR == 1
31 | #error "IOS/IPHONE not supported"
32 | #elif TARGET_OS_IPHONE
33 | #define RC_PLATFORM_IOS
34 | #error "IOS not supported"
35 | #elif TARGET_OS_MAC
36 | #define RC_PLATFORM_MAC
37 | #else
38 | #error "Unknown APPLE"
39 | #endif
40 | #endif
41 |
42 | #ifdef RC_PLATFORM_WINDOWS
43 | #ifdef RC_BUILD_DLL
44 | #define RC_API __declspec(dllexport)
45 | #else
46 | #define RC_API __declspec(dllimport)
47 | #endif
48 | #else
49 | #ifdef RC_BUILD_DLL
50 | #define RC_API __attribute__ ((visibility ("default")))
51 | // #define DLL_LOCAL __attribute__ ((visibility ("hidden")))
52 | #else
53 | #define RC_API
54 | // #define DLL_LOCAL
55 | #endif
56 | #endif
57 |
58 | #ifdef RC_DEBUG
59 | #define RC_ENABLE_ASSERTS
60 | #endif
61 |
62 | #ifdef RC_ENABLE_ASSERTS
63 | #define RC_ASSERT(x, ...) {if(!(x)){RC_ERROR("Assertion Failed: {0}",__VA_ARGS__); DEBUG_BREAK; }}
64 | #define RC_CORE_ASSERT(x, ...) {if(!(x)) {RC_CORE_ERROR("Assertion failed: {0}",__VA_ARGS__); DEBUG_BREAK;} }
65 | #else
66 | #define RC_ASSERT(x, ...)
67 | #define RC_CORE_ASSERT(x, ...)
68 | #endif
69 |
70 | #define RC_BIND_EVENT_TO_FUNCTION(fn) [this](auto&&... args) -> decltype(auto){return this->fn(std::forward(args)...);}
71 |
72 | namespace RcEngine{
73 | template
74 | using Scope = std::unique_ptr;
75 | template
76 | constexpr Scope CreateScope(Args&& ...args){
77 | return std::make_unique(std::forward(args)...);
78 | }
79 | template
80 | using Ref = std::shared_ptr;
81 | template
82 | using Ref = std::shared_ptr;
83 |
84 | template
85 | constexpr Ref CreateRef(Args&& ... args)
86 | {
87 | return std::make_shared(std::forward(args)...);
88 | }
89 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/EntryPoint.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #pragma once
5 | #include "RcEngine.h"
6 | #include "RcEngine/Core/Log.h"
7 |
8 | #ifdef RC_PLATFORM_WINDOWS
9 | extern RcEngine::Application* RcEngine::CreateApplication();
10 |
11 | int main(int argc, char** argv){
12 | RcEngine::Log::Init();
13 | RC_CORE_WARN("Init log");
14 | RC_PROFILE_BEGIN_SESSION("Startup","RCENGINE-Startup.json");
15 | auto app = RcEngine::CreateApplication();
16 | RC_PROFILE_END_SESSION();
17 | RC_PROFILE_BEGIN_SESSION("Runtime","RCENGINE-runtime.json");
18 | app->Run();
19 | RC_PROFILE_END_SESSION();
20 | RC_PROFILE_BEGIN_SESSION("Shutdown","RCENGINE-Shutdown.json");
21 | delete app;
22 | RC_PROFILE_END_SESSION();
23 | return 0;
24 | }
25 | #else
26 | extern RcEngine::Application* RcEngine::CreateApplication();
27 |
28 | int main(int argc, char** argv){
29 | RcEngine::Log::Init();
30 | RC_CORE_WARN("Init log");
31 | RC_PROFILE_BEGIN_SESSION("Startup","RCENGINE-Startup.json");
32 | auto app = RcEngine::CreateApplication();
33 | RC_PROFILE_END_SESSION();
34 | RC_PROFILE_BEGIN_SESSION("Runtime","RCENGINE-runtime.json");
35 | app->Run();
36 | RC_PROFILE_END_SESSION();
37 | RC_PROFILE_BEGIN_SESSION("Shutdown","RCENGINE-Shutdown.json");
38 | delete app;
39 | RC_PROFILE_END_SESSION();
40 | return 0;
41 | }
42 | #endif
43 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Input.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/24/21.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "RcEngine/Core/Core.h"
8 |
9 | namespace RcEngine{
10 | class RC_API Input{
11 | public:
12 | inline static bool IsKeyPressed(int keycode){return s_Instance->IsKeyPressedImpl(keycode);}
13 |
14 | inline static bool IsMouseButtonPressed(int button){return s_Instance->IsMouseButtonPressedImpl(button);}
15 | inline static float GetMouseX() {return s_Instance-> GetMouseXImpl();}
16 | inline static float GetMouseY() {return s_Instance->GetMouseYImpl(); }
17 | inline static std::pair GetMousePos() {return s_Instance->GetMousePosImpl(); }
18 | protected:
19 | virtual bool IsKeyPressedImpl(int keycode) =0;
20 | virtual bool IsMouseButtonPressedImpl(int button) = 0;
21 | virtual float GetMouseXImpl()=0;
22 | virtual float GetMouseYImpl()=0;
23 | virtual std::pair GetMousePosImpl()=0;
24 |
25 |
26 | private:
27 | static Input* s_Instance;
28 | };
29 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Layer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 |
5 | #include "Layer.h"
6 | #include "rcpch.h"
7 |
8 | namespace RcEngine{
9 | Layer::Layer(const std::string& debugName)
10 | : m_DebugName(debugName){}
11 |
12 | Layer::~Layer(){
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Layer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Core/Core.h"
6 | #include "RcEngine/Events/Event.h"
7 | #include "RcEngine/Core/Timestep.h"
8 |
9 | namespace RcEngine{
10 | class RC_API Layer{
11 | public:
12 | Layer(const std::string& name = "RCLayer");
13 | virtual ~Layer();
14 |
15 | virtual void OnAttach(){}
16 | virtual void OnDetach(){}
17 | virtual void OnUpdate(Timestep ts){}
18 | virtual void OnImGuiRender(){}
19 |
20 | virtual void OnEvent(Event& event){}
21 |
22 | inline const std::string& GetName() const{return m_DebugName; }
23 |
24 | protected:
25 | std::string m_DebugName;
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/LayerStack.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 |
5 | #include "LayerStack.h"
6 | #include "rcpch.h"
7 |
8 | namespace RcEngine{
9 |
10 | LayerStack::LayerStack(){
11 | }
12 |
13 | LayerStack::~LayerStack(){
14 | for (Layer* layer :m_Layers)
15 | delete layer;
16 | }
17 | void LayerStack::PushLayer(Layer* layer){
18 | m_Layers.emplace(m_LayerInsertIndex + m_Layers.begin(), layer);
19 | m_LayerInsertIndex++;
20 | }
21 | void LayerStack::PopLayer(Layer *layer) {
22 | auto deletion = std::find(m_Layers.begin(),m_Layers.end(),layer);
23 | if(deletion != m_Layers.end()){
24 | m_Layers.erase(deletion);
25 | m_LayerInsertIndex--;
26 | }
27 | }
28 | void LayerStack::PushOverlay(Layer *overlay) {
29 | //back to front starting at the main game layer
30 | m_Layers.emplace_back(overlay);
31 | }
32 | void LayerStack::PopOverlay(Layer *overlay) {
33 | auto delayer = std::find(m_Layers.begin(),m_Layers.end(),overlay);
34 | if(delayer != m_Layers.end())
35 | m_Layers.erase(delayer);
36 | }
37 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/LayerStack.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 | #pragma once
5 | #include "RcEngine/Core/Core.h"
6 | #include "Layer.h"
7 | #include
8 |
9 | namespace RcEngine{
10 | class RC_API LayerStack{
11 | public:
12 | LayerStack();
13 | ~LayerStack();
14 |
15 | void PushLayer(Layer* layer);
16 | void PushOverlay(Layer* overlay);
17 | void PopLayer(Layer* layer);
18 | void PopOverlay(Layer* overlay);
19 |
20 | std::vector::iterator begin() {
21 | return m_Layers.begin();
22 | }
23 | std::vector::iterator end() {return m_Layers.end();}
24 | private:
25 | std::vector m_Layers;
26 | unsigned int m_LayerInsertIndex=0;
27 | };
28 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Log.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #include
5 | #include
6 | #include
7 | #include "Log.h"
8 |
9 |
10 | namespace RcEngine{
11 | std::shared_ptr Log::s_CoreLogger;
12 | std::shared_ptr Log::s_ClientLogger;
13 | std::shared_ptr Log::s_EditorConsoleLogger;
14 |
15 | void Log::Init() {
16 | spdlog::set_pattern("%^[%T] %n: %v%$");
17 | s_CoreLogger = spdlog::stdout_color_mt("RCENGINE");
18 | s_CoreLogger->set_level(spdlog::level::trace);
19 |
20 | s_ClientLogger = spdlog::stdout_color_mt("App");
21 | s_ClientLogger->set_level(spdlog::level::trace);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Log.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/21/21.
3 | //
4 | #pragma once
5 |
6 | #include "Core.h"
7 | #include
8 | #include "spdlog/fmt/ostr.h"
9 | #include "glm/gtx/string_cast.hpp"
10 |
11 | namespace RcEngine{
12 | class RC_API Log{
13 | public:
14 | static void Init();
15 |
16 | inline static std::shared_ptr& GetCoreLogger(){return s_CoreLogger; }
17 | inline static std::shared_ptr& GetClientLogger(){return s_ClientLogger; }
18 | inline static std::shared_ptr& GetEditorConsoleLogger(){return s_EditorConsoleLogger;}
19 | private:
20 | static std::shared_ptr s_CoreLogger;
21 | static std::shared_ptr s_ClientLogger;
22 | static std::shared_ptr s_EditorConsoleLogger;
23 | };
24 | }
25 |
26 | template
27 | inline OStream& operator << (OStream& os, const glm::vec& vector){
28 | return os<< glm::to_string(vector);
29 | }
30 | template
31 | inline OStream& operator << (OStream& os, const glm::mat& matrix){
32 | return os<< glm::to_string(matrix);
33 | }
34 |
35 | #define RC_CORE_ERROR(...) ::RcEngine::Log::GetClientLogger()->error(__VA_ARGS__)
36 | #define RC_CORE_WARN(...) ::RcEngine::Log::GetCoreLogger()->warn(__VA_ARGS__)
37 | #define RC_CORE_INFO(...) ::RcEngine::Log::GetCoreLogger()->info(__VA_ARGS__)
38 | #define RC_CORE_TRACE(...) ::RcEngine::Log::GetCoreLogger()->trace(__VA_ARGS__)
39 | //#define RC_CORE_FATAL(...) ::RcEngine::Log::GetCoreLogger()->error(__VA_ARGS__)
40 |
41 | //Client log macros
42 |
43 | #define RC_ERROR(...) ::RcEngine::Log::GetClientLogger()->error(__VA_ARGS__)
44 | #define RC_WARN(...) ::RcEngine::Log::GetClientLogger()->warn(__VA_ARGS__)
45 | #define RC_INFO(...) ::RcEngine::Log::GetClientLogger()->info(__VA_ARGS__)
46 | #define RC_TRACE(...) ::RcEngine::Log::GetClientLogger()->trace(__VA_ARGS__)
47 | //#define RC_FATAL(...) ::RcEngine::Log::GetClientLogger()->(__VA_ARGS__)
48 |
49 | //Editor Console logging macros
50 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/MouseButtonCodes.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/24/21.
3 | //
4 |
5 | #pragma once
6 |
7 | //from glfw.h
8 | #define RC_MOUSE_BUTTON_1 0
9 | #define RC_MOUSE_BUTTON_2 1
10 | #define RC_MOUSE_BUTTON_3 2
11 | #define RC_MOUSE_BUTTON_4 3
12 | #define RC_MOUSE_BUTTON_5 4
13 | #define RC_MOUSE_BUTTON_6 5
14 | #define RC_MOUSE_BUTTON_7 6
15 | #define RC_MOUSE_BUTTON_8 7
16 | #define RC_MOUSE_BUTTON_LAST RC_MOUSE_BUTTON_8
17 | #define RC_MOUSE_BUTTON_LEFT RC_MOUSE_BUTTON_1
18 | #define RC_MOUSE_BUTTON_RIGHT RC_MOUSE_BUTTON_2
19 | #define RC_MOUSE_BUTTON_MIDDLE RC_MOUSE_BUTTON_3
20 |
21 | namespace RcEngine{
22 | using MouseCode = uint16_t;
23 | namespace Mouse{
24 | enum: MouseCode{
25 | // From glfw3.h
26 | Button0 = 0,
27 | Button1 = 1,
28 | Button2 = 2,
29 | Button3 = 3,
30 | Button4 = 4,
31 | Button5 = 5,
32 | Button6 = 6,
33 | Button7 = 7,
34 |
35 | ButtonLast = Button7,
36 | ButtonLeft = Button0,
37 | ButtonRight = Button1,
38 | ButtonMiddle = Button2
39 | };
40 | }
41 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Timestep.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 6/16/21.
3 | //
4 | #pragma once
5 | #ifndef RCENGINE_CLION_TIMESTEP_H
6 | #define RCENGINE_CLION_TIMESTEP_H
7 |
8 | namespace RcEngine{
9 | class Timestep{
10 | public:
11 | Timestep(float time=0.0f)
12 | :m_Time(time){
13 |
14 | }
15 | float GetSeconds() const {return m_Time;}
16 | float GetMiliseconds() const {return m_Time * 1000.0f;}
17 | operator float() const {return m_Time;}
18 | private:
19 | float m_Time;
20 | };
21 | }
22 |
23 |
24 | #endif //RCENGINE_CLION_TIMESTEP_H
25 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/UUID.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 10/14/21.
3 | //
4 | #include "rcpch.h"
5 | #include "UUID.h"
6 |
7 | #include
8 | #include
9 |
10 | static std::unordered_map m_map;
11 |
12 | static void AddToMap(){
13 | m_map[RcEngine::UUID()] = "RcEngine";
14 | }
15 |
16 | namespace RcEngine{
17 | static std::random_device s_RandomDevice;
18 | static std::mt19937_64 s_Engine(s_RandomDevice());
19 | static std::uniform_int_distribution s_UniformDistribution;
20 |
21 | UUID::UUID()
22 | : m_UUID(s_UniformDistribution(s_Engine)){
23 |
24 | }
25 |
26 | UUID::UUID(uint64_t uuid)
27 | : m_UUID(uuid){
28 |
29 | }
30 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/UUID.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 10/14/21.
3 | //
4 | #ifndef RCENGINE_UUID_H
5 | #define RCENGINE_UUID_H
6 |
7 | namespace RcEngine{
8 | class UUID{
9 | public:
10 | UUID();
11 | UUID(uint64_t uuid);
12 | UUID(const UUID&) = default;
13 |
14 | operator uint64_t() const {return m_UUID;}
15 | private:
16 | uint64_t m_UUID;
17 | };
18 | }
19 | namespace std{
20 | template<>
21 | struct hash{
22 | std::size_t operator() (const RcEngine::UUID& uuid)const{
23 | return hash()((uint64_t)uuid);
24 | }
25 | };
26 | }
27 |
28 | #endif //RCENGINE_UID_H
29 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Window.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 7/6/21.
3 | //
4 | #include "rcpch.h"
5 | #include "RcEngine/Core/Window.h"
6 |
7 | #ifdef RC_PLATFORM_WINDOW
8 | #include "Platform/Windows/WindowsWindow.h"
9 | #endif
10 |
11 | #ifdef RC_PLATFORM_MAC
12 | #include "Platform/Mac/MacWindow.h"
13 | #endif
14 |
15 | namespace RcEngine{
16 | Scope Window::Create(const WindowProps &props) {
17 | #ifdef RC_PLATFORM_WINDOWS
18 | return CreateScope(props);
19 | #endif
20 |
21 | #ifdef RC_PLATFORM_MAC
22 | return CreateScope(props);
23 | #endif
24 |
25 | RC_CORE_ASSERT(false, "Unknown platform!");
26 | return nullptr;
27 | }
28 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Core/Window.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 | #pragma once
5 | #include "rcpch.h"
6 |
7 | #include "RcEngine/Core/Core.h"
8 | #include "RcEngine/Events/Event.h"
9 |
10 | namespace RcEngine{
11 | struct WindowProps{
12 | std::string Title;
13 | unsigned int Width;
14 | unsigned int Height;
15 |
16 | WindowProps(const std::string& title = "RC-ENGINE",
17 | unsigned int width = 1280,
18 | unsigned int height = 720)
19 | :Title(title),Width(width),Height(height){}
20 | };
21 | class RC_API Window{
22 | public:
23 | using EventCallbackfn = std::function;
24 |
25 | virtual ~Window(){}
26 |
27 | virtual void OnUpdate() = 0;
28 |
29 | virtual unsigned int GetWidth() const =0;
30 | virtual unsigned int GetHeight() const =0;
31 |
32 | //attributes
33 | virtual void SetEventCallback(const EventCallbackfn& callback) =0;
34 | virtual void SetVSync(bool enabled) =0;
35 | virtual bool IsVsync() const =0;
36 | static Scope Create(const WindowProps& props =WindowProps());
37 |
38 | virtual void* GetNativeWindow() const = 0;
39 | };
40 | }
41 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Editor/EditorConsole/EditorConsoleSink.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/20/21.
3 | //
4 |
5 | #ifndef RCENGINE_EDITORCONSOLESINK_H
6 | #define RCENGINE_EDITORCONSOLESINK_H
7 |
8 | #include "spdlog/sinks/base_sink.h"
9 | #include
10 | #include "RcEngine/Editor/EditorConsolePanel.h"
11 |
12 | namespace RcEngine{
13 | class EditorConsoleSink: public spdlog::sinks::base_sink{
14 | public:
15 | explicit EditorConsoleSink(uint32_t bufferCap)
16 | : m_MessageBufferCap(bufferCap), m_MessageBuffer(bufferCap){
17 | }
18 |
19 | virtual ~EditorConsoleSink() = default;
20 | EditorConsoleSink(const EditorConsoleSink& other) = delete;
21 | EditorConsoleSink& operator =(const EditorConsoleSink& other) = delete;
22 |
23 | protected:
24 | void sink_it_(const spdlog::details::log_msg& msg) override{
25 | spdlog::memory_buf_t formatted;
26 | spdlog::sinks::base_sink::formatter_->format(msg,formatted);
27 | m_MessageBuffer[m_MessageCount++] = ConsoleMessage(fmt::to_string(formatted,GetMessageCategory(msg.level)));
28 |
29 | if (m_MessageCount == m_MessageBufferCap)
30 | flush_();
31 | }
32 | void flush_() override{
33 | for(const auto& message: m_MessageBuffer){
34 | if(message.GetCategory() == ConsoleMessage::Category::None)
35 | continue;
36 |
37 | EditorConsolePanel::PushMessage(message);
38 | }
39 | m_MessageCount =0;
40 | }
41 | private:
42 | static ConsoleMessage::Category GetMessageCategory(spdlog::level::level_enum level){
43 | switch (level) {
44 | case spdlog::level::trace:
45 | case spdlog::level::debug:
46 | case spdlog::level::info:
47 | return ConsoleMessage::Category::Info;
48 | case spdlog::level::warn:
49 | return ConsoleMessage::Category::Warning;
50 | case spdlog::level::critical:
51 | return ConsoleMessage::Category::Error;
52 | }
53 | return ConsoleMessage::Category::None;
54 | }
55 | private:
56 | uint32_t m_MessageBufferCapacity;
57 | std::vector m_MessageBuffer;
58 | uint32_t m_MessageCount = 0;
59 |
60 | };
61 | }
62 |
63 | #endif //RCENGINE_EDITORCONSOLESINK_H
64 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Editor/EditorConsolePanel.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 8/20/21.
3 | //
4 |
5 | #ifndef RCENGINE_EDITORCONSOLEPANEL_H
6 | #define RCENGINE_EDITORCONSOLEPANEL_H
7 |
8 | #endif //RCENGINE_EDITORCONSOLEPANEL_H
9 |
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Events/ApplicationEvent.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 |
5 | #pragma once
6 | #include "Event.h"
7 | #include
8 |
9 | namespace RcEngine{
10 | class RC_API WindowResizeEvent: public Event{
11 | public:
12 | WindowResizeEvent(unsigned int width, unsigned int height)
13 | : m_Width(width), m_Height(height){}
14 |
15 | inline unsigned int GetWidth() const {return m_Width;}
16 | inline unsigned int GetHeight() const {return m_Height;}
17 |
18 | std::string ToString() const override{
19 | std::stringstream stream;
20 | stream << "WindowResizeEvent(Width, Height): (" << m_Width << ", " << m_Height <<")";
21 | return stream.str();
22 | };
23 |
24 | EVENT_CLASS_TYPE(WindowResize)
25 |
26 | EVENT_CLASS_CATEGORY(EventCategoryApplication)
27 | private:
28 | unsigned int m_Width, m_Height;
29 | };
30 | class RC_API WindowCloseEvent : public Event{
31 | public:
32 | WindowCloseEvent(){}
33 |
34 | EVENT_CLASS_CATEGORY(EventCategoryApplication)
35 |
36 | EVENT_CLASS_TYPE(WindowClose)
37 | };
38 | class RC_API AppTickEvent: public Event{
39 | public:
40 | AppTickEvent(){}
41 |
42 | EVENT_CLASS_TYPE(ApplicationTick)
43 |
44 | EVENT_CLASS_CATEGORY(EventCategoryApplication)
45 | };
46 | class RC_API AppUpdateEvent: public Event{
47 | public:
48 | AppUpdateEvent(){}
49 |
50 | EVENT_CLASS_TYPE(AppUpdate)
51 |
52 | EVENT_CLASS_CATEGORY(EventCategoryApplication)
53 | };
54 | class RC_API AppRenderEvent: public Event{
55 | public:
56 | AppRenderEvent(){}
57 |
58 | EVENT_CLASS_TYPE(AppRender)
59 |
60 | EVENT_CLASS_CATEGORY(EventCategoryApplication)
61 | };
62 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Events/Event.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 | #pragma once
5 |
6 | #include "RcEngine/Core/Core.h"
7 | #include
8 |
9 | namespace RcEngine{
10 |
11 | // Events arent buffered in any way and use a blocking system, in the future it should be
12 | // put into a Queue system
13 |
14 | enum class EventType{
15 | None=0, WindowClose, WindowResize, WindowOnFocus,WindowOnLostFocus,WindowMoved,
16 | ApplicationTick, AppUpdate, AppRender, OnKeyPressed, OnKeyRelease, OnKeyTyped,
17 | MouseButtonPress, MouseButtonRelease, MouseMoved, MouseScrolled,
18 | };
19 |
20 | // Bit-Shifted constant field values for bit masking
21 | enum EventCategory{
22 | None = 0x00,
23 | EventCategoryApplication = 0x01,
24 | EventCategoryInput = 0x02,
25 | EventCategoryKeyboard = 0x04,
26 | EventCategoryMouse = 0x08,
27 | EventCategoryMouseButton= 0x10,
28 | };
29 |
30 | #define EVENT_CLASS_TYPE(type) static EventType GetStaticType() {return EventType::type;} \
31 | virtual EventType GetEventType() const override {return GetStaticType(); } \
32 | virtual const char* GetName() const override {return #type; }
33 |
34 | #define EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override {return category;}
35 |
36 | class RC_API Event{
37 | friend class EventDispatcher;
38 | public:
39 | virtual ~Event() = default;
40 |
41 | // Virtual for functions that have to be implemented
42 | virtual EventType GetEventType() const = 0;
43 | virtual const char* GetName() const = 0;
44 | virtual int GetCategoryFlags() const = 0;
45 | virtual std::string ToString() const {return GetName();}
46 |
47 | // Bitwise & used to check bitposition of EventCategory
48 | inline bool IsInCategory(EventCategory category){
49 | return GetCategoryFlags() & category;
50 | }
51 |
52 | // check if event is already handled
53 | bool m_Handeled = false;
54 | };
55 |
56 | class EventDispatcher{
57 | template
58 | using EventFn = std::function;
59 | public:
60 | EventDispatcher(Event& event)
61 | :m_Event(event){}
62 |
63 | template
64 | bool Dispatch(const A& func){
65 | if(m_Event.GetEventType() == T::GetStaticType()){
66 | m_Event.m_Handeled = func(static_cast(m_Event));
67 | return true;
68 | }
69 | return false;
70 | }
71 | private:
72 | Event& m_Event;
73 | };
74 | inline std::ostream& operator<<(std::ostream& os, const Event& e){
75 | return os << e.ToString();
76 | }
77 |
78 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Events/KeyEvent.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 | #pragma once
5 |
6 | #include "Event.h"
7 | #include
8 |
9 | namespace RcEngine{
10 | class RC_API KeyEvent: public Event{
11 | public:
12 | inline int GetKeyCode() const{return m_KeyCode; }
13 | EVENT_CLASS_CATEGORY( EventCategoryKeyboard | EventCategoryInput)
14 | protected:
15 | KeyEvent(int keycode): m_KeyCode(keycode){}
16 | int m_KeyCode;
17 | };
18 | class RC_API KeyPressedEvent
19 | : public KeyEvent{
20 | public:
21 | KeyPressedEvent(int keycode, int repeat): KeyEvent(keycode), m_RepeatCount(repeat){}
22 |
23 | inline int GetRepeatCount() const {return m_RepeatCount;}
24 |
25 | std::string ToString() const override{
26 | std::stringstream stream;
27 | stream << "Received KeyPressedEvent: " << m_KeyCode << " (" << m_RepeatCount << " many repeats)";
28 | return stream.str();
29 | }
30 |
31 | EVENT_CLASS_TYPE(OnKeyPressed);
32 | private:
33 | int m_RepeatCount;
34 | };
35 | class RC_API KeyTypedEvent
36 | : public KeyEvent{
37 | public:
38 | KeyTypedEvent(int keycode): KeyEvent(keycode){}
39 |
40 |
41 | std::string ToString() const override{
42 | std::stringstream stream;
43 | stream << "Received KeyTypedEvent: " << m_KeyCode ;
44 | return stream.str();
45 | }
46 |
47 | EVENT_CLASS_TYPE(OnKeyTyped);
48 | };
49 | class RC_API KeyReleasedEvent: public KeyEvent{
50 |
51 | public:
52 | KeyReleasedEvent(int keycode)
53 | : KeyEvent(keycode){}
54 |
55 | std::string ToString() const override{
56 | std::stringstream stream;
57 | stream << "KeyReleasedEvent: " << m_KeyCode;
58 | return stream.str();
59 | }
60 | EVENT_CLASS_TYPE(OnKeyRelease)
61 | };
62 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Events/MouseEvent.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/22/21.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "Event.h"
8 | #include
9 |
10 | namespace RcEngine{
11 |
12 | class RC_API MouseMovedEvent: public Event{
13 | public:
14 | MouseMovedEvent(float x, float y)
15 | : m_MouseX(x), m_MouseY(y){}
16 | inline float GetX() const {return m_MouseX; }
17 | inline float GetY() const {return m_MouseY; }
18 |
19 | std::string ToString() const override{
20 | std::stringstream stream;
21 | stream << "MouseMovedEvent(X,Y): (" << m_MouseX << ", " << m_MouseY << ")";
22 | return stream.str();
23 | }
24 |
25 | EVENT_CLASS_TYPE(MouseMoved)
26 |
27 | EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
28 | private:
29 | float m_MouseX, m_MouseY;
30 | };
31 | class RC_API MouseScrolledEvent: public Event{
32 | public:
33 | MouseScrolledEvent(float xOffset, float yOffset)
34 | : m_XOffset(xOffset), m_YOffset(yOffset){}
35 | inline float GetXOffset() const {return m_XOffset;}
36 | inline float GetYOffset() const{return m_YOffset;}
37 |
38 | std::string ToString() const override{
39 | std::stringstream stream;
40 | stream << "MouseScrolledEvent(X,Y): "<< GetXOffset() << ", " << GetYOffset();
41 | return stream.str();
42 | }
43 |
44 | EVENT_CLASS_TYPE(MouseScrolled)
45 |
46 | EVENT_CLASS_CATEGORY(EventCategoryMouse| EventCategoryInput)
47 | private:
48 | float m_XOffset, m_YOffset;
49 | };
50 | class RC_API MouseButtonEvent: public Event{
51 | public:
52 | inline int GetMouseButton() const {return m_Button;}
53 | EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
54 | protected:
55 | MouseButtonEvent(int button)
56 | : m_Button(button){}
57 | int m_Button;
58 | };
59 | class RC_API MouseButtonPressedEvent: public MouseButtonEvent{
60 | public:
61 | MouseButtonPressedEvent(int button)
62 | : MouseButtonEvent(button){}
63 | std::string ToString() const override{
64 | std::stringstream stream;
65 | stream << "MouseButtonPressedEvent: " << m_Button;
66 | return stream.str();
67 | }
68 |
69 | EVENT_CLASS_TYPE(MouseButtonPress)
70 | };
71 | class RC_API MouseButtonReleasedEvent: public MouseButtonEvent{
72 | public:
73 | MouseButtonReleasedEvent(int button)
74 | : MouseButtonEvent(button){}
75 | std::string ToString() const override{
76 | std::stringstream stream;
77 | stream << "MouseButtonReleasedEvent: "<< m_Button;
78 | return stream.str();
79 | }
80 |
81 | EVENT_CLASS_TYPE(MouseButtonRelease)
82 | };
83 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/ImGui/ImGuiBuild.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/24/21.
3 | //
4 |
5 | #include "rcpch.h"
6 |
7 | #define IMGUI_IMPL_OPENGL_LOADER_GLAD
8 |
9 | #include "backends/imgui_impl_glfw.cpp"
10 | #include "backends/imgui_impl_opengl3.cpp"
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/ImGui/ImGuiLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 5/23/21.
3 | //
4 |
5 | #pragma once
6 | #include "RcEngine/Core/Layer.h"
7 |
8 |
9 | #include "RcEngine/Events/MouseEvent.h"
10 | #include "RcEngine/Events/ApplicationEvent.h"
11 | #include "RcEngine/Events/KeyEvent.h"
12 |
13 | namespace RcEngine{
14 | class RC_API ImGuiLayer : public Layer{
15 |
16 | private:
17 | float m_Time =0.0f;
18 |
19 | public:
20 | ImGuiLayer();
21 | ~ImGuiLayer();
22 |
23 | virtual void OnAttach() override;
24 | virtual void OnDetach() override;
25 |
26 | virtual void OnImGuiRender() override;
27 |
28 | void Begin();
29 | void End();
30 |
31 | void BlockEvents(bool block) { m_BlockEvents = block; }
32 |
33 | virtual void SetDarkThemeColors();
34 | private:
35 | bool m_BlockEvents = true;
36 | };
37 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Lua/luastate.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 12/31/21.
3 | //
4 |
5 | #include "luastate.h"
6 | #include "RcEngine/Scene/Component.h"
7 | #include "luautil.h"
8 |
9 | namespace LUtil{
10 |
11 | LuaState::LuaState(std::string &filename) {
12 |
13 | }
14 |
15 | void LuaState::initLua() {
16 |
17 | }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/RcEngine/src/RcEngine/Lua/luastate.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Tristan Zippert on 12/30/21.
3 | //
4 |
5 | #ifndef RCENGINE_LUASTATE_H
6 | #define RCENGINE_LUASTATE_H
7 |
8 | #include "sol/sol.hpp"
9 | #include
10 | #include ]