├── IDE ├── a.txt ├── file.txt ├── log.txt ├── out.txt ├── shaders.glsl ├── test.png ├── Source │ ├── CrossCompiler │ │ ├── CrossShader.cpp │ │ ├── CrossShader.h │ │ └── CrossCompiler.h │ ├── DocumentType.h │ ├── Main.cpp │ ├── Settings.h │ ├── Menu │ │ ├── WindowMenu.h │ │ ├── FileMenu.h │ │ ├── BaseMenu.h │ │ ├── DebugMenu.h │ │ ├── WindowMenu.cpp │ │ └── BaseMenu.cpp │ ├── LuaDocument.h │ ├── SpirvDocument.h │ ├── Settings.cpp │ ├── SpirvDocument.cpp │ ├── Inspector │ │ ├── InspectorPane.h │ │ ├── InspectorPane.cpp │ │ ├── InspectorItem.h │ │ └── InspectorModel.h │ ├── OutputPane.h │ ├── HlslDocument.h │ ├── StackPane.h │ ├── Hierarchy │ │ ├── HierarchyPane.h │ │ └── HierarchyModel.h │ ├── MainWindow.h │ ├── SceneDocument.h │ ├── TextDocument.h │ ├── LuaDocument.cpp │ ├── DocumentsPane.h │ ├── Document.h │ ├── IDE.h │ └── CodeEditor.h ├── images │ ├── app.png │ ├── new.png │ ├── icon.png │ ├── open.png │ ├── pause.png │ ├── play.png │ ├── save.png │ ├── stop.png │ ├── icon128.png │ ├── stepinto.png │ ├── stepout.png │ ├── stepover.png │ ├── play_disabled.png │ ├── stop_disabled.png │ ├── pause_disabled.png │ ├── stepinto_disabled.png │ ├── stepout_disabled.png │ └── stepover_disabled.png ├── shaders.spirv ├── folder │ └── req.lua ├── settings.windows.lua ├── settings.linux.lua ├── luascript.lua ├── settings.osx.lua ├── shadersTextured.ps ├── shadersTextured.vs ├── IDE.pro ├── ide.qrc ├── shaders.hlsl ├── shadersTextured.hlsl └── style.css ├── Game ├── New Text Document.txt ├── frag.spv ├── test.png ├── vert.spv ├── shaders.spirv ├── skullbox.png ├── Data │ └── Math.lua ├── Shaders │ ├── gen │ │ ├── frag.ps.spirv │ │ ├── test.ps.spirv │ │ ├── test.vs.spirv │ │ ├── vert.vs.spirv │ │ ├── frag.ps.glsl │ │ ├── test.ps.glsl │ │ ├── test.vs.glsl │ │ └── vert.vs.glsl │ ├── frag.hlsl │ ├── vert.hlsl │ ├── test.hlsl │ └── test2.hlsl ├── shadersTextured.ps ├── Class.lua ├── shadersTextured.vs ├── shaders.hlsl ├── Main.lua └── shadersTextured.hlsl ├── Engine ├── Source │ ├── Meta │ │ ├── MethodMeta.cpp │ │ ├── ClassDefiner.tpp │ │ ├── AnyData.cpp │ │ ├── TypeMeta.cpp │ │ ├── FieldMeta.cpp │ │ ├── FunctionMeta.cpp │ │ ├── CFunctionMeta.cpp │ │ ├── ConstructorMeta.cpp │ │ ├── ITypeMeta.cpp │ │ ├── IMemberMeta.cpp │ │ ├── Meta.gen.h │ │ ├── IMemberMeta.h │ │ ├── TypeTraits │ │ │ ├── select_if.h │ │ │ ├── fulldecay.h │ │ │ ├── is_built_in.h │ │ │ └── pointers.h │ │ ├── IConstructorMeta.h │ │ ├── IndexSequence.h │ │ ├── IFieldMeta.h │ │ ├── PropertyMeta.h │ │ ├── Binder.h │ │ ├── IFunctionMeta.h │ │ ├── AnyData.h │ │ ├── Meta.cpp │ │ ├── PropertyMeta.cpp │ │ ├── IClassMeta.h │ │ ├── IClassMeta.cpp │ │ ├── FieldMeta.h │ │ ├── FunctionMeta.h │ │ └── CFunctionMeta.h │ ├── Render │ │ ├── Impl.cpp │ │ ├── GL │ │ │ ├── GLContext.cpp │ │ │ ├── GLContext.h │ │ │ ├── gl.h │ │ │ ├── GLShaderImpl.h │ │ │ ├── GLTextureImpl.h │ │ │ ├── GLPipelineStateImpl.h │ │ │ ├── GLIndexBufferImpl.cpp │ │ │ ├── GLIndexBufferImpl.h │ │ │ ├── GLVertexBufferImpl.h │ │ │ ├── GLVertexBufferImpl.cpp │ │ │ ├── GLConstantBufferImpl.h │ │ │ ├── Linux │ │ │ │ ├── PlatformGLContext.h │ │ │ │ └── PlatformGLContext.cpp │ │ │ ├── GLTextureImpl.cpp │ │ │ ├── GLConstantBufferImpl.cpp │ │ │ ├── GLRenderer.h │ │ │ └── GLPipelineStateImpl.cpp │ │ ├── DX │ │ │ ├── DXSwapChain.cpp │ │ │ ├── DXSwapChain.h │ │ │ ├── dx.h │ │ │ ├── DXShaderImpl.h │ │ │ ├── DXPipelineStateImpl.h │ │ │ ├── DXIndexBufferImpl.h │ │ │ ├── DXVertexBufferImpl.h │ │ │ ├── DXDescriptorHandle.h │ │ │ ├── DXTextureImpl.h │ │ │ ├── DXConstantBufferImpl.h │ │ │ ├── DXDescriptorHandle.cpp │ │ │ ├── DXShaderImpl.cpp │ │ │ ├── DXDescriptorHeap.h │ │ │ ├── DXDescriptorHeap.cpp │ │ │ └── DXIndexBufferImpl.cpp │ │ ├── RenderCommand.cpp │ │ ├── RenderTarget.cpp │ │ ├── Impl.h │ │ ├── ShaderType.h │ │ ├── Vulkan │ │ │ ├── vulkaninc.h │ │ │ ├── VulkanDescriptorPool.h │ │ │ ├── VulkanIndexBufferImpl.h │ │ │ ├── VulkanVertexBufferImpl.h │ │ │ ├── VulkanShaderImpl.h │ │ │ ├── VulkanPipelineStateImpl.h │ │ │ ├── VulkanConstantBufferImpl.h │ │ │ ├── VulkanTextureImpl.h │ │ │ └── VulkanDescriptorPool.cpp │ │ ├── RendererType.h │ │ ├── PipelineSettings.cpp │ │ ├── RenderCommand.h │ │ ├── RenderTarget.h │ │ ├── IndexBuffer.h │ │ ├── Texture.h │ │ ├── VertexBuffer.h │ │ ├── RenderResource.cpp │ │ ├── IRenderer.cpp │ │ ├── PipelineState.h │ │ ├── ConstantBuffer.h │ │ ├── IndexBuffer.cpp │ │ ├── VertexBuffer.cpp │ │ ├── Shader.h │ │ ├── PipelineState.cpp │ │ ├── Texture.cpp │ │ ├── ConstantBuffer.cpp │ │ ├── Shader.cpp │ │ ├── RenderState.h │ │ ├── RendererFrontend.h │ │ ├── RenderManager.h │ │ ├── RenderResource.h │ │ ├── PipelineSettings.h.DC1364 │ │ ├── PipelineSettings.h.EJ1364 │ │ ├── PipelineSettings.h.Sx1364 │ │ ├── PipelineSettings.h.ro1364 │ │ ├── PipelineSettings.h.BjC376 │ │ ├── PipelineSettings.h.CyH376 │ │ ├── ShaderBunch.h │ │ ├── RendererFrontend.cpp │ │ └── PipelineSettings.h │ ├── Color.cpp │ ├── Vertex.cpp │ ├── Attributes.h │ ├── Material.cpp │ ├── DeepPointer.cpp │ ├── Input │ │ ├── Win │ │ │ ├── WinKeyboard.cpp │ │ │ ├── PlatformInputDevice.cpp │ │ │ ├── WinKeyboard.h │ │ │ ├── PlatformInputDevice.h │ │ │ └── PlatformInputSystem.h │ │ ├── InputDeviceType.h │ │ ├── KeysState.h │ │ ├── InputSystem.h │ │ ├── InputDevice.h │ │ ├── Linux │ │ │ ├── PlatformInputDevice.h │ │ │ └── PlatformInputSystem.h │ │ ├── InputSystem.cpp │ │ ├── KeysState.cpp │ │ ├── VirtualDevice.h │ │ └── InputDevice.cpp │ ├── Material.h │ ├── Linux │ │ ├── PlatformApp.cpp │ │ ├── PlatformApp.h │ │ ├── PlatformRenderTarget.cpp │ │ ├── PlatformWindow.h │ │ └── PlatformRenderTarget.h │ ├── LuaMachine │ │ ├── CallStack.cpp │ │ ├── LogMessage.cpp │ │ ├── DebugCommand.cpp │ │ ├── CallStack.h │ │ ├── LogMessage.h │ │ ├── DebugCommand.h │ │ ├── FileBreakpoints.cpp │ │ ├── CallInfo.cpp │ │ ├── FileBreakpoints.h │ │ ├── CallInfo.h │ │ └── Breakpoints.h │ ├── Win │ │ ├── PlatformApp.cpp │ │ ├── PlatformApp.h │ │ ├── PlatformWindow.h │ │ ├── PlatformProcess.h │ │ ├── PlatformRenderTarget.h │ │ ├── PlatformGLContext.h │ │ └── PlatformRenderTarget.cpp │ ├── Keyframe.cpp │ ├── Process.cpp │ ├── Keyframe.h │ ├── Scene.h │ ├── Vertex.h │ ├── Mac │ │ ├── MacApp.h │ │ ├── MacWindow.h │ │ └── MacApp.mm │ ├── Scene.cpp │ ├── Net │ │ ├── Socket.cpp │ │ ├── Unix │ │ │ └── PlatformSocket.h │ │ ├── Socket.h │ │ └── Win │ │ │ └── PlatformSocket.h │ ├── Singleton.tpp │ ├── Lua.cpp │ ├── luainc.h │ ├── Blob.cpp │ ├── Color.h │ ├── Quad.cpp │ ├── SingletonObject.h │ ├── Math │ │ ├── Transform2D.h │ │ ├── Quaternion.h │ │ ├── Transform2D.cpp │ │ ├── Vector3.h │ │ ├── Vector4.h │ │ ├── Vector2.h │ │ ├── Transform.h │ │ ├── Quaternion.cpp │ │ └── Transform.cpp │ ├── Pipe.h │ ├── Blob.h │ ├── Images.h │ ├── Process.h │ ├── TextureManager.h │ ├── Mesh.h │ ├── TextureManager.cpp │ ├── Unix │ │ └── PlatformProcess.h │ ├── Model.h │ ├── Singleton.h │ ├── Object.h │ ├── Platform.cpp │ ├── ShaderManager.h │ ├── Quad.h │ ├── Platform.h │ ├── ShaderManager.cpp │ ├── App.h │ ├── Containers │ │ └── Set.h │ ├── Window.h │ ├── Model.cpp │ ├── DeepPointer.h │ ├── Utils.h │ └── Node.h └── Engine.pro ├── 3rd-party ├── lua │ ├── readme.txt │ └── Source │ │ ├── lua.hpp │ │ ├── lapi.h │ │ ├── lundump.h │ │ └── lprefix.h ├── libpng │ ├── readme.txt │ └── libpng.pro ├── scintilla │ ├── readme.txt │ ├── lexers │ │ ├── LexCSS.cxx │ │ ├── LexErlang.cxx │ │ ├── LexMMIXAL.cxx │ │ └── LexMatlab.cxx │ ├── src │ │ ├── SciTE.properties │ │ ├── Catalogue.h │ │ ├── UnicodeFromUTF8.h │ │ ├── FontQuality.h │ │ └── CharClassify.h │ └── lexlib │ │ ├── CharacterCategory.h │ │ ├── PropSetSimple.h │ │ ├── LexerSimple.h │ │ ├── Accessor.h │ │ ├── StringCopy.h │ │ └── WordList.h ├── zlib │ ├── readme.txt │ ├── Source │ │ └── inffast.h │ └── zlib.pro ├── glslang │ ├── readme.txt │ ├── Source │ │ └── glslang │ │ │ ├── MachineIndependent │ │ │ └── Constant.cpp │ │ │ ├── updateGrammar │ │ │ └── Include │ │ │ ├── revision.h │ │ │ └── revision.template │ └── glslang.pro ├── spirv-cross │ ├── readme.txt │ └── spirv-cross.pro └── 3rd-party.pro ├── MetaGen └── Source │ ├── Parser │ ├── Tokens │ │ ├── Token.cpp │ │ ├── AtomToken.h │ │ ├── Token.h │ │ └── AtomToken.cpp │ ├── Snippet.h │ ├── CodeParser.h │ ├── RegexConstants.h │ └── Statement.h │ ├── Info │ ├── NamespaceInfo.cpp │ ├── ClassType.h │ ├── AccessModifier.h │ ├── NamespaceInfo.h │ ├── AttributeInfo.cpp │ ├── AttributeInfo.h │ ├── FieldInfo.h │ ├── Specifier.h │ ├── InheritanceInfo.h │ ├── ArgumentInfo.h │ ├── FieldInfo.cpp │ ├── PropertyInfo.h │ ├── MemberInfo.cpp │ ├── TypeInfo.h │ ├── Specifier.cpp │ ├── ArgumentInfo.cpp │ ├── MemberInfo.h │ ├── MethodInfo.h │ ├── PropertyInfo.cpp │ ├── InheritanceInfo.cpp │ └── ClassInfo.h │ └── Generator │ ├── GenericInfo.h │ ├── GenericInfo.cpp │ └── CodeGenerator.h ├── readme.txt ├── Judy.pro ├── .gitignore ├── Player ├── Player.pro └── Source │ ├── RemoteDebbuger.h │ └── Main.cpp └── Default.pri /IDE/a.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /IDE/file.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /IDE/log.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /IDE/out.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /IDE/shaders.glsl: -------------------------------------------------------------------------------- 1 | efefef -------------------------------------------------------------------------------- /Game/New Text Document.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Engine/Source/Meta/MethodMeta.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Engine/Source/Render/Impl.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3rd-party/lua/readme.txt: -------------------------------------------------------------------------------- 1 | version: 5.3.0 -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLContext.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3rd-party/libpng/readme.txt: -------------------------------------------------------------------------------- 1 | version: 1.6.12 -------------------------------------------------------------------------------- /3rd-party/scintilla/readme.txt: -------------------------------------------------------------------------------- 1 | version: 355 -------------------------------------------------------------------------------- /3rd-party/zlib/readme.txt: -------------------------------------------------------------------------------- 1 | version: 1.2.8 -------------------------------------------------------------------------------- /Engine/Source/Meta/ClassDefiner.tpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /3rd-party/glslang/readme.txt: -------------------------------------------------------------------------------- 1 | version: 21 oct 2016 3:22 -------------------------------------------------------------------------------- /Engine/Source/Color.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Color.h" 3 | -------------------------------------------------------------------------------- /3rd-party/spirv-cross/readme.txt: -------------------------------------------------------------------------------- 1 | version: 07 oct 2016 16:30 -------------------------------------------------------------------------------- /Engine/Source/Vertex.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Vertex.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Attributes.h: -------------------------------------------------------------------------------- 1 | 2 | #define Property union 3 | -------------------------------------------------------------------------------- /Engine/Source/Material.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Material.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Meta/AnyData.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "AnyData.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Meta/TypeMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "TypeMeta.h" 3 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Tokens/Token.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Token.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Meta/FieldMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "FieldMeta.h" 3 | 4 | -------------------------------------------------------------------------------- /Engine/Source/Meta/FunctionMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "FunctionMeta.h" 3 | -------------------------------------------------------------------------------- /Game/frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/frag.spv -------------------------------------------------------------------------------- /Game/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/test.png -------------------------------------------------------------------------------- /Game/vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/vert.spv -------------------------------------------------------------------------------- /IDE/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/test.png -------------------------------------------------------------------------------- /Engine/Source/DeepPointer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DeepPointer.h" 3 | 4 | 5 | -------------------------------------------------------------------------------- /Engine/Source/Input/Win/WinKeyboard.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "WinKeyboard.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Meta/CFunctionMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CFunctionMeta.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXSwapChain.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DXSwapChain.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderCommand.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "RenderCommand.h" 3 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderTarget.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "RenderTarget.h" 3 | -------------------------------------------------------------------------------- /IDE/Source/CrossCompiler/CrossShader.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CrossShader.h" 3 | -------------------------------------------------------------------------------- /Game/shaders.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/shaders.spirv -------------------------------------------------------------------------------- /Game/skullbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/skullbox.png -------------------------------------------------------------------------------- /IDE/images/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/app.png -------------------------------------------------------------------------------- /IDE/images/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/new.png -------------------------------------------------------------------------------- /IDE/shaders.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/shaders.spirv -------------------------------------------------------------------------------- /MetaGen/Source/Info/NamespaceInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "NamespaceInfo.h" 3 | 4 | -------------------------------------------------------------------------------- /Engine/Source/Input/Win/PlatformInputDevice.cpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma 3 | -------------------------------------------------------------------------------- /Engine/Source/Meta/ConstructorMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ConstructorMeta.h" 3 | 4 | -------------------------------------------------------------------------------- /IDE/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/icon.png -------------------------------------------------------------------------------- /IDE/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/open.png -------------------------------------------------------------------------------- /IDE/images/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/pause.png -------------------------------------------------------------------------------- /IDE/images/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/play.png -------------------------------------------------------------------------------- /IDE/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/save.png -------------------------------------------------------------------------------- /IDE/images/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stop.png -------------------------------------------------------------------------------- /Engine/Source/Meta/ITypeMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ITypeMeta.h" 3 | #include "TypeMeta.h" 4 | -------------------------------------------------------------------------------- /IDE/images/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/icon128.png -------------------------------------------------------------------------------- /IDE/images/stepinto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepinto.png -------------------------------------------------------------------------------- /IDE/images/stepout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepout.png -------------------------------------------------------------------------------- /IDE/images/stepover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepover.png -------------------------------------------------------------------------------- /Engine/Source/Material.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class Material 5 | { 6 | 7 | }; 8 | -------------------------------------------------------------------------------- /Game/Data/Math.lua: -------------------------------------------------------------------------------- 1 | 2 | function sum(a, b) 3 | local result = a + b 4 | return result 5 | end -------------------------------------------------------------------------------- /IDE/images/play_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/play_disabled.png -------------------------------------------------------------------------------- /IDE/images/stop_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stop_disabled.png -------------------------------------------------------------------------------- /Game/Shaders/gen/frag.ps.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/Shaders/gen/frag.ps.spirv -------------------------------------------------------------------------------- /Game/Shaders/gen/test.ps.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/Shaders/gen/test.ps.spirv -------------------------------------------------------------------------------- /Game/Shaders/gen/test.vs.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/Shaders/gen/test.vs.spirv -------------------------------------------------------------------------------- /Game/Shaders/gen/vert.vs.spirv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/Game/Shaders/gen/vert.vs.spirv -------------------------------------------------------------------------------- /IDE/images/pause_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/pause_disabled.png -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXSwapChain.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class DXSwapChain 5 | { 6 | 7 | }; 8 | -------------------------------------------------------------------------------- /IDE/images/stepinto_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepinto_disabled.png -------------------------------------------------------------------------------- /IDE/images/stepout_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepout_disabled.png -------------------------------------------------------------------------------- /IDE/images/stepover_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/IDE/images/stepover_disabled.png -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | Judy is a crossplatform multirender game engine. 2 | 3 | Homepage: http://alprog.net/judy/ 4 | -------------------------------------------------------------------------------- /Engine/Source/Linux/PlatformApp.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | LinuxApp::LinuxApp() 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /IDE/folder/req.lua: -------------------------------------------------------------------------------- 1 | 2 | function fun() 3 | 4 | local b = 4 5 | 6 | b = b + 1 7 | 8 | return b 9 | end -------------------------------------------------------------------------------- /3rd-party/scintilla/lexers/LexCSS.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/3rd-party/scintilla/lexers/LexCSS.cxx -------------------------------------------------------------------------------- /3rd-party/scintilla/lexers/LexErlang.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/3rd-party/scintilla/lexers/LexErlang.cxx -------------------------------------------------------------------------------- /3rd-party/scintilla/lexers/LexMMIXAL.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/3rd-party/scintilla/lexers/LexMMIXAL.cxx -------------------------------------------------------------------------------- /3rd-party/scintilla/lexers/LexMatlab.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/3rd-party/scintilla/lexers/LexMatlab.cxx -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/CallStack.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CallStack.h" 3 | 4 | CallStack::CallStack() 5 | { 6 | } 7 | 8 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformApp.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | WinApp::WinApp() 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /Engine/Source/Keyframe.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Keyframe.h" 3 | 4 | template 5 | Keyframe::Keyframe() 6 | { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /3rd-party/3rd-party.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = subdirs 3 | SUBDIRS += zlib libpng lua scintilla glslang spirv-cross 4 | 5 | libpng.depends = zlib 6 | -------------------------------------------------------------------------------- /Engine/Source/Render/Impl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "RendererType.h" 5 | 6 | template 7 | class Impl; 8 | -------------------------------------------------------------------------------- /Engine/Source/Render/ShaderType.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class ShaderType 5 | { 6 | Vertex, 7 | Geometry, 8 | Pixel 9 | }; 10 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/vulkaninc.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #define VK_USE_PLATFORM_WIN32_KHR 5 | #include 6 | #include 7 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/ClassType.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class ClassType 5 | { 6 | Class, 7 | Struct, 8 | Union 9 | }; 10 | -------------------------------------------------------------------------------- /Engine/Source/Input/Win/WinKeyboard.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "../InputDevice.h" 4 | 5 | class WinKeyboard : public InputDevice 6 | { 7 | 8 | }; 9 | -------------------------------------------------------------------------------- /IDE/settings.windows.lua: -------------------------------------------------------------------------------- 1 | { 2 | class = 'Settings', 3 | projectPath = 'D:\\Judy\\Game', 4 | playerPath = 'D:\\Judy\\Build\\Win\\Player\\Player.exe' 5 | } -------------------------------------------------------------------------------- /MetaGen/Source/Generator/GenericInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Info/ClassInfo.h" 6 | #include "../Info/TypeInfo.h" 7 | 8 | -------------------------------------------------------------------------------- /3rd-party/glslang/Source/glslang/MachineIndependent/Constant.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alprog/Judy/HEAD/3rd-party/glslang/Source/glslang/MachineIndependent/Constant.cpp -------------------------------------------------------------------------------- /MetaGen/Source/Info/AccessModifier.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class AccessModifier 5 | { 6 | Private, 7 | Protected, 8 | Public 9 | }; 10 | -------------------------------------------------------------------------------- /Engine/Source/Process.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | Process* Process::create() 6 | { 7 | return new PlatformProcess(); 8 | } 9 | -------------------------------------------------------------------------------- /IDE/settings.linux.lua: -------------------------------------------------------------------------------- 1 | { 2 | class = 'Settings', 3 | projectPath = '/media/alprog/Data/Judy/Player/', 4 | playerPath = '/media/alprog/Data/Judy/Player/' 5 | } 6 | -------------------------------------------------------------------------------- /Engine/Source/Render/RendererType.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class RendererType : int 5 | { 6 | DX, 7 | GL, 8 | Vulkan, 9 | Count 10 | }; 11 | -------------------------------------------------------------------------------- /IDE/Source/DocumentType.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class DocumentType 5 | { 6 | Text, 7 | Lua, 8 | Hlsl, 9 | Scene, 10 | Unknown 11 | }; 12 | -------------------------------------------------------------------------------- /IDE/Source/Main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "IDE.h" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | IDE ideApp(argc, argv); 7 | return ideApp.exec(); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /IDE/luascript.lua: -------------------------------------------------------------------------------- 1 | 2 | dofile "req.lua" 3 | 4 | function myluafunction(x) 5 | x = x + 1 6 | x = x + 2 7 | return x + cppvar + fun() 8 | end 9 | 10 | myluafunction(3) -------------------------------------------------------------------------------- /Engine/Source/Input/InputDeviceType.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum class InputDeviceType 5 | { 6 | Mouse, 7 | Keyboard, 8 | GamePad, 9 | Unknown 10 | }; 11 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/dx.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "d3d12.h" 5 | #include "wrl.h" 6 | 7 | using namespace Microsoft::WRL; 8 | 9 | #define MUST < 0 ? throw : 0 10 | -------------------------------------------------------------------------------- /3rd-party/glslang/Source/glslang/updateGrammar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp 4 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLContext.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class GLContext 5 | { 6 | public: 7 | virtual void makeCurrent() = 0; 8 | virtual void swap() = 0; 9 | }; 10 | -------------------------------------------------------------------------------- /IDE/settings.osx.lua: -------------------------------------------------------------------------------- 1 | { 2 | class = 'Settings', 3 | projectPath = '/Users/alprog/Judy/Player', 4 | playerPath = '/Users/alprog/Judy/Build/OSX/Player/Player.app/Contents/MacOS/Player' 5 | } -------------------------------------------------------------------------------- /Engine/Source/Keyframe.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | template 5 | class Keyframe 6 | { 7 | public: 8 | Keyframe(); 9 | 10 | int frame; 11 | T value; 12 | }; 13 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IMemberMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "IMemberMeta.h" 3 | 4 | bool IMemberMeta::hasAttribute(std::string name) 5 | { 6 | return attributes.find(name) != std::end(attributes); 7 | } 8 | -------------------------------------------------------------------------------- /Engine/Source/Scene.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class Scene 5 | { 6 | public: 7 | Scene(); 8 | 9 | virtual void update(float delta); 10 | virtual void render(); 11 | }; 12 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformApp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "App.h" 5 | 6 | class WinApp : public App 7 | { 8 | public: 9 | WinApp(); 10 | }; 11 | 12 | using PlatformApp = WinApp; 13 | -------------------------------------------------------------------------------- /Judy.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = subdirs 3 | SUBDIRS += 3rd-party MetaGen Engine Player IDE 4 | 5 | Engine.depends += 3rd-party 6 | Engine.depends += MetaGen 7 | Player.depends = Engine 8 | IDE.depends = Engine 9 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/NamespaceInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "ClassInfo.h" 6 | 7 | struct NamespaceInfo 8 | { 9 | std::vector classes; 10 | }; 11 | -------------------------------------------------------------------------------- /Engine/Source/Vertex.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Math/Vector3.h" 5 | #include "Math/Vector2.h" 6 | 7 | struct Vertex 8 | { 9 | Vector3 position; 10 | Vector2 texCoord; 11 | }; 12 | -------------------------------------------------------------------------------- /Game/shadersTextured.ps: -------------------------------------------------------------------------------- 1 | 2 | varying vec2 v_texCoord; 3 | varying vec3 pos; 4 | 5 | uniform sampler2D mainTexture; 6 | 7 | void main() 8 | { 9 | gl_FragColor = texture2D(mainTexture, v_texCoord); 10 | } 11 | -------------------------------------------------------------------------------- /Engine/Source/Linux/PlatformApp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "App.h" 4 | 5 | class LinuxApp : public App 6 | { 7 | public: 8 | LinuxApp(); 9 | }; 10 | 11 | using PlatformApp = LinuxApp; 12 | 13 | -------------------------------------------------------------------------------- /Engine/Source/Mac/MacApp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "App.h" 4 | 5 | class MacApp : public App 6 | { 7 | public: 8 | MacApp(); 9 | virtual void startMainLoop(); 10 | 11 | }; 12 | 13 | 14 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/gl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #if MAC 5 | #include 6 | #else 7 | #define GLEW_STATIC 8 | #include 9 | #include 10 | #endif 11 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/LogMessage.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "LogMessage.h" 3 | 4 | LogMessage::LogMessage() 5 | { 6 | } 7 | 8 | LogMessage::LogMessage(std::string text) 9 | { 10 | this->text = text; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Scene.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Scene.h" 3 | 4 | Scene::Scene() 5 | { 6 | } 7 | 8 | void Scene::update(float /*delta*/) 9 | { 10 | 11 | } 12 | 13 | void Scene::render() 14 | { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Game/Shaders/gen/frag.ps.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) out vec4 _entryPointOutput; 4 | layout(location = 0) in vec2 uv; 5 | 6 | void psmain() 7 | { 8 | _entryPointOutput = vec4(0.0); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Engine/Source/Net/Socket.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | Socket* Socket::create() 6 | { 7 | return new PlatformSocket(); 8 | } 9 | 10 | Socket::~Socket() 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/DebugCommand.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DebugCommand.h" 3 | 4 | DebugCommand::DebugCommand() 5 | { 6 | } 7 | 8 | DebugCommand::DebugCommand(std::string name) 9 | { 10 | this->name = name; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Meta/Meta.gen.h: -------------------------------------------------------------------------------- 1 | 2 | template 3 | void defineList(); 4 | 5 | template 6 | void defineMap(); 7 | 8 | template 9 | void defineSet(); 10 | 11 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/AttributeInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "AttributeInfo.h" 3 | #include "../Parser/Tokens/TokenGroup.h" 4 | 5 | AttributeInfo::AttributeInfo(TokenGroup& tokens) 6 | { 7 | name = tokens[0]->getName(); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | PipelineSettings::PipelineSettings() 6 | : vertexShader {nullptr} 7 | , pixelShader {nullptr} 8 | { 9 | } 10 | 11 | 12 | -------------------------------------------------------------------------------- /Game/Shaders/frag.hlsl: -------------------------------------------------------------------------------- 1 | 2 | #pragma ps psmain 3 | 4 | struct PSInput 5 | { 6 | float4 position : SV_POSITION; 7 | float2 uv : TEXCOORD; 8 | }; 9 | 10 | float4 psmain(PSInput input) : SV_TARGET 11 | { 12 | return float4(0, 0, 0, 0); 13 | } -------------------------------------------------------------------------------- /Engine/Source/Render/RenderCommand.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Math/Matrix.h" 5 | #include "Mesh.h" 6 | #include "RenderState.h" 7 | 8 | struct RenderCommand 9 | { 10 | Mesh* mesh; 11 | RenderState* state; 12 | }; 13 | -------------------------------------------------------------------------------- /Engine/Source/Singleton.tpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | template 7 | T* Singleton::getInstance() 8 | { 9 | static RealT instance; 10 | return &instance; 11 | } 12 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/AttributeInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class TokenGroup; 7 | 8 | struct AttributeInfo 9 | { 10 | public: 11 | AttributeInfo(TokenGroup& tokens); 12 | std::string name; 13 | }; 14 | -------------------------------------------------------------------------------- /IDE/Source/Settings.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Meta/ClassDefiner.h" 6 | 7 | struct Settings 8 | { 9 | std::string playerPath; 10 | std::string projectPath; 11 | 12 | static void initMeta(); 13 | }; 14 | -------------------------------------------------------------------------------- /3rd-party/lua/Source/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /IDE/shadersTextured.ps: -------------------------------------------------------------------------------- 1 | 2 | varying vec2 v_texCoord; 3 | uniform sampler2D mainTexture; 4 | varying vec3 pos; 5 | 6 | void main() 7 | { 8 | gl_FragColor = texture2D(mainTexture, v_texCoord); 9 | //gl_FragColor.rgb = vec3(pos.z, -pos.z, 0); 10 | } 11 | -------------------------------------------------------------------------------- /MetaGen/Source/Generator/GenericInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "GenericInfo.h" 3 | 4 | GenericInfo::GenericInfo() 5 | : classInfo{nullptr} 6 | { 7 | } 8 | 9 | GenericInfo::GenericInfo(ClassInfo* classInfo) 10 | : classInfo{classInfo} 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/CallStack.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Containers/List.h" 5 | #include "CallInfo.h" 6 | #include "Attributes.h" 7 | 8 | struct [[Meta]] CallStack 9 | { 10 | CallStack(); 11 | [[Serialize]] List calls; 12 | }; 13 | -------------------------------------------------------------------------------- /IDE/Source/Menu/WindowMenu.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BaseMenu.h" 5 | 6 | class WindowMenu : public BaseMenu 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | WindowMenu(MainWindow* window); 12 | 13 | private slots: 14 | void stub(); 15 | }; 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.obj 2 | *.DS_Store 3 | *.pro.* 4 | *.pro.user.* 5 | *.manifest 6 | Makefile 7 | Makefile.* 8 | Build 9 | IDE/cache 10 | *.pdb 11 | Player/cache 12 | log.txt 13 | 14 | *.vcxproj 15 | *.vcxproj.user 16 | *.vcxproj.filters 17 | *.suo 18 | *.sln 19 | *.sdf 20 | *.opensdf -------------------------------------------------------------------------------- /IDE/Source/LuaDocument.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "TextDocument.h" 5 | 6 | class LuaDocument : public TextDocument 7 | { 8 | public: 9 | LuaDocument(); 10 | 11 | virtual DocumentType getType() const override; 12 | virtual void reload() override; 13 | }; 14 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/LogMessage.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Attributes.h" 6 | 7 | struct [[Meta]] LogMessage 8 | { 9 | LogMessage(); 10 | LogMessage(std::string text); 11 | 12 | [[Serialize]] std::string text; 13 | }; 14 | -------------------------------------------------------------------------------- /Engine/Source/Lua.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "luainc.h" 3 | 4 | bool lua_isemptytable(lua_State* L, int index) 5 | { 6 | lua_pushnil(L); 7 | if (lua_next(L, index - 1)) 8 | { 9 | lua_pop(L, 2); 10 | return false; 11 | } 12 | return true; 13 | } 14 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/DebugCommand.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Attributes.h" 6 | 7 | struct [[Meta]] DebugCommand 8 | { 9 | DebugCommand(); 10 | DebugCommand(std::string name); 11 | 12 | [[Serialize]] std::string name; 13 | }; 14 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderTarget.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Math/Vector2.h" 5 | #include "RendererType.h" 6 | 7 | class RenderTarget 8 | { 9 | public: 10 | virtual void onRendering(RendererType type) = 0; 11 | virtual Vector2 getSize() const = 0; 12 | }; 13 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/FileBreakpoints.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "FileBreakpoints.h" 3 | 4 | FileBreakpoints::FileBreakpoints() 5 | { 6 | } 7 | 8 | FileBreakpoints::FileBreakpoints(std::string fileName, Set lines) 9 | : fileName(fileName) 10 | , lines(lines) 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/luainc.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | extern "C" 5 | { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | 11 | bool lua_isemptytable(lua_State* L, int index); 12 | 13 | #define lua_pushuserdata lua_pushuserdata_unsafe 14 | 15 | -------------------------------------------------------------------------------- /Engine/Source/Mac/MacWindow.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "Window.h" 4 | 5 | class MacWindow : public Window 6 | { 7 | public: 8 | MacWindow(); 9 | 10 | virtual void processEvents(); 11 | virtual void setContext(); 12 | virtual void swap(); 13 | 14 | private: 15 | }; 16 | -------------------------------------------------------------------------------- /Game/Class.lua: -------------------------------------------------------------------------------- 1 | 2 | function Class(name, base) 3 | local class = {} 4 | class.__index = class 5 | setmetatable(class, base) 6 | 7 | class.new = function() 8 | setForceLuaClass(name) 9 | return base.new0() 10 | end 11 | 12 | _G[name] = class 13 | 14 | return class, base 15 | end -------------------------------------------------------------------------------- /Engine/Source/Blob.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Blob.h" 3 | #include 4 | #include 5 | 6 | Blob::Blob(Path path) 7 | { 8 | std::ifstream fstream(path.c_str(), std::ios::binary); 9 | std::stringstream sstream; 10 | sstream << fstream.rdbuf(); 11 | this->str = sstream.str(); 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IMemberMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class IMemberMeta 8 | { 9 | public: 10 | std::string name; 11 | std::unordered_set attributes; 12 | 13 | bool hasAttribute(std::string name); 14 | }; 15 | -------------------------------------------------------------------------------- /Engine/Source/Meta/TypeTraits/select_if.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | template 5 | struct select_if 6 | { 7 | using type = T1; 8 | }; 9 | 10 | template 11 | struct select_if 12 | { 13 | using type = T2; 14 | }; 15 | -------------------------------------------------------------------------------- /Engine/Source/Render/IndexBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "RenderResource.h" 6 | 7 | class IndexBuffer : public RenderResource 8 | { 9 | public: 10 | IndexBuffer(); 11 | void Load(); 12 | 13 | std::vector indices; 14 | }; 15 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/FieldInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "MemberInfo.h" 5 | #include "TypeInfo.h" 6 | #include "../Parser/Tokens/TokenGroup.h" 7 | 8 | struct FieldInfo : MemberInfo 9 | { 10 | FieldInfo(TokenGroup& tokens); 11 | 12 | bool isStatic; 13 | TypeInfo type; 14 | }; 15 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/Specifier.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Parser/Tokens/TokenGroup.h" 6 | 7 | struct Specifier 8 | { 9 | std::string keyword; 10 | bool* flag; 11 | }; 12 | 13 | void processSpecifiers(TokenGroup& tokens, std::vector specifiers); 14 | -------------------------------------------------------------------------------- /Engine/Source/Color.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | struct Color 5 | { 6 | union 7 | { 8 | struct 9 | { 10 | float r; 11 | float g; 12 | float b; 13 | float a; 14 | }; 15 | 16 | float data[4]; 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /3rd-party/spirv-cross/spirv-cross.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../../Default.pri) 3 | 4 | TEMPLATE = lib 5 | TARGET = ../spirv-cross 6 | CONFIG += staticlib 7 | 8 | SOURCES += \ 9 | Source/main.cpp \ 10 | Source/spirv_cross.cpp \ 11 | Source/spirv_cpp.cpp \ 12 | Source/spirv_glsl.cpp \ 13 | Source/spirv_msl.cpp 14 | -------------------------------------------------------------------------------- /Engine/Source/Quad.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Quad.h" 3 | #include "Render/IRenderer.h" 4 | 5 | using base = Node; 6 | 7 | Quad::Quad() 8 | : base() 9 | , size(1, 1) 10 | { 11 | } 12 | 13 | void Quad::render(Matrix matrix, RendererFrontend* renderer) 14 | { 15 | base::render(matrix, renderer); 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/Render/Texture.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "RenderResource.h" 5 | #include 6 | #include 7 | 8 | class Texture : public RenderResource 9 | { 10 | public: 11 | Texture(Path filePath); 12 | void load(); 13 | 14 | public: 15 | Path filePath; 16 | }; 17 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanDescriptorPool.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class VulkanDescriptorPool 7 | { 8 | public: 9 | VulkanDescriptorPool(VkDevice& device); 10 | 11 | inline VkDescriptorPool& getPool() { return pool; } 12 | 13 | private: 14 | VkDescriptorPool pool; 15 | }; 16 | -------------------------------------------------------------------------------- /Engine/Source/SingletonObject.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | template 8 | class SingletonObject : public Object, public Singleton 9 | { 10 | public: 11 | SingletonObject() 12 | { 13 | retain(); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /Engine/Source/Math/Transform2D.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Vector2.h" 5 | #include "Matrix.h" 6 | 7 | struct Transform2D 8 | { 9 | Transform2D(); 10 | 11 | Matrix GetMatrix(); 12 | 13 | Vector3 pivot; 14 | Vector3 translation; 15 | float rotation; 16 | Vector3 scaling; 17 | }; 18 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IConstructorMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "IFunctionMeta.h" 5 | #include 6 | #include "Any.h" 7 | 8 | class IConstructorMeta : public virtual IFunctionMeta 9 | { 10 | public: 11 | virtual Any New(std::vector& args) = 0; 12 | virtual ITypeMeta* getNewType() = 0; 13 | }; 14 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLShaderImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class GLRenderer; 5 | 6 | #include "../Impl.h" 7 | #include "gl.h" 8 | #include "../Shader.h" 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(GLRenderer* renderer, Shader* shader); 15 | 16 | GLuint id; 17 | }; 18 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/InheritanceInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "AccessModifier.h" 5 | #include 6 | #include "TypeInfo.h" 7 | 8 | class TokenGroup; 9 | 10 | struct InheritanceInfo 11 | { 12 | InheritanceInfo(TokenGroup& tokens); 13 | 14 | AccessModifier accessModifier; 15 | TypeInfo type; 16 | }; 17 | -------------------------------------------------------------------------------- /Engine/Source/Pipe.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class Pipe 8 | { 9 | public: 10 | Pipe(FILE* file); 11 | ~Pipe(); 12 | 13 | std::string readText(); 14 | friend void operator>>(Pipe& pipe, std::string& string); 15 | 16 | private: 17 | int descriptors[2]; 18 | }; 19 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLTextureImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../Impl.h" 5 | #include "gl.h" 6 | #include "../Texture.h" 7 | 8 | class GLRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(GLRenderer* renderer, Texture* texture); 15 | 16 | GLuint id; 17 | }; 18 | -------------------------------------------------------------------------------- /Engine/Source/Render/VertexBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Vertex.h" 6 | 7 | #include "RenderResource.h" 8 | 9 | class VertexBuffer : public RenderResource 10 | { 11 | public: 12 | VertexBuffer(); 13 | 14 | void Load(); 15 | 16 | std::vector vertices; 17 | }; 18 | -------------------------------------------------------------------------------- /IDE/Source/CrossCompiler/CrossShader.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class CrossShader 8 | { 9 | public: 10 | 11 | 12 | 13 | std::string hlslText; 14 | std::vector spirvBinary; 15 | std::string sprivText; 16 | std::string glslText; 17 | std::string metalText; 18 | }; 19 | -------------------------------------------------------------------------------- /3rd-party/glslang/Source/glslang/Include/revision.h: -------------------------------------------------------------------------------- 1 | // This header is generated by the make-revision script. 2 | // For the version, it uses the latest git tag followed by the number of commits. 3 | // For the date, it uses the current date (when then script is run). 4 | 5 | #define GLSLANG_REVISION "Overload400-PrecQual.1603" 6 | #define GLSLANG_DATE "16-Oct-2016" 7 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IndexSequence.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | template 5 | struct index_sequence {}; 6 | 7 | template 8 | struct make_index_sequence : public make_index_sequence {}; 9 | 10 | template 11 | struct make_index_sequence<0, I...> : public index_sequence{}; 12 | -------------------------------------------------------------------------------- /3rd-party/scintilla/src/SciTE.properties: -------------------------------------------------------------------------------- 1 | # SciTE.properties is the per directory local options file and can be used to override 2 | # settings made in SciTEGlobal.properties 3 | command.build.directory.*.cxx=..\win32 4 | command.build.directory.*.h=..\win32 5 | command.build.*.cxx=nmake -f scintilla.mak QUIET=1 6 | command.build.*.h=nmake -f scintilla.mak QUIET=1 7 | -------------------------------------------------------------------------------- /IDE/Source/SpirvDocument.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "TextDocument.h" 5 | 6 | class SpirvDocument : public TextDocument 7 | { 8 | friend class HlslDocument; 9 | 10 | protected: 11 | virtual void setBinaryData(QByteArray data) override; 12 | virtual QByteArray getBinaryData() const override; 13 | 14 | QByteArray binaryData; 15 | }; 16 | -------------------------------------------------------------------------------- /Engine/Source/Blob.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class Blob 8 | { 9 | public: 10 | Blob(Path path); 11 | 12 | void* data() { return &str[0]; } 13 | size_t size() { return str.size(); }; 14 | 15 | const std::string& asString() const { return str; } 16 | 17 | private: 18 | std::string str; 19 | }; 20 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/CallInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CallInfo.h" 3 | 4 | CallInfo::CallInfo() 5 | { 6 | } 7 | 8 | CallInfo::CallInfo(std::string name, std::string source, int line, int startLine, int endLine) 9 | : name(name) 10 | , source(source) 11 | , line{line} 12 | , startLine{startLine} 13 | , endLine{endLine} 14 | { 15 | } 16 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLPipelineStateImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "gl.h" 5 | #include 6 | #include 7 | 8 | class GLRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(GLRenderer* renderer, PipelineState* pipelineState); 15 | 16 | GLuint programId; 17 | }; 18 | -------------------------------------------------------------------------------- /Game/shadersTextured.vs: -------------------------------------------------------------------------------- 1 | 2 | attribute vec4 a_position; 3 | attribute vec2 a_texCoord; 4 | attribute vec4 a_color; 5 | 6 | varying vec2 v_texCoord; 7 | varying vec3 pos; 8 | 9 | uniform mat4 MVP; 10 | 11 | void main() 12 | { 13 | gl_Position = a_position * transpose(MVP); 14 | pos = gl_Position.xyz / gl_Position.w; 15 | v_texCoord = a_texCoord; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderResource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "RenderResource.h" 3 | #include "RenderManager.h" 4 | 5 | IRenderResource::IRenderResource() 6 | { 7 | this->id = RenderManager::getInstance()->registerResource(this); 8 | } 9 | 10 | IRenderResource::~IRenderResource() 11 | { 12 | RenderManager::getInstance()->unregisterResource(this); 13 | } 14 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/ArgumentInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "TypeInfo.h" 5 | class TokenGroup; 6 | 7 | struct ArgumentInfo 8 | { 9 | ArgumentInfo(TokenGroup& tokens); 10 | 11 | TypeInfo type; 12 | std::string name; 13 | std::string defaultValue; 14 | 15 | private: 16 | void proccessMainTokens(TokenGroup& tokens); 17 | }; 18 | -------------------------------------------------------------------------------- /Engine/Source/Render/IRenderer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "IRenderer.h" 3 | #include "RendererFrontend.h" 4 | #include "Node.h" 5 | 6 | void IRenderer::render(Node* scene, RenderTarget* target) 7 | { 8 | RendererFrontend frontEnd; 9 | frontEnd.render(scene); 10 | 11 | target->onRendering(getType()); 12 | this->render(frontEnd.commands, target); 13 | } 14 | -------------------------------------------------------------------------------- /Engine/Source/Images.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct Image 9 | { 10 | int width; 11 | int height; 12 | unsigned char* data; 13 | 14 | size_t getSize() { return width * height * 4; }; 15 | }; 16 | 17 | namespace Images 18 | { 19 | Image* loadPng(Path path); 20 | } 21 | -------------------------------------------------------------------------------- /Engine/Source/Process.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | 5 | class Process 6 | { 7 | public: 8 | static Process* create(); 9 | 10 | virtual ~Process() = default; 11 | 12 | virtual void run(std::string path, std::string commandLine, std::string directory) = 0; 13 | virtual void stop() = 0; 14 | virtual bool isRunning() = 0; 15 | }; 16 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXShaderImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../Shader.h" 5 | #include "dx.h" 6 | #include "../Impl.h" 7 | #include "../Shader.h" 8 | 9 | class DXRenderer; 10 | 11 | template <> 12 | class Impl 13 | { 14 | public: 15 | Impl(DXRenderer* renderer, Shader* shader); 16 | ComPtr blob; 17 | }; 18 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineState.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class Shader; 8 | 9 | class PipelineState : public RenderResource 10 | { 11 | public: 12 | PipelineState(PipelineSettings& pipelineSettings); 13 | void load(); 14 | 15 | PipelineSettings settings; 16 | }; 17 | -------------------------------------------------------------------------------- /Engine/Source/TextureManager.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Singleton.h" 5 | #include 6 | #include 7 | 8 | class Texture; 9 | 10 | class TextureManager : public Singleton 11 | { 12 | public: 13 | std::unordered_map textures; 14 | 15 | Texture* getTexture(std::string name); 16 | }; 17 | -------------------------------------------------------------------------------- /IDE/Source/Menu/FileMenu.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BaseMenu.h" 5 | 6 | class FileMenu : public BaseMenu 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | FileMenu(MainWindow* window); 12 | 13 | private slots: 14 | void newFile(); 15 | void openFile(); 16 | void saveFile(); 17 | void saveAsFile(); 18 | void compile(); 19 | }; 20 | -------------------------------------------------------------------------------- /Engine/Source/Mac/MacApp.mm: -------------------------------------------------------------------------------- 1 | 2 | #include "MacApp.h" 3 | 4 | #import 5 | 6 | NSApplication* application; 7 | 8 | MacApp::MacApp() 9 | { 10 | NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 11 | application = [NSApplication sharedApplication]; 12 | } 13 | 14 | void MacApp::startMainLoop() 15 | { 16 | [application run]; 17 | } 18 | -------------------------------------------------------------------------------- /IDE/Source/Settings.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Settings.h" 3 | 4 | void Settings::initMeta() 5 | { 6 | auto meta = Meta::getInstance(); 7 | ClassDefiner(meta, "Settings") 8 | .constructor() 9 | .field("playerPath", &Settings::playerPath).attr("Serialize") 10 | .field("projectPath", &Settings::projectPath).attr("Serialize") 11 | ; 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/Input/Win/PlatformInputDevice.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class WinInputDevice : public InputDevice 8 | { 9 | public: 10 | virtual void updateState() override 11 | { 12 | previousState = currentState; 13 | } 14 | 15 | HANDLE handle; 16 | }; 17 | 18 | using PlatformInputDevice = WinInputDevice; 19 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IFieldMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "IMemberMeta.h" 5 | #include "ITypeMeta.h" 6 | 7 | class IFieldMeta : public IMemberMeta 8 | { 9 | public: 10 | virtual void set(Any& object, Any& value) = 0; 11 | virtual Any get(Any& object) = 0; 12 | virtual Any getAddr(Any& object) = 0; 13 | virtual ITypeMeta* const getType() = 0; 14 | }; 15 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/FileBreakpoints.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Containers/Set.h" 6 | #include "Attributes.h" 7 | 8 | struct [[Meta]] FileBreakpoints 9 | { 10 | FileBreakpoints(); 11 | FileBreakpoints(std::string fileName, Set lines); 12 | 13 | [[Serialize]] std::string fileName; 14 | [[Serialize]] Set lines; 15 | }; 16 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanIndexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Impl.h" 6 | #include "../IndexBuffer.h" 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, IndexBuffer* resource); 15 | 16 | VkBuffer buffer; 17 | }; 18 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Tokens/AtomToken.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Token.h" 5 | 6 | class AtomToken : public Token 7 | { 8 | public: 9 | AtomToken(std::string text); 10 | const std::string getName() const override; 11 | const std::string getText() const override; 12 | const bool isGroup() const override; 13 | 14 | private: 15 | std::string text; 16 | }; 17 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanVertexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Impl.h" 6 | #include "../VertexBuffer.h" 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, VertexBuffer* resource); 15 | 16 | VkBuffer buffer; 17 | }; 18 | -------------------------------------------------------------------------------- /Engine/Source/Mesh.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Vertex.h" 6 | #include 7 | 8 | class VertexBuffer; 9 | class IndexBuffer; 10 | 11 | struct Mesh 12 | { 13 | std::vector vertices; 14 | std::vector indices; 15 | 16 | VertexBuffer* vertexBuffer; 17 | IndexBuffer* indexBuffer; 18 | }; 19 | 20 | Mesh* createCubeMesh(); 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLIndexBufferImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "GLIndexBufferImpl.h" 3 | 4 | Impl::Impl(GLRenderer* renderer, IndexBuffer* indexBuffer) 5 | { 6 | glGenBuffers(1, &id); 7 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); 8 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexBuffer->indices.size() * sizeof(uint32_t), &indexBuffer->indices[0], GL_STATIC_DRAW); 9 | } 10 | -------------------------------------------------------------------------------- /Engine/Source/Linux/PlatformRenderTarget.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | LinuxRenderTarget::LinuxRenderTarget(Display* display, XWindow window) 5 | : display{display} 6 | , window{window} 7 | { 8 | } 9 | 10 | 11 | Vector2 LinuxRenderTarget::getSize() const 12 | { 13 | return Vector2(800, 800); 14 | } 15 | 16 | void LinuxRenderTarget::onRendering(RendererType type) 17 | { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Tokens/Token.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | struct Token 7 | { 8 | public: 9 | virtual const std::string getName() const = 0; 10 | virtual const std::string getText() const = 0; 11 | virtual const bool isGroup() const = 0; 12 | 13 | template 14 | T cast() 15 | { 16 | return static_cast(this); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /Engine/Source/Input/KeysState.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | constexpr int KEY_COUNT = static_cast(Key::COUNT); 9 | 10 | class KeysState 11 | { 12 | public: 13 | bool isSet(int keyCode); 14 | void set(int keyCode); 15 | void unset(int keyCode); 16 | 17 | private: 18 | std::bitset knownKeys; 19 | std::set unknownKeys; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/ConstantBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Math/Matrix.h" 5 | #include "RenderResource.h" 6 | 7 | class ConstantBuffer : public RenderResource 8 | { 9 | public: 10 | ConstantBuffer(); 11 | 12 | void load(); 13 | void update(); 14 | 15 | struct 16 | { 17 | Matrix MVP; 18 | } 19 | data; 20 | 21 | int version; 22 | }; 23 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/FieldInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "FieldInfo.h" 3 | #include "Specifier.h" 4 | 5 | FieldInfo::FieldInfo(TokenGroup& tokens) 6 | : isStatic {false} 7 | { 8 | attributes = tokens.extractAttributes(); 9 | 10 | processSpecifiers(tokens, 11 | { 12 | { "static", &isStatic }, 13 | }); 14 | 15 | name = tokens.extractLast()->getName(); 16 | type = TypeInfo(tokens); 17 | } 18 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/CallInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | #include "Attributes.h" 5 | 6 | struct [[Meta]] CallInfo 7 | { 8 | friend class Meta; 9 | 10 | public: 11 | CallInfo(); 12 | CallInfo(std::string name, std::string source, int line, int startLine, int endLine); 13 | 14 | [[Serialize]] std::string name, source; 15 | [[Serialize]] int line, startLine, endLine; 16 | }; 17 | -------------------------------------------------------------------------------- /Engine/Source/Render/IndexBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "IndexBuffer.h" 3 | 4 | #include "RenderManager.h" 5 | #include "IRenderer.h" 6 | 7 | IndexBuffer::IndexBuffer() 8 | { 9 | } 10 | 11 | void IndexBuffer::Load() 12 | { 13 | auto& renderers = RenderManager::getInstance()->renderers; 14 | for (size_t i = 0; i < renderers.size(); i++) 15 | { 16 | renderers[i]->createImpl(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXPipelineStateImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | #include 6 | #include 7 | 8 | class DXRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(DXRenderer* renderer, PipelineState* pipelineState); 15 | 16 | ComPtr pipelineState; 17 | ComPtr rootSignature; 18 | }; 19 | -------------------------------------------------------------------------------- /Engine/Source/Render/VertexBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "VertexBuffer.h" 3 | 4 | #include "RenderManager.h" 5 | #include "IRenderer.h" 6 | 7 | VertexBuffer::VertexBuffer() 8 | { 9 | } 10 | 11 | void VertexBuffer::Load() 12 | { 13 | auto& renderers = RenderManager::getInstance()->renderers; 14 | for (size_t i = 0; i < renderers.size(); i++) 15 | { 16 | renderers[i]->createImpl(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Game/Shaders/gen/test.ps.glsl: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | struct PSInput 4 | { 5 | vec4 position; 6 | vec2 uv; 7 | }; 8 | 9 | layout(binding = 0, std140) uniform ConstantBuffer 10 | { 11 | mat4 MVP; 12 | } _25; 13 | 14 | uniform sampler2D _67; 15 | 16 | layout(location = 0) out vec4 _entryPointOutput; 17 | layout(location = 0) in vec2 uv; 18 | 19 | void psmain() 20 | { 21 | _entryPointOutput = texture(_67, uv); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /IDE/Source/SpirvDocument.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SpirvDocument.h" 3 | #include "CrossCompiler/CrossCompiler.h" 4 | 5 | void SpirvDocument::setBinaryData(QByteArray binaryData) 6 | { 7 | this->binaryData = binaryData; 8 | 9 | auto text = CrossCompiler::getInstance()->spirvToHumanReadable(binaryData); 10 | this->setText(text); 11 | } 12 | 13 | QByteArray SpirvDocument::getBinaryData() const 14 | { 15 | return binaryData; 16 | } 17 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Tokens/AtomToken.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "AtomToken.h" 3 | 4 | AtomToken::AtomToken(std::string text) 5 | : text(text) 6 | { 7 | } 8 | 9 | const std::string AtomToken::getName() const 10 | { 11 | return text; 12 | } 13 | 14 | const std::string AtomToken::getText() const 15 | { 16 | return text; 17 | } 18 | 19 | const bool AtomToken::isGroup() const 20 | { 21 | return false; 22 | } 23 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXIndexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | #include "../Impl.h" 6 | #include "../IndexBuffer.h" 7 | 8 | class DXRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(DXRenderer* renderer, IndexBuffer* indexBuffer); 15 | 16 | ComPtr indexBuffer; 17 | D3D12_INDEX_BUFFER_VIEW indexBufferView; 18 | }; 19 | -------------------------------------------------------------------------------- /IDE/Source/Inspector/InspectorPane.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Node; 7 | class QTreeView; 8 | class NodeInspectorModel; 9 | 10 | class InspectorPane : public QDockWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | InspectorPane(); 16 | ~InspectorPane(); 17 | 18 | private slots: 19 | void onSelectNode(Node* node); 20 | 21 | private: 22 | QTreeView* tree; 23 | }; 24 | -------------------------------------------------------------------------------- /Player/Player.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../Default.pri) 3 | include(../Engine/Include.pri) 4 | 5 | TEMPLATE = app 6 | 7 | INCLUDEPATH += \ 8 | ../3rd-party/lua/Source \ 9 | 10 | SOURCES += \ 11 | Source/Main.cpp \ 12 | Source/RemoteDebbuger.cpp 13 | 14 | HEADERS += \ 15 | Windows.h \ 16 | Source/RemoteDebbuger.h 17 | 18 | win { 19 | QMAKE_LFLAGS += /ENTRY:"mainCRTStartup" 20 | LIBS += -lglew32s 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanShaderImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Impl.h" 6 | #include "../Shader.h" 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, Shader* resource); 15 | 16 | VkShaderModule shaderModule; 17 | VkPipelineShaderStageCreateInfo shaderStageInfo; 18 | }; 19 | -------------------------------------------------------------------------------- /Engine/Source/TextureManager.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "TextureManager.h" 3 | #include "Render/Texture.h" 4 | #include "Images.h" 5 | 6 | Texture* TextureManager::getTexture(std::string name) 7 | { 8 | auto it = textures.find(name); 9 | if (it != std::end(textures)) 10 | { 11 | return it->second; 12 | } 13 | 14 | auto texture = new Texture(name); 15 | textures[name] = texture; 16 | return texture; 17 | } 18 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXVertexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | #include "../Impl.h" 6 | #include "../VertexBuffer.h" 7 | 8 | class DXRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(DXRenderer* renderer, VertexBuffer* vertexBuffer); 15 | 16 | ComPtr vertexBuffer; 17 | D3D12_VERTEX_BUFFER_VIEW vertexBufferView; 18 | }; 19 | -------------------------------------------------------------------------------- /Game/Shaders/vert.hlsl: -------------------------------------------------------------------------------- 1 | 2 | #pragma vs vsmain 3 | 4 | cbuffer ConstantBuffer : register(b0) 5 | { 6 | row_major float4x4 MVP; 7 | }; 8 | 9 | struct PSInput 10 | { 11 | float4 position : SV_POSITION; 12 | float2 uv : TEXCOORD; 13 | }; 14 | 15 | PSInput vsmain(float3 position : POSITION, float4 uv : TEXCOORD) 16 | { 17 | PSInput result; 18 | 19 | result.position = float4(position, 1); 20 | result.uv = uv; 21 | 22 | return result; 23 | } 24 | -------------------------------------------------------------------------------- /IDE/shadersTextured.vs: -------------------------------------------------------------------------------- 1 | 2 | #version 430 3 | 4 | attribute vec4 a_position; 5 | attribute vec2 a_texCoord; 6 | attribute vec4 a_color; 7 | 8 | varying vec2 v_texCoord; 9 | varying vec4 v_color; 10 | varying vec3 pos; 11 | 12 | uniform mat4 MVP; 13 | 14 | void main() 15 | { 16 | gl_Position = a_position * transpose(MVP); 17 | pos = gl_Position.xyz / gl_Position.w; 18 | v_texCoord = a_texCoord; 19 | v_color = a_color; 20 | } -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLIndexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "gl.h" 5 | 6 | #include "../Impl.h" 7 | #include "../IndexBuffer.h" 8 | 9 | class GLRenderer; 10 | 11 | template <> 12 | class Impl 13 | { 14 | public: 15 | Impl(GLRenderer* renderer, IndexBuffer* indexBuffer); 16 | 17 | inline void bind() { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); } 18 | 19 | GLuint id; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLVertexBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class GLRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(GLRenderer* renderer, VertexBuffer* vertexBuffer); 15 | 16 | inline void bind() { glBindBuffer(GL_ARRAY_BUFFER, id); } 17 | 18 | private: 19 | GLuint id; 20 | }; 21 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/PropertyInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "MemberInfo.h" 5 | #include "MethodInfo.h" 6 | #include "../Parser/Tokens/TokenGroup.h" 7 | 8 | struct PropertyInfo : public MemberInfo 9 | { 10 | PropertyInfo(TokenGroup& tokens); 11 | 12 | void addMethod(TokenGroup& tokens); 13 | 14 | bool hasGetter() const; 15 | bool hasSetter() const; 16 | 17 | MethodInfo getter; 18 | MethodInfo setter; 19 | }; 20 | -------------------------------------------------------------------------------- /Engine/Source/Render/Shader.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class ShaderBunch; 9 | 10 | class Shader : public RenderResource 11 | { 12 | public: 13 | Shader(ShaderBunch* bunch, ShaderType type, std::string entryPoint); 14 | void load(); 15 | 16 | public: 17 | ShaderBunch* bunch; 18 | ShaderType type; 19 | std::string entryPoint; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformWindow.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Window.h" 5 | #include 6 | #include 7 | 8 | class WinWindow : public Window 9 | { 10 | public: 11 | WinWindow(); 12 | ~WinWindow(); 13 | 14 | virtual void processEvents() override; 15 | 16 | HWND hWnd; 17 | 18 | virtual void switchRenderType() override; 19 | 20 | private: 21 | HDC hDC; 22 | }; 23 | 24 | using PlatformWindow = WinWindow; 25 | -------------------------------------------------------------------------------- /IDE/Source/OutputPane.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Pipe.h" 7 | 8 | class QTextEdit; 9 | 10 | class OutputPane : public QDockWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | OutputPane(); 16 | ~OutputPane(); 17 | 18 | private slots: 19 | void clear(); 20 | void work(); 21 | 22 | private: 23 | QTextEdit* edit; 24 | Pipe stdoutPipe; 25 | QTimer timer; 26 | }; 27 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXDescriptorHandle.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | #include 6 | 7 | class DXDescriptorHeap; 8 | 9 | struct DXDescriptorHandle 10 | { 11 | DXDescriptorHandle(); 12 | DXDescriptorHandle(DXDescriptorHeap* heap, int index); 13 | 14 | CD3DX12_CPU_DESCRIPTOR_HANDLE getCPU(); 15 | CD3DX12_GPU_DESCRIPTOR_HANDLE getGPU(); 16 | 17 | private: 18 | DXDescriptorHeap* heap; 19 | int index; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLVertexBufferImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "GLVertexBufferImpl.h" 3 | 4 | Impl::Impl(GLRenderer* renderer, VertexBuffer* vertexBuffer) 5 | { 6 | glGenBuffers(1, &id); 7 | glBindBuffer(GL_ARRAY_BUFFER, id); 8 | glBufferData(GL_ARRAY_BUFFER, vertexBuffer->vertices.size() * sizeof(Vertex), &vertexBuffer->vertices[0], GL_STATIC_DRAW); 9 | 10 | printf("id: %i %i\n", id, vertexBuffer->vertices.size()); 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Unix/PlatformProcess.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Process.h" 5 | #include 6 | 7 | class UnixProcess : public Process 8 | { 9 | public: 10 | UnixProcess(); 11 | ~UnixProcess(); 12 | 13 | virtual void run(std::string path, std::string commandLine, std::string directory); 14 | virtual void stop(); 15 | virtual bool isRunning(); 16 | 17 | pid_t pid; 18 | }; 19 | 20 | using PlatformProcess = UnixProcess; 21 | -------------------------------------------------------------------------------- /Engine/Source/Model.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Node.h" 5 | 6 | #include "Mesh.h" 7 | #include "Render/RenderState.h" 8 | #include "Render/IRenderer.h" 9 | #include "Attributes.h" 10 | 11 | struct [[Meta]] Model : public Node 12 | { 13 | Model(); 14 | 15 | virtual void render(Matrix matrix, RendererFrontend* renderer) override; 16 | 17 | Mesh* mesh; 18 | RenderState* renderState; 19 | 20 | [[Serialize, Inspect]] std::string name; 21 | }; 22 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformProcess.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Process.h" 5 | #include 6 | 7 | class WinProcess : public Process 8 | { 9 | public: 10 | WinProcess(); 11 | ~WinProcess(); 12 | 13 | virtual void run(std::string path, std::string commandLine, std::string directory); 14 | virtual void stop(); 15 | virtual bool isRunning(); 16 | 17 | HANDLE handle; 18 | HANDLE outFileHandle; 19 | }; 20 | 21 | using PlatformProcess = WinProcess; 22 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineState.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PipelineState.h" 3 | #include 4 | 5 | PipelineState::PipelineState(PipelineSettings& pipelineSettings) 6 | : settings {pipelineSettings} 7 | { 8 | load(); 9 | } 10 | 11 | void PipelineState::load() 12 | { 13 | auto& renderers = RenderManager::getInstance()->renderers; 14 | for (size_t i = 0; i < renderers.size(); i++) 15 | { 16 | renderers[i]->createImpl(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /3rd-party/zlib/Source/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /Engine/Source/Render/Texture.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Texture.h" 3 | #include "Images.h" 4 | #include "RenderManager.h" 5 | #include "IRenderer.h" 6 | #include "Impl.h" 7 | 8 | Texture::Texture(Path filePath) 9 | : filePath { filePath } 10 | { 11 | load(); 12 | } 13 | 14 | void Texture::load() 15 | { 16 | auto& renderers = RenderManager::getInstance()->renderers; 17 | for (size_t i = 0; i < renderers.size(); i++) 18 | { 19 | renderers[i]->createImpl(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/Singleton.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | template 5 | class Singleton 6 | { 7 | public: 8 | using SingletonType = Singleton; 9 | 10 | inline static T* getInstance(); 11 | }; 12 | 13 | template 14 | class Singleton 15 | { 16 | public: 17 | using SingletonType = Singleton; 18 | 19 | inline static T* getInstance() 20 | { 21 | static T instance; 22 | return &instance; 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /Engine/Source/Linux/PlatformWindow.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Window.h" 5 | #include "Render/RenderTarget.h" 6 | 7 | #define Window XWindow 8 | #include 9 | #include 10 | #undef Window 11 | 12 | class LinuxWindow : public Window 13 | { 14 | public: 15 | LinuxWindow(); 16 | 17 | virtual void processEvents(); 18 | virtual void switchRenderType(); 19 | 20 | Display* display; 21 | XWindow window; 22 | }; 23 | 24 | using PlatformWindow = LinuxWindow; 25 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/MemberInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "MemberInfo.h" 3 | 4 | MemberInfo::MemberInfo() 5 | : isFriend(false) 6 | { 7 | } 8 | 9 | bool MemberInfo::isTemplate() const 10 | { 11 | return templateParameters.size() > 0; 12 | } 13 | 14 | bool MemberInfo::containsAttribute(std::string name) 15 | { 16 | for (auto& attribute : attributes) 17 | { 18 | if (attribute.name == name) 19 | { 20 | return true; 21 | } 22 | } 23 | return false; 24 | } 25 | -------------------------------------------------------------------------------- /Default.pri: -------------------------------------------------------------------------------- 1 | 2 | # Platform defines 3 | 4 | win32|win64:CONFIG += win 5 | unix:!macx:CONFIG += linux 6 | macx:CONFIG += mac 7 | 8 | win:DEFINES += WIN 9 | linux:DEFINES += LINUX 10 | mac:DEFINES += MAC 11 | 12 | # Default settings 13 | 14 | CONFIG -= qt 15 | CONFIG -= debug_and_release debug_and_release_target 16 | CONFIG += c++11 17 | 18 | win|mac { 19 | QMAKE_CXXFLAGS += /wd4250 /wd4800 /wd5030 20 | } 21 | 22 | linux { 23 | QMAKE_CXXFLAGS += -std=c++0x -fpermissive -Wno-attribute 24 | } 25 | 26 | -------------------------------------------------------------------------------- /IDE/Source/HlslDocument.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "TextDocument.h" 5 | #include "SpirvDocument.h" 6 | 7 | class HlslDocument : public TextDocument 8 | { 9 | public: 10 | HlslDocument(); 11 | 12 | virtual DocumentType getType() const override; 13 | 14 | virtual void save() override; 15 | virtual void reload() override; 16 | 17 | private: 18 | SpirvDocument* vsSpirvDocument; 19 | SpirvDocument* psSpirvDocument; 20 | TextDocument* vsGlslDocument; 21 | TextDocument* psGlslDocument; 22 | }; 23 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/TypeInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class TokenGroup; 8 | struct ClassInfo; 9 | 10 | struct TypeInfo 11 | { 12 | TypeInfo(); 13 | TypeInfo(TokenGroup& tokens); 14 | 15 | std::string fullName; 16 | std::string name; 17 | std::vector templateArguments; 18 | bool isConst; 19 | 20 | bool isTemplate() const; 21 | 22 | bool isDependent(ClassInfo& classInfo); 23 | void refreshFullName(); 24 | }; 25 | -------------------------------------------------------------------------------- /Engine/Source/Object.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Attributes.h" 6 | 7 | struct lua_State; 8 | 9 | class [[Meta]] Object 10 | { 11 | friend class LuaBinder; 12 | 13 | public: 14 | Object(); 15 | virtual ~Object(); 16 | 17 | void retain(); 18 | void release(); 19 | 20 | private: 21 | static int GC(lua_State* L); 22 | 23 | public: 24 | int referenceCount; 25 | 26 | void* luaObject; 27 | [[Serialize]] std::string luaClass; 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /IDE/Source/StackPane.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class StackPane : public QDockWidget 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | StackPane(); 14 | ~StackPane(); 15 | 16 | private: 17 | void set(int row, int col, std::string text); 18 | 19 | private slots: 20 | void onDoubleClicked(const QModelIndex& index); 21 | void work(); 22 | 23 | private: 24 | QTableWidget* table; 25 | QTimer timer; 26 | }; 27 | -------------------------------------------------------------------------------- /Engine/Source/Math/Quaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Containers/List.h" 5 | #include "Attributes.h" 6 | 7 | class [[Meta]] Quaternion 8 | { 9 | public: 10 | static const Quaternion Identity; 11 | 12 | Quaternion(float x = 0, float y = 0, float z = 0, float w = 1); 13 | 14 | [[Serialize]] Quaternion(List list); 15 | [[Serialize]] List toList(); 16 | 17 | static Quaternion yawPitchRoll(float yaw, float pitch, float roll); 18 | 19 | [[Bind]] float x, y, z, w; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Platform.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Platform.h" 3 | 4 | Platform currentPlatform() 5 | { 6 | #if WIN 7 | return Platform::Windows; 8 | #elif LINUX 9 | return Platform::Linux; 10 | #elif MAC 11 | return Platform::OSX; 12 | #else 13 | return Platform::Unknown; 14 | #endif 15 | } 16 | 17 | std::string getPlatformName() 18 | { 19 | #if WIN 20 | return "windows"; 21 | #elif LINUX 22 | return "linux"; 23 | #elif MAC 24 | return "osx"; 25 | #else 26 | return ""; 27 | #endif 28 | } 29 | -------------------------------------------------------------------------------- /Engine/Source/ShaderManager.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class ShaderManager : public Singleton 13 | { 14 | public: 15 | ShaderBunch* getShaderBunch(Path path); 16 | Shader* getShader(Path bunchPath, std::string entryPoint); 17 | 18 | private: 19 | std::unordered_map> bunches; 20 | }; 21 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/Specifier.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Specifier.h" 3 | 4 | void processSpecifiers(TokenGroup& tokens, std::vector specifiers) 5 | { 6 | for (auto i = 0; i < tokens.size(); i++) 7 | { 8 | auto name = tokens[i]->getName(); 9 | for (auto& s : specifiers) 10 | { 11 | if (name == s.keyword) 12 | { 13 | *s.flag = true; 14 | tokens.extractAt(i--); 15 | break; 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /IDE/Source/Menu/BaseMenu.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../MainWindow.h" 6 | 7 | class BaseMenu : public QMenu 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | BaseMenu(std::string name, MainWindow* window); 13 | 14 | QAction* createAction(const char* name, std::string iconName, const char* slot, 15 | const QKeySequence& shortcut = QKeySequence::UnknownKey); 16 | 17 | QAction* addAction(QAction* action); 18 | 19 | protected: 20 | MainWindow* window; 21 | }; 22 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLConstantBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class GLRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(GLRenderer* renderer, ConstantBuffer* constantBuffer); 15 | 16 | inline void bind() { glBindBufferBase(GL_UNIFORM_BUFFER, 0, id); } 17 | void update(); 18 | 19 | private: 20 | ConstantBuffer* resource; 21 | int version; 22 | GLuint id; 23 | }; 24 | -------------------------------------------------------------------------------- /Engine/Source/Meta/PropertyMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "IMemberMeta.h" 5 | #include "FunctionMeta.h" 6 | #include "IFieldMeta.h" 7 | 8 | class PropertyMeta : public IFieldMeta 9 | { 10 | public: 11 | PropertyMeta(std::string name); 12 | 13 | virtual void set(Any& object, Any& value) override; 14 | virtual Any get(Any& object) override; 15 | virtual Any getAddr(Any& object) override; 16 | virtual ITypeMeta* const getType() override; 17 | 18 | IFunctionMeta* getter; 19 | IFunctionMeta* setter; 20 | }; 21 | -------------------------------------------------------------------------------- /Engine/Source/Quad.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Node.h" 5 | #include "string" 6 | #include "Math/Transform2D.h" 7 | #include "Meta/ITypeMeta.h" 8 | #include "Attributes.h" 9 | 10 | class [[Meta]] Quad : public Node 11 | { 12 | friend class Meta; 13 | 14 | public: 15 | Quad(); 16 | 17 | virtual void render(Matrix matrix, RendererFrontend* renderer) override; 18 | 19 | [[Serialize, Inspect]] Vector2 size; 20 | [[Serialize, Inspect]] std::string shader; 21 | [[Serialize, Inspect]] std::string texture; 22 | }; 23 | -------------------------------------------------------------------------------- /Engine/Source/Render/ConstantBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ConstantBuffer.h" 3 | 4 | #include "RenderManager.h" 5 | #include "IRenderer.h" 6 | 7 | ConstantBuffer::ConstantBuffer() 8 | : version{1} 9 | { 10 | load(); 11 | } 12 | 13 | void ConstantBuffer::load() 14 | { 15 | auto& renderers = RenderManager::getInstance()->renderers; 16 | for (size_t i = 0; i < renderers.size(); i++) 17 | { 18 | renderers[i]->createImpl(this); 19 | } 20 | } 21 | 22 | void ConstantBuffer::update() 23 | { 24 | version++; 25 | } 26 | -------------------------------------------------------------------------------- /Game/Shaders/gen/test.vs.glsl: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | struct PSInput 4 | { 5 | vec4 position; 6 | vec2 uv; 7 | }; 8 | 9 | layout(binding = 0, std140) uniform ConstantBuffer 10 | { 11 | mat4 MVP; 12 | } _21; 13 | 14 | layout(location = 0) in vec3 _position; 15 | layout(location = 1) in vec4 _uv; 16 | layout(location = 0) out vec2 uv; 17 | 18 | void vsmain() 19 | { 20 | PSInput result; 21 | result.position = (_21.MVP * vec4(_position, 1.0)); 22 | result.uv = vec2(_uv.xy); 23 | gl_Position = result.position; 24 | uv = result.uv; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Engine/Source/Input/InputSystem.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "SingletonObject.h" 5 | #include "InputDevice.h" 6 | #include "Platform.h" 7 | #include 8 | 9 | PLATFORM_FORWARD_DECLARE(InputSystem) 10 | 11 | class [[Meta]] InputSystem : public SingletonObject 12 | { 13 | friend class Meta; 14 | 15 | public: 16 | virtual void updateState() = 0; 17 | 18 | bool isPressed(int keyCode); 19 | bool onPressed(int keyCode); 20 | 21 | protected: 22 | std::vector devices; 23 | }; 24 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXTextureImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | #include 6 | #include "../Impl.h" 7 | 8 | #include "DXDescriptorHandle.h" 9 | #include "../Texture.h" 10 | 11 | class DXRenderer; 12 | 13 | template <> 14 | class Impl 15 | { 16 | public: 17 | Impl(DXRenderer* renderer, Texture* resource); 18 | 19 | protected: 20 | std::vector generateChessboard(); 21 | 22 | public: 23 | ComPtr texture; 24 | DXDescriptorHandle descriptorHandle; 25 | }; 26 | -------------------------------------------------------------------------------- /Engine/Source/Math/Transform2D.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Transform2D.h" 3 | 4 | Transform2D::Transform2D() 5 | : pivot {Vector3::Zero} 6 | , translation {Vector3::Zero} 7 | , rotation {0} 8 | , scaling {Vector3::One} 9 | { 10 | } 11 | 12 | Matrix Transform2D::GetMatrix() 13 | { 14 | Matrix matrix = Matrix::Translation(-pivot); 15 | matrix *= Matrix::Scaling(scaling); 16 | matrix *= Matrix::RotationZ(rotation); 17 | matrix *= Matrix::Translation(translation); 18 | matrix *= Matrix::Translation(pivot); 19 | return matrix; 20 | } 21 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/ArgumentInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ArgumentInfo.h" 3 | 4 | #include 5 | #include "../Parser/Tokens/TokenGroup.h" 6 | 7 | ArgumentInfo::ArgumentInfo(TokenGroup& tokens) 8 | { 9 | auto v = tokens.split("="); 10 | proccessMainTokens(v[0]); 11 | if (v.size() > 1) 12 | { 13 | defaultValue = v[1].getText(); 14 | } 15 | } 16 | 17 | void ArgumentInfo::proccessMainTokens(TokenGroup& tokens) 18 | { 19 | auto token = tokens.extractLast(); 20 | name = token->getName(); 21 | type = TypeInfo(tokens); 22 | } 23 | -------------------------------------------------------------------------------- /Engine/Source/Render/Shader.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Shader.h" 3 | #include 4 | #include 5 | #include 6 | 7 | Shader::Shader(ShaderBunch* bunch, ShaderType type, std::string entryPoint) 8 | : bunch{bunch} 9 | , type{type} 10 | , entryPoint{entryPoint} 11 | { 12 | load(); 13 | } 14 | 15 | void Shader::load() 16 | { 17 | auto& renderers = RenderManager::getInstance()->renderers; 18 | for (size_t i = 0; i < renderers.size(); i++) 19 | { 20 | renderers[i]->createImpl(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Snippet.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Statement.h" 7 | 8 | struct Snippet 9 | { 10 | Snippet(std::string text); 11 | Snippet(std::string text, std::vector* escapedLiterals); 12 | const std::vector& getStatements(); 13 | 14 | private: 15 | void escapeLiterals(); 16 | void parseStatements(); 17 | 18 | std::string text; 19 | bool parsed; 20 | std::vector statements; 21 | std::vector* escapedLiterals; 22 | }; 23 | -------------------------------------------------------------------------------- /Engine/Source/Meta/TypeTraits/fulldecay.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | template 7 | struct fulldecay 8 | { 9 | using type = typename std::decay::type; 10 | }; 11 | 12 | template 13 | struct fulldecay 14 | { 15 | using type = typename std::decay::type*>::type; 16 | }; 17 | 18 | template struct fulldecay : public fulldecay {}; 19 | template struct fulldecay : public fulldecay {}; 20 | template struct fulldecay : public fulldecay {}; 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanPipelineStateImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, PipelineState* pipelineState); 15 | 16 | VkPipeline pipeline; 17 | VkPipelineLayout pipelineLayout; 18 | 19 | VkRenderPass renderPass; 20 | 21 | private: 22 | void initRenderPass(VulkanRenderer* renderer, VkFormat colorFormat, VkFormat depthFormat); 23 | }; 24 | -------------------------------------------------------------------------------- /Engine/Source/Meta/TypeTraits/is_built_in.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | template 5 | struct is_built_in 6 | { 7 | static const bool value = false; 8 | }; 9 | 10 | template <> 11 | struct is_built_in 12 | { 13 | static const bool value = true; 14 | }; 15 | 16 | template <> 17 | struct is_built_in 18 | { 19 | static const bool value = true; 20 | }; 21 | 22 | template <> 23 | struct is_built_in 24 | { 25 | static const bool value = true; 26 | }; 27 | 28 | template <> 29 | struct is_built_in 30 | { 31 | static const bool value = true; 32 | }; 33 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformRenderTarget.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | class WinRenderTarget : public RenderTarget 8 | { 9 | public: 10 | WinRenderTarget(HINSTANCE hInstance, HWND hWnd); 11 | 12 | virtual void onRendering(RendererType type) override; 13 | virtual Vector2 getSize() const override; 14 | 15 | HINSTANCE hInstance; 16 | HWND hWnd; 17 | 18 | // mix DX- and GL/Vulkan-render causes problems 19 | // use additional hWnd for DX 20 | HWND hWndEx; 21 | }; 22 | 23 | using PlatformRenderTarget = WinRenderTarget; 24 | -------------------------------------------------------------------------------- /Engine/Source/Meta/Binder.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Meta; 7 | struct lua_State; 8 | class IClassMeta; 9 | class Any; 10 | class ITypeMeta; 11 | class IFunctionMeta; 12 | 13 | using luaCFunction = auto (*)(lua_State*) -> int; 14 | 15 | class LuaBinder 16 | { 17 | public: 18 | LuaBinder(lua_State* L); 19 | void bind(Meta* meta); 20 | 21 | private: 22 | void init(); 23 | 24 | void bindClass(IClassMeta* classMeta); 25 | void bindHelper(std::string name, luaCFunction closure, void* upvalue); 26 | 27 | lua_State* L; 28 | }; 29 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderState.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class Shader; 5 | class Texture; 6 | class ConstantBuffer; 7 | class PipelineState; 8 | 9 | #include 10 | 11 | class RenderState 12 | { 13 | public: 14 | RenderState(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | Texture* texture; 20 | ConstantBuffer* constantBuffer; 21 | 22 | PipelineState* getPipelineState(); 23 | 24 | private: 25 | PipelineSettings pipelineSettings; 26 | PipelineState* pipelineState; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/Linux/PlatformRenderTarget.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Render/RenderTarget.h" 5 | 6 | #define Window XWindow 7 | #include 8 | #include 9 | #include 10 | #include 11 | #undef Window 12 | 13 | class LinuxRenderTarget : public RenderTarget 14 | { 15 | public: 16 | LinuxRenderTarget(Display* display, XWindow window); 17 | 18 | virtual Vector2 getSize() const override; 19 | virtual void onRendering(RendererType type); 20 | 21 | Display* display; 22 | XWindow window; 23 | }; 24 | 25 | using PlatformRenderTarget = LinuxRenderTarget; 26 | -------------------------------------------------------------------------------- /Engine/Source/Platform.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | 5 | enum class Platform 6 | { 7 | Windows, 8 | Linux, 9 | OSX, 10 | Unknown 11 | }; 12 | 13 | Platform currentPlatform(); 14 | std::string getPlatformName(); 15 | 16 | #if WIN 17 | #define PLATFORM_TYPE(x) Win ## x 18 | #elif LINUX 19 | #define PLATFORM_TYPE(x) Linux ## x 20 | #elif MAC 21 | #define PLATFORM_TYPE(x) Mac ## x 22 | #endif 23 | 24 | #define PLATFORM_FORWARD_DECLARE(x) \ 25 | class PLATFORM_TYPE(x); \ 26 | using Platform ## x = PLATFORM_TYPE(x); 27 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Render/GL/GLContext.h" 5 | #include "Render/RenderTarget.h" 6 | #include 7 | 8 | class WinGLContext : public GLContext 9 | { 10 | public: 11 | WinGLContext(HWND hWnd = 0); 12 | WinGLContext(RenderTarget* renderTarget); 13 | 14 | virtual void makeCurrent() override; 15 | virtual void swap() override; 16 | 17 | private: 18 | void setupPixelFormat(HDC hDC); 19 | 20 | static HGLRC hRC; // render context 21 | HDC hDC; // device context 22 | }; 23 | 24 | using PlatformGLContext = WinGLContext; 25 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/MemberInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "AccessModifier.h" 5 | #include "AttributeInfo.h" 6 | #include 7 | #include 8 | #include "TypeInfo.h" 9 | #include "../Parser/Tokens/TokenGroup.h" 10 | 11 | struct MemberInfo 12 | { 13 | MemberInfo(); 14 | 15 | std::vector attributes; 16 | AccessModifier accessModifier; 17 | 18 | bool isTemplate() const; 19 | bool isFriend; 20 | std::string name; 21 | std::vector templateParameters; 22 | 23 | bool containsAttribute(std::string name); 24 | }; 25 | -------------------------------------------------------------------------------- /Engine/Source/ShaderManager.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ShaderManager.h" 3 | #include 4 | #include 5 | 6 | ShaderBunch* ShaderManager::getShaderBunch(Path path) 7 | { 8 | auto it = bunches.find(path); 9 | if (it != bunches.end()) 10 | return it->second.get(); 11 | 12 | auto bunch = new ShaderBunch(path); 13 | bunches[path] = std::unique_ptr(bunch); 14 | return bunch; 15 | } 16 | 17 | 18 | Shader* ShaderManager::getShader(Path bunchPath, std::string entryPoint) 19 | { 20 | return getShaderBunch(bunchPath)->getShader(entryPoint); 21 | } 22 | -------------------------------------------------------------------------------- /Player/Source/RemoteDebbuger.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Meta/Any.h" 5 | #include "LuaMachine/LuaMachine.h" 6 | #include "Pipe.h" 7 | #include "Net/NetNode.h" 8 | 9 | class RemoteDebbuger 10 | { 11 | public: 12 | RemoteDebbuger(LuaMachine* luaMachine, int port); 13 | ~RemoteDebbuger(); 14 | 15 | private: 16 | void waitForFinish(); 17 | 18 | void onBreak(); 19 | void onResume(); 20 | void customNetWork(); 21 | void onGetMessage(Any& message); 22 | 23 | private: 24 | LuaMachine* luaMachine; 25 | Pipe* logPipe; 26 | NetNode* netNode; 27 | }; 28 | -------------------------------------------------------------------------------- /Game/Shaders/gen/vert.vs.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | struct PSInput 4 | { 5 | vec4 position; 6 | vec2 uv; 7 | }; 8 | 9 | layout(set = 0, binding = 0, std140) uniform ConstantBuffer 10 | { 11 | mat4 MVP; 12 | } _46; 13 | 14 | layout(location = 0) in vec3 position; 15 | layout(location = 1) in vec4 uv; 16 | layout(location = 0) out vec2 uv_1; 17 | 18 | void vsmain() 19 | { 20 | PSInput result; 21 | result.position = vec4(position, 1.0); 22 | result.uv = vec2(uv.xy); 23 | gl_Position = result.position; 24 | uv_1 = result.uv; 25 | gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IFunctionMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "IMemberMeta.h" 5 | #include 6 | #include "Any.h" 7 | 8 | class IFunctionMeta : public IMemberMeta 9 | { 10 | public: 11 | virtual ITypeMeta* getReturnType() = 0; 12 | virtual size_t getArgCount() = 0; 13 | virtual std::vector getArgTypes() = 0; 14 | 15 | virtual Any invoke(std::vector& args) = 0; 16 | 17 | template 18 | inline Any invoke(ArgTypes... args) 19 | { 20 | std::vector vector{args...}; 21 | return invoke(vector); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXConstantBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../Impl.h" 5 | #include "dx.h" 6 | #include "Matrix.h" 7 | #include "DXDescriptorHandle.h" 8 | #include "../ConstantBuffer.h" 9 | 10 | class DXRenderer; 11 | 12 | template <> 13 | class Impl 14 | { 15 | public: 16 | Impl(DXRenderer* renderer, ConstantBuffer* resource); 17 | void update(); 18 | 19 | ComPtr constantBuffer; 20 | DXDescriptorHandle descriptorHandle; 21 | 22 | ConstantBuffer* resource; 23 | int version; 24 | UINT8* gpuDataBegin; 25 | }; 26 | -------------------------------------------------------------------------------- /IDE/Source/Menu/DebugMenu.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BaseMenu.h" 5 | #include 6 | 7 | class DebugMenu : public BaseMenu 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | DebugMenu(MainWindow* window); 13 | 14 | QAction* playAction; 15 | QAction* pauseAction; 16 | QAction* stopAction; 17 | QList stepActions; 18 | 19 | private slots: 20 | void play(); 21 | void pause(); 22 | void stop(); 23 | void stepInto(); 24 | void stepOver(); 25 | void stepOut(); 26 | 27 | void refresh(); 28 | 29 | private: 30 | QTimer timer; 31 | }; 32 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXDescriptorHandle.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DXDescriptorHandle.h" 3 | #include "DXDescriptorHeap.h" 4 | 5 | DXDescriptorHandle::DXDescriptorHandle() 6 | : heap {nullptr} 7 | , index {0} 8 | { 9 | } 10 | 11 | DXDescriptorHandle::DXDescriptorHandle(DXDescriptorHeap* heap, int index) 12 | : heap {heap} 13 | , index {index} 14 | { 15 | } 16 | 17 | CD3DX12_CPU_DESCRIPTOR_HANDLE DXDescriptorHandle::getCPU() 18 | { 19 | return heap->getCpuHandle(index); 20 | } 21 | 22 | CD3DX12_GPU_DESCRIPTOR_HANDLE DXDescriptorHandle::getGPU() 23 | { 24 | return heap->getGpuHandle(index); 25 | } 26 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanConstantBufferImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Impl.h" 6 | #include "../ConstantBuffer.h" 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, ConstantBuffer* resource); 15 | void update(); 16 | 17 | VkDescriptorSet descriptorSet; 18 | 19 | private: 20 | VulkanRenderer* renderer; 21 | VkDeviceMemory constantBufferMemory; 22 | ConstantBuffer* resource; 23 | int version; 24 | 25 | VkBuffer buffer; 26 | }; 27 | -------------------------------------------------------------------------------- /IDE/Source/Hierarchy/HierarchyPane.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "HierarchyModel.h" 6 | #include 7 | 8 | class Node; 9 | class QTreeView; 10 | class NodeInspectorModel; 11 | 12 | class HierarchyPane : public QDockWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | HierarchyPane(); 18 | ~HierarchyPane(); 19 | 20 | private slots: 21 | void onSelectScene(Node* scene); 22 | void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); 23 | 24 | private: 25 | QTreeView* tree; 26 | HierarchyModel model; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/App.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Meta/Meta.h" 5 | #include "Meta/TypeMeta.h" 6 | #include "SingletonObject.h" 7 | #include "Window.h" 8 | #include "Containers/Set.h" 9 | #include "Attributes.h" 10 | 11 | class [[Meta]] App : public SingletonObject 12 | { 13 | friend class Meta; 14 | 15 | public: 16 | void startMainLoop(); 17 | 18 | void addWindow(Window* window); 19 | void removeWindow(Window* window); 20 | 21 | protected: 22 | void updateCollection(); 23 | 24 | Set windows; 25 | Set addedWindows; 26 | Set removedWindows; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/Render/RendererFrontend.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Node.h" 7 | #include "Mesh.h" 8 | #include "Math/Matrix.h" 9 | #include "Render/RenderState.h" 10 | #include "RenderCommand.h" 11 | 12 | struct Context 13 | { 14 | Matrix View; 15 | Matrix Projection; 16 | Matrix ViewProjection; 17 | }; 18 | 19 | class RendererFrontend 20 | { 21 | public: 22 | void render(Node* scene); 23 | void draw(Mesh* mesh, Matrix matrix, RenderState* renderState); 24 | 25 | std::queue contexts; 26 | std::vector commands; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderManager.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Singleton.h" 5 | #include "RenderResource.h" 6 | #include 7 | #include 8 | 9 | class RenderManager : public Singleton 10 | { 11 | public: 12 | RenderManager(); 13 | 14 | IRenderer* getRenderer(RendererType type); 15 | 16 | unsigned int registerResource(IRenderResource* resource); 17 | void unregisterResource(IRenderResource* resource); 18 | 19 | std::vector renderers; 20 | 21 | private: 22 | std::vector resources; 23 | std::queue freeIds; 24 | }; 25 | -------------------------------------------------------------------------------- /IDE/Source/Menu/WindowMenu.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "WindowMenu.h" 3 | 4 | WindowMenu::WindowMenu(MainWindow* window) 5 | : BaseMenu{"Window", window} 6 | { 7 | auto layoutMenu = addMenu(tr("&Layout")); 8 | for (int i = 0; i < 4; i++) 9 | { 10 | auto str = std::to_string(i); 11 | auto name = str.c_str(); 12 | auto action = createAction(name, "", SLOT(stub())); 13 | layoutMenu->addAction(action); 14 | } 15 | } 16 | 17 | void WindowMenu::stub() 18 | { 19 | } 20 | 21 | //QByteArray ba; 22 | //window->restoreState(ba, 0); 23 | // printf("save!\n"); 24 | // ba = this->saveState(0); 25 | -------------------------------------------------------------------------------- /Engine/Source/Input/Win/PlatformInputSystem.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | #include 5 | #include 6 | 7 | class WinInputSystem : public InputSystem 8 | { 9 | friend class SingletonType; 10 | 11 | private: 12 | WinInputSystem(); 13 | ~WinInputSystem(); 14 | 15 | public: 16 | virtual void updateState() override; 17 | 18 | std::vector keys; 19 | 20 | void initKeys(); 21 | void findDevices(); 22 | 23 | void handleEvent(HANDLE handle, int key, int message); 24 | 25 | private: 26 | HWND hWnd; 27 | }; 28 | 29 | using PlatfromInputSystem = WinInputSystem; 30 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/Linux/PlatformGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../GLContext.h" 5 | 6 | #define Window XWindow 7 | #include 8 | #include 9 | #include 10 | #include 11 | #undef Window 12 | 13 | #include "Render/RenderTarget.h" 14 | 15 | class LinuxGLContext : public GLContext 16 | { 17 | public: 18 | LinuxGLContext(); 19 | LinuxGLContext(RenderTarget* renderTarget); 20 | 21 | virtual void makeCurrent() override; 22 | virtual void swap() override; 23 | 24 | Display* display; 25 | XWindow window; 26 | GLXContext glc; 27 | }; 28 | 29 | using PlatformGLContext = LinuxGLContext; 30 | -------------------------------------------------------------------------------- /Engine/Source/Render/RenderResource.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "RendererType.h" 5 | #include "Impl.h" 6 | 7 | class IRenderResource 8 | { 9 | public: 10 | IRenderResource(); 11 | ~IRenderResource(); 12 | 13 | unsigned int id; 14 | }; 15 | 16 | template 17 | class Renderer; 18 | 19 | template 20 | class RenderResource : public IRenderResource 21 | { 22 | public: 23 | template 24 | inline Impl* getImpl(Renderer* renderer) 25 | { 26 | return renderer->getImpl((ResourceType*)this); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /Engine/Source/Input/InputDevice.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "InputDeviceType.h" 5 | #include "Key.h" 6 | #include "KeysState.h" 7 | 8 | class [[Meta]] InputDevice 9 | { 10 | friend class Meta; 11 | 12 | public: 13 | InputDevice(); 14 | 15 | virtual void updateState() = 0; 16 | 17 | bool isPressed(int keyCode); 18 | bool isReleased(int keyCode); 19 | bool wasPressed(int keyCode); 20 | bool wasReleased(int keyCode); 21 | bool onPressed(int keyCode); 22 | bool onReleased(int keyCode); 23 | 24 | InputDeviceType type; 25 | 26 | KeysState currentState; 27 | KeysState previousState; 28 | }; 29 | -------------------------------------------------------------------------------- /3rd-party/lua/Source/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.8 2014/07/15 21:26:50 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | #define api_incr_top(L) {L->top++; api_check(L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Game/Shaders/test.hlsl: -------------------------------------------------------------------------------- 1 | 2 | #pragma vs vsmain 3 | #pragma ps psmain 4 | 5 | cbuffer ConstantBuffer : register(b0) 6 | { 7 | row_major float4x4 MVP; 8 | }; 9 | 10 | Texture2D g_texture : register(t0); 11 | SamplerState g_sampler : register(s0); 12 | 13 | struct PSInput 14 | { 15 | float4 position : SV_POSITION; 16 | float2 uv : TEXCOORD; 17 | }; 18 | 19 | PSInput vsmain(float3 _position : POSITION, float4 _uv : TEXCOORD) 20 | { 21 | PSInput result; 22 | 23 | result.position = mul(float4(_position, 1), MVP); 24 | result.uv = _uv; 25 | return result; 26 | } 27 | 28 | float4 psmain(PSInput input) : SV_TARGET 29 | { 30 | return g_texture.Sample(g_sampler, input.uv); 31 | } -------------------------------------------------------------------------------- /IDE/Source/MainWindow.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | #include "DocumentsPane.h" 5 | #include "LuaMachine/LuaMachine.h" 6 | 7 | class MainWindow : public QMainWindow 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit MainWindow(QWidget* parent = 0); 13 | ~MainWindow(); 14 | 15 | DocumentsPane* documents; 16 | 17 | private: 18 | void createToolBar(QMenu* menu); 19 | void createActions(); 20 | 21 | bool eventFilter(QObject* obj, QEvent* event) override; 22 | 23 | QMenu* fileMenu; 24 | QMenu* editMenu; 25 | QMenu* debugMenu; 26 | QMenu* windowMenu; 27 | 28 | bool modificationChecking; 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLTextureImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "GLTextureImpl.h" 3 | 4 | #include "Images.h" 5 | 6 | Impl::Impl(GLRenderer* renderer, Texture* texture) 7 | : id {0} 8 | { 9 | auto image = Images::loadPng(texture->filePath); 10 | 11 | glGenTextures(1, &id); 12 | glBindTexture(GL_TEXTURE_2D, id); 13 | 14 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, (GLsizei)image->width, (GLsizei)image->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->data); 15 | 16 | auto err = glGetError(); 17 | if (err != GL_NO_ERROR) 18 | { 19 | printf("ERROR %i!!\n"); 20 | fflush(stdout); 21 | } 22 | 23 | delete image; 24 | } 25 | -------------------------------------------------------------------------------- /3rd-party/glslang/Source/glslang/Include/revision.template: -------------------------------------------------------------------------------- 1 | // The file revision.h should be updated to the latest version, somehow, on 2 | // check-in, if glslang has changed. 3 | // 4 | // revision.template is the source for revision.h when using SubWCRev as the 5 | // method of updating revision.h. You don't have to do it this way, the 6 | // requirement is only that revision.h gets updated. 7 | // 8 | // revision.h is under source control so that not all consumers of glslang 9 | // source have to figure out how to create revision.h just to get a build 10 | // going. However, if it is not updated, it can be a version behind. 11 | 12 | #define GLSLANG_REVISION "$WCREV$" 13 | #define GLSLANG_DATE "$WCDATE$" 14 | -------------------------------------------------------------------------------- /Engine/Source/Containers/Set.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "List.h" 6 | #include "Attributes.h" 7 | 8 | template 9 | class [[Meta]] Set : public std::unordered_set 10 | { 11 | friend class Meta; 12 | using base = std::unordered_set; 13 | 14 | public: 15 | Set() = default; 16 | 17 | private: 18 | Set(List list) [[Serialize]] 19 | : base(std::begin(list), std::end(list)) 20 | { 21 | } 22 | 23 | [[Serialize]] List toList() 24 | { 25 | List list(this->size()); 26 | std::copy(this->begin(), this->end(), std::begin(list)); 27 | return list; 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /Engine/Source/Input/Linux/PlatformInputDevice.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class LinuxInputDevice : public InputDevice 9 | { 10 | public: 11 | static LinuxInputDevice* create(std::string filePath); 12 | 13 | private: 14 | LinuxInputDevice(std::string filePath, int file, libevdev* device); 15 | ~LinuxInputDevice(); 16 | 17 | public: 18 | virtual void updateState() override; 19 | 20 | private: 21 | void handleSynDropped(); 22 | 23 | public: 24 | std::string filePath; 25 | int file; 26 | libevdev* device; 27 | }; 28 | 29 | using PlatformInputDevice = LinuxInputDevice; 30 | -------------------------------------------------------------------------------- /Engine/Source/Net/Unix/PlatformSocket.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Net/Socket.h" 5 | 6 | class UnixSocket : public Socket 7 | { 8 | public: 9 | UnixSocket(); 10 | UnixSocket(int handle); 11 | ~UnixSocket(); 12 | 13 | virtual bool setBlockingMode(bool value) override; 14 | virtual void listen(int port) override; 15 | virtual Socket* accept() override; 16 | virtual bool connect(std::string host, int port) override; 17 | virtual int send(const char* buffer, int length) override; 18 | virtual int receive(char* buffer, int max) override; 19 | virtual Error getLastError() override; 20 | 21 | private: 22 | int handle; 23 | }; 24 | 25 | using PlatformSocket = UnixSocket; 26 | -------------------------------------------------------------------------------- /3rd-party/glslang/glslang.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../../Default.pri) 3 | 4 | TEMPLATE = lib 5 | TARGET = ../glslang 6 | CONFIG += staticlib 7 | 8 | dirs += \ 9 | Source/glslang/Include \ 10 | Source/glslang/Public \ 11 | Source/glslang/GenericCodeGen \ 12 | Source/glslang/MachineIndependent \ 13 | Source/glslang/MachineIndependent/preprocessor \ 14 | Source/glslang/OSDependent \ 15 | Source/hlsl \ 16 | Source/SPIRV \ 17 | Source/OGLCompilersDLL 18 | 19 | win: dirs += Source/glslang/OSDependent/Windows 20 | unix: dirs += Source/glslang/OSDependent/Unix 21 | 22 | for(dir, dirs) { 23 | INCLUDEPATH += $$dir 24 | HEADERS += $$files($$dir/*.h) 25 | SOURCES += $$files($$dir/*.cpp) 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/Input/InputSystem.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include 6 | template class Singleton; 7 | 8 | bool InputSystem::isPressed(int keyCode) 9 | { 10 | for (auto device : devices) 11 | { 12 | if (device->isPressed(keyCode)) 13 | { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | 20 | bool InputSystem::onPressed(int keyCode) 21 | { 22 | for (auto device : devices) 23 | { 24 | if (device->onPressed(keyCode)) 25 | { 26 | return true; 27 | } 28 | } 29 | return false; 30 | } 31 | -------------------------------------------------------------------------------- /IDE/IDE.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../Default.pri) 3 | include(../Engine/Include.pri) 4 | 5 | TEMPLATE = app 6 | 7 | CONFIG += qt 8 | QT += widgets 9 | 10 | DEFINES += SCI_NAMESPACE 11 | 12 | HEADERS += $$files(Source/*.h, true) 13 | SOURCES += $$files(Source/*.cpp, true) 14 | 15 | LIBS += -L"../3rd-Party" -lglslang -lspirv-cross 16 | 17 | INCLUDEPATH += "../3rd-party/scintilla/include" 18 | INCLUDEPATH += "../3rd-party/glslang/Source" 19 | INCLUDEPATH += "../3rd-party/spirv-cross/Source" 20 | 21 | win: LIBS += -L"../3rd-party" -lscintillaedit3 22 | 23 | linux: LIBS += -L"../3rd-party" -lScintillaEdit 24 | 25 | mac: LIBS += -F"../3rd-party" -framework ScintillaEdit 26 | 27 | RESOURCES = ide.qrc 28 | -------------------------------------------------------------------------------- /3rd-party/scintilla/src/Catalogue.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Catalogue.h 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CATALOGUE_H 9 | #define CATALOGUE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class Catalogue { 16 | public: 17 | static const LexerModule *Find(int language); 18 | static const LexerModule *Find(const char *languageName); 19 | static void AddLexerModule(LexerModule *plm); 20 | }; 21 | 22 | #ifdef SCI_NAMESPACE 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanTextureImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "../Impl.h" 6 | #include "../Texture.h" 7 | 8 | class VulkanRenderer; 9 | 10 | template <> 11 | class Impl 12 | { 13 | public: 14 | Impl(VulkanRenderer* renderer, Texture* resource); 15 | 16 | void initImage(VulkanRenderer* renderer, Texture* texture); 17 | void initImageView(VulkanRenderer* renderer); 18 | void initSampler(VulkanRenderer* renderer); 19 | void initDescriptorSet(VulkanRenderer* renderer); 20 | 21 | VkImage image; 22 | VkImageView imageView; 23 | VkSampler sampler; 24 | VkDescriptorSet descriptorSet; 25 | }; 26 | -------------------------------------------------------------------------------- /Engine/Source/Meta/AnyData.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class ITypeMeta; 5 | 6 | template 7 | ITypeMeta* typeMetaOf(); 8 | 9 | struct IAnyData 10 | { 11 | virtual ~IAnyData() {} 12 | 13 | virtual ITypeMeta* getType() = 0; 14 | virtual IAnyData* copy() = 0; 15 | }; 16 | 17 | template 18 | struct AnyData : public IAnyData 19 | { 20 | T data; 21 | 22 | AnyData(T const& data) 23 | : data(data) 24 | { 25 | } 26 | 27 | virtual ITypeMeta* getType() override 28 | { 29 | return typeMetaOf(); 30 | } 31 | 32 | virtual IAnyData* copy() override 33 | { 34 | return new AnyData(data); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXShaderImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DXShaderImpl.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | Impl::Impl(DXRenderer* renderer, Shader* shader) 9 | { 10 | auto& source = shader->bunch->getSourceText(ShaderBunch::BlobType::Hlsl); 11 | 12 | auto entryPoint = shader->entryPoint.c_str(); 13 | auto target = shader->type == ShaderType::Vertex ? "vs_5_0" : "ps_5_0"; 14 | UINT compileFlags = 0; 15 | 16 | auto result = D3DCompile(source.data(), source.size(), entryPoint, nullptr, nullptr, entryPoint, target, compileFlags, 0, &blob, nullptr); 17 | 18 | if (FAILED(result)) throw; 19 | } 20 | -------------------------------------------------------------------------------- /IDE/Source/SceneDocument.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Document.h" 5 | #include 6 | #include "Node.h" 7 | #include "Render/RenderTarget.h" 8 | 9 | class SceneDocument : public IDocument 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | SceneDocument(); 15 | 16 | virtual DocumentType getType() const override; 17 | virtual bool changed() const override; 18 | virtual void reload() override; 19 | 20 | private slots: 21 | void render(); 22 | 23 | private: 24 | virtual void setBinaryData(QByteArray data) override; 25 | virtual QByteArray getBinaryData() const override; 26 | 27 | Node* scene; 28 | RenderTarget* renderTarget; 29 | QTimer timer; 30 | }; 31 | -------------------------------------------------------------------------------- /Engine/Source/Input/Linux/PlatformInputSystem.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | #include 5 | #include 6 | 7 | class LinuxInputSystem : public InputSystem 8 | { 9 | friend SingletonType; 10 | 11 | private: 12 | LinuxInputSystem(); 13 | ~LinuxInputSystem(); 14 | 15 | protected: 16 | virtual void updateState() override; 17 | void checkHotPlugs(); 18 | 19 | private: 20 | void registerAllDevices(); 21 | void tryAddDevice(std::string filePath); 22 | void tryRemoveDevice(std::string filePath); 23 | 24 | udev* udev; 25 | udev_monitor* monitor; 26 | int monitorFile; 27 | }; 28 | 29 | using PlatformInputSystem = LinuxInputSystem; 30 | -------------------------------------------------------------------------------- /Engine/Source/Meta/Meta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Meta.h" 3 | #include "TypeMeta.h" 4 | 5 | #include "ClassDefiner.h" 6 | #include "CallInfo.h" 7 | #include "Node.h" 8 | 9 | void Meta::init() 10 | { 11 | defineBuildInType("bool"); 12 | defineBuildInType("int"); 13 | defineBuildInType("float"); 14 | defineBuildInType("string"); 15 | defineBuildInType("char"); 16 | defineBuildInType("double"); 17 | 18 | defineClasses(); 19 | } 20 | 21 | ITypeMeta* Meta::find(std::type_index index) 22 | { 23 | auto it = typeMap.find(index); 24 | if (it != std::end(typeMap)) 25 | { 26 | return it->second; 27 | } 28 | return nullptr; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/Net/Socket.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Socket 7 | { 8 | public: 9 | static Socket* create(); 10 | virtual ~Socket(); 11 | 12 | enum class Error 13 | { 14 | Ok, 15 | WouldBlock, 16 | AlreadyConnected, 17 | InvalidArgument, 18 | Unknown 19 | }; 20 | 21 | virtual bool setBlockingMode(bool value) = 0; 22 | virtual void listen(int port) = 0; 23 | virtual Socket* accept() = 0; 24 | virtual bool connect(std::string host, int port) = 0; 25 | virtual int send(const char* buffer, int length) = 0; 26 | virtual int receive(char* buffer, int max) = 0; 27 | virtual Error getLastError() = 0; 28 | }; 29 | -------------------------------------------------------------------------------- /IDE/Source/TextDocument.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Document.h" 5 | #include "CodeEditor.h" 6 | 7 | class TextDocument : public IDocument 8 | { 9 | public: 10 | TextDocument(CodeEditor::HighlightType highlightType = CodeEditor::HighlightType::None); 11 | 12 | virtual DocumentType getType() const override; 13 | virtual void save() override; 14 | virtual bool changed() const override; 15 | 16 | std::string getText() const; 17 | void setText(std::string text); 18 | void goToLine(int line); 19 | void setReadOnly(bool value); 20 | 21 | protected: 22 | virtual void setBinaryData(QByteArray data) override; 23 | virtual QByteArray getBinaryData() const override; 24 | 25 | CodeEditor* editor; 26 | }; 27 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/MethodInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "MemberInfo.h" 5 | #include 6 | #include "ArgumentInfo.h" 7 | 8 | class TokenGroup; 9 | 10 | struct MethodInfo : public MemberInfo 11 | { 12 | MethodInfo(); 13 | MethodInfo(TokenGroup& tokens); 14 | 15 | bool isStatic; 16 | bool isVirtual; 17 | bool isOperator; 18 | bool isInline; 19 | 20 | TypeInfo returnType; 21 | std::vector arguments; 22 | 23 | bool isConst; 24 | bool isOverride; 25 | bool isPure; 26 | 27 | private: 28 | void processOperator(TokenGroup& tokens); 29 | void processArguments(TokenGroup& tokens); 30 | void processSpecifiers(TokenGroup& tokens); 31 | }; 32 | -------------------------------------------------------------------------------- /IDE/Source/Inspector/InspectorPane.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "InspectorPane.h" 3 | #include 4 | #include 5 | #include "../IDE.h" 6 | #include "InspectorModel.h" 7 | 8 | InspectorPane::InspectorPane() 9 | : QDockWidget("Inspector", 0, 0) 10 | { 11 | setObjectName("Inspector"); 12 | setMinimumWidth(250); 13 | 14 | tree = new QTreeView(); 15 | setWidget(tree); 16 | 17 | connect(IDE::getInstance(), SIGNAL(selectNode(Node*)), this, SLOT(onSelectNode(Node*))); 18 | } 19 | 20 | InspectorPane::~InspectorPane() 21 | { 22 | } 23 | 24 | void InspectorPane::onSelectNode(Node* node) 25 | { 26 | auto model = new InspectorModel(node); 27 | tree->setModel(model); 28 | tree->expandAll(); 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/Input/KeysState.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | bool KeysState::isSet(int keyCode) 5 | { 6 | if (keyCode < KEY_COUNT) 7 | { 8 | return knownKeys[keyCode]; 9 | } 10 | else 11 | { 12 | return unknownKeys.find(keyCode) != std::end(unknownKeys); 13 | } 14 | } 15 | 16 | void KeysState::set(int keyCode) 17 | { 18 | if (keyCode < KEY_COUNT) 19 | { 20 | knownKeys[keyCode] = true; 21 | } 22 | else 23 | { 24 | unknownKeys.insert(keyCode); 25 | } 26 | } 27 | 28 | void KeysState::unset(int keyCode) 29 | { 30 | if (keyCode < KEY_COUNT) 31 | { 32 | knownKeys[keyCode] = false; 33 | } 34 | else 35 | { 36 | unknownKeys.erase(keyCode); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Engine/Source/Net/Win/PlatformSocket.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Net/Socket.h" 5 | #include 6 | 7 | class WinSocket : public Socket 8 | { 9 | public: 10 | WinSocket(); 11 | WinSocket(SOCKET handle); 12 | ~WinSocket(); 13 | 14 | virtual bool setBlockingMode(bool value) override; 15 | virtual void listen(int port) override; 16 | virtual Socket* accept() override; 17 | virtual bool connect(std::string host, int port) override; 18 | virtual int send(const char* buffer, int length) override; 19 | virtual int receive(char* buffer, int max) override; 20 | virtual Error getLastError() override; 21 | 22 | private: 23 | SOCKET handle; 24 | static int count; 25 | }; 26 | 27 | using PlatformSocket = WinSocket; 28 | -------------------------------------------------------------------------------- /Engine/Source/Render/Vulkan/VulkanDescriptorPool.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "VulkanDescriptorPool.h" 3 | 4 | VulkanDescriptorPool::VulkanDescriptorPool(VkDevice& device) 5 | { 6 | VkDescriptorPoolSize poolSizes[2]; 7 | poolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; 8 | poolSizes[1].descriptorCount = 1; 9 | poolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; 10 | poolSizes[1].descriptorCount = 1; 11 | 12 | VkDescriptorPoolCreateInfo poolInfo = {}; 13 | poolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; 14 | poolInfo.maxSets = 2; 15 | poolInfo.poolSizeCount = 2; 16 | poolInfo.pPoolSizes = poolSizes; 17 | 18 | auto err = vkCreateDescriptorPool(device, &poolInfo, nullptr, &pool); 19 | assert(!err); 20 | } 21 | -------------------------------------------------------------------------------- /IDE/Source/Hierarchy/HierarchyModel.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Node; 7 | 8 | class HierarchyModel : public QAbstractItemModel 9 | { 10 | public: 11 | HierarchyModel(); 12 | void setNode(Node* node); 13 | 14 | virtual int rowCount(const QModelIndex& index) const override; 15 | virtual int columnCount(const QModelIndex& index) const override; 16 | virtual QModelIndex index(int row, int column, const QModelIndex& index) const override; 17 | virtual QModelIndex parent(const QModelIndex& index) const override; 18 | virtual QVariant data(const QModelIndex& index, int role) const override; 19 | 20 | Node* getNode(const QModelIndex& index) const; 21 | 22 | private: 23 | Node* rootNode; 24 | }; 25 | -------------------------------------------------------------------------------- /Engine/Source/Win/PlatformRenderTarget.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | WinRenderTarget::WinRenderTarget(HINSTANCE hInstance, HWND hWnd) 5 | { 6 | this->hInstance = hInstance; 7 | this->hWnd = hWnd; 8 | 9 | // create additional hWnd 10 | auto dwStyle = WS_CHILD | WS_VISIBLE; 11 | auto size = getSize(); 12 | this->hWndEx = CreateWindowEx(NULL, L"EDIT", L"", dwStyle, 0, 0, size.x, size.y, hWnd, NULL, hInstance, NULL); 13 | } 14 | 15 | void WinRenderTarget::onRendering(RendererType type) 16 | { 17 | ShowWindow(hWndEx, type == RendererType::DX ? SW_SHOW : SW_HIDE); 18 | } 19 | 20 | Vector2 WinRenderTarget::getSize() const 21 | { 22 | RECT rect; 23 | GetClientRect(hWnd, &rect); 24 | return Vector2(rect.right - rect.left, rect.bottom - rect.top); 25 | } 26 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/CodeParser.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Snippet.h" 7 | #include "Statement.h" 8 | #include "../Info/ClassInfo.h" 9 | 10 | class CodeParser 11 | { 12 | public: 13 | void parse(std::string text, std::string headerName = ""); 14 | const std::vector& getClasses() const; 15 | 16 | private: 17 | void spliceLines(std::string& text); 18 | void removeComments(std::string& text); 19 | void removeDirectives(std::string& text); 20 | void parseClasses(Snippet* snippet, std::string headerName = ""); 21 | void parseClassMembers(ClassInfo& classInfo, Snippet* definitionSnippet); 22 | void checkAcessModifiers(TokenGroup& tokens); 23 | 24 | std::vector classes; 25 | }; 26 | -------------------------------------------------------------------------------- /Engine/Source/Math/Vector3.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Containers/List.h" 5 | #include "Attributes.h" 6 | 7 | struct [[Meta]] Vector3 8 | { 9 | static const Vector3 Zero; 10 | static const Vector3 One; 11 | 12 | Vector3(float x = 0, float y = 0, float z = 0); 13 | 14 | [[Serialize]] Vector3(List list); 15 | [[Serialize]] List toList(); 16 | 17 | float length(); 18 | float squaredLength(); 19 | 20 | friend Vector3 operator-(const Vector3& vector); 21 | friend Vector3 operator+(const Vector3& lhs, const Vector3& rhs); 22 | friend Vector3 operator-(const Vector3& lhs, const Vector3& rhs); 23 | 24 | friend Vector3 operator*(const Vector3& vector, const float& value); 25 | 26 | [[Bind, Inspect]] float x, y, z; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/Math/Vector4.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Containers/List.h" 5 | #include "Attributes.h" 6 | 7 | struct [[Meta]] Vector4 8 | { 9 | static const Vector4 Zero; 10 | static const Vector4 One; 11 | 12 | Vector4(float x = 0, float y = 0, float z = 0, float w = 0); 13 | 14 | Vector4(List list); 15 | [[Serialize]] List toList(); 16 | 17 | float length(); 18 | float squaredLength(); 19 | 20 | friend Vector4 operator-(const Vector4& vector); 21 | friend Vector4 operator+(const Vector4& lhs, const Vector4& rhs); 22 | friend Vector4 operator-(const Vector4& lhs, const Vector4& rhs); 23 | 24 | friend Vector4 operator*(const Vector4& vector, const float& value); 25 | 26 | [[Bind, Inspect]] float x, y, z, w; 27 | }; 28 | -------------------------------------------------------------------------------- /Engine/Source/Input/VirtualDevice.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class InputDevice; 10 | 11 | class [[Meta]] VirtualDevice : public Object 12 | { 13 | friend class Meta; 14 | 15 | VirtualDevice(); 16 | 17 | struct Source 18 | { 19 | InputDevice* device; 20 | int keyCode; 21 | }; 22 | 23 | [[Bind]] void addKeySource(int index, InputDevice* device, int keyCode); 24 | 25 | [[Bind]] bool isPressed(int index); 26 | [[Bind]] bool isReleased(int index); 27 | [[Bind]] bool wasPressed(int index); 28 | [[Bind]] bool wasReleased(int index); 29 | [[Bind]] bool onPressed(int index); 30 | [[Bind]] bool onReleased(int index); 31 | 32 | std::vector> keys; 33 | }; 34 | -------------------------------------------------------------------------------- /IDE/Source/LuaDocument.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "LuaDocument.h" 3 | #include 4 | #include "CodeEditor.h" 5 | #include "IDE.h" 6 | #include "Utils.h" 7 | 8 | LuaDocument::LuaDocument() 9 | : TextDocument(CodeEditor::HighlightType::Lua) 10 | { 11 | } 12 | 13 | DocumentType LuaDocument::getType() const 14 | { 15 | return DocumentType::Lua; 16 | } 17 | 18 | void LuaDocument::reload() 19 | { 20 | TextDocument::reload(); 21 | 22 | auto projectPath = Path(IDE::getInstance()->settings.projectPath); 23 | if (startsWith(documentPath, projectPath)) 24 | { 25 | auto size = projectPath.str().size(); 26 | auto source = "@" + documentPath.str().substr(size + 1); 27 | editor->setSource(source); 28 | } 29 | 30 | editor->pullBreakpoints(); 31 | editor->updateActiveLine(); 32 | } 33 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.DC1364: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | private: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.EJ1364: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | private: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.Sx1364: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | private: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.ro1364: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | private: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /IDE/ide.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/new.png 4 | images/open.png 5 | images/save.png 6 | images/icon.png 7 | images/pause.png 8 | images/stepinto.png 9 | images/stepout.png 10 | images/stepover.png 11 | images/stop.png 12 | images/play.png 13 | images/play_disabled.png 14 | images/pause_disabled.png 15 | images/stepinto_disabled.png 16 | images/stepout_disabled.png 17 | images/stepover_disabled.png 18 | images/stop_disabled.png 19 | 20 | 21 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.BjC376: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | protected: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h.CyH376: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | class PipelineSettings 10 | { 11 | friend class std::hash; 12 | 13 | public: 14 | PipelineSettings(); 15 | 16 | void setVertexShader(Shader* shader); 17 | void setPixelShader(Shader* shader); 18 | 19 | protected: 20 | Shader* vertexShader; 21 | Shader* pixelShader; 22 | 23 | PipelineState* pipelineState; 24 | }; 25 | 26 | 27 | template <> 28 | struct std::hash 29 | { 30 | size_t operator()(const PipelineSettings &ps) const 31 | { 32 | size_t h1 = std::hash()(ps.vertexShader); 33 | size_t h2 = std::hash()(ps.pixelShader); 34 | return h1 ^ (h2 << 1); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /3rd-party/zlib/zlib.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../../Default.pri) 3 | 4 | TEMPLATE = lib 5 | TARGET = ../zlib 6 | CONFIG += staticlib 7 | 8 | DEFINES += Z_SOLO 9 | 10 | INCLUDEPATH += \ 11 | Source \ 12 | 13 | HEADERS += \ 14 | Source/crc32.h \ 15 | Source/deflate.h \ 16 | Source/inffast.h \ 17 | Source/inffixed.h \ 18 | Source/inflate.h \ 19 | Source/inftrees.h \ 20 | Source/trees.h \ 21 | Source/zconf.h \ 22 | Source/zlib.h \ 23 | Source/zutil.h 24 | 25 | SOURCES += \ 26 | Source/adler32.c \ 27 | Source/compress.c \ 28 | Source/crc32.c \ 29 | Source/deflate.c \ 30 | Source/infback.c \ 31 | Source/inffast.c \ 32 | Source/inflate.c \ 33 | Source/inftrees.c \ 34 | Source/trees.c \ 35 | Source/uncompr.c \ 36 | Source/zutil.c 37 | -------------------------------------------------------------------------------- /Engine/Source/LuaMachine/Breakpoints.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Containers/Set.h" 6 | #include 7 | 8 | class Breakpoints 9 | { 10 | using MapType = std::unordered_map>; 11 | 12 | public: 13 | Breakpoints(); 14 | 15 | bool isEmpty(); 16 | bool isAnySet(int line); 17 | bool isSet(std::string source, int line); 18 | 19 | bool clear(std::string fileName); 20 | Set getLines(std::string fileName); 21 | bool setLines(std::string fileName, Set lines); 22 | const MapType& getMap() const; 23 | 24 | void setCaseSensitive(bool value); 25 | 26 | private: 27 | void updateLines(); 28 | 29 | MapType map; 30 | bool linesDirty; 31 | Set lines; 32 | bool caseSensitive; 33 | }; 34 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLConstantBufferImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "GLConstantBufferImpl.h" 4 | 5 | Impl::Impl(GLRenderer* renderer, ConstantBuffer* cb) 6 | : resource{cb} 7 | , version{cb->version} 8 | { 9 | glGenBuffers(1, &id); 10 | glBindBuffer(GL_UNIFORM_BUFFER, id); 11 | glBufferData(GL_UNIFORM_BUFFER, sizeof(cb->data), &cb->data, GL_DYNAMIC_DRAW); 12 | } 13 | 14 | void Impl::update() 15 | { 16 | if (version != resource->version) 17 | { 18 | glBindBuffer(GL_UNIFORM_BUFFER, id); 19 | void* data = glMapBuffer(GL_UNIFORM_BUFFER, GL_WRITE_ONLY); 20 | memcpy(data, &resource->data, sizeof(resource->data)); 21 | glUnmapBuffer(GL_UNIFORM_BUFFER); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /3rd-party/libpng/libpng.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../../Default.pri) 3 | 4 | TEMPLATE = lib 5 | TARGET = ../libpng 6 | CONFIG += staticlib 7 | 8 | INCLUDEPATH += \ 9 | source \ 10 | ../zlib/Source \ 11 | 12 | HEADERS += \ 13 | Source/png.h \ 14 | Source/pngconf.h \ 15 | Source/pngdebug.h \ 16 | Source/pnginfo.h \ 17 | Source/pngstruct.h \ 18 | Source/pngpriv.h 19 | 20 | SOURCES += \ 21 | Source/png.c \ 22 | Source/pngerror.c \ 23 | Source/pngget.c \ 24 | Source/pngmem.c \ 25 | Source/pngpread.c \ 26 | Source/pngread.c \ 27 | Source/pngrio.c \ 28 | Source/pngrtran.c \ 29 | Source/pngrutil.c \ 30 | Source/pngset.c \ 31 | Source/pngtrans.c \ 32 | Source/pngwio.c \ 33 | Source/pngwrite.c \ 34 | Source/pngwtran.c \ 35 | Source/pngwutil.c 36 | -------------------------------------------------------------------------------- /Engine/Source/Window.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Object.h" 5 | #include "Ref.h" 6 | #include "Node.h" 7 | #include "Render/RenderTarget.h" 8 | #include "Render/IRenderer.h" 9 | #include "Attributes.h" 10 | 11 | class [[Meta]] Window : public Object 12 | { 13 | friend class Meta; 14 | 15 | public: 16 | static Window* create(); 17 | virtual ~Window(); 18 | 19 | void show(); 20 | 21 | virtual void processEvents() = 0; 22 | 23 | void update(float delta); 24 | void render(); 25 | 26 | virtual void switchRenderType() = 0; 27 | 28 | protected: 29 | Window(); 30 | 31 | [[Bind]] Ref scene; 32 | [[Bind]] RenderTarget* renderTarget; 33 | [[Bind]] IRenderer* renderer; 34 | 35 | //RenderTarget* RenderTarget1; 36 | //RenderTarget* RenderTarget2; 37 | }; 38 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/PropertyInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PropertyInfo.h" 3 | 4 | PropertyInfo::PropertyInfo(TokenGroup& tokens) 5 | { 6 | attributes = tokens.extractAttributes(); 7 | name = tokens.extractLast()->getName(); 8 | } 9 | 10 | void PropertyInfo::addMethod(TokenGroup& tokens) 11 | { 12 | MethodInfo methodInfo(tokens); 13 | if (methodInfo.returnType.name != "void" && methodInfo.arguments.size() == 0) 14 | { 15 | getter = methodInfo; 16 | } 17 | else if (methodInfo.returnType.name == "void" && methodInfo.arguments.size() == 1) 18 | { 19 | setter = methodInfo; 20 | } 21 | } 22 | 23 | bool PropertyInfo::hasGetter() const 24 | { 25 | return !getter.name.empty(); 26 | } 27 | 28 | bool PropertyInfo::hasSetter() const 29 | { 30 | return !setter.name.empty(); 31 | } 32 | -------------------------------------------------------------------------------- /Engine/Source/Math/Vector2.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Meta/TypeMeta.h" 6 | #include "Containers/List.h" 7 | #include "Attributes.h" 8 | 9 | struct [[Meta]] Vector2 10 | { 11 | static const Vector2 Zero; 12 | static const Vector2 One; 13 | 14 | Vector2(); 15 | Vector2(float x, float y); 16 | 17 | [[Serialize]] Vector2(List list); 18 | [[Serialize]] List toList(); 19 | 20 | float length(); 21 | float squaredLength(); 22 | 23 | friend Vector2 operator-(const Vector2& vector); 24 | friend Vector2 operator+(const Vector2& lhs, const Vector2& rhs); 25 | friend Vector2 operator-(const Vector2& lhs, const Vector2& rhs); 26 | 27 | friend Vector2 operator*(const Vector2& vector, const float& value); 28 | 29 | [[Bind, Inspect]] float x, y; 30 | }; 31 | -------------------------------------------------------------------------------- /IDE/Source/DocumentsPane.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "Document.h" 9 | 10 | 11 | class DocumentsPane : public QTabWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | DocumentsPane(); 17 | 18 | void open(Path path); 19 | void openAtLine(Path path, int line); 20 | IDocument* getCurrentDocument(); 21 | IDocument* getDocument(Path path); 22 | IDocument* getDocument(int index); 23 | 24 | void saveCurrentDocument(); 25 | void checkOutsideModification(); 26 | 27 | private: 28 | static IDocument* createDocumentByExtension(std::string extension); 29 | int reloadDocumentMessageBox(IDocument* document); 30 | 31 | private slots: 32 | void closeTab(int index); 33 | void updateTabNames(); 34 | }; 35 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/InheritanceInfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "InheritanceInfo.h" 3 | #include "../Parser/Tokens/TokenGroup.h" 4 | 5 | InheritanceInfo::InheritanceInfo(TokenGroup& tokens) 6 | : accessModifier(AccessModifier::Private) 7 | { 8 | if (tokens.size() > 0) 9 | { 10 | auto name = tokens[0]->getName(); 11 | if (name == "private") 12 | { 13 | accessModifier = AccessModifier::Private; 14 | tokens.extractAt(0); 15 | } 16 | else if (name == "protected") 17 | { 18 | accessModifier = AccessModifier::Protected; 19 | tokens.extractAt(0); 20 | } 21 | else if (name == "public") 22 | { 23 | accessModifier = AccessModifier::Public; 24 | tokens.extractAt(0); 25 | } 26 | } 27 | 28 | type = TypeInfo(tokens); 29 | } 30 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/CharacterCategory.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterCategory.h 3 | ** Returns the Unicode general category of a character. 4 | **/ 5 | // Copyright 2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARACTERCATEGORY_H 9 | #define CHARACTERCATEGORY_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | enum CharacterCategory { 16 | ccLu, ccLl, ccLt, ccLm, ccLo, 17 | ccMn, ccMc, ccMe, 18 | ccNd, ccNl, ccNo, 19 | ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, 20 | ccSm, ccSc, ccSk, ccSo, 21 | ccZs, ccZl, ccZp, 22 | ccCc, ccCf, ccCs, ccCo, ccCn 23 | }; 24 | 25 | CharacterCategory CategoriseCharacter(int character); 26 | 27 | #ifdef SCI_NAMESPACE 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /IDE/Source/CrossCompiler/CrossCompiler.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "Render/Shader.h" 8 | 9 | class CrossCompiler : public Singleton 10 | { 11 | friend class SingletonType; 12 | 13 | using Pragmas = std::vector>; 14 | using EntryPoints = std::map>; 15 | 16 | struct Spirv 17 | { 18 | QByteArray vs, gs, ps; 19 | }; 20 | 21 | private: 22 | CrossCompiler(); 23 | 24 | public: 25 | Spirv hlslToSpirv(std::string hlslText); 26 | std::string spirvToHumanReadable(QByteArray spirvBinary); 27 | std::string spirvToGlsl(QByteArray spirvBinary); 28 | 29 | private: 30 | EntryPoints getEntryPoints(std::string hlslText); 31 | Pragmas getPragmas(std::string hlslText); 32 | }; 33 | -------------------------------------------------------------------------------- /Engine/Source/Meta/PropertyMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PropertyMeta.h" 3 | 4 | PropertyMeta::PropertyMeta(std::string name) 5 | : getter{nullptr} 6 | , setter{nullptr} 7 | { 8 | this->name = name; 9 | } 10 | 11 | void PropertyMeta::set(Any& object, Any& value) 12 | { 13 | std::vector args {object, value}; 14 | setter->invoke(args); 15 | } 16 | 17 | Any PropertyMeta::get(Any& object) 18 | { 19 | return getter->invoke(object); 20 | } 21 | 22 | Any PropertyMeta::getAddr(Any& object) 23 | { 24 | return Any::empty; 25 | } 26 | 27 | ITypeMeta* const PropertyMeta::getType() 28 | { 29 | if (getter != nullptr) 30 | { 31 | return getter->getReturnType(); 32 | } 33 | else if (setter != nullptr) 34 | { 35 | return setter->getArgTypes()[0]; 36 | } 37 | else 38 | { 39 | return nullptr; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Game/Shaders/test2.hlsl: -------------------------------------------------------------------------------- 1 | 2 | cbuffer ConstantBuffer : register(b0) 3 | { 4 | row_major float4x4 MVP; 5 | }; 6 | 7 | struct Vertex 8 | { 9 | float3 position : POSITION; 10 | float4 uv : TEXCOORD; 11 | }; 12 | 13 | struct Gradient 14 | { 15 | float4 position : SV_POSITION; 16 | float2 uv : TEXCOORD; 17 | }; 18 | 19 | Texture2D g_texture : register(t0); 20 | SamplerState g_sampler : register(s0); 21 | 22 | Gradient vsmain(Vertex v) 23 | { 24 | Gradient result; 25 | 26 | result.position = mul(float4(v.position, 1), MVP); 27 | result.uv = v.uv; 28 | 29 | return result; 30 | } 31 | 32 | float4 psmain_normal(Gradient in) : SV_TARGET 33 | { 34 | return g_texture.Sample(g_sampler, in.uv); 35 | } 36 | 37 | float4 psmain_grayscale(Gradient p) : SV_TARGET 38 | { 39 | float4 color = g_texture.Sample(g_sampler, in.uv); 40 | color.rgb = color.r * 0.3 + color.g * 0.59 + color.b * 0.11 41 | return color; 42 | } -------------------------------------------------------------------------------- /MetaGen/Source/Parser/RegexConstants.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | const std::string singleLineComment = "//.*"; 7 | const std::string multiLineComment = "[/][*][^]*?[*][/]"; 8 | const std::string charLiteral = "'(\\\\'|[^'])*?'"; // '(\\'|[^'])*?' 9 | const std::string stringLiteral = "\"(\\\\\"|[^\"])*?\""; // "(\\"|[^"])*?" 10 | 11 | const std::string comments = "(" + singleLineComment + ")|(" + multiLineComment + ")"; 12 | const std::string literals = "(" + charLiteral + ")|(" + stringLiteral + ")"; 13 | 14 | const std::string lineContinuation = "\\\\\\n"; // \\\n 15 | const std::string directiveLine = "^( |\t|\v)*#.*$"; 16 | 17 | const std::string space = "[ \t\v\n\r]+"; 18 | const std::string spaceOrEmpty = "[ \t\v\n\r]*"; 19 | 20 | const std::string simplexOperator = "[(){}\\[\\],~?]"; // (){}[],~? 21 | const std::string combinableOperator = "[*&<>+-/%|!=.:]"; 22 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLRenderer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../IRenderer.h" 5 | 6 | #include "GLContext.h" 7 | 8 | #include "../RendererType.h" 9 | #include "GLShaderImpl.h" 10 | #include "GLTextureImpl.h" 11 | #include "GLIndexBufferImpl.h" 12 | #include "GLVertexBufferImpl.h" 13 | #include "GLConstantBufferImpl.h" 14 | #include "GLPipelineStateImpl.h" 15 | #include "../Renderer.h" 16 | 17 | class Shader; 18 | class Texture; 19 | 20 | class GLRenderer : public Renderer 21 | { 22 | public: 23 | GLRenderer(); 24 | 25 | virtual void render(std::vector commands, RenderTarget* target) override; 26 | virtual void draw(RenderCommand renderCommand) override; 27 | 28 | std::unordered_map contexts; 29 | 30 | GLContext* getContext(RenderTarget* renderTarget); 31 | virtual void clear(Color color) override; 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /Engine/Source/Render/ShaderBunch.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class ShaderBunch 11 | { 12 | public: 13 | enum BlobType 14 | { 15 | Hlsl, 16 | SpirvVertex, 17 | SpirvPixel, 18 | GlslVertex, 19 | GlslPixel, 20 | Count 21 | }; 22 | 23 | public: 24 | ShaderBunch(Path path); 25 | 26 | const std::unordered_map& getEntryPoints(); 27 | const Blob& getSource(BlobType type); 28 | const std::string& getSourceText(BlobType type); 29 | 30 | Shader* getShader(std::string entryPoint); 31 | 32 | private: 33 | Path path; 34 | std::unique_ptr blobs[BlobType::Count]; 35 | std::unordered_map entryPoints; 36 | 37 | std::unordered_map> shaders; 38 | }; 39 | -------------------------------------------------------------------------------- /Engine/Engine.pro: -------------------------------------------------------------------------------- 1 | 2 | include(../Default.pri) 3 | 4 | TEMPLATE = lib 5 | CONFIG += staticlib 6 | 7 | INCLUDEPATH += ../3rd-party/lua/Source 8 | 9 | subdirs = Source Source/Input Source/Meta Source/Meta/TypeTraits Source/Math \ 10 | Source/Net Source/LuaMachine Source/Containers Source/Render \ 11 | Source/Render/GL 12 | 13 | for(subdir, subdirs) { 14 | dirs += $$subdir 15 | 16 | win: dirs += $$subdir/Win 17 | linux: dirs += $$subdir/Linux $$subdir/Unix 18 | mac: dirs += $$subdir/Mac $$subdir/Unix 19 | } 20 | 21 | win: dirs += Source/Render/DX Source/Render/Vulkan "$$(Vulkan_SDK)/Include" 22 | linux: dirs += /usr/include/libevdev-1.0 23 | 24 | for(dir, dirs) { 25 | INCLUDEPATH += $$dir 26 | HEADERS += $$files($$dir/*.h) 27 | HEADERS += $$files($$dir/*.tpp) 28 | SOURCES += $$files($$dir/*.cpp) 29 | SOURCES += $$files($$dir/*.mm) 30 | } 31 | 32 | OTHER_FILES += \ 33 | Include.pri 34 | -------------------------------------------------------------------------------- /Engine/Source/Model.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Model.h" 3 | 4 | #include "TextureManager.h" 5 | #include "ShaderManager.h" 6 | #include "Render/ConstantBuffer.h" 7 | #include "Render/PipelineState.h" 8 | #include "Render/RendererFrontend.h" 9 | 10 | using base = Node; 11 | 12 | Model::Model() 13 | { 14 | mesh = createCubeMesh(); 15 | renderState = new RenderState(); 16 | 17 | renderState->setVertexShader(ShaderManager::getInstance()->getShader("Shaders/test", "vsmain")); 18 | renderState->setPixelShader(ShaderManager::getInstance()->getShader("Shaders/test", "psmain")); 19 | renderState->texture = TextureManager::getInstance()->getTexture("skullbox.png"); 20 | 21 | renderState->constantBuffer = new ConstantBuffer(); 22 | } 23 | 24 | void Model::render(Matrix matrix, RendererFrontend* renderer) 25 | { 26 | renderer->draw(mesh, matrix, renderState); 27 | base::render(matrix, renderer); 28 | } 29 | -------------------------------------------------------------------------------- /3rd-party/scintilla/src/UnicodeFromUTF8.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UnicodeFromUTF8.h 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 2013 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #ifndef UNICODEFROMUTF8_H 9 | #define UNICODEFROMUTF8_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | inline int UnicodeFromUTF8(const unsigned char *us) { 16 | if (us[0] < 0xC2) { 17 | return us[0]; 18 | } else if (us[0] < 0xE0) { 19 | return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F); 20 | } else if (us[0] < 0xF0) { 21 | return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F); 22 | } else if (us[0] < 0xF5) { 23 | return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F); 24 | } 25 | return us[0]; 26 | } 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXDescriptorHeap.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "dx.h" 5 | 6 | #include "DXDescriptorHandle.h" 7 | 8 | class DXDescriptorHeap 9 | { 10 | public: 11 | DXDescriptorHeap(ID3D12Device* device, UINT maxCount); 12 | 13 | ID3D12DescriptorHeap* get() { return heap.Get(); } 14 | DXDescriptorHandle getNextHandle(); 15 | 16 | inline CD3DX12_CPU_DESCRIPTOR_HANDLE getCpuHandle(int index) 17 | { 18 | return {cpuHandle, index * handleIncrementSize}; 19 | } 20 | 21 | inline CD3DX12_GPU_DESCRIPTOR_HANDLE getGpuHandle(int index) 22 | { 23 | return {gpuHandle, index * handleIncrementSize}; 24 | } 25 | 26 | private: 27 | ComPtr heap; 28 | 29 | CD3DX12_CPU_DESCRIPTOR_HANDLE cpuHandle; 30 | CD3DX12_GPU_DESCRIPTOR_HANDLE gpuHandle; 31 | int handleIncrementSize; 32 | 33 | int descriptorCount; 34 | int maxCount; 35 | }; 36 | -------------------------------------------------------------------------------- /Game/shaders.hlsl: -------------------------------------------------------------------------------- 1 | //********************************************************* 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the MIT License (MIT). 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //********************************************************* 11 | 12 | cbuffer ConstantBuffer : register(b0) 13 | { 14 | float4x4 MVP; 15 | }; 16 | 17 | struct PSInput 18 | { 19 | float4 position : SV_POSITION; 20 | float4 color : COLOR; 21 | }; 22 | 23 | PSInput VSMain(float4 position : POSITION, float4 color : COLOR) 24 | { 25 | PSInput result; 26 | 27 | result.position = position; 28 | result.color = color; 29 | 30 | return result; 31 | } 32 | 33 | float4 PSMain(PSInput input) : SV_TARGET 34 | { 35 | return input.color; 36 | } 37 | -------------------------------------------------------------------------------- /Player/Source/Main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "LuaMachine/LuaMachine.h" 3 | #include "RemoteDebbuger.h" 4 | 5 | #include "App.h" 6 | #include "Meta/Meta.h" 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | auto debug = false; 11 | for (int i = 0; i < argc; i++) 12 | { 13 | std::string arg = argv[i]; 14 | if (arg == "-d" || arg == "-debug") 15 | { 16 | debug = true; 17 | } 18 | } 19 | 20 | if (fileno(stdout) <= 0) 21 | { 22 | freopen("log.txt", "w", stdout); 23 | } 24 | 25 | Meta::getInstance()->init(); 26 | 27 | auto luaMachine = LuaMachine::getInstance(); 28 | 29 | if (debug) 30 | { 31 | auto debugger = new RemoteDebbuger(luaMachine, 0xC0DE); 32 | luaMachine->execute("Main.lua", true); 33 | delete debugger; 34 | } 35 | else 36 | { 37 | luaMachine->execute("Main.lua"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MetaGen/Source/Parser/Statement.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "Tokens/TokenGroup.h" 7 | 8 | struct Snippet; 9 | 10 | struct Statement 11 | { 12 | Statement(std::string& text, std::vector* escapedLiterals); 13 | Statement(std::string& text, std::string& childSnippetText, std::vector* escapedLiterals); 14 | 15 | const std::string& getText() const; 16 | TokenGroup& getTokens(); 17 | Snippet* getChildSnippet() const; 18 | 19 | bool isClass() const; 20 | bool isUsing() const; 21 | bool isFunction() const; 22 | bool isProperty() const; 23 | bool hasDefinition() const; 24 | 25 | private: 26 | void robustTokenize(); 27 | void addToken(std::string text); 28 | 29 | std::string text; 30 | TokenGroup tokens; 31 | const std::vector* const escapedLiterals; 32 | Snippet* childSnippet; 33 | }; 34 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IClassMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "ITypeMeta.h" 5 | #include 6 | #include 7 | #include 8 | 9 | class IFieldMeta; 10 | class IFunctionMeta; 11 | class IConstructorMeta; 12 | class PropertyMeta; 13 | template class List; 14 | 15 | class IClassMeta : public ITypeMeta 16 | { 17 | public: 18 | IClassMeta(); 19 | 20 | std::vector templateArguments; 21 | std::vector baseTypes; 22 | bool hasDerives; 23 | 24 | std::vector constructors; 25 | std::unordered_map methods; 26 | std::unordered_map functions; 27 | std::unordered_map fields; 28 | std::unordered_map properties; 29 | 30 | List getFieldsWithAttribute(std::string attribute, bool includeProperties = false); 31 | }; 32 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/PropSetSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PropSetSimple.h 3 | ** A basic string to string map. 4 | **/ 5 | // Copyright 1998-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PROPSETSIMPLE_H 9 | #define PROPSETSIMPLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class PropSetSimple { 16 | void *impl; 17 | void Set(const char *keyVal); 18 | public: 19 | PropSetSimple(); 20 | virtual ~PropSetSimple(); 21 | void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); 22 | void SetMultiple(const char *); 23 | const char *Get(const char *key) const; 24 | int GetExpanded(const char *key, char *result) const; 25 | int GetInt(const char *key, int defaultValue=0) const; 26 | }; 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXDescriptorHeap.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | DXDescriptorHeap::DXDescriptorHeap(ID3D12Device* device, UINT maxCount) 6 | { 7 | D3D12_DESCRIPTOR_HEAP_DESC desc = {}; 8 | desc.NumDescriptors = maxCount; 9 | desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; 10 | desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; 11 | 12 | this->descriptorCount = 0; 13 | this->maxCount = maxCount; 14 | 15 | auto result = device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&heap)); 16 | if (FAILED(result)) throw; 17 | 18 | cpuHandle = heap->GetCPUDescriptorHandleForHeapStart(); 19 | gpuHandle = heap->GetGPUDescriptorHandleForHeapStart(); 20 | 21 | handleIncrementSize = device->GetDescriptorHandleIncrementSize(desc.Type); 22 | } 23 | 24 | DXDescriptorHandle DXDescriptorHeap::getNextHandle() 25 | { 26 | return DXDescriptorHandle(this, descriptorCount++); 27 | } 28 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/Linux/PlatformGLContext.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PlatformGLContext.h" 3 | #include 4 | 5 | int att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, 0 }; 6 | 7 | LinuxGLContext::LinuxGLContext(RenderTarget* renderTarget) 8 | { 9 | auto rt = static_cast(renderTarget); 10 | 11 | this->display = rt->display; 12 | this->window = rt->window; 13 | 14 | XVisualInfo* vi = glXChooseVisual(rt->display, 0, att); 15 | glc = glXCreateContext(rt->display, vi, NULL, GL_TRUE); 16 | } 17 | 18 | LinuxGLContext::LinuxGLContext() 19 | : window{0} 20 | { 21 | display = XOpenDisplay(0); 22 | XVisualInfo* vi = glXChooseVisual(display, 0, att); 23 | glc = glXCreateContext(display, vi, NULL, GL_TRUE); 24 | } 25 | 26 | void LinuxGLContext::makeCurrent() 27 | { 28 | glXMakeCurrent(display, window, glc); 29 | } 30 | 31 | void LinuxGLContext::swap() 32 | { 33 | glXSwapBuffers(display, window); 34 | } 35 | -------------------------------------------------------------------------------- /Engine/Source/Math/Transform.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Vector3.h" 5 | #include "Quaternion.h" 6 | #include "Matrix.h" 7 | #include "Attributes.h" 8 | #include "Object.h" 9 | 10 | struct [[Meta]] Transform : public Object 11 | { 12 | friend class Meta; 13 | 14 | Transform(); 15 | 16 | Property [[Bind, Inspect]] translation; 17 | void setTranslation(Vector3 translation); 18 | Vector3 getTranslation() const; 19 | 20 | Property [[Bind, Inspect]] rotation; 21 | Quaternion getRotation() const; 22 | void setRotation(Quaternion quaternion); 23 | 24 | Property [[Bind, Inspect]] scaling; 25 | Vector3 getScaling() const; 26 | void setScaling(Vector3 scaling); 27 | 28 | Matrix getMatrix(); 29 | 30 | private: 31 | [[Serialize]] Vector3 translation; 32 | [[Serialize]] Quaternion rotation; 33 | [[Serialize]] Vector3 scaling; 34 | 35 | bool invalidateMatrix; 36 | Matrix matrix; 37 | }; 38 | -------------------------------------------------------------------------------- /Engine/Source/Meta/IClassMeta.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "IClassMeta.h" 3 | #include "IFieldMeta.h" 4 | #include "PropertyMeta.h" 5 | #include "Containers/List.h" 6 | 7 | IClassMeta::IClassMeta() 8 | : hasDerives(false) 9 | { 10 | } 11 | 12 | List IClassMeta::getFieldsWithAttribute(std::string attribute, bool includeProperties) 13 | { 14 | List list; 15 | 16 | for (auto& pair : fields) 17 | { 18 | auto fieldMeta = pair.second; 19 | if (fieldMeta->hasAttribute(attribute)) 20 | { 21 | list.push_back(fieldMeta); 22 | } 23 | } 24 | 25 | if (includeProperties) 26 | { 27 | for (auto& pair : properties) 28 | { 29 | auto propertyMeta = pair.second; 30 | if (propertyMeta->hasAttribute(attribute)) 31 | { 32 | list.push_back(propertyMeta); 33 | } 34 | } 35 | } 36 | 37 | return list; 38 | } 39 | -------------------------------------------------------------------------------- /Game/Main.lua: -------------------------------------------------------------------------------- 1 | 2 | require 'Class' 3 | require 'ModelDerived' 4 | --require 'Serializer' 5 | require 'Keys' 6 | 7 | print(3) 8 | 9 | local app = App.getInstance() 10 | local window = Window.create() 11 | local scene = window.scene 12 | 13 | app.window = window 14 | 15 | local inputSystem = InputSystem.getInstance() 16 | 17 | function add() 18 | local model = ModelDerived.new() 19 | print(model) 20 | --model.foo = 'abr' 21 | print(model.foo) 22 | scene:addChild(model) 23 | end 24 | 25 | local virtualDevice = VirtualDevice.new0() 26 | virtualDevice:addKeySource(0, nil, 0) 27 | virtualDevice:addKeySource(0, nil, 1) 28 | 29 | local b = virtualDevice:isPressed(0) 30 | 31 | add() 32 | 33 | collectgarbage() 34 | 35 | function remove() 36 | local model = scene:getChild(2) 37 | print(model) 38 | print(model.foo) 39 | scene:removeChild(model) 40 | end 41 | 42 | --remove() 43 | 44 | collectgarbage() 45 | 46 | print('---') 47 | 48 | app:startMainLoop() -------------------------------------------------------------------------------- /IDE/shaders.hlsl: -------------------------------------------------------------------------------- 1 | 2 | //********************************************************* 3 | // 4 | // Copyright (c) Microsoft. All rights reserved. 5 | // This code is licensed under the MIT License (MIT). 6 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 8 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 9 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 10 | // 11 | //********************************************************* 12 | 13 | cbuffer ConstantBuffer : register(b0) 14 | { 15 | float4x4 MVP; 16 | }; 17 | 18 | struct PSInput 19 | { 20 | float4 position : SV_POSITION; 21 | float4 color : COLOR; 22 | }; 23 | 24 | PSInput VSMain(float4 position : POSITION, float4 color : COLOR) 25 | { 26 | PSInput result; 27 | 28 | result.position = position; 29 | result.color = color; 30 | 31 | return result; 32 | } 33 | 34 | float4 PSMain(PSInput input) : SV_TARGET 35 | { 36 | return input.color; 37 | } 38 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/LexerSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerSimple.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERSIMPLE_H 9 | #define LEXERSIMPLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | // A simple lexer with no state 16 | class LexerSimple : public LexerBase { 17 | const LexerModule *module; 18 | std::string wordLists; 19 | public: 20 | explicit LexerSimple(const LexerModule *module_); 21 | const char * SCI_METHOD DescribeWordListSets(); 22 | void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 23 | void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 24 | }; 25 | 26 | #ifdef SCI_NAMESPACE 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Engine/Source/Input/InputDevice.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "InputDevice.h" 3 | 4 | constexpr int KeyCount = static_cast(Key::COUNT); 5 | 6 | InputDevice::InputDevice() 7 | { 8 | } 9 | 10 | void InputDevice::updateState() 11 | { 12 | previousState = currentState; 13 | } 14 | 15 | bool InputDevice::isPressed(int keyCode) 16 | { 17 | return currentState.isSet(keyCode); 18 | } 19 | 20 | bool InputDevice::isReleased(int keyCode) 21 | { 22 | return !currentState.isSet(keyCode); 23 | } 24 | 25 | bool InputDevice::wasPressed(int keyCode) 26 | { 27 | return previousState.isSet(keyCode); 28 | } 29 | 30 | bool InputDevice::wasReleased(int keyCode) 31 | { 32 | return !previousState.isSet(keyCode); 33 | } 34 | 35 | bool InputDevice::onPressed(int keyCode) 36 | { 37 | return !previousState.isSet(keyCode) && currentState.isSet(keyCode); 38 | } 39 | 40 | bool InputDevice::onReleased(int keyCode) 41 | { 42 | return previousState.isSet(keyCode) && !currentState.isSet(keyCode); 43 | } 44 | -------------------------------------------------------------------------------- /Engine/Source/Meta/FieldMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Any.h" 5 | #include "IFieldMeta.h" 6 | 7 | class ITypeMeta; 8 | 9 | template 10 | class FieldMeta : public IFieldMeta 11 | { 12 | public: 13 | virtual ITypeMeta* const getType() override 14 | { 15 | return typeMetaOf(); 16 | } 17 | 18 | FieldMeta(std::string name, FieldType ClassType::*pointer) 19 | { 20 | this->name = name; 21 | this->pointer = pointer; 22 | } 23 | 24 | virtual void set(Any& object, Any& value) override 25 | { 26 | object.as()->*pointer = value.as(); 27 | } 28 | 29 | virtual Any get(Any& object) override 30 | { 31 | return object.as()->*pointer; 32 | } 33 | 34 | virtual Any getAddr(Any& object) override 35 | { 36 | return &(object.as()->*pointer); 37 | } 38 | 39 | FieldType ClassType::*pointer; 40 | }; 41 | -------------------------------------------------------------------------------- /3rd-party/lua/Source/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.44 2014/06/19 18:27:20 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, 27 | const char* name); 28 | 29 | /* dump one chunk; from ldump.c */ 30 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 31 | void* data, int strip); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Engine/Source/DeepPointer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Meta/Any.h" 5 | 6 | template 7 | class DeepPointer 8 | { 9 | public: 10 | using pointeeType = T; 11 | 12 | DeepPointer() 13 | : pointer{nullptr} 14 | , count{2} 15 | { 16 | } 17 | 18 | DeepPointer(T** pointer) 19 | : pointer{pointer} 20 | , count{2} 21 | { 22 | } 23 | 24 | DeepPointer(void* pointer, int count = 2) 25 | : pointer{pointer} 26 | , count{count} 27 | { 28 | } 29 | 30 | Any operator*() 31 | { 32 | if (count == 2) 33 | { 34 | return *static_cast(pointer); 35 | } 36 | else 37 | { 38 | return DeepPointer(*static_cast(pointer), count - 1); 39 | } 40 | } 41 | 42 | DeepPointer operator&() 43 | { 44 | return DeepPointer(&pointer, count + 1); 45 | } 46 | 47 | private: 48 | void* pointer; 49 | int count; 50 | }; 51 | -------------------------------------------------------------------------------- /3rd-party/scintilla/src/FontQuality.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file FontQuality.h 3 | ** Definitions to control font anti-aliasing. 4 | ** Redefine constants from Scintilla.h to avoid including Scintilla.h in PlatWin.cxx. 5 | **/ 6 | // Copyright 1998-2009 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef FONTQUALITY_H 10 | #define FONTQUALITY_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | // These definitions match Scintilla.h 17 | #define SC_EFF_QUALITY_MASK 0xF 18 | #define SC_EFF_QUALITY_DEFAULT 0 19 | #define SC_EFF_QUALITY_NON_ANTIALIASED 1 20 | #define SC_EFF_QUALITY_ANTIALIASED 2 21 | #define SC_EFF_QUALITY_LCD_OPTIMIZED 3 22 | 23 | // These definitions must match SC_TECHNOLOGY_* in Scintilla.h 24 | #define SCWIN_TECH_GDI 0 25 | #define SCWIN_TECH_DIRECTWRITE 1 26 | 27 | #ifdef SCI_NAMESPACE 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/Accessor.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Accessor.h 3 | ** Interfaces between Scintilla and lexers. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ACCESSOR_H 9 | #define ACCESSOR_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; 16 | 17 | class Accessor; 18 | class WordList; 19 | class PropSetSimple; 20 | 21 | typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); 22 | 23 | class Accessor : public LexAccessor { 24 | public: 25 | PropSetSimple *pprops; 26 | Accessor(IDocument *pAccess_, PropSetSimple *pprops_); 27 | int GetPropertyInt(const char *, int defaultValue=0) const; 28 | int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); 29 | }; 30 | 31 | #ifdef SCI_NAMESPACE 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Engine/Source/Render/RendererFrontend.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "RendererFrontend.h" 3 | #include "Render/ConstantBuffer.h" 4 | 5 | void RendererFrontend::render(Node* scene) 6 | { 7 | Context context; 8 | context.View = Matrix::Identity; //Matrix::RotationX(3.1416); 9 | context.Projection = Matrix::OrthographicLH(2, 2, -2, 2); 10 | context.ViewProjection = context.View * context.Projection; 11 | contexts.push(context); 12 | 13 | 14 | scene->render(scene->transform->getMatrix(), this); 15 | 16 | } 17 | 18 | #if WIN 19 | #include "Render/DX/DXConstantBufferImpl.h" 20 | #include "RenderManager.h" 21 | #include "Render/DX/DXRenderer.h" 22 | #endif 23 | 24 | void RendererFrontend::draw(Mesh* mesh, Matrix matrix, RenderState* renderState) 25 | { 26 | RenderCommand command; 27 | command.mesh = mesh; 28 | command.state = renderState; 29 | 30 | auto cb = command.state->constantBuffer; 31 | cb->data.MVP = matrix * contexts.back().ViewProjection; 32 | cb->update(); 33 | 34 | commands.push_back(command); 35 | } 36 | -------------------------------------------------------------------------------- /IDE/Source/Document.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include "Path.h" 8 | #include "DocumentType.h" 9 | 10 | class IDocument : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | virtual DocumentType getType() const = 0; 16 | 17 | void open(Path documentPath); 18 | virtual void save(); 19 | virtual void reload(); 20 | 21 | Path getPath() { return documentPath; } 22 | std::string getName() { return documentPath.getName(); } 23 | std::string getTabName(); 24 | 25 | bool isModifiedOutside(); 26 | void ignoreOutsideModification(); 27 | 28 | virtual bool changed() const = 0; 29 | 30 | protected: 31 | QDateTime getLastModifiedTime(); 32 | virtual void setBinaryData(QByteArray data) = 0; 33 | virtual QByteArray getBinaryData() const = 0; 34 | 35 | private slots: 36 | void onModified(); 37 | 38 | signals: 39 | void modified(); 40 | 41 | protected: 42 | Path documentPath; 43 | QDateTime modifiedTime; 44 | }; 45 | -------------------------------------------------------------------------------- /Engine/Source/Math/Quaternion.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Quaternion.h" 3 | #include "math.h" 4 | 5 | const Quaternion Quaternion::Identity {0, 0, 0, 1}; 6 | 7 | Quaternion::Quaternion(float x, float y, float z, float w) 8 | : x{x} 9 | , y{y} 10 | , z{z} 11 | , w{w} 12 | { 13 | } 14 | 15 | Quaternion::Quaternion(List list) 16 | : x{list[0]} 17 | , y{list[1]} 18 | , z{list[2]} 19 | , w{list[3]} 20 | { 21 | } 22 | 23 | List Quaternion::toList() 24 | { 25 | return {x, y, z, w}; 26 | } 27 | 28 | Quaternion Quaternion::yawPitchRoll(float yaw, float pitch, float roll) // Euler sequence 2; -1; -3 29 | { 30 | auto c1 = cos(yaw / 2); 31 | auto s1 = sin(yaw / 2); 32 | auto c2 = cos(-pitch / 2); 33 | auto s2 = sin(-pitch / 2); 34 | auto c3 = cos(-roll / 2); 35 | auto s3 = sin(-roll / 2); 36 | 37 | return 38 | { 39 | s1 * c2 * s3 + c1 * s2 * c3, 40 | s1 * c2 * c3 - c1 * s2 * s3, 41 | -s1 * s2 * c3 + c1 * c2 * s3, 42 | s1 * s2 * s3 + c1 * c2 * c3, 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /Engine/Source/Render/PipelineSettings.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class Shader; 7 | class PipelineState; 8 | 9 | enum class CullMode : char 10 | { 11 | None, 12 | Front, 13 | Back 14 | }; 15 | 16 | class PipelineSettings 17 | { 18 | public: 19 | PipelineSettings(); 20 | 21 | Shader* vertexShader; 22 | Shader* pixelShader; 23 | 24 | union 25 | { 26 | struct 27 | { 28 | CullMode cullMode : 2; 29 | }; 30 | unsigned int flags; 31 | }; 32 | 33 | inline friend bool operator ==(const PipelineSettings& lhs, const PipelineSettings& rhs) 34 | { 35 | return lhs.vertexShader == rhs.vertexShader && 36 | lhs.pixelShader == rhs.pixelShader; 37 | } 38 | }; 39 | 40 | template <> 41 | struct std::hash 42 | { 43 | size_t operator()(const PipelineSettings &ps) const 44 | { 45 | size_t h1 = std::hash()(ps.vertexShader); 46 | size_t h2 = std::hash()(ps.pixelShader); 47 | return h1 ^ (h2 << 1); 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /IDE/Source/Menu/BaseMenu.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "BaseMenu.h" 3 | #include "../MainWindow.h" 4 | 5 | BaseMenu::BaseMenu(std::string name, MainWindow* window) 6 | : QMenu(tr(name.c_str()), window) 7 | , window{window} 8 | { 9 | } 10 | 11 | QAction* BaseMenu::createAction(const char* name, std::string iconName, const char* slot, const QKeySequence& shortcut) 12 | { 13 | auto action = new QAction(QObject::tr(name), this); 14 | if (iconName != "") 15 | { 16 | auto normalName = ":/images/" + iconName + ".png"; 17 | auto disabledName = ":/images/" + iconName + "_disabled.png"; 18 | 19 | QIcon icon; 20 | icon.addPixmap(QPixmap(normalName.c_str())); 21 | icon.addPixmap(QPixmap(disabledName.c_str()), QIcon::Disabled); 22 | action->setIcon(icon); 23 | } 24 | 25 | action->setShortcut(shortcut); 26 | connect(action, SIGNAL(triggered()), this, slot); 27 | return action; 28 | } 29 | 30 | QAction* BaseMenu::addAction(QAction* action) 31 | { 32 | QMenu::addAction(action); 33 | return action; 34 | } 35 | -------------------------------------------------------------------------------- /Game/shadersTextured.hlsl: -------------------------------------------------------------------------------- 1 | //********************************************************* 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the MIT License (MIT). 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //********************************************************* 11 | 12 | cbuffer ConstantBuffer : register(b0) 13 | { 14 | row_major float4x4 MVP; 15 | }; 16 | 17 | struct PSInput 18 | { 19 | float4 position : SV_POSITION; 20 | float2 uv : TEXCOORD; 21 | }; 22 | 23 | Texture2D g_texture : register(t0); 24 | SamplerState g_sampler : register(s0); 25 | 26 | PSInput VSMain(float3 position : POSITION, float4 uv : TEXCOORD) 27 | { 28 | PSInput result; 29 | 30 | result.position = mul(float4(position, 1), MVP); 31 | result.uv = uv; 32 | 33 | return result; 34 | } 35 | 36 | float4 PSMain(PSInput input) : SV_TARGET 37 | { 38 | return g_texture.Sample(g_sampler, input.uv); 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/Utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | std::vector split(std::string string, std::string separator); 9 | std::string join(std::vector vector, std::string separator); 10 | 11 | void replace(std::string& string, std::string oldValue, std::string newValue); 12 | std::string GetReplaced(std::string string, std::string oldValue, std::string newValue); 13 | 14 | std::string lowerCase(std::string string); 15 | std::string upperCase(std::string string); 16 | bool caseInsensitiveCompare(const std::string& string1, const std::string& string2); 17 | 18 | bool startsWith(const std::string& string, const std::string& pattern); 19 | bool endsWith(const std::string& string, const std::string& pattern); 20 | 21 | std::string toStr(std::wstring wstr); 22 | std::wstring toWStr(std::string str); 23 | 24 | template 25 | bool contains(CT container, T item) 26 | { 27 | return std::find(std::begin(container), std::end(container), item) != std::end(container); 28 | } 29 | -------------------------------------------------------------------------------- /IDE/Source/IDE.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include "Settings.h" 8 | #include "MainWindow.h" 9 | #include "Meta/Serializer.h" 10 | #include "LuaMachine/CallInfo.h" 11 | #include "Render/IRenderer.h" 12 | #include "Node.h" 13 | 14 | class IDE : public QApplication 15 | { 16 | Q_OBJECT 17 | 18 | friend int main(int argc, char *argv[]); 19 | 20 | IDE(int argc, char** argv); 21 | 22 | public: 23 | static IDE* getInstance(); 24 | void saveSettings(); 25 | MainWindow* getMainWindow(); 26 | void followToCall(CallInfo callInfo); 27 | 28 | private: 29 | std::string getSettingsFilename(); 30 | 31 | void start(); 32 | void loadStyle(); 33 | void loadSettings(); 34 | 35 | signals: 36 | void selectScene(Node* scene); 37 | void selectNode(Node* node); 38 | 39 | private slots: 40 | void onPlayerStateChanged(); 41 | 42 | public: 43 | Serializer serializer; 44 | Settings settings; 45 | 46 | private: 47 | std::vector windows; 48 | }; 49 | -------------------------------------------------------------------------------- /Engine/Source/Node.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Math/Vector2.h" 6 | #include "Math/Transform.h" 7 | #include "Meta/ITypeMeta.h" 8 | #include "Attributes.h" 9 | #include "Ref.h" 10 | #include "Object.h" 11 | 12 | class RendererFrontend; 13 | 14 | class [[Meta]] Node : public Object 15 | { 16 | friend class Meta; 17 | 18 | public: 19 | Node(); 20 | Node(int a); 21 | virtual ~Node(); 22 | 23 | Node* getParent(); 24 | int childCount(); 25 | Node* getChild(int i); 26 | 27 | void addChild(Node* node); 28 | void removeChild(Node* node); 29 | void unparent(); 30 | void reparent(Node* parent); 31 | 32 | [[Ignore]] void update(float delta); 33 | [[Bind("update")]] virtual void updateInternal(float delta); 34 | 35 | virtual void render(Matrix matrix, RendererFrontend* renderer); 36 | 37 | [[Serialize, Inspect]] Ref transform; 38 | 39 | Transform* getTransform() { return transform.get(); } 40 | 41 | private: 42 | Node* parent; 43 | [[Serialize]] List> childs; 44 | }; 45 | -------------------------------------------------------------------------------- /3rd-party/lua/Source/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/StringCopy.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StringCopy.h 3 | ** Safe string copy function which always NUL terminates. 4 | ** ELEMENTS macro for determining array sizes. 5 | **/ 6 | // Copyright 2013 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef STRINGCOPY_H 10 | #define STRINGCOPY_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | // Safer version of string copy functions like strcpy, wcsncpy, etc. 17 | // Instantiate over fixed length strings of both char and wchar_t. 18 | // May truncate if source doesn't fit into dest with room for NUL. 19 | 20 | template 21 | void StringCopy(T (&dest)[count], const T* source) { 22 | for (size_t i=0; i 5 | 6 | template 7 | class Ref; 8 | 9 | template 10 | class DeepPointer; 11 | 12 | //-- 13 | 14 | template 15 | struct pointerOf 16 | { 17 | using type = T*; 18 | }; 19 | 20 | template 21 | struct pointerOf 22 | { 23 | using type = DeepPointer; 24 | }; 25 | 26 | template 27 | struct pointerOf> 28 | { 29 | using type = DeepPointer; 30 | }; 31 | 32 | template 33 | struct pointerOf> 34 | { 35 | using type = DeepPointer; 36 | }; 37 | 38 | //-- 39 | 40 | template 41 | struct pointeeOf 42 | { 43 | using type = std::nullptr_t; 44 | }; 45 | 46 | template 47 | struct pointeeOf 48 | { 49 | using type = T; 50 | }; 51 | 52 | template 53 | struct pointeeOf> 54 | { 55 | using type = typename Ref::pointeeType; 56 | }; 57 | 58 | template 59 | struct pointeeOf> 60 | { 61 | using type = typename DeepPointer::pointeeType; 62 | }; 63 | -------------------------------------------------------------------------------- /IDE/shadersTextured.hlsl: -------------------------------------------------------------------------------- 1 | //********************************************************* 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // This code is licensed under the MIT License (MIT). 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //********************************************************* 11 | 12 | cbuffer ConstantBuffer : register(b0) 13 | { 14 | row_major float4x4 MVP; 15 | }; 16 | 17 | struct PSInput 18 | { 19 | float4 position : SV_POSITION; 20 | float2 uv : TEXCOORD; 21 | }; 22 | 23 | Texture2D g_texture : register(t0); 24 | SamplerState g_sampler : register(s0); 25 | 26 | PSInput VSMain(float3 position : POSITION, float4 uv : TEXCOORD) 27 | { 28 | PSInput result; 29 | 30 | result.position = mul(float4(position, 1), MVP); 31 | result.uv = uv; 32 | 33 | return result; 34 | } 35 | 36 | float4 PSMain(PSInput input) : SV_TARGET 37 | { 38 | return g_texture.Sample(g_sampler, input.uv); 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/Render/DX/DXIndexBufferImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "DXIndexBufferImpl.h" 3 | #include "DXRenderer.h" 4 | 5 | Impl::Impl(DXRenderer* renderer, IndexBuffer* ib) 6 | { 7 | auto device = renderer->getDevice(); 8 | 9 | const UINT indexBufferSize = ib->indices.size() * sizeof(uint32_t); 10 | 11 | auto result = device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, 12 | &CD3DX12_RESOURCE_DESC::Buffer(indexBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&indexBuffer)); 13 | if (FAILED(result)) throw; 14 | 15 | UINT8* data; 16 | CD3DX12_RANGE readRange(0, 0); 17 | 18 | result = indexBuffer->Map(0, &readRange, reinterpret_cast(&data)); 19 | if (FAILED(result)) throw; 20 | memcpy(data, &ib->indices[0], indexBufferSize); 21 | indexBuffer->Unmap(0, nullptr); 22 | 23 | indexBufferView.BufferLocation = indexBuffer->GetGPUVirtualAddress(); 24 | indexBufferView.Format = DXGI_FORMAT::DXGI_FORMAT_R32_UINT; 25 | indexBufferView.SizeInBytes = indexBufferSize; 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/Render/GL/GLPipelineStateImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "GLPipelineStateImpl.h" 3 | #include 4 | 5 | Impl::Impl(GLRenderer* renderer, PipelineState* pipelineState) 6 | { 7 | programId = glCreateProgram(); 8 | 9 | auto vid = renderer->getImpl(pipelineState->settings.vertexShader)->id; 10 | auto pid = renderer->getImpl(pipelineState->settings.pixelShader)->id; 11 | 12 | glAttachShader(programId, vid); 13 | glAttachShader(programId, pid); 14 | glLinkProgram(programId); 15 | 16 | GLint isLinked; 17 | glGetProgramiv(programId, GL_LINK_STATUS, &isLinked); 18 | if(isLinked == GL_FALSE) 19 | { 20 | GLint maxLength = 0; 21 | glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &maxLength); 22 | 23 | std::vector errorLog(maxLength); 24 | glGetProgramInfoLog(programId, maxLength, &maxLength, &errorLog[0]); 25 | 26 | glDeleteProgram(programId); 27 | programId = 0; 28 | } 29 | 30 | auto location = glGetUniformBlockIndex(programId, "ConstantBuffer"); 31 | glUniformBlockBinding(programId, location, 0); 32 | } 33 | -------------------------------------------------------------------------------- /IDE/Source/Inspector/InspectorItem.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Containers/List.h" 5 | #include "Meta/Any.h" 6 | #include 7 | 8 | class ITypeMeta; 9 | class IFieldMeta; 10 | class Node; 11 | 12 | class InspectorItem 13 | { 14 | public: 15 | static InspectorItem* create(Node* node); 16 | InspectorItem(Any pointer, List* fields, InspectorItem* parent, int row); 17 | ~InspectorItem(); 18 | 19 | private: 20 | static List* getFields(ITypeMeta* typeMeta); 21 | 22 | public: 23 | QVariant getName(int i); 24 | QVariant getValue(int i); 25 | bool setValue(int i, const QVariant& value); 26 | 27 | inline size_t getChildCount() const { return childs.size(); } 28 | inline InspectorItem* getChild(size_t i) const { return childs[i]; } 29 | inline InspectorItem* getParent() const { return parent; } 30 | inline int getRow() const { return row; } 31 | 32 | private: 33 | Any localData; 34 | Any pointer; 35 | List childs; 36 | List* fields; 37 | int row; 38 | InspectorItem* parent; 39 | }; 40 | -------------------------------------------------------------------------------- /MetaGen/Source/Info/ClassInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "ClassType.h" 7 | #include "InheritanceInfo.h" 8 | #include "MethodInfo.h" 9 | #include "FieldInfo.h" 10 | #include "MemberInfo.h" 11 | #include "TypeInfo.h" 12 | #include "PropertyInfo.h" 13 | 14 | class TokenGroup; 15 | 16 | struct ClassInfo : MemberInfo 17 | { 18 | ClassInfo(TokenGroup& tokens); 19 | 20 | ClassType classType; 21 | bool isFinal; 22 | std::vector inheritances; 23 | 24 | std::vector constructors; 25 | std::vector methods; 26 | std::vector fields; 27 | std::vector properties; 28 | 29 | AccessModifier getDefaultAccessModifier(); 30 | bool isAbstract(); 31 | 32 | std::string headerName; 33 | TypeInfo instantinateSubtype(TypeInfo typeInfo, std::vector templateArguments); 34 | 35 | private: 36 | void processMainTokens(TokenGroup& tokens); 37 | void processTemplateTokens(TokenGroup& tokens); 38 | void processInheritanceTokens(TokenGroup& tokens); 39 | }; 40 | -------------------------------------------------------------------------------- /IDE/Source/CodeEditor.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Document.h" 5 | #include "SciLexer.h" 6 | #include 7 | #include "string" 8 | #include "../qt/ScintillaEdit.h" 9 | 10 | class CodeEditor : public Scintilla::ScintillaEdit 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | enum class HighlightType 16 | { 17 | None, 18 | Lua, 19 | HLSL 20 | }; 21 | 22 | CodeEditor(QWidget* parent = 0); 23 | void setText(std::string text); 24 | void setSource(std::string source); 25 | void setHighlightType(HighlightType type); 26 | 27 | void pullBreakpoints(); 28 | void pushBreakpoints(); 29 | 30 | private slots: 31 | void onMarginClicked(int position, int modifiers, int margin); 32 | void onLinesAdded(int arg); 33 | 34 | void tick(); 35 | void onDwellStart(int x, int y); 36 | void onDwellEnd(int x, int y); 37 | 38 | public slots: 39 | void updateActiveLine(); 40 | 41 | private: 42 | void setLuaLexer(); 43 | void setHlslLexer(); 44 | 45 | std::string source; 46 | QTimer timer; 47 | int mouseTime; 48 | QPoint mousePoint; 49 | }; 50 | -------------------------------------------------------------------------------- /3rd-party/scintilla/src/CharClassify.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.h 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARCLASSIFY_H 9 | #define CHARCLASSIFY_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class CharClassify { 16 | public: 17 | CharClassify(); 18 | 19 | enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; 20 | void SetDefaultCharClasses(bool includeWordClass); 21 | void SetCharClasses(const unsigned char *chars, cc newCharClass); 22 | int GetCharsOfClass(cc charClass, unsigned char *buffer); 23 | cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} 24 | bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} 25 | 26 | private: 27 | enum { maxChar=256 }; 28 | unsigned char charClass[maxChar]; // not type cc to save space 29 | }; 30 | 31 | #ifdef SCI_NAMESPACE 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /MetaGen/Source/Generator/CodeGenerator.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "../Info/ClassInfo.h" 7 | 8 | class CodeGenerator 9 | { 10 | public: 11 | std::string generateHeader(std::vector& classes); 12 | std::string generateSource(std::vector& classes); 13 | 14 | private: 15 | std::string generateIncludes(std::vector& classes); 16 | std::string generateTemplateFunctions(std::vector& templateClasses); 17 | std::string generateMainFunction(std::vector& realClasses, std::vector& classTemplates); 18 | std::string generateDefineTemplatesSection(std::vector& realClasses, std::vector& classTemplates); 19 | std::string generateClassDefinition(ClassInfo& classInfo, bool isTemplate); 20 | std::string generateMethod(std::string type, MethodInfo& method, std::string className); 21 | std::string generateAttributes(MemberInfo& memberInfo); 22 | std::string generateParametersList(ClassInfo& classInfo, bool typenames); 23 | 24 | std::vector getTemplateTypes(std::vector& classes); 25 | }; 26 | -------------------------------------------------------------------------------- /Engine/Source/Meta/FunctionMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "IMemberMeta.h" 5 | #include "ITypeMeta.h" 6 | #include "Meta.h" 7 | #include "Any.h" 8 | #include 9 | #include "IFunctionMeta.h" 10 | 11 | template 12 | class FunctionMeta : public virtual IFunctionMeta 13 | { 14 | virtual size_t getArgCount() override 15 | { 16 | return sizeof...(ArgTypes); 17 | } 18 | 19 | ITypeMeta* getReturnType() override 20 | { 21 | return typeMetaOf(); 22 | } 23 | 24 | virtual std::vector getArgTypes() override 25 | { 26 | return { typeMetaOf()... }; 27 | } 28 | }; 29 | 30 | template 31 | class FunctionMeta : public virtual IFunctionMeta 32 | { 33 | virtual size_t getArgCount() override 34 | { 35 | return 0; 36 | } 37 | 38 | ITypeMeta* getReturnType() override 39 | { 40 | return typeMetaOf(); 41 | } 42 | 43 | virtual std::vector getArgTypes() override 44 | { 45 | return {}; 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /3rd-party/scintilla/lexlib/WordList.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file WordList.h 3 | ** Hold a list of words. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef WORDLIST_H 9 | #define WORDLIST_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class WordList { 18 | // Each word contains at least one character - a empty word acts as sentinel at the end. 19 | char **words; 20 | char *list; 21 | int len; 22 | bool onlyLineEnds; ///< Delimited by any white space or only line ends 23 | int starts[256]; 24 | public: 25 | explicit WordList(bool onlyLineEnds_ = false); 26 | ~WordList(); 27 | operator bool() const; 28 | bool operator!=(const WordList &other) const; 29 | int Length() const; 30 | void Clear(); 31 | void Set(const char *s); 32 | bool InList(const char *s) const; 33 | bool InListAbbreviated(const char *s, const char marker) const; 34 | const char *WordAt(int n) const; 35 | }; 36 | 37 | #ifdef SCI_NAMESPACE 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Engine/Source/Meta/CFunctionMeta.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "FunctionMeta.h" 5 | #include 6 | #include "Any.h" 7 | #include "IndexSequence.h" 8 | #include 9 | 10 | template 11 | class CFunctionMeta : public FunctionMeta 12 | { 13 | public: 14 | template 15 | inline Any realInvoke(SELECT_IF(ReturnType, Void, int, std::vector&) args, index_sequence) 16 | { 17 | return pointer(args.at(I)...); 18 | } 19 | 20 | template 21 | inline Any realInvoke(SELECT_IF(ReturnType, Void, std::vector&, int) args, index_sequence) 22 | { 23 | pointer(args.at(I)...); 24 | return Any::empty; 25 | } 26 | 27 | Any invoke(std::vector& args) override 28 | { 29 | if (args.size() == sizeof...(ArgTypes)) 30 | { 31 | return realInvoke(args, make_index_sequence()); 32 | } 33 | else 34 | { 35 | throw std::exception(); 36 | } 37 | } 38 | 39 | ReturnType(*pointer)(ArgTypes...); 40 | }; 41 | -------------------------------------------------------------------------------- /IDE/Source/Inspector/InspectorModel.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "Containers/Map.h" 6 | #include "Containers/List.h" 7 | 8 | class Node; 9 | class ITypeMeta; 10 | class IFieldMeta; 11 | class InspectorItem; 12 | 13 | class InspectorModel : public QAbstractItemModel 14 | { 15 | public: 16 | InspectorModel(Node* node); 17 | ~InspectorModel(); 18 | 19 | virtual int rowCount(const QModelIndex& index) const override; 20 | virtual int columnCount(const QModelIndex& index) const override; 21 | virtual QModelIndex index(int row, int column, const QModelIndex& index) const override; 22 | virtual QModelIndex parent(const QModelIndex& index) const override; 23 | virtual QVariant data(const QModelIndex& index, int role) const override; 24 | virtual Qt::ItemFlags flags(const QModelIndex& index) const override; 25 | virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override; 26 | 27 | private: 28 | inline InspectorItem* getBaseItem(const QModelIndex& index) const; 29 | InspectorItem* getSubItem(const QModelIndex& index) const; 30 | 31 | InspectorItem* rootItem; 32 | }; 33 | -------------------------------------------------------------------------------- /IDE/style.css: -------------------------------------------------------------------------------- 1 | 2 | QWidget 3 | { 4 | color: #C0C0C0; 5 | background-color: #2D2D2D; 6 | } 7 | 8 | QMenuBar::item 9 | { 10 | background: #2D2D2D; 11 | } 12 | 13 | QMenuBar::item:selected 14 | { 15 | background: #333333; 16 | } 17 | 18 | QMenu::item 19 | { 20 | background: #1B1B1B; 21 | } 22 | 23 | QMenu::item:selected 24 | { 25 | background: #333333; 26 | } 27 | 28 | QToolBar 29 | { 30 | border: none; 31 | } 32 | 33 | QTabWidget 34 | { 35 | border: none; 36 | } 37 | 38 | QTabWidget#documentsTabs 39 | { 40 | border: 1px solid; 41 | } 42 | 43 | QTabBar::tab 44 | { 45 | background: #2D2D2D; 46 | } 47 | 48 | QTabBar::tab:selected 49 | { 50 | color: #0E99DD; 51 | background: #1B1B1B; 52 | } 53 | 54 | QTabBar::tab:hover 55 | { 56 | color: #0E99DD; 57 | background: #3E3E3E; 58 | } 59 | 60 | QTabBar#documentsTabs::tab 61 | { 62 | color: white; 63 | background: #333333; 64 | } 65 | 66 | QTabBar#documentsTabs::tab:selected 67 | { 68 | background: #007ACC; 69 | } 70 | 71 | QTabBar#documentsTabs::tab:hover 72 | { 73 | background: #1C97EA; 74 | } 75 | 76 | QHeaderView::section 77 | { 78 | background-color: #2D2D2D; 79 | } 80 | -------------------------------------------------------------------------------- /Engine/Source/Math/Transform.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Transform.h" 3 | 4 | Transform::Transform() 5 | : invalidateMatrix{true} 6 | , translation{Vector3::Zero} 7 | , rotation{Quaternion::Identity} 8 | , scaling{Vector3::One} 9 | { 10 | } 11 | 12 | Vector3 Transform::getTranslation() const 13 | { 14 | return translation; 15 | } 16 | 17 | Quaternion Transform::getRotation() const 18 | { 19 | return rotation; 20 | } 21 | 22 | Vector3 Transform::getScaling() const 23 | { 24 | return scaling; 25 | } 26 | 27 | void Transform::setTranslation(Vector3 translation) 28 | { 29 | this->translation = translation; 30 | invalidateMatrix = true; 31 | } 32 | 33 | void Transform::setRotation(Quaternion rotation) 34 | { 35 | this->rotation = rotation; 36 | invalidateMatrix = true; 37 | } 38 | 39 | void Transform::setScaling(Vector3 scaling) 40 | { 41 | this->scaling = scaling; 42 | invalidateMatrix = true; 43 | } 44 | 45 | Matrix Transform::getMatrix() 46 | { 47 | //if (invalidateMatrix) 48 | { 49 | matrix = Matrix::TRS(translation, rotation, scaling); 50 | invalidateMatrix = false; 51 | } 52 | return matrix; 53 | } 54 | --------------------------------------------------------------------------------