├── .gitignore ├── CMakeLists.txt ├── LICENSE.GNU ├── README.md ├── bin ├── Demo │ └── core.paxconfig └── core.example.paxconfig ├── cmake ├── AssertPathExists.cmake ├── FindSDL2.cmake ├── FindSDL2_image.cmake ├── FindSDL2_ttf.cmake ├── PaxArchitectureDetection.cmake ├── PaxCompilerDetection.cmake ├── PaxFlagsDefinition.cmake └── PaxSetup.cmake ├── doc ├── BUILD.md ├── dependencies │ └── requirements.txt ├── todo.txt └── wiki │ └── PredefinedVariables.md ├── include ├── EngineMain.h ├── PaxEngineIncludes.h ├── paxcore │ ├── Engine.h │ ├── Game.h │ ├── OStreamOverloads.h │ ├── animation │ │ ├── Animation.h │ │ ├── AnimationBehaviour.h │ │ ├── DiscreteAnimation.h │ │ ├── Timing.h │ │ └── json │ │ │ ├── AnimationBehaviourParser.h │ │ │ └── DiscreteAnimationParser.h │ ├── function │ │ ├── UpdateOptions.h │ │ └── Updateable.h │ ├── gameentity │ │ ├── GameEntity.h │ │ ├── GameEntityIDService.h │ │ ├── GameEntityProperty.h │ │ ├── MotionType.h │ │ ├── Tag.h │ │ ├── event │ │ │ ├── GameEntityEvent.h │ │ │ ├── GameEntityParentChangedEvent.h │ │ │ ├── ScaleChangedEvent.h │ │ │ └── SizeChangedEvent.h │ │ ├── prefab │ │ │ └── JsonGameEntityPrefabTagsParser.h │ │ └── property │ │ │ ├── Ability.h │ │ │ ├── AbilityIdentifier.h │ │ │ ├── Behaviour.h │ │ │ ├── Size.h │ │ │ └── behaviours │ │ │ ├── 2d │ │ │ ├── FollowGameEntityBehaviour.h │ │ │ └── Movement2D.h │ │ │ └── NoClipControls.h │ ├── io │ │ ├── InputSystem.h │ │ ├── InputSystemFactory.h │ │ ├── Keyboard.h │ │ ├── Keys.h │ │ ├── Mouse.h │ │ ├── MouseButtons.h │ │ ├── Window.h │ │ ├── WindowFactory.h │ │ ├── event │ │ │ ├── KeyEvent.h │ │ │ ├── KeyPressedEvent.h │ │ │ ├── KeyReleasedEvent.h │ │ │ ├── MouseButtonEvent.h │ │ │ ├── MouseButtonPressedEvent.h │ │ │ ├── MouseButtonReleasedEvent.h │ │ │ ├── MouseEvent.h │ │ │ ├── MouseMovedEvent.h │ │ │ ├── MouseWheelEvent.h │ │ │ └── ResolutionChangedEvent.h │ │ └── properties │ │ │ └── InputAbilityController.h │ ├── json │ │ ├── JsonEntityPrefabResourceLoader.h │ │ └── JsonResourceLoader.h │ ├── plugin │ │ ├── EngineInternalPlugin.h │ │ └── EnginePlugin.h │ ├── rendering │ │ ├── Graphics.h │ │ ├── RenderOptions.h │ │ ├── Renderer.h │ │ ├── animation │ │ │ ├── SpriteSheetAnimations.h │ │ │ └── SpriteSheetAnimator.h │ │ ├── camera │ │ │ ├── Camera.h │ │ │ ├── FullPixelScreenProjection.h │ │ │ ├── PerspectiveProjection.h │ │ │ ├── PixelScreenProjection.h │ │ │ ├── Projection.h │ │ │ ├── Viewport.h │ │ │ └── json │ │ │ │ ├── ProjectionJsonParser.h │ │ │ │ └── ViewportJsonParser.h │ │ ├── config │ │ │ └── PointCloudSettings.h │ │ ├── data │ │ │ ├── Asset.h │ │ │ ├── Colour.h │ │ │ ├── ColourPalette.h │ │ │ ├── Image.h │ │ │ ├── Material.h │ │ │ ├── Mesh.h │ │ │ ├── Shader.h │ │ │ ├── SpriteSheet.h │ │ │ └── Texture.h │ │ ├── event │ │ │ ├── GraphicsShaderChangedEvent.h │ │ │ └── ShaderChangedEvent.h │ │ ├── factory │ │ │ ├── MeshFactory.h │ │ │ ├── TextureFactory.h │ │ │ └── ViewportFactory.h │ │ ├── graphics │ │ │ ├── AssetGraphics.h │ │ │ ├── SceneGraphGraphics.h │ │ │ ├── SpriteGraphics.h │ │ │ └── SpriteSheetGraphics.h │ │ ├── interface │ │ │ └── Renderable.h │ │ ├── light │ │ │ ├── AmbientLight.h │ │ │ ├── DirectionalLight.h │ │ │ ├── Light.h │ │ │ ├── PointLight.h │ │ │ └── SpotLight.h │ │ ├── loader │ │ │ ├── NullTextureLoader.h │ │ │ └── SpriteSheetLoader.h │ │ ├── primitives │ │ │ └── PrimitiveFactory.h │ │ ├── renderpass │ │ │ ├── RenderPass.h │ │ │ ├── RenderPassChannel.h │ │ │ └── RenderPassFactory.h │ │ └── scenegraph │ │ │ ├── SceneGraph.h │ │ │ ├── generators │ │ │ ├── DefaultSceneGraphGeneratorFactory.h │ │ │ ├── GroupByShadersSceneGraphGenerator.h │ │ │ ├── SceneGraphGenerator.h │ │ │ ├── SceneGraphGeneratorFactory.h │ │ │ └── SortByZSceneGraphGenerator.h │ │ │ ├── nodes │ │ │ ├── MeshNode.h │ │ │ ├── ShadingNode.h │ │ │ ├── SortingNode.h │ │ │ ├── SpriteSheetNode.h │ │ │ ├── TexturingNode.h │ │ │ └── TransformationNode.h │ │ │ └── sort │ │ │ └── GraphicsSort.h │ ├── service │ │ ├── FactoryService.h │ │ ├── Paths.h │ │ ├── Services.h │ │ └── WindowService.h │ ├── state │ │ └── StateMachine.h │ ├── system │ │ ├── GameSystem.h │ │ ├── gameentity │ │ │ ├── BehaviourSystem.h │ │ │ ├── GameEntityPropertyPool.h │ │ │ ├── GameEntityPropertySystem.h │ │ │ └── LightSystem.h │ │ └── world │ │ │ └── WorldBehaviourSystem.h │ └── world │ │ ├── World.h │ │ ├── WorldProperty.h │ │ ├── event │ │ ├── ActiveWorldChangedEvent.h │ │ ├── GameEntityDespawnedEvent.h │ │ ├── GameEntitySpawnedEvent.h │ │ └── WorldEvent.h │ │ ├── prefab │ │ ├── JsonWorldGameEntityParser.h │ │ └── JsonWorldPrefabInitParser.h │ │ ├── property │ │ ├── WorldBehaviour.h │ │ └── WorldSize.h │ │ └── scenegraph │ │ ├── WorldSceneGraph.h │ │ └── WorldSceneGraphFactory.h └── paxutil │ ├── Signature.h │ ├── Sleep.h │ ├── genericfactory │ ├── GenericFactory.h │ └── GenericFactoryService.h │ ├── io │ ├── FileTypeChecker.h │ ├── PrettyPrint.h │ └── Settings.h │ ├── lib │ ├── GlmIncludes.h │ └── LibIncludes.h │ ├── macros │ ├── Functional.h │ └── PlatformIncludes.h │ ├── math │ ├── Angles.h │ ├── Basis.h │ ├── BoundingBox.h │ ├── Conversion.h │ ├── Functions.h │ ├── MathDefines.h │ ├── Transformation.h │ └── json │ │ └── JsonToTransformation.h │ ├── property │ └── construction │ │ └── json │ │ └── parsers │ │ └── JsonEntityPrefabTransformationParser.h │ ├── reflection │ ├── EngineFieldFlags.h │ ├── MemberCheck.h │ ├── TypeHierarchy.h │ └── TypeRegister.h │ ├── rendering │ └── Cube.h │ ├── resources │ ├── JsonResourceFieldWriter.h │ ├── ResourceHandle.h │ ├── ResourceLoader.h │ └── Resources.h │ └── stdutils │ ├── OstreamOverloads.h │ └── Templates.h ├── libs ├── CMakeLists.txt ├── setupLinks.bat └── setupLinks.sh ├── license ├── README-SDL.txt ├── SDL2_ttf │ ├── LICENSE.freetype.txt │ └── LICENSE.zlib.txt └── SDL_image │ ├── LICENSE.jpeg.txt │ ├── LICENSE.png.txt │ ├── LICENSE.tiff.txt │ ├── LICENSE.webp.txt │ └── LICENSE.zlib.txt ├── plugins ├── CMakeLists.txt ├── games │ ├── PlatformerDemo │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── platformerdemo │ │ │ │ ├── Demo.h │ │ │ │ ├── Plugin.h │ │ │ │ └── behaviour │ │ │ │ ├── Dance2D.h │ │ │ │ ├── DragNDrop.h │ │ │ │ ├── PlayerControls.h │ │ │ │ ├── PlayerSpriteAnimation.h │ │ │ │ └── ProfileGameLoopBehaviour.h │ │ └── src │ │ │ ├── Plugin.cpp │ │ │ ├── behaviour │ │ │ ├── Dance2D.cpp │ │ │ ├── DragNDrop.cpp │ │ │ ├── PlayerControls.cpp │ │ │ ├── PlayerSpriteAnimation.cpp │ │ │ └── ProfileGameLoopBehaviour.cpp │ │ │ └── main.cpp │ ├── PlaygroundDemo │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── playgrounddemo │ │ │ │ ├── Demo.h │ │ │ │ └── Plugin.h │ │ └── src │ │ │ ├── Plugin.cpp │ │ │ └── main.cpp │ ├── RayMarcher │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── raymarcher │ │ │ │ ├── Demo.h │ │ │ │ └── Plugin.h │ │ └── src │ │ │ ├── Plugin.cpp │ │ │ └── main.cpp │ └── TileDemo │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── tiledemo │ │ │ ├── Demo.h │ │ │ └── Plugin.h │ │ └── src │ │ ├── Plugin.cpp │ │ └── main.cpp ├── paxassetimport │ ├── CMakeLists.txt │ ├── include │ │ └── paxassimp │ │ │ ├── AssimpResourceLoader.h │ │ │ └── Plugin.h │ └── src │ │ ├── AssimpResourceLoader.cpp │ │ └── Plugin.cpp ├── paxfont │ ├── CMakeLists.txt │ ├── include │ │ └── paxfont │ │ │ ├── Plugin.h │ │ │ └── bitmap │ │ │ ├── BitmapFont.h │ │ │ ├── BitmapText.h │ │ │ └── loader │ │ │ └── XMLBitmapFontLoader.h │ └── src │ │ ├── Plugin.cpp │ │ └── bitmap │ │ ├── BitmapFont.cpp │ │ ├── BitmapText.cpp │ │ └── loader │ │ └── XMLBitmapFontLoader.cpp ├── paxgeneration │ ├── CMakeLists.txt │ ├── include │ │ ├── grid │ │ │ ├── Grid.h │ │ │ └── GridGenerator.h │ │ └── terrain │ │ │ ├── Terrain.h │ │ │ └── TerrainGenerator.h │ └── src │ │ ├── grid │ │ └── GridGenerator.cpp │ │ └── terrain │ │ ├── Terrain.cpp │ │ └── TerrainGenerator.cpp ├── paximgui │ ├── CMakeLists.txt │ ├── ImguiPPLexer.g4 │ ├── ImguiPPParser.g4 │ ├── genImguiPPAntlrFiles.sh │ ├── imgui │ │ ├── LICENSE.txt │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_impl_opengl3.cpp │ │ ├── imgui_impl_opengl3.h │ │ ├── imgui_impl_opengl3_loader.h │ │ ├── imgui_impl_sdl.cpp │ │ ├── imgui_impl_sdl.h │ │ ├── imgui_internal.h │ │ ├── imgui_tables.cpp │ │ ├── imgui_widgets.cpp │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ ├── imstb_truetype.h │ │ └── misc │ │ │ ├── README.txt │ │ │ ├── cpp │ │ │ ├── README.txt │ │ │ ├── imgui_stdlib.cpp │ │ │ └── imgui_stdlib.h │ │ │ ├── debuggers │ │ │ ├── README.txt │ │ │ ├── imgui.gdb │ │ │ ├── imgui.natstepfilter │ │ │ └── imgui.natvis │ │ │ ├── fonts │ │ │ ├── Cousine-Regular.ttf │ │ │ ├── DroidSans.ttf │ │ │ ├── Karla-Regular.ttf │ │ │ ├── ProggyClean.ttf │ │ │ ├── ProggyTiny.ttf │ │ │ ├── Roboto-Medium.ttf │ │ │ └── binary_to_compressed_c.cpp │ │ │ ├── freetype │ │ │ ├── README.md │ │ │ ├── imgui_freetype.cpp │ │ │ └── imgui_freetype.h │ │ │ └── single_file │ │ │ └── imgui_single_file.h │ ├── imguipp_antlr │ │ ├── ImguiPPLexer.cpp │ │ ├── ImguiPPLexer.h │ │ ├── ImguiPPLexer.interp │ │ ├── ImguiPPLexer.tokens │ │ ├── ImguiPPParser.cpp │ │ ├── ImguiPPParser.h │ │ ├── ImguiPPParser.interp │ │ ├── ImguiPPParser.tokens │ │ ├── ImguiPPParserBaseListener.cpp │ │ ├── ImguiPPParserBaseListener.h │ │ ├── ImguiPPParserBaseVisitor.cpp │ │ ├── ImguiPPParserBaseVisitor.h │ │ ├── ImguiPPParserListener.cpp │ │ ├── ImguiPPParserListener.h │ │ ├── ImguiPPParserVisitor.cpp │ │ └── ImguiPPParserVisitor.h │ ├── include │ │ └── paximgui │ │ │ ├── ImguiPlugin.h │ │ │ ├── ImguiRenderer.h │ │ │ ├── ImguiUniformDetector.h │ │ │ ├── ImguiUniformDetectorVisitor.h │ │ │ └── Variable.h │ └── src │ │ ├── ImguiPlugin.cpp │ │ ├── ImguiRenderer.cpp │ │ ├── ImguiUniformDetector.cpp │ │ ├── ImguiUniformDetectorVisitor.cpp │ │ └── Variable.cpp ├── paxopengl │ ├── CMakeLists.txt │ ├── include │ │ └── paxopengl │ │ │ ├── Conversion.h │ │ │ ├── OpenGLError.h │ │ │ ├── OpenGLMacros.h │ │ │ ├── OpenGLPlugin.h │ │ │ ├── OpenGLPointCloudSettings.h │ │ │ ├── OpenGLViewport.h │ │ │ ├── factory │ │ │ ├── OpenGLMeshFactory.h │ │ │ ├── OpenGLRenderPassFactory.h │ │ │ ├── OpenGLTextureFactory.h │ │ │ └── OpenGLViewportFactory.h │ │ │ ├── glslpreprocessor │ │ │ ├── GLSLIncludeDirectives.h │ │ │ ├── GLSLPreprocessor.h │ │ │ └── GLSLPreprocessorService.h │ │ │ ├── io │ │ │ ├── FreeImageOpenGLTextureLoader.h │ │ │ └── OpenGLShaderLoader.h │ │ │ ├── rendernodes │ │ │ ├── OpenGLContext.h │ │ │ ├── OpenGLDefaultWorldSceneGraph.h │ │ │ └── OpenGLRenderPass.h │ │ │ └── resource │ │ │ ├── OpenGLMesh.h │ │ │ ├── OpenGLShader.h │ │ │ └── OpenGLTexture2D.h │ └── src │ │ ├── Conversion.cpp │ │ ├── OpenGLError.cpp │ │ ├── OpenGLPlugin.cpp │ │ ├── OpenGLPointCloudSettings.cpp │ │ ├── OpenGLViewport.cpp │ │ ├── factory │ │ ├── OpenGLRenderPassFactory.cpp │ │ └── OpenGLTextureFactory.cpp │ │ ├── glslpreprocessor │ │ ├── GLSLIncludeDirectives.cpp │ │ └── GLSLPreprocessorService.cpp │ │ ├── io │ │ ├── FreeImageOpenGLTextureLoader.cpp │ │ └── OpenGLShaderLoader.cpp │ │ ├── rendernodes │ │ ├── OpenGLContext.cpp │ │ ├── OpenGLDefaultWorldSceneGraph.cpp │ │ └── OpenGLRenderPass.cpp │ │ └── resource │ │ ├── OpenGLMesh.cpp │ │ ├── OpenGLShader.cpp │ │ └── OpenGLTexture2D.cpp ├── paxphysics │ ├── CMakeLists.txt │ ├── include │ │ └── paxphysics │ │ │ ├── 2d │ │ │ ├── Hitbox2D.h │ │ │ ├── PhysicsSystem2D.h │ │ │ ├── PhysicsWorld2D.h │ │ │ ├── RigidBody2D.h │ │ │ ├── box2d │ │ │ │ ├── Box2DHitbox.h │ │ │ │ ├── Box2DPhysicsSystem.h │ │ │ │ ├── Box2DRigidBody.h │ │ │ │ ├── Box2DUtils.h │ │ │ │ └── Box2DWorld.h │ │ │ ├── event │ │ │ │ └── Collision.h │ │ │ ├── gravityfields │ │ │ │ ├── DirectionalGravityField.h │ │ │ │ ├── GravityField.h │ │ │ │ ├── GravityFieldRegister.h │ │ │ │ ├── GravityFieldSensitive.h │ │ │ │ ├── GravityFieldSystem.h │ │ │ │ └── SphereGravityField.h │ │ │ ├── json │ │ │ │ └── JsonShape2DParser.h │ │ │ ├── material │ │ │ │ ├── PhysicsMaterial.h │ │ │ │ └── PhysicsMaterialLoader.h │ │ │ ├── shape │ │ │ │ ├── Circle.h │ │ │ │ ├── Rectangle.h │ │ │ │ └── Shape2D.h │ │ │ └── visualization │ │ │ │ └── HitboxGraphics.h │ │ │ └── Plugin.h │ └── src │ │ ├── 2d │ │ ├── Hitbox2D.cpp │ │ ├── PhysicsWorld2D.cpp │ │ ├── RigidBody2D.cpp │ │ ├── box2d │ │ │ ├── Box2DHitbox.cpp │ │ │ ├── Box2DPhysicsSystem.cpp │ │ │ ├── Box2DRigidBody.cpp │ │ │ ├── Box2DUtils.cpp │ │ │ └── Box2DWorld.cpp │ │ ├── event │ │ │ └── Collision.cpp │ │ ├── gravityfields │ │ │ ├── DirectionalGravityField.cpp │ │ │ ├── GravityField.cpp │ │ │ ├── GravityFieldRegister.cpp │ │ │ ├── GravityFieldSensitive.cpp │ │ │ ├── GravityFieldSystem.cpp │ │ │ └── SphereGravityField.cpp │ │ ├── json │ │ │ └── JsonShape2DParser.cpp │ │ ├── material │ │ │ ├── PhysicsMaterial.cpp │ │ │ └── PhysicsMaterialLoader.cpp │ │ ├── shape │ │ │ ├── Circle.cpp │ │ │ ├── Rectangle.cpp │ │ │ └── Shape2D.cpp │ │ └── visualization │ │ │ └── HitboxGraphics.cpp │ │ └── Plugin.cpp ├── paxsdl │ ├── CMakeLists.txt │ ├── include │ │ └── paxsdl │ │ │ ├── SDLImageLoader.h │ │ │ ├── SDLInputSystem.h │ │ │ ├── SDLKeyboard.h │ │ │ ├── SDLPlugin.h │ │ │ ├── SDLPureContext.h │ │ │ ├── SDLTextureLoader.h │ │ │ ├── SDLWindow.h │ │ │ └── opengl │ │ │ ├── SDLOpenGLContext.h │ │ │ ├── SDLOpenGLPlugin.h │ │ │ └── SDLOpenGLWindow.h │ └── src │ │ ├── SDLImageLoader.cpp │ │ ├── SDLInputSystem.cpp │ │ ├── SDLKeyboard.cpp │ │ ├── SDLPureContext.cpp │ │ ├── SDLTextureLoader.cpp │ │ ├── SDLWindow.cpp │ │ └── opengl │ │ ├── SDLOpenGLContext.cpp │ │ ├── SDLOpenGLPlugin.cpp │ │ └── SDLOpenGLWindow.cpp ├── paxtiles │ ├── CMakeLists.txt │ ├── include │ │ └── paxtiles │ │ │ ├── Plugin.h │ │ │ ├── Tile.h │ │ │ ├── TileMap.h │ │ │ ├── TileMapGraphics.h │ │ │ ├── TileMapProperty.h │ │ │ ├── TileMapTransition.h │ │ │ ├── TileSet.h │ │ │ ├── tiled │ │ │ ├── TileMapJsonLoader.h │ │ │ └── TileSetJsonLoader.h │ │ │ └── topdown │ │ │ ├── CharacterOrientation.h │ │ │ ├── CharacterSpriteAnimation.h │ │ │ └── SimpleCharacterKeyboardControls.h │ └── src │ │ ├── Plugin.cpp │ │ ├── TileMap.cpp │ │ ├── TileMapGraphics.cpp │ │ ├── TileMapProperty.cpp │ │ ├── TileMapTransition.cpp │ │ ├── TileSet.cpp │ │ ├── tiled │ │ ├── TileMapJsonLoader.cpp │ │ └── TileSetJsonLoader.cpp │ │ └── topdown │ │ ├── CharacterOrientation.cpp │ │ ├── CharacterSpriteAnimation.cpp │ │ └── SimpleCharacterKeyboardControls.cpp └── template │ ├── CMakeLists.txt │ ├── include │ ├── FollowEntityBehaviour.h │ └── Plugin.h │ └── src │ └── Plugin.cpp ├── res ├── antlr │ ├── antlr-4.10.1-complete.jar │ └── antlr-4.8-complete.jar ├── demos │ ├── PlatformerDemo │ │ ├── img │ │ │ ├── Block │ │ │ │ ├── Center.png │ │ │ │ ├── Left.png │ │ │ │ └── Right.png │ │ │ ├── Bush │ │ │ │ ├── bush1.png │ │ │ │ ├── bush2.png │ │ │ │ └── bush3.png │ │ │ ├── GreenBot16.png │ │ │ ├── bg.png │ │ │ └── thanksto.txt │ │ ├── material │ │ │ └── GreenGuy.psxmat │ │ └── prefabs │ │ │ ├── entity │ │ │ ├── DemoGameObject.paxprefab.json │ │ │ ├── GreenGuy.paxprefab.json │ │ │ └── Player.paxprefab.json │ │ │ └── world │ │ │ └── mainlayer.paxprefab.json │ ├── PlaygroundDemo │ │ └── mesh │ │ │ ├── lowpolytree │ │ │ ├── lowpolytree.mtl │ │ │ └── lowpolytree.obj │ │ │ └── ltp │ │ │ ├── LTP.mtl │ │ │ ├── LTP.obj │ │ │ ├── LTP.png │ │ │ └── T-50_2_track.png │ ├── RayMarcher │ │ ├── mandelbrot_frag.glsl │ │ ├── raymarcher.paxconfig │ │ ├── raymarcher4d_frag.glsl │ │ ├── raymarcher_frag.glsl │ │ └── vert.glsl │ └── TileDemo │ │ ├── entities │ │ ├── glenys.paxprefab.json │ │ └── transitionarea.paxprefab.json │ │ ├── game.paxconfig │ │ ├── img │ │ ├── Glenys-the-Demonswordsman.png │ │ └── orangepixel.png │ │ └── worlds │ │ ├── DenseForest.paxprefab.json │ │ ├── SmallForest.paxprefab.json │ │ └── tiled │ │ ├── Platforms │ │ ├── Platforms.json │ │ ├── PlatformsTileMap.json │ │ ├── PlatformsTileMapSnowExpansion.json │ │ ├── snow-expansion.png │ │ └── tiles_packed.png │ │ └── SmallForest │ │ ├── DenseForest.json │ │ ├── SmallForest.json │ │ ├── SmallForestTileset.json │ │ ├── SolidTile.tx │ │ └── Tiles.png ├── font │ ├── BoxyBold │ │ ├── boxy_bold_regular_8.png │ │ ├── boxy_bold_regular_8.xml │ │ └── boxy_bold_regular_8_transp.PNG │ └── Pixeled.ttf ├── icon │ ├── PaxEngine2 │ │ ├── PaxEngine2x128.ico │ │ ├── PaxEngine2x128.png │ │ ├── PaxEngine2x16.ico │ │ ├── PaxEngine2x16.png │ │ ├── PaxEngine2x32.ico │ │ ├── PaxEngine2x32.png │ │ ├── PaxEngine2x64.ico │ │ └── PaxEngine2x64.png │ └── PaxEngine3 │ │ └── PaxEngine3_128.png ├── img │ ├── Black16.png │ ├── PaxEngine3.png │ └── White16.png ├── prefabs │ ├── gravityfields │ │ ├── Circle.json │ │ └── DirectedBox.json │ └── playerspawn.paxprefab.json ├── screenshots │ ├── 3d.PNG │ ├── meshfold.PNG │ ├── platformer.PNG │ ├── raymarcher.PNG │ └── tiled.PNG └── shader │ ├── conventions.txt │ ├── default.vert │ ├── font │ ├── BitmapFont.frag │ └── BitmapFont.vert │ ├── gui │ ├── PlainTexture.frag │ └── PlainTexture.vert │ ├── hitbox │ ├── rect.frag │ └── rect.vert │ ├── material │ └── simple │ │ ├── simplemat.frag │ │ └── simplemat.vert │ ├── sprite │ ├── sprite.frag │ └── sprite.vert │ ├── terrain │ ├── terrain.frag │ └── terrain.vert │ ├── test │ ├── PlainTexture.frag │ ├── PlainTexture.vert │ ├── lambert │ │ ├── SingleColor.frag │ │ └── SingleColor.vert │ ├── red │ │ ├── red.frag │ │ └── red.vert │ └── thinmatrix │ │ ├── tut5.frag │ │ └── tut5.vert │ └── tilemap │ ├── tilemap.frag │ └── tilemap.vert └── src ├── CMakeLists.txt ├── EngineMain.cpp ├── paxcore ├── CMakeLists.txt ├── Engine.cpp ├── Game.cpp ├── animation │ ├── AnimationBehaviour.cpp │ ├── Timing.cpp │ └── json │ │ └── AnimationBehaviourParser.cpp ├── function │ ├── UpdateOptions.cpp │ └── Updateable.cpp ├── gameentity │ ├── GameEntity.cpp │ ├── GameEntityIDService.cpp │ ├── GameEntityProperty.cpp │ ├── prefab │ │ └── JsonGameEntityPrefabTagsParser.cpp │ └── property │ │ ├── Ability.cpp │ │ ├── Behaviour.cpp │ │ ├── Size.cpp │ │ └── behaviours │ │ ├── 2d │ │ ├── FollowGameEntityBehaviour.cpp │ │ └── Movement2D.cpp │ │ └── NoClipControls.cpp ├── io │ ├── CMakeLists.txt │ ├── Keyboard.cpp │ ├── Keys.cpp │ ├── Mouse.cpp │ ├── Window.cpp │ ├── event │ │ └── ResolutionChangedEvent.cpp │ └── properties │ │ └── InputAbilityController.cpp ├── json │ └── JsonResourceLoader.cpp ├── plugin │ ├── EngineInternalPlugin.cpp │ └── EnginePlugin.cpp ├── rendering │ ├── CMakeLists.txt │ ├── Graphics.cpp │ ├── RenderOptions.cpp │ ├── Renderer.cpp │ ├── SceneGraphGraphics.cpp │ ├── animation │ │ ├── SpriteSheetAnimations.cpp │ │ └── SpriteSheetAnimator.cpp │ ├── camera │ │ ├── Camera.cpp │ │ ├── FullPixelScreenProjection.cpp │ │ ├── PerspectiveProjection.cpp │ │ ├── PixelScreenProjection.cpp │ │ ├── Projection.cpp │ │ ├── Viewport.cpp │ │ └── json │ │ │ ├── ProjectionJsonParser.cpp │ │ │ └── ViewportJsonParser.cpp │ ├── config │ │ └── PointCloudSettings.cpp │ ├── data │ │ ├── Asset.cpp │ │ ├── Colour.cpp │ │ ├── ColourPalette.cpp │ │ ├── Image.cpp │ │ ├── Material.cpp │ │ ├── Mesh.cpp │ │ └── SpriteSheet.cpp │ ├── graphics │ │ ├── AssetGraphics.cpp │ │ ├── SceneGraphGraphics.cpp │ │ ├── SpriteGraphics.cpp │ │ ├── SpriteSheetGraphics.cpp │ │ └── nodes │ │ │ ├── MeshNode.cpp │ │ │ ├── SpriteSheetNode.cpp │ │ │ └── TexturingNode.cpp │ ├── interface │ │ └── Renderable.cpp │ ├── light │ │ ├── AmbientLight.cpp │ │ ├── DirectionalLight.cpp │ │ ├── Light.cpp │ │ ├── PointLight.cpp │ │ └── SpotLight.cpp │ ├── loader │ │ ├── NullTextureLoader.cpp │ │ └── SpriteSheetLoader.cpp │ ├── primitives │ │ └── PrimitiveFactory.cpp │ ├── renderpass │ │ ├── RenderPass.cpp │ │ └── RenderPassChannel.cpp │ ├── resource │ │ ├── Mesh.cpp │ │ ├── Shader.cpp │ │ └── Texture.cpp │ └── scenegraph │ │ ├── generators │ │ ├── DefaultSceneGraphGeneratorFactory.cpp │ │ ├── GroupByShadersSceneGraphGenerator.cpp │ │ ├── SceneGraphGenerator.cpp │ │ └── SortByZSceneGraphGenerator.cpp │ │ ├── nodes │ │ ├── ShadingNode.cpp │ │ ├── SortingNode.cpp │ │ └── TransformationNode.cpp │ │ └── sort │ │ └── GraphicsSort.cpp ├── service │ ├── Paths.cpp │ ├── Services.cpp │ └── WindowService.cpp ├── state │ └── StateMachine.cpp ├── system │ ├── GameSystem.cpp │ ├── gameentity │ │ ├── BehaviourSystem.cpp │ │ ├── GameEntityPropertyPool.cpp │ │ └── LightSystem.cpp │ └── world │ │ └── WorldBehaviourSystem.cpp └── world │ ├── World.cpp │ ├── prefab │ ├── JsonWorldGameEntityParser.cpp │ └── JsonWorldPrefabInitParser.cpp │ ├── property │ ├── WorldBehaviour.cpp │ └── WorldSize.cpp │ └── scenegraph │ └── WorldSceneGraph.cpp └── paxutil ├── CMakeLists.txt ├── Signature.cpp ├── io ├── PrettyPrint.cpp └── Settings.cpp ├── math ├── Angles.cpp ├── Conversion.cpp ├── Functions.cpp ├── Transformation.cpp └── json │ └── JsonToTransformation.cpp ├── reflection ├── TypeHierarchy.cpp └── TypeRegister.cpp └── resources ├── ResourceHandle.cpp ├── ResourceLoader.cpp └── Resources.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries 2 | !bin/ 3 | bin/* 4 | !bin/core.example.paxconfig! 5 | !bin/Demo/ 6 | bin/Demo/* 7 | !bin/Demo/core.paxconfig 8 | 9 | # libraries 10 | libs/Polypropylene 11 | libs/Polypropylene/* 12 | 13 | # Project data 14 | .idea 15 | vs 16 | .vscode 17 | 18 | # Generated code 19 | *.generated.cpp 20 | 21 | # Python temp files 22 | __pycache__ 23 | 24 | # Build 25 | build 26 | cmake-build-* -------------------------------------------------------------------------------- /bin/Demo/core.paxconfig: -------------------------------------------------------------------------------- 1 | core_engineResourceDirectory = ${CURRENT_DIR}/../../res 2 | core_customResourceDirectory = undefined 3 | 4 | core_windowTitle = PaxEngine3 5 | 6 | core_resolutionWidth = 800 7 | core_resolutionHeight = 600 8 | 9 | core_startInFullscreen = false 10 | 11 | # constraint: core_targetFPS <= core_targetUPS 12 | core_targetFPS = 60 13 | core_targetUPS = 100 14 | 15 | # TODO: Move this to a config file for PlatformerDemo because it is game specific 16 | physics2d_pixels_per_meter = 16 -------------------------------------------------------------------------------- /bin/core.example.paxconfig: -------------------------------------------------------------------------------- 1 | core_engineResourceDirectory = ${CURRENT_DIR}/../res 2 | core_customResourceDirectory = undefined 3 | 4 | core_windowTitle = PaxEngine3 5 | 6 | core_resolutionWidth = 800 7 | core_resolutionHeight = 600 8 | 9 | core_startInFullscreen = false 10 | 11 | # constraint: core_targetFPS <= core_targetUPS 12 | core_targetFPS = 60 13 | core_targetUPS = 100 14 | 15 | # TODO: Move this to a config file for PlatformerDemo because it is game specific 16 | physics2d_pixels_per_meter = 16 -------------------------------------------------------------------------------- /cmake/AssertPathExists.cmake: -------------------------------------------------------------------------------- 1 | function(assertPathExists name path) 2 | if (EXISTS ${path}) 3 | 4 | else() 5 | message(FATAL_ERROR "Path ${name} = ${path} does not exist!") 6 | endif() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/PaxArchitectureDetection.cmake: -------------------------------------------------------------------------------- 1 | # Defines: PAX_OS_ARCHITECTURE 2 | 3 | set(PAX_OS_ARCHITECTURE x86) # This is the default value 4 | 5 | if (CMAKE_SIZEOF_VOID_P EQUAL 8) 6 | set(PAX_OS_ARCHITECTURE x64) 7 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 8 | set(PAX_OS_ARCHITECTURE x86) 9 | else() 10 | message(WARNING "Unknown Architecture: CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P}") 11 | message(WARNING "Continuing with ${PAX_OS_ARCHITECTURE}") 12 | endif() 13 | 14 | message("PAX_OS_ARCHITECTURE is ${PAX_OS_ARCHITECTURE}") -------------------------------------------------------------------------------- /cmake/PaxCompilerDetection.cmake: -------------------------------------------------------------------------------- 1 | set(PAX_COMPILER_IS_CLANG FALSE) 2 | set(PAX_COMPILER_IS_GCC FALSE) 3 | set(PAX_COMPILER_IS_INTEL FALSE) 4 | set(PAX_COMPILER_IS_MSVC FALSE) 5 | 6 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 7 | # using Clang 8 | set(PAX_COMPILER_IS_CLANG TRUE) 9 | message("Compiler set to CLANG") 10 | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 11 | # using GCC 12 | set(PAX_COMPILER_IS_GCC TRUE) 13 | message("Compiler set to GCC") 14 | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") 15 | # using Intel C++ 16 | set(PAX_COMPILER_IS_INTEL TRUE) 17 | message("Compiler set to INTEL") 18 | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 19 | # using Visual Studio C++ 20 | set(PAX_COMPILER_IS_MSVC TRUE) 21 | message("Compiler set to MSVC") 22 | endif() -------------------------------------------------------------------------------- /doc/dependencies/requirements.txt: -------------------------------------------------------------------------------- 1 | -e git+https://github.com/PaulAtTUBS/Polypropylene.git@master#egg=Polypropylene-0 2 | -------------------------------------------------------------------------------- /doc/todo.txt: -------------------------------------------------------------------------------- 1 | - glClearColor -> create centralized stack (OGLRenderPass is currently hacky in that way) -------------------------------------------------------------------------------- /doc/wiki/PredefinedVariables.md: -------------------------------------------------------------------------------- 1 | These are predefined variables by the engine that can be used when loading prefabs. 2 | A variable `foo` can be referenced in a json file with `${foo}`. 3 | - `EngineResourceDir`: Resource directory of the game engine. Example usage: `${EngineResourceDir}/shader/sprite/sprite.vert` 4 | - `CustomResourceDir`: Resource directory of your custom game or project. -------------------------------------------------------------------------------- /include/EngineMain.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_ENGINEMAIN_H 6 | #define PAXENGINE3_ENGINEMAIN_H 7 | 8 | #include "utility/macros/MacroIncludes.h" 9 | 10 | namespace PAX { 11 | int Engine_Main(int argc, char *argv[]); 12 | } 13 | 14 | #endif //PAXENGINE3_ENGINEMAIN_H 15 | -------------------------------------------------------------------------------- /include/PaxEngineIncludes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MAININCLUDES_H 6 | #define PAXENGINE3_MAININCLUDES_H 7 | 8 | #include "paxutil/macros/PlatformIncludes.h" 9 | #include "paxutil/lib/LibIncludes.h" 10 | #include "paxcore/OStreamOverloads.h" 11 | #include "paxcore/Engine.h" 12 | 13 | #endif //PAXENGINE3_MAININCLUDES_H 14 | -------------------------------------------------------------------------------- /include/paxcore/OStreamOverloads.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 31.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_OSTREAMOVERLOADS_H 6 | #define MESHFOLD_OSTREAMOVERLOADS_H 7 | 8 | #include 9 | #include "rendering/data/Shader.h" 10 | 11 | std::ostream &operator<<(std::ostream &os, PAX::Shader::Flags const &flags); 12 | std::ostream &operator<<(std::ostream &os, PAX::Shader::FileInfo const &fileInfo); 13 | 14 | #endif //MESHFOLD_OSTREAMOVERLOADS_H 15 | -------------------------------------------------------------------------------- /include/paxcore/animation/AnimationBehaviour.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 31.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_ANIMATIONBEHAVIOUR_H 6 | #define MESHFOLD_ANIMATIONBEHAVIOUR_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | enum class AnimationBehaviour { 12 | ONCE, 13 | LOOP, 14 | PINGPONG 15 | }; 16 | } 17 | 18 | std::ostream & operator<<(std::ostream & str, const PAX::AnimationBehaviour & ab); 19 | 20 | #endif //MESHFOLD_ANIMATIONBEHAVIOUR_H 21 | -------------------------------------------------------------------------------- /include/paxcore/animation/Timing.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 31.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_TIMING_H 6 | #define MESHFOLD_TIMING_H 7 | 8 | #include 9 | 10 | namespace PAX::Time { 11 | using Clock = std::chrono::high_resolution_clock; 12 | using Seconds = std::chrono::seconds; 13 | using Timespan = std::chrono::duration; 14 | using Timepoint = std::chrono::time_point; 15 | 16 | Timespan Modulo(Timespan lhs, Timespan rhs); 17 | } 18 | 19 | #endif //MESHFOLD_TIMING_H 20 | -------------------------------------------------------------------------------- /include/paxcore/animation/json/AnimationBehaviourParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 04.03.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_ANIMATIONBEHAVIOURPARSER_H 6 | #define MESHFOLD_ANIMATIONBEHAVIOURPARSER_H 7 | 8 | #include 9 | #include "../AnimationBehaviour.h" 10 | 11 | PAX_DECLARE_JSON_CONVERTER_FOR(AnimationBehaviour) 12 | 13 | #endif //MESHFOLD_ANIMATIONBEHAVIOURPARSER_H 14 | -------------------------------------------------------------------------------- /include/paxcore/function/UpdateOptions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 17/07/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_UPDATEOPTIONS_H 6 | #define PAXENGINE3_UPDATEOPTIONS_H 7 | 8 | namespace PAX { 9 | class World; 10 | 11 | class UpdateOptions { 12 | public: 13 | const float dt; 14 | const float actual_dt; 15 | World * activeWorld = nullptr; 16 | 17 | UpdateOptions(float dt, float actual_dt); 18 | }; 19 | } 20 | 21 | #endif //PAXENGINE3_UPDATEOPTIONS_H 22 | -------------------------------------------------------------------------------- /include/paxcore/function/Updateable.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 17/07/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_UPDATEABLE_H 6 | #define PAXENGINE3_UPDATEABLE_H 7 | 8 | #include "UpdateOptions.h" 9 | 10 | namespace PAX { 11 | class Updateable { 12 | public: 13 | virtual ~Updateable() = 0; 14 | virtual void update(UpdateOptions & options) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_UPDATEABLE_H 19 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/GameEntityProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_ENTITYCOMPONENT_H 6 | #define PAXENGINE3_ENTITYCOMPONENT_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class GameEntity; 13 | class World; 14 | 15 | class GameEntityProperty : public Property { 16 | PAX_PROPERTY(GameEntityProperty, PAX_PROPERTY_IS_ABSTRACT) 17 | PAX_PROPERTY_DERIVES(Property) 18 | PAX_PROPERTY_IS_MULTIPLE 19 | 20 | public: 21 | virtual void spawned(); 22 | virtual void despawned(); 23 | 24 | PAX_NODISCARD World * getWorld() const; 25 | }; 26 | } 27 | 28 | #include "GameEntity.h" 29 | 30 | #endif //PAXENGINE3_ENTITYCOMPONENT_H 31 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/MotionType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOTIONTYPE_H 6 | #define PAXENGINE3_MOTIONTYPE_H 7 | 8 | namespace PAX { 9 | enum class MotionType { 10 | Static = 0, 11 | Kinematic, 12 | Dynamic 13 | }; 14 | } 15 | 16 | #endif //PAXENGINE3_MOTIONTYPE_H 17 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/Tag.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.11.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_TAG_H 6 | #define PAXENGINE3_TAG_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | using Tag = std::string; 12 | 13 | 14 | class Tags { 15 | public: 16 | #define PAX_DEFAULT_TAG(name) static constexpr const char* name = #name; 17 | 18 | PAX_DEFAULT_TAG(Player) 19 | PAX_DEFAULT_TAG(PlayerSpawn) 20 | PAX_DEFAULT_TAG(Enemy) 21 | PAX_DEFAULT_TAG(EnemySpawn) 22 | PAX_DEFAULT_TAG(Camera) 23 | 24 | #undef PAX_DEFAULT_TAG 25 | }; 26 | 27 | } 28 | 29 | #endif //PAXENGINE3_TAG_H 30 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/event/GameEntityEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 08.05.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_ENTITYEVENT_H 6 | #define PAXENGINE3_ENTITYEVENT_H 7 | 8 | #include "polypropylene/event/Event.h" 9 | 10 | namespace PAX { 11 | class GameEntity; 12 | 13 | struct GameEntityEvent : public Event { 14 | public: 15 | GameEntity* entity = nullptr; 16 | explicit GameEntityEvent(GameEntity *entity) : entity(entity) {} 17 | }; 18 | } 19 | 20 | #endif //PAXENGINE3_ENTITYEVENT_H 21 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/event/GameEntityParentChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 01.06.17. 3 | // 4 | 5 | #ifndef PAXENGINE3_ENTITYPARENTCHANGEDEVENT_H 6 | #define PAXENGINE3_ENTITYPARENTCHANGEDEVENT_H 7 | 8 | #include "GameEntityEvent.h" 9 | 10 | namespace PAX { 11 | struct GameEntityParentChangedEvent : public GameEntityEvent { 12 | public: 13 | GameEntity *newParent, *oldParent; 14 | GameEntityParentChangedEvent(GameEntity *entity, GameEntity *oldParent, GameEntity *newParent) : GameEntityEvent(entity), oldParent(oldParent), newParent(newParent) {} 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_ENTITYPARENTCHANGEDEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/event/ScaleChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.02.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_SCALECHANGEDEVENT_H 6 | #define PAXENGINE3_SCALECHANGEDEVENT_H 7 | 8 | #include 9 | #include "GameEntityEvent.h" 10 | 11 | namespace PAX { 12 | struct ScaleChangedEvent : public GameEntityEvent { 13 | union { 14 | const glm::vec2 oldScale2D; 15 | const glm::vec3 oldScale; 16 | }; 17 | union { 18 | const glm::vec2 newScale2D; 19 | const glm::vec3 newScale; 20 | }; 21 | 22 | ScaleChangedEvent(GameEntity *entity, const glm::vec3 &oldScale, const glm::vec3 &newScale) 23 | : GameEntityEvent(entity), oldScale(oldScale), newScale(newScale) 24 | { 25 | } 26 | }; 27 | } 28 | 29 | #endif //PAXENGINE3_SCALECHANGEDEVENT_H 30 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/event/SizeChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.02.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_SIZECHANGEDEVENT_H 6 | #define PAXENGINE3_SIZECHANGEDEVENT_H 7 | 8 | #include 9 | #include "GameEntityEvent.h" 10 | 11 | namespace PAX { 12 | class Size; 13 | 14 | struct SizeChangedEvent : public GameEntityEvent { 15 | union { 16 | const glm::vec2 oldSize2D; 17 | const glm::vec3 oldSize; 18 | }; 19 | 20 | Size *size; 21 | 22 | SizeChangedEvent(GameEntity *entity, const glm::vec3 &oldSize, Size *size) 23 | : GameEntityEvent(entity), oldSize(oldSize), size(size) 24 | { 25 | } 26 | }; 27 | } 28 | 29 | #endif //PAXENGINE3_SIZECHANGEDEVENT_H 30 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/prefab/JsonGameEntityPrefabTagsParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.11.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONENTITYPREFABTAGSPARSER_H 6 | #define PAXENGINE3_JSONENTITYPREFABTAGSPARSER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class JsonGameEntityPrefabTagsParser : public Json::JsonEntityPrefabElementParser { 13 | public: 14 | void parse( 15 | nlohmann::json & node, 16 | GameEntity & e, 17 | Json::JsonEntityPrefab & prefab, 18 | const VariableRegister & v) override; 19 | }; 20 | } 21 | 22 | #endif //PAXENGINE3_JSONENTITYPREFABTAGSPARSER_H 23 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/property/AbilityIdentifier.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 30.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_ABILITYIDENTIFIER_H 6 | #define MESHFOLD_ABILITYIDENTIFIER_H 7 | 8 | namespace PAX { 9 | using AbilityIdentifier = std::string; 10 | enum class AbilityResult { 11 | Success = 0, 12 | Failure, 13 | NoSuchAbility 14 | }; 15 | } 16 | 17 | #endif //MESHFOLD_ABILITYIDENTIFIER_H 18 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/property/Behaviour.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_BEHAVIOUR_H 6 | #define PAXENGINE3_BEHAVIOUR_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class Behaviour : public GameEntityProperty, public Updateable { 13 | PAX_PROPERTY(Behaviour, PAX_PROPERTY_IS_ABSTRACT) 14 | PAX_PROPERTY_DERIVES(GameEntityProperty) 15 | PAX_PROPERTY_IS_MULTIPLE 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_BEHAVIOUR_H 20 | -------------------------------------------------------------------------------- /include/paxcore/gameentity/property/behaviours/2d/Movement2D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 19.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOVEMENT2D_H 6 | #define PAXENGINE3_MOVEMENT2D_H 7 | 8 | 9 | #include 10 | #include 11 | 12 | namespace PAX { 13 | class Movement2D : public Behaviour { 14 | PAX_PROPERTY(Movement2D, PAX_PROPERTY_IS_CONCRETE) 15 | PAX_PROPERTY_DERIVES(PAX::Behaviour) 16 | PAX_PROPERTY_IS_SINGLE 17 | 18 | bool active = true; 19 | 20 | public: 21 | glm::vec2 velocity = glm::vec2(0); 22 | float angularVelocityInDegrees = 0; 23 | 24 | void update(UpdateOptions & options) override; 25 | 26 | PAX_NODISCARD ClassMetadata getMetadata() override; 27 | 28 | void activate(); 29 | void deactivate(); 30 | PAX_NODISCARD bool isActive() const; 31 | }; 32 | } 33 | 34 | #endif //PAXENGINE3_MOVEMENT2D_H 35 | -------------------------------------------------------------------------------- /include/paxcore/io/InputSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_INPUTSYSTEM_H 6 | #define PAXENGINE3_INPUTSYSTEM_H 7 | 8 | #include 9 | #include 10 | 11 | #include "Keyboard.h" 12 | #include "Mouse.h" 13 | #include "Window.h" 14 | 15 | namespace PAX { 16 | class InputSystem : public Updateable { 17 | public: 18 | virtual Keyboard* getKeyboard() = 0; 19 | virtual Mouse* getMouse() = 0; 20 | 21 | virtual void initialize() = 0; 22 | virtual void terminate() = 0; 23 | 24 | protected: 25 | inline static void setMouseScreenPosition(Mouse& mouse, int x, int y) { 26 | mouse.screenPos.x = x; 27 | mouse.screenPos.y = y; 28 | } 29 | 30 | inline static void setWindowResolution(Window& window, const glm::ivec2 & res) { 31 | window._resolution = res; 32 | } 33 | }; 34 | } 35 | 36 | #endif //PAXENGINE3_INPUTSYSTEM_H 37 | -------------------------------------------------------------------------------- /include/paxcore/io/InputSystemFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_INPUTSYSTEMFACTORY_H 6 | #define PAXENGINE3_INPUTSYSTEMFACTORY_H 7 | 8 | #include "InputSystem.h" 9 | 10 | namespace PAX { 11 | class InputSystemFactory { 12 | public: 13 | virtual std::shared_ptr create() = 0; 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_INPUTSYSTEMFACTORY_H 18 | -------------------------------------------------------------------------------- /include/paxcore/io/Keyboard.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_KEYBOARD_H 6 | #define PAXENGINE3_KEYBOARD_H 7 | 8 | // giosheo 9 | #include "Keys.h" 10 | 11 | namespace PAX { 12 | class Keyboard { 13 | public: 14 | virtual bool isKeyDown(Key key) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_KEYBOARD_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/Mouse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSE_H 6 | #define PAXENGINE3_MOUSE_H 7 | 8 | #include 9 | 10 | #include "../rendering/camera/Camera.h" 11 | #include "MouseButtons.h" 12 | 13 | namespace PAX { 14 | class InputSystem; 15 | 16 | class Mouse { 17 | friend class InputSystem; 18 | 19 | glm::ivec2 screenPos; 20 | 21 | public: 22 | PAX_NODISCARD const glm::ivec2 & getScreenPosition() const; 23 | bool isButtonDown(MouseButton button); 24 | 25 | static glm::ivec2 ScreenPosToViewportPos(const glm::ivec2 &, Camera&); 26 | static glm::ivec2 ViewportPosToWorldPos(const glm::ivec2&, Camera&); 27 | static glm::ivec2 ScreenPosToWorldPos(const glm::ivec2 &, Camera&); 28 | }; 29 | } 30 | 31 | #endif //PAXENGINE3_MOUSE_H 32 | -------------------------------------------------------------------------------- /include/paxcore/io/MouseButtons.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEBUTTONS_H 6 | #define PAXENGINE3_MOUSEBUTTONS_H 7 | 8 | namespace PAX { 9 | enum class MouseButton { 10 | NONE = 0, 11 | LEFT = 1, 12 | MIDDLE = 2, 13 | RIGHT = 3, 14 | X1 = 4, 15 | X2 = 5 16 | }; 17 | } 18 | #endif //PAXENGINE3_MOUSEBUTTONS_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/Window.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Gordon on 16.05.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_WINDOW_H 6 | #define PAXENGINE3_WINDOW_H 7 | 8 | #include 9 | #include 10 | 11 | #include "polypropylene/event/EventHandler.h" 12 | #include "event/ResolutionChangedEvent.h" 13 | 14 | namespace PAX { 15 | class InputSystem; 16 | 17 | class Window { 18 | friend class InputSystem; 19 | 20 | bool _fullscreen = false; 21 | 22 | protected: 23 | glm::ivec2 _resolution; 24 | 25 | public: 26 | virtual ~Window() = default; 27 | 28 | EventHandler OnResolutionChanged; 29 | 30 | virtual void setResolution(const glm::ivec2 & resolution); 31 | virtual glm::ivec2 getResolution(); 32 | 33 | virtual void setFullscreen(bool fullscreen); 34 | bool isFullscreen(); 35 | 36 | virtual void dispose(); 37 | }; 38 | } 39 | 40 | #endif //PAXENGINE3_WINDOW_H 41 | -------------------------------------------------------------------------------- /include/paxcore/io/WindowFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_WINDOWFACTORY_H 6 | #define PAXENGINE3_WINDOWFACTORY_H 7 | 8 | #include 9 | #include "Window.h" 10 | 11 | namespace PAX { 12 | class WindowFactory { 13 | public: 14 | virtual std::shared_ptr create(const char* title, int resX, int resY) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_WINDOWFACTORY_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/event/KeyEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_KEYEVENT_H 6 | #define PAXENGINE3_KEYEVENT_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | struct KeyEvent : public Event { 13 | public: 14 | Keyboard *keyboard = nullptr; 15 | Key button = Key::NONE; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_KEYEVENT_H 20 | -------------------------------------------------------------------------------- /include/paxcore/io/event/KeyPressedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_KEYPRESSEDEVENT_H 6 | #define PAXENGINE3_KEYPRESSEDEVENT_H 7 | 8 | #include "KeyEvent.h" 9 | 10 | namespace PAX { 11 | struct KeyPressedEvent : public KeyEvent { 12 | bool repeated = false; 13 | }; 14 | } 15 | 16 | #endif //PAXENGINE3_KEYPRESSEDEVENT_H 17 | -------------------------------------------------------------------------------- /include/paxcore/io/event/KeyReleasedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_KEYRELEASEDEVENT_H 6 | #define PAXENGINE3_KEYRELEASEDEVENT_H 7 | 8 | #include "KeyEvent.h" 9 | 10 | namespace PAX { 11 | struct KeyReleasedEvent : public KeyEvent { 12 | 13 | }; 14 | } 15 | 16 | 17 | #endif //PAXENGINE3_KEYRELEASEDEVENT_H 18 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseButtonEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEBUTTONEVENT_H 6 | #define PAXENGINE3_MOUSEBUTTONEVENT_H 7 | 8 | #include "MouseEvent.h" 9 | #include 10 | 11 | namespace PAX { 12 | struct MouseButtonEvent : public MouseEvent { 13 | public: 14 | MouseButton button = MouseButton::NONE; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_MOUSEBUTTONEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseButtonPressedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEBUTTONPRESSEDEVENT_H 6 | #define PAXENGINE3_MOUSEBUTTONPRESSEDEVENT_H 7 | 8 | #include "MouseButtonEvent.h" 9 | 10 | namespace PAX { 11 | struct MouseButtonPressedEvent : public MouseButtonEvent { 12 | int clicks = 0; 13 | }; 14 | } 15 | 16 | #endif //PAXENGINE3_MOUSEBUTTONPRESSEDEVENT_H 17 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseButtonReleasedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEBUTTONRELEASEDEVENT_H 6 | #define PAXENGINE3_MOUSEBUTTONRELEASEDEVENT_H 7 | 8 | #include "MouseButtonEvent.h" 9 | 10 | namespace PAX { 11 | struct MouseButtonReleasedEvent : public MouseButtonEvent { 12 | }; 13 | } 14 | 15 | #endif //PAXENGINE3_MOUSEBUTTONRELEASEDEVENT_H 16 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEEVENT_H 6 | #define PAXENGINE3_MOUSEEVENT_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | struct MouseEvent : public Event { 13 | public: 14 | Mouse *mouse = nullptr; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_MOUSEEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseMovedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 09.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEMOVEDEVENT_H 6 | #define PAXENGINE3_MOUSEMOVEDEVENT_H 7 | 8 | #include "MouseEvent.h" 9 | #include 10 | 11 | namespace PAX { 12 | struct MouseMovedEvent : public MouseEvent { 13 | public: 14 | glm::ivec2 oldScreenPos; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_MOUSEMOVEDEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/event/MouseWheelEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MOUSEWHEELEVENT_H 6 | #define PAXENGINE3_MOUSEWHEELEVENT_H 7 | 8 | #include "MouseEvent.h" 9 | 10 | namespace PAX { 11 | struct MouseWheelEvent : public MouseEvent { 12 | public: 13 | int ticksX = 0; /**< The amount scrolled horizontally, positive to the right and negative to the left */ 14 | int ticksY = 0; /**< The amount scrolled vertically, positive away from the user (up) and negative toward the user (down) */ 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_MOUSEWHEELEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/io/event/ResolutionChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 09.07.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_RESOLUTIONCHANGEDEVENT_H 6 | #define PAXENGINE3_RESOLUTIONCHANGEDEVENT_H 7 | 8 | #include 9 | #include "polypropylene/event/Event.h" 10 | 11 | namespace PAX { 12 | struct ResolutionChangedEvent : public Event { 13 | int _oldWidth, _oldHeight, _newWidth, _newHeight; 14 | 15 | public: 16 | ResolutionChangedEvent(int oldWidth, int oldHeight, int newWidth, int newHeight); 17 | ResolutionChangedEvent(glm::ivec2 oldRes, glm::ivec2 newRes); 18 | 19 | int getOldWidth(); 20 | int getOldHeight(); 21 | int getNewWidth(); 22 | int getNewHeight(); 23 | }; 24 | } 25 | 26 | #endif //PAXENGINE3_RESOLUTIONCHANGEDEVENT_H 27 | -------------------------------------------------------------------------------- /include/paxcore/json/JsonResourceLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 04.01.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONRESOURCELOADER_H 6 | #define PAXENGINE3_JSONRESOURCELOADER_H 7 | 8 | #include 9 | #include "paxutil/resources/ResourceLoader.h" 10 | 11 | namespace PAX { 12 | class JsonResourceLoader : public ResourceLoader { 13 | public: 14 | PAX_NODISCARD bool canLoad(Path p) const override; 15 | PAX_NODISCARD std::shared_ptr load(Path p) override; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_JSONRESOURCELOADER_H 20 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/FullPixelScreenProjection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 09.07.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_FULLPIXELSCREENPROJECTION_H 6 | #define PAXENGINE3_FULLPIXELSCREENPROJECTION_H 7 | 8 | #include "PixelScreenProjection.h" 9 | 10 | namespace PAX { 11 | class FullPixelScreenProjection : public PixelScreenProjection { 12 | int _coordWidth, _coordHeight; 13 | 14 | public: 15 | FullPixelScreenProjection(int coordinateSystemWidth = 800, int coordinateSystemHeight = 600); 16 | virtual void calcMatrix() override; 17 | 18 | void setCoordinateSystemWidth(int width); 19 | int getCoordinateSystemWidth(); 20 | 21 | void setCoordinateSystemHeight(int width); 22 | int getCoordinateSystemHeight(); 23 | }; 24 | } 25 | 26 | #endif //PAXENGINE3_FULLPIXELSCREENPROJECTION_H 27 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/PerspectiveProjection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_PERSPECTIVEPROJECTION_H 6 | #define PAXENGINE3_PERSPECTIVEPROJECTION_H 7 | 8 | #include "Projection.h" 9 | 10 | namespace PAX { 11 | class PerspectiveProjection : public Projection { 12 | float _fov = 90, _near = 0.1f, _far = 1000; 13 | 14 | public: 15 | PerspectiveProjection(); 16 | virtual void calcMatrix() override; 17 | 18 | /** 19 | * @param fov field of view in degrees 20 | */ 21 | void setFOV(float fov); 22 | 23 | /** 24 | * @return field of view in degrees 25 | */ 26 | float getFOV(); 27 | 28 | float getNearPlane(); 29 | void setNearPlane(float nearPlane); 30 | 31 | float getFarPlane(); 32 | void setFarPlane(float farPlane); 33 | }; 34 | } 35 | 36 | #endif //PAXENGINE3_PERSPECTIVEPROJECTION_H 37 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/PixelScreenProjection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_ORTHOGRAPHICPROJECTION_H 6 | #define PAXENGINE3_ORTHOGRAPHICPROJECTION_H 7 | 8 | #include "Projection.h" 9 | 10 | namespace PAX { 11 | class PixelScreenProjection : public Projection { 12 | public: 13 | void calcMatrix() override; 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_ORTHOGRAPHICPROJECTION_H 18 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/Projection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_PROJECTION_H 6 | #define PAXENGINE3_PROJECTION_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class Projection { 13 | private: 14 | bool _dirty = true; 15 | glm::ivec2 _resolution; 16 | 17 | protected: 18 | glm::mat4 _matrix; 19 | virtual void calcMatrix(); 20 | void makeDirty(); 21 | 22 | public: 23 | const glm::mat4& toMatrix(); 24 | 25 | PAX_NODISCARD const glm::ivec2 & getResolution() const; 26 | void setResolution(const glm::ivec2 & res); 27 | }; 28 | } 29 | 30 | #endif //PAXENGINE3_PROJECTION_H 31 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/json/ProjectionJsonParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 21.02.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_PROJECTIONJSONPARSER_H 6 | #define PAXENGINE3_PROJECTIONJSONPARSER_H 7 | 8 | #include 9 | #include "../Projection.h" 10 | 11 | PAX_DECLARE_JSON_CONVERTER_FOR(Projection *) 12 | 13 | #endif //PAXENGINE3_PROJECTIONJSONPARSER_H 14 | -------------------------------------------------------------------------------- /include/paxcore/rendering/camera/json/ViewportJsonParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 21.02.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_VIEWPORTJSONPARSER_H 6 | #define PAXENGINE3_VIEWPORTJSONPARSER_H 7 | 8 | #include 9 | #include "paxcore/rendering/camera/Viewport.h" 10 | 11 | PAX_DECLARE_JSON_CONVERTER_FOR(Viewport*) 12 | 13 | #endif //PAXENGINE3_VIEWPORTJSONPARSER_H 14 | -------------------------------------------------------------------------------- /include/paxcore/rendering/config/PointCloudSettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_POINTCLOUDSETTINGS_H 6 | #define PAXENGINE3_POINTCLOUDSETTINGS_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class PointCloudSettings { 12 | float pointSize = 1; 13 | 14 | public: 15 | virtual ~PointCloudSettings() = 0; 16 | 17 | virtual void init(Shader * shader); 18 | 19 | virtual void setPointSize(float pointSize); 20 | float getPointSize(); 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_POINTCLOUDSETTINGS_H 25 | -------------------------------------------------------------------------------- /include/paxcore/rendering/data/Colour.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_COLOUR_H 6 | #define PAXENGINE3_COLOUR_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | using Colour = glm::vec<4, unsigned char, glm::defaultp>; 12 | 13 | namespace Colours { 14 | const Colour Red = Colour(255, 0, 0, 255); 15 | const Colour Green = Colour(0, 255, 0, 255); 16 | const Colour Blue = Colour(0, 0, 255, 255); 17 | const Colour White = Colour(255, 255, 255, 255); 18 | const Colour Black = Colour(0, 0, 0, 255); 19 | } 20 | } 21 | 22 | #endif //PAXENGINE3_COLOUR_H 23 | -------------------------------------------------------------------------------- /include/paxcore/rendering/data/ColourPalette.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 11.04.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_COLOURPALETTE_H 6 | #define PAXENGINE3_COLOURPALETTE_H 7 | 8 | #include "Colour.h" 9 | #include 10 | 11 | namespace PAX { 12 | class ColourPalette { 13 | size_t current = 0; 14 | 15 | protected: 16 | virtual Colour get(size_t index) = 0; 17 | 18 | public: 19 | virtual ~ColourPalette() = 0; 20 | PAX_NODISCARD Colour getNext(); 21 | PAX_NODISCARD Colour getColourAt(size_t index); 22 | }; 23 | 24 | class RandomColourPalette : public ColourPalette { 25 | std::mt19937 rng; 26 | std::uniform_int_distribution distribution; 27 | 28 | public: 29 | RandomColourPalette(); 30 | 31 | ~RandomColourPalette() override; 32 | Colour get(size_t index) override; 33 | }; 34 | } 35 | 36 | #endif //PAXENGINE3_COLOURPALETTE_H 37 | -------------------------------------------------------------------------------- /include/paxcore/rendering/data/SpriteSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_SPRITESHEET_H 6 | #define PAXENGINE3_SPRITESHEET_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include "Texture.h" 12 | 13 | namespace PAX { 14 | class SpriteSheet { 15 | protected: 16 | std::shared_ptr texture; 17 | glm::ivec2 dimensions; 18 | 19 | public: 20 | SpriteSheet(const std::shared_ptr& texture, int columns, int rows); 21 | 22 | const std::shared_ptr getTexture() const; 23 | 24 | /// \return dimensions = (columns, rows) 25 | const glm::ivec2 & getDimensions() const; 26 | 27 | glm::vec2 getCellSize() const; 28 | }; 29 | } 30 | 31 | #endif //PAXENGINE3_SPRITESHEET_H 32 | -------------------------------------------------------------------------------- /include/paxcore/rendering/event/GraphicsShaderChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.10.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_GRAPHICSSHADERCHANGEDEVENT_H 6 | #define PAXENGINE3_GRAPHICSSHADERCHANGEDEVENT_H 7 | 8 | #include "ShaderChangedEvent.h" 9 | 10 | namespace PAX { 11 | class Graphics; 12 | 13 | struct GraphicsShaderChangedEvent : public ShaderChangedEvent { 14 | public: 15 | Graphics *graphics; 16 | 17 | GraphicsShaderChangedEvent(const std::shared_ptr &oldShader, const std::shared_ptr &newShader, Graphics *graphics) : 18 | ShaderChangedEvent(oldShader, newShader), graphics(graphics) {} 19 | }; 20 | } 21 | 22 | #endif //PAXENGINE3_GRAPHICSSHADERCHANGEDEVENT_H 23 | -------------------------------------------------------------------------------- /include/paxcore/rendering/event/ShaderChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.10.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SHADERCHANGEDEVENT_H 6 | #define PAXENGINE3_SHADERCHANGEDEVENT_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class Shader; 13 | struct ShaderChangedEvent : public Event { 14 | public: 15 | const std::shared_ptr oldShader, newShader; 16 | 17 | ShaderChangedEvent(const std::shared_ptr &oldShader, const std::shared_ptr &newShader) 18 | : oldShader(oldShader), newShader(newShader) 19 | {} 20 | }; 21 | } 22 | 23 | #endif //PAXENGINE3_SHADERCHANGEDEVENT_H 24 | -------------------------------------------------------------------------------- /include/paxcore/rendering/factory/MeshFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_MESHFACTORY_H 6 | #define PAXENGINE3_MESHFACTORY_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class MeshFactory { 12 | public: 13 | virtual std::shared_ptr create(const std::vector & vertices, const std::vector & faces) = 0; 14 | virtual std::shared_ptr create(const std::vector & vertices, const std::vector & faces) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_MESHFACTORY_H 19 | -------------------------------------------------------------------------------- /include/paxcore/rendering/factory/TextureFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 10/07/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_TEXTUREFACTORY_H 6 | #define PAXENGINE3_TEXTUREFACTORY_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class TextureFactory { 13 | public: 14 | PAX_NODISCARD virtual std::shared_ptr create(int width, int height) = 0; 15 | PAX_NODISCARD virtual std::shared_ptr create(int width, int height, Texture::PixelFormat pixelFormat, Texture::ColourType colourType) = 0; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_TEXTUREFACTORY_H 20 | -------------------------------------------------------------------------------- /include/paxcore/rendering/factory/ViewportFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_VIEWPORTFACTORY_H 6 | #define PAXENGINE3_VIEWPORTFACTORY_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class ViewportFactory { 13 | public: 14 | virtual Viewport * create() = 0; 15 | virtual Viewport * create(int x, int y, int w, int h, Viewport::ResizePolicy resizePolicy) = 0; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_VIEWPORTFACTORY_H 20 | -------------------------------------------------------------------------------- /include/paxcore/rendering/graphics/AssetGraphics.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.09.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_ASSETGRAPHICS_H 6 | #define PAXENGINE3_ASSETGRAPHICS_H 7 | 8 | #include 9 | #include "../Graphics.h" 10 | 11 | namespace PAX { 12 | class AssetGraphics : public Graphics { 13 | PAX_PROPERTY(AssetGraphics, PAX_PROPERTY_IS_CONCRETE) 14 | PAX_PROPERTY_DERIVES(Graphics) 15 | PAX_PROPERTY_IS_SINGLE 16 | 17 | protected: 18 | std::shared_ptr _asset; 19 | 20 | AssetGraphics(); 21 | 22 | public: 23 | explicit AssetGraphics(const std::shared_ptr & asset); 24 | 25 | void render(RenderOptions &renderOptions) override; 26 | PAX_NODISCARD ClassMetadata getMetadata() override; 27 | 28 | PAX_NODISCARD const std::shared_ptr & getAsset() const; 29 | }; 30 | } 31 | 32 | #endif //PAXENGINE3_ASSETGRAPHICS_H 33 | -------------------------------------------------------------------------------- /include/paxcore/rendering/graphics/SceneGraphGraphics.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 08.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SCENEGRAPHGRAPHICS_H 6 | #define PAXENGINE3_SCENEGRAPHGRAPHICS_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class SceneGraphGraphics : public Graphics { 12 | PAX_PROPERTY(PAX::SceneGraphGraphics, PAX_PROPERTY_IS_CONCRETE) 13 | PAX_PROPERTY_DERIVES(Graphics) 14 | PAX_PROPERTY_IS_SINGLE 15 | 16 | protected: 17 | SceneGraph _scenegraph; 18 | 19 | public: 20 | SceneGraphGraphics(); 21 | 22 | SceneGraph& getSceneGraph(); 23 | void render(RenderOptions &renderOptions) override; 24 | }; 25 | } 26 | 27 | #endif //PAXENGINE3_SCENEGRAPHGRAPHICS_H 28 | -------------------------------------------------------------------------------- /include/paxcore/rendering/interface/Renderable.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.05.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_RENDERABLE_H 6 | #define PAXENGINE3_RENDERABLE_H 7 | 8 | #include "../RenderOptions.h" 9 | 10 | namespace PAX { 11 | class Renderable { 12 | public: 13 | virtual ~Renderable() = 0; 14 | virtual void render(RenderOptions &renderOptions) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_RENDERABLE_H 19 | -------------------------------------------------------------------------------- /include/paxcore/rendering/light/AmbientLight.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 08.11.18. 3 | // 4 | 5 | #ifndef PAXENGINE3_AMBIENTLIGHT_H 6 | #define PAXENGINE3_AMBIENTLIGHT_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class AmbientLight : public WorldProperty { 12 | PAX_PROPERTY(AmbientLight, PAX_PROPERTY_IS_CONCRETE) 13 | PAX_PROPERTY_DERIVES(WorldProperty) 14 | PAX_PROPERTY_IS_SINGLE 15 | 16 | glm::vec3 color; 17 | 18 | public: 19 | explicit AmbientLight(const glm::vec3 & color = {0.2, 0.2, 0.2}); 20 | 21 | virtual void uploadTo(Shader* shader); 22 | 23 | void setColor(const glm::vec3 & color); 24 | PAX_NODISCARD const glm::vec3& getColor() const; 25 | 26 | PAX_NODISCARD ClassMetadata getMetadata() override; 27 | }; 28 | } 29 | 30 | #endif //PAXENGINE3_AMBIENTLIGHT_H 31 | -------------------------------------------------------------------------------- /include/paxcore/rendering/light/PointLight.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 10.09.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_POINTLIGHT_H 6 | #define PAXENGINE3_POINTLIGHT_H 7 | 8 | #include "Light.h" 9 | 10 | namespace PAX { 11 | class PointLight : public Light { 12 | PAX_PROPERTY(PointLight, PAX_PROPERTY_IS_CONCRETE) 13 | PAX_PROPERTY_DERIVES(Light) 14 | PAX_PROPERTY_IS_SINGLE 15 | 16 | public: 17 | explicit PointLight(const glm::vec4 & color = glm::vec4(1)); 18 | ~PointLight() override; 19 | 20 | void uploadTo(PAX::Shader * shader, int index) override; 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_POINTLIGHT_H 25 | -------------------------------------------------------------------------------- /include/paxcore/rendering/loader/NullTextureLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_NULLTEXTURELOADER_H 6 | #define PAXENGINE3_NULLTEXTURELOADER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class NullTextureLoader : public ResourceLoader { 13 | private: 14 | // Cache texture here, so that it will never be deleted. 15 | std::shared_ptr _texture = nullptr; 16 | 17 | public: 18 | NullTextureLoader(); 19 | ~NullTextureLoader() override; 20 | 21 | PAX_NODISCARD bool canLoad(Path path) const override; 22 | PAX_NODISCARD std::shared_ptr load(Path path) override; 23 | PAX_NODISCARD std::shared_ptr loadOrGetFromJson(Resources & resources, const nlohmann::json & j) const override; 24 | 25 | }; 26 | } 27 | 28 | #endif //PAXENGINE3_NULLTEXTURELOADER_H 29 | -------------------------------------------------------------------------------- /include/paxcore/rendering/loader/SpriteSheetLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 03.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_SPRITESHEETLOADER_H 6 | #define PAXENGINE3_SPRITESHEETLOADER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class SpriteSheetLoader : public ResourceLoader { 13 | public: 14 | std::shared_ptr loadOrGetFromJson(Resources & resources, const nlohmann::json & json) const override; 15 | PAX_NODISCARD bool canLoad(Path, int, int) const override; 16 | PAX_NODISCARD std::shared_ptr load(Path, int, int) override; 17 | }; 18 | } 19 | 20 | #endif //PAXENGINE3_SPRITESHEETLOADER_H 21 | -------------------------------------------------------------------------------- /include/paxcore/rendering/primitives/PrimitiveFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 27.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_PRIMITIVEFACTORY_H 6 | #define MESHFOLD_PRIMITIVEFACTORY_H 7 | 8 | #include "../data/Mesh.h" 9 | 10 | namespace PAX { 11 | struct PrimitiveFactory { 12 | static std::shared_ptr CreateQuad(bool upload = true); 13 | static std::shared_ptr CreateFrame(bool upload = true); 14 | static std::shared_ptr CreateScreenQuad(float left, float right, float bottom, float top); 15 | static std::shared_ptr CreateScreenFillingQuad(); 16 | static std::shared_ptr CreateCircle(int steps, bool upload = true); 17 | static std::shared_ptr CreateFilledCircle(int steps, bool upload = true); 18 | }; 19 | } 20 | 21 | #endif //MESHFOLD_PRIMITIVEFACTORY_H 22 | -------------------------------------------------------------------------------- /include/paxcore/rendering/renderpass/RenderPassFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 08.04.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_RENDERPASSFACTORY_H 6 | #define PAXENGINE3_RENDERPASSFACTORY_H 7 | 8 | #include 9 | #include "RenderPass.h" 10 | 11 | namespace PAX { 12 | class RenderPassFactory { 13 | public: 14 | PAX_NODISCARD virtual RenderPass * create(const glm::ivec2 & resolution) = 0; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_RENDERPASSFACTORY_H 19 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/generators/DefaultSceneGraphGeneratorFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 10/07/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_DEFAULTSCENEGRAPHGENERATORFACTORY_H 6 | #define PAXENGINE3_DEFAULTSCENEGRAPHGENERATORFACTORY_H 7 | 8 | #include "SceneGraphGeneratorFactory.h" 9 | 10 | namespace PAX { 11 | class DefaultSceneGraphGeneratorFactory : public SceneGraphGeneratorFactory { 12 | public: 13 | SceneGraphGenerator * create(int dimensions) override; 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_DEFAULTSCENEGRAPHGENERATORFACTORY_H 18 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/generators/SceneGraphGeneratorFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_SCENEGRAPHGENERATORFACTORY_H 6 | #define PAXENGINE3_SCENEGRAPHGENERATORFACTORY_H 7 | 8 | #include "SceneGraphGenerator.h" 9 | 10 | namespace PAX { 11 | class SceneGraphGeneratorFactory { 12 | public: 13 | virtual SceneGraphGenerator * create(int dimensions) = 0; 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_SCENEGRAPHGENERATORFACTORY_H 18 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/MeshNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 07.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MESHNODE_H 6 | #define PAXENGINE3_MESHNODE_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class MeshNode : public SceneGraph { 13 | std::shared_ptr _mesh = nullptr; 14 | 15 | public: 16 | MeshNode(); 17 | explicit MeshNode(const std::shared_ptr & mesh); 18 | ~MeshNode() override; 19 | 20 | void setMesh(const std::shared_ptr & mesh); 21 | PAX_NODISCARD const std::shared_ptr & getMesh() const; 22 | 23 | void render(RenderOptions &options) override; 24 | }; 25 | } 26 | 27 | #endif //PAXENGINE3_MESHNODE_H 28 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/ShadingNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.10.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SHADINGNODE_H 6 | #define PAXENGINE3_SHADINGNODE_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class ShadingNode : public SceneGraph { 13 | std::shared_ptr _shader = nullptr; 14 | ShaderPriority _priority = ShaderPriority::MUTABLE; 15 | 16 | public: 17 | ShadingNode(); 18 | ~ShadingNode() override; 19 | 20 | std::shared_ptr& getShader(); 21 | void setShader(const std::shared_ptr& shader); 22 | 23 | ShaderPriority getPriority() const; 24 | void setPriority(ShaderPriority priority); 25 | 26 | virtual void render(RenderOptions &renderOptions) override; 27 | }; 28 | } 29 | 30 | #endif //PAXENGINE3_SHADINGNODE_H 31 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/SortingNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.10.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SORTEDSCENEGRAPH_H 6 | #define PAXENGINE3_SORTEDSCENEGRAPH_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | template 13 | class SortingNode : public TypedSceneGraph { 14 | public: 15 | void render(RenderOptions &renderOptions) override { 16 | Sorter::sort(TypedSceneGraph::_children); 17 | TypedSceneGraph::render(renderOptions); 18 | } 19 | }; 20 | 21 | typedef SortingNode GraphicsSortingNode2D; 22 | typedef SortingNode GraphicsSortingNode3D; 23 | } 24 | 25 | #endif //PAXENGINE3_SORTEDSCENEGRAPH_H 26 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/SpriteSheetNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 10.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_SPRITESHEETNODE_H 6 | #define PAXENGINE3_SPRITESHEETNODE_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class SpriteSheetNode : public SceneGraph { 12 | glm::ivec2 _offset{}; 13 | glm::ivec2 _size; 14 | 15 | public: 16 | SpriteSheetNode(int columns, int rows); 17 | 18 | void setOffset(int xOffset, int yOffset); 19 | PAX_NODISCARD const glm::ivec2 & getOffset() const; 20 | void setSize(const glm::ivec2 & size); 21 | PAX_NODISCARD const glm::ivec2 & getSize() const; 22 | 23 | void render(RenderOptions &options) override; 24 | }; 25 | } 26 | 27 | #endif //PAXENGINE3_SPRITESHEETNODE_H 28 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/TexturingNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SPRITE_H 6 | #define PAXENGINE3_SPRITE_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace PAX { 14 | class TexturingNode : public SceneGraph { 15 | std::shared_ptr _texture; 16 | 17 | public: 18 | explicit TexturingNode(const std::shared_ptr &texture); 19 | void render(RenderOptions &options) override; 20 | 21 | void setTexture(const std::shared_ptr &texture); 22 | PAX_NODISCARD const std::shared_ptr& getTexture() const; 23 | }; 24 | } 25 | 26 | #endif //PAXENGINE3_SPRITE_H 27 | -------------------------------------------------------------------------------- /include/paxcore/rendering/scenegraph/nodes/TransformationNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_TRANSFORMATIONNODE_H 6 | #define PAXENGINE3_TRANSFORMATIONNODE_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class TransformationNode : public SceneGraph { 12 | glm::mat4 _transformation; 13 | 14 | public: 15 | explicit TransformationNode(const glm::mat4& transformation = glm::mat4(1.0)); 16 | 17 | void setTransformation(const glm::mat4& transformation); 18 | glm::mat4& getTransformation(); 19 | 20 | void render(RenderOptions& options) override; 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_TRANSFORMATIONNODE_H 25 | -------------------------------------------------------------------------------- /include/paxcore/service/FactoryService.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 19.05.18. 3 | // 4 | 5 | #ifndef PAXENGINE3_FACTORYSERVICE_H 6 | #define PAXENGINE3_FACTORYSERVICE_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | using FactoryService = TypeRegister; 12 | } 13 | 14 | 15 | #endif //PAXENGINE3_FACTORYSERVICE_H 16 | -------------------------------------------------------------------------------- /include/paxcore/service/WindowService.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 02.12.18. 3 | // 4 | 5 | #ifndef PAXENGINE3_WINDOWSERVICE_H 6 | #define PAXENGINE3_WINDOWSERVICE_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class Services; 13 | 14 | class WindowService { 15 | friend class Services; 16 | 17 | std::shared_ptr _window = nullptr; 18 | 19 | WindowService(); 20 | 21 | void initialize(); 22 | void terminate(); 23 | public: 24 | 25 | const std::shared_ptr& getWindow(); 26 | }; 27 | } 28 | 29 | #endif //PAXENGINE3_WINDOWSERVICE_H 30 | -------------------------------------------------------------------------------- /include/paxcore/state/StateMachine.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 29.01.2021. 3 | // 4 | 5 | #ifndef PAXENGINE3_STATEMACHINE_H 6 | #define PAXENGINE3_STATEMACHINE_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class StateMachine { 13 | public: 14 | struct State { 15 | // std::function states; 25 | State currentState; 26 | 27 | public: 28 | const State initialState; 29 | const EventHandler OnStateChanged; 30 | 31 | explicit StateMachine(const State & initialState, const std::vector & states); 32 | PAX_NODISCARD const State & getCurrentState() const; 33 | }; 34 | } 35 | 36 | #endif //PAXENGINE3_STATEMACHINE_H 37 | -------------------------------------------------------------------------------- /include/paxcore/system/GameSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 9/27/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_GAMESYSTEM_H 6 | #define PAXENGINE3_GAMESYSTEM_H 7 | 8 | #include "paxcore/world/event/WorldEvent.h" 9 | 10 | namespace PAX { 11 | class Game; 12 | 13 | class GameSystem : public Updateable { 14 | friend Game; 15 | Game * game = nullptr; 16 | 17 | void setGame(Game * game); 18 | 19 | public: 20 | GameSystem() = default; 21 | virtual ~GameSystem() = 0; 22 | 23 | virtual void initialize(Game*); 24 | virtual void terminate(Game*); 25 | 26 | Game * getGame(); 27 | 28 | virtual void onWorldAdded(WorldEvent &event) {}; 29 | virtual void onWorldRemoved(WorldEvent &event) {}; 30 | }; 31 | } 32 | 33 | #include "paxcore/Game.h" 34 | 35 | #endif //PAXENGINE3_GAMESYSTEM_H 36 | -------------------------------------------------------------------------------- /include/paxcore/system/gameentity/BehaviourSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_BEHAVIOURSYSTEM_H 6 | #define PAXENGINE3_BEHAVIOURSYSTEM_H 7 | 8 | #include "GameEntityPropertySystem.h" 9 | #include 10 | 11 | namespace PAX { 12 | class BehaviourSystem : public GameEntityPropertySystem { 13 | public: 14 | void update(UpdateOptions & options) override; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_BEHAVIOURSYSTEM_H 19 | -------------------------------------------------------------------------------- /include/paxcore/system/world/WorldBehaviourSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 24.03.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDBEHAVIOURSYSTEM_H 6 | #define PAXENGINE3_WORLDBEHAVIOURSYSTEM_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class WorldBehaviourSystem : public GameSystem { 12 | public: 13 | void update(UpdateOptions & options) override; 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_WORLDBEHAVIOURSYSTEM_H 18 | -------------------------------------------------------------------------------- /include/paxcore/world/WorldProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.09.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDPROPERTY_H 6 | #define PAXENGINE3_WORLDPROPERTY_H 7 | 8 | #include 9 | #include "World.h" 10 | 11 | namespace PAX { 12 | using WorldProperty = Property; 13 | } 14 | 15 | #endif //PAXENGINE3_WORLDPROPERTY_H 16 | -------------------------------------------------------------------------------- /include/paxcore/world/event/ActiveWorldChangedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 9/27/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_ACTIVEWORLDCHANGEDEVENT_H 6 | #define PAXENGINE3_ACTIVEWORLDCHANGEDEVENT_H 7 | 8 | #include "polypropylene/event/Event.h" 9 | #include "../World.h" 10 | 11 | namespace PAX { 12 | struct ActiveWorldChangedEvent : public Event { 13 | World *oldWorld, *newWorld; 14 | 15 | ActiveWorldChangedEvent(World* oldWorld, World* newWorld) : oldWorld(oldWorld), newWorld(newWorld) { 16 | 17 | } 18 | }; 19 | } 20 | 21 | 22 | 23 | #endif //PAXENGINE3_ACTIVEWORLDCHANGEDEVENT_H 24 | -------------------------------------------------------------------------------- /include/paxcore/world/event/GameEntityDespawnedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 08.05.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_GAMEENTITYDESPAWNEDEVENT_H 6 | #define PAXENGINE3_GAMEENTITYDESPAWNEDEVENT_H 7 | 8 | #include "../../gameentity/GameEntity.h" 9 | #include "../../gameentity/event/GameEntityEvent.h" 10 | 11 | namespace PAX { 12 | struct GameEntityDespawnedEvent : public GameEntityEvent { 13 | World* oldWorld = nullptr; 14 | GameEntityDespawnedEvent(GameEntity *entity, World* oldWorld) : GameEntityEvent(entity), oldWorld(oldWorld) {} 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_GAMEENTITYDESPAWNEDEVENT_H 19 | -------------------------------------------------------------------------------- /include/paxcore/world/event/GameEntitySpawnedEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 08.05.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_GAMEENTITYSPAWNEDEVENT_H 6 | #define PAXENGINE3_GAMEENTITYSPAWNEDEVENT_H 7 | 8 | #include "../../gameentity/GameEntity.h" 9 | #include "../../gameentity/event/GameEntityEvent.h" 10 | 11 | namespace PAX { 12 | struct GameEntitySpawnedEvent : public GameEntityEvent { 13 | GameEntitySpawnedEvent(GameEntity *entity) : GameEntityEvent(entity) {} 14 | }; 15 | } 16 | 17 | #endif //PAXENGINE3_GAMEENTITYSPAWNEDEVENT_H 18 | -------------------------------------------------------------------------------- /include/paxcore/world/event/WorldEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 9/27/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDEVENT_H 6 | #define PAXENGINE3_WORLDEVENT_H 7 | 8 | #include "polypropylene/event/Event.h" 9 | #include "../World.h" 10 | 11 | namespace PAX { 12 | struct WorldEvent : public Event { 13 | World * world; 14 | 15 | WorldEvent(World *world) : world(world) {} 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_WORLDEVENT_H 20 | -------------------------------------------------------------------------------- /include/paxcore/world/prefab/JsonWorldGameEntityParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 22.06.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONWORLDGAMEENTITYPARSER_H 6 | #define PAXENGINE3_JSONWORLDGAMEENTITYPARSER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | namespace Json { 13 | class JsonWorldGameEntityParser : public JsonEntityPrefabElementParser { 14 | public: 15 | ~JsonWorldGameEntityParser() override; 16 | void parse(nlohmann::json & node, World & w, JsonEntityPrefab & prefab, const VariableRegister & v) override; 17 | }; 18 | } 19 | } 20 | 21 | #endif //PAXENGINE3_JSONWORLDGAMEENTITYPARSER_H 22 | -------------------------------------------------------------------------------- /include/paxcore/world/prefab/JsonWorldPrefabInitParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 01/04/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONWORLDPREFABINITPARSER_H 6 | #define PAXENGINE3_JSONWORLDPREFABINITPARSER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | namespace Json { 13 | class JsonWorldPrefabInitParser : public JsonEntityPrefabElementParser { 14 | public: 15 | ~JsonWorldPrefabInitParser() override; 16 | void parse(nlohmann::json & node, World & w, JsonEntityPrefab & prefab, const VariableRegister & v) override; 17 | }; 18 | } 19 | } 20 | 21 | #endif //PAXENGINE3_JSONWORLDPREFABINITPARSER_H 22 | -------------------------------------------------------------------------------- /include/paxcore/world/property/WorldBehaviour.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 24.03.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDBEHAVIOUR_H 6 | #define PAXENGINE3_WORLDBEHAVIOUR_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class WorldBehaviour : public WorldProperty, public Updateable { 13 | PAX_PROPERTY(PAX::WorldBehaviour, PAX_PROPERTY_IS_ABSTRACT) 14 | PAX_PROPERTY_DERIVES(PAX::WorldProperty) 15 | PAX_PROPERTY_IS_MULTIPLE 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_WORLDBEHAVIOUR_H 20 | -------------------------------------------------------------------------------- /include/paxcore/world/scenegraph/WorldSceneGraph.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 07.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDSCENEGRAPH_H 6 | #define PAXENGINE3_WORLDSCENEGRAPH_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class World; 12 | 13 | class WorldSceneGraph : public SceneGraph { 14 | friend class World; 15 | World * world = nullptr; 16 | float z; 17 | 18 | public: 19 | void render(RenderOptions &renderOptions) override; 20 | PAX_NODISCARD World* getWorld() const; 21 | PAX_NODISCARD float getZ() const; 22 | 23 | PAX_NODISCARD bool operator<(const WorldSceneGraph& other) const; 24 | }; 25 | } 26 | 27 | #endif //PAXENGINE3_WORLDSCENEGRAPH_H 28 | -------------------------------------------------------------------------------- /include/paxcore/world/scenegraph/WorldSceneGraphFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_WORLDSCENEGRAPHFACTORY_H 6 | #define PAXENGINE3_WORLDSCENEGRAPHFACTORY_H 7 | 8 | #include "WorldSceneGraph.h" 9 | 10 | namespace PAX { 11 | class WorldSceneGraphFactory { 12 | public: 13 | virtual WorldSceneGraph * create(World *world) = 0; 14 | }; 15 | } 16 | #endif //PAXENGINE3_WORLDSCENEGRAPHFACTORY_H 17 | -------------------------------------------------------------------------------- /include/paxutil/Sleep.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SLEEP_H 6 | #define PAXENGINE3_SLEEP_H 7 | 8 | #include 9 | 10 | #if defined(PAX_OS_LINUX) || defined(PAX_OS_ANDROID) 11 | #include 12 | #elif defined(PAX_OS_WIN) 13 | #include 14 | #endif 15 | 16 | namespace PAX { 17 | void ThreadSleep(unsigned int milliseconds) { 18 | #if defined(PAX_OS_LINUX) || defined(PAX_OS_ANDROID) 19 | // usleep takes sleep time in microseconds (1 millionth of a second, 1 thousandth of a millisecond) 20 | usleep(milliseconds * 1000); 21 | #elif defined(PAX_OS_WIN) 22 | Sleep(milliseconds); 23 | #endif 24 | } 25 | } 26 | 27 | #endif //PAXENGINE3_SLEEP_H 28 | -------------------------------------------------------------------------------- /include/paxutil/genericfactory/GenericFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_GENERICFACTORY_H 6 | #define PAXENGINE3_GENERICFACTORY_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | class IGenericFactory { 12 | public: 13 | virtual ~IGenericFactory() = default; 14 | }; 15 | 16 | template 17 | class GenericFactoryT : public IGenericFactory {}; 18 | 19 | template 20 | class GenericFactory : public GenericFactoryT { 21 | public: 22 | virtual std::shared_ptr create(Params...) = 0; 23 | }; 24 | } 25 | 26 | #endif //PAXENGINE3_GENERICFACTORY_H 27 | -------------------------------------------------------------------------------- /include/paxutil/io/PrettyPrint.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 05.09.2022. 3 | // 4 | 5 | #ifndef PAXENGINE3_PRETTYPRINT_H 6 | #define PAXENGINE3_PRETTYPRINT_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace Util { 12 | void printWithLineNumbersTo(std::stringstream & target, const std::string & text); 13 | void printWithLineNumbersTo(std::stringstream & target, const std::string & text, unsigned int maxLineNoDigits); 14 | } 15 | } 16 | 17 | #endif //PAXENGINE3_PRETTYPRINT_H 18 | -------------------------------------------------------------------------------- /include/paxutil/lib/LibIncludes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_LOGINCLUDES_H 6 | #define PAXENGINE3_LOGINCLUDES_H 7 | 8 | #include "GlmIncludes.h" 9 | 10 | #endif //PAXENGINE3_LOGINCLUDES_H 11 | -------------------------------------------------------------------------------- /include/paxutil/macros/Functional.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 20.02.21. 3 | // 4 | 5 | #ifndef MESHFOLD_FUNCTIONAL_H 6 | #define MESHFOLD_FUNCTIONAL_H 7 | 8 | #define _PAX_FORALL(collection, f, eval) do { for (const auto& x : collection) { x eval f; } } while(0) 9 | #define PAX_FORALL(collection, f) _PAX_FORALL(collection, f, .) 10 | #define PAX_FORALL_ON_POINTERS(collection, f) _PAX_FORALL(collection, f, ->) 11 | 12 | #endif //MESHFOLD_FUNCTIONAL_H 13 | -------------------------------------------------------------------------------- /include/paxutil/macros/PlatformIncludes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 01.09.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PLATFORMINCLUDES_H 6 | #define PAXENGINE3_PLATFORMINCLUDES_H 7 | 8 | #include "polypropylene/definitions/OSDetection.h" 9 | 10 | #ifdef PAX_OS_WIN 11 | // Disable min and max macros in windows.h as they conflict with std functions min/max and glm 12 | #ifndef NOMINMAX 13 | #define NOMINMAX 14 | #endif 15 | #endif 16 | 17 | #endif //PAXENGINE3_PLATFORMINCLUDES_H 18 | -------------------------------------------------------------------------------- /include/paxutil/math/Basis.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 11.09.18. 3 | // 4 | 5 | #ifndef PAXENGINE3_BASIS_H 6 | #define PAXENGINE3_BASIS_H 7 | 8 | #include "../lib/GlmIncludes.h" 9 | 10 | namespace PAX { 11 | namespace Math { 12 | struct Basis { 13 | const glm::vec3 Forward; 14 | const glm::vec3 Up; 15 | const glm::vec3 Left; 16 | 17 | Basis(const glm::vec3 &forward, const glm::vec3 &up, const glm::vec3 &left) : 18 | Forward(forward), Up(up), Left(left) {} 19 | }; 20 | 21 | const Basis OpenGLBasis = Basis( 22 | {0, 0, -1}, 23 | {0, 1, 0}, 24 | {-1, 0, 0}); 25 | } 26 | } 27 | 28 | #endif //PAXENGINE3_BASIS_H 29 | -------------------------------------------------------------------------------- /include/paxutil/math/Conversion.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_CONVERSION_H 6 | #define PAXENGINE3_CONVERSION_H 7 | 8 | namespace PAX { 9 | namespace Util { 10 | namespace Conversion { 11 | int coordinatesToIndex(int w, int x, int y); 12 | } 13 | } 14 | } 15 | 16 | #endif //PAXENGINE3_CONVERSION_H 17 | -------------------------------------------------------------------------------- /include/paxutil/math/Functions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 20.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_FUNCTIONS_H 6 | #define PAXENGINE3_FUNCTIONS_H 7 | 8 | #include "../lib/GlmIncludes.h" 9 | 10 | namespace PAX { 11 | namespace Math { 12 | template 13 | int sign(T val) { 14 | return (T(0) < val) - (val < T(0)); 15 | } 16 | 17 | template 18 | int signPositiveNull(T val) { 19 | return (T(0) <= val) - (val < T(0)); 20 | } 21 | 22 | template 23 | T clamp(T value, T min, T max) { 24 | return std::max(std::min(value, max), min); 25 | } 26 | 27 | glm::vec2 angleToDirection(float angleInRadians); 28 | float directionToRadians(const glm::vec2 & direction); 29 | } 30 | } 31 | 32 | #endif //PAXENGINE3_FUNCTIONS_H 33 | -------------------------------------------------------------------------------- /include/paxutil/math/MathDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 10.09.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_MATHDEFINES_H 6 | #define PAXENGINE3_MATHDEFINES_H 7 | 8 | #define _USE_MATH_DEFINES 9 | #include 10 | 11 | #ifndef M_PI 12 | #include 13 | #endif 14 | 15 | #undef _USE_MATH_DEFINES 16 | 17 | #endif //PAXENGINE3_MATHDEFINES_H 18 | -------------------------------------------------------------------------------- /include/paxutil/math/json/JsonToTransformation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 11/03/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONTOTRANSFORMATION_H 6 | #define PAXENGINE3_JSONTOTRANSFORMATION_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | // TODO: Use the actual json interface 13 | namespace Json { 14 | class JsonToTransformation { 15 | public: 16 | JsonToTransformation(); 17 | 18 | void convert(const nlohmann::json & node, Transformation & t); 19 | }; 20 | } 21 | } 22 | 23 | #endif //PAXENGINE3_JSONTOTRANSFORMATION_H 24 | -------------------------------------------------------------------------------- /include/paxutil/property/construction/json/parsers/JsonEntityPrefabTransformationParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 11.03.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_JSONENTITYPREFABTRANSFORMATIONPARSER_H 6 | #define PAXENGINE3_JSONENTITYPREFABTRANSFORMATIONPARSER_H 7 | 8 | #include "polypropylene/serialisation/json/property/JsonEntityPrefab.h" 9 | #include "paxutil/math/json/JsonToTransformation.h" 10 | 11 | namespace PAX { 12 | namespace Json { 13 | template 14 | class JsonEntityPrefabTransformationParser : public JsonEntityPrefabElementParser { 15 | public: 16 | void parse(nlohmann::json & node, C & c, JsonEntityPrefab & prefab, const VariableRegister & v) override { 17 | JsonToTransformation converter; 18 | converter.convert(node, c.getTransformation()); 19 | } 20 | }; 21 | } 22 | } 23 | 24 | #endif //PAXENGINE3_JSONENTITYPREFABTRANSFORMATIONPARSER_H 25 | -------------------------------------------------------------------------------- /include/paxutil/reflection/EngineFieldFlags.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 02.01.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_ENGINEFIELDFLAGS_H 6 | #define PAXENGINE3_ENGINEFIELDFLAGS_H 7 | 8 | #include 9 | 10 | namespace PAX::EngineFieldFlags { 11 | constexpr FieldFlag IsResource = Field::CustomFlagsBegin; 12 | } 13 | 14 | #endif //PAXENGINE3_ENGINEFIELDFLAGS_H 15 | -------------------------------------------------------------------------------- /include/paxutil/reflection/MemberCheck.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 16.07.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_MEMBERCHECK_H 6 | #define PAXENGINE3_MEMBERCHECK_H 7 | 8 | #include 9 | 10 | #define PAX_CREATE_MEMBER_CHECKER_FOR_NAME(memberName) \ 11 | namespace PAX { \ 12 | namespace Util { \ 13 | template \ 14 | struct HasMember_##memberName : std::false_type { }; \ 15 | template \ 16 | struct HasMember_##memberName : std::true_type { }; \ 17 | } \ 18 | } 19 | 20 | #define PAX_HAS_MEMBER(type, memberName) PAX::Util::HasMember_##memberName::value 21 | 22 | #endif //PAXENGINE3_MEMBERCHECK_H 23 | -------------------------------------------------------------------------------- /include/paxutil/reflection/TypeRegister.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_TYPEREGISTER_H 6 | #define PAXENGINE3_TYPEREGISTER_H 7 | 8 | #include "polypropylene/reflection/TypeMap.h" 9 | 10 | namespace PAX { 11 | class TypeRegister { 12 | TypeMap factories; 13 | 14 | public: 15 | TypeRegister(); 16 | void set(const TypeId & type, void* factory); 17 | 18 | template 19 | T* get() { 20 | const auto& factory = factories.find(paxtypeid(T)); 21 | if (factory != factories.end()) 22 | return static_cast(factory->second); 23 | return nullptr; 24 | } 25 | }; 26 | } 27 | 28 | #endif //PAXENGINE3_TYPEREGISTER_H 29 | -------------------------------------------------------------------------------- /include/paxutil/stdutils/OstreamOverloads.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_OSTREAMOVERLOADS_H 6 | #define PAXENGINE3_OSTREAMOVERLOADS_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../lib/GlmIncludes.h" // allows printing of glm types 13 | 14 | template 15 | std::ostream& operator<<(std::ostream& os, const std::vector & v) 16 | { 17 | os << "std::vector<" << PAX::Reflection::GetTypeName() << ">["; 18 | for (const T & t : v) 19 | os << t; 20 | return os << "]"; 21 | } 22 | 23 | #endif //PAXENGINE3_OSTREAMOVERLOADS_H 24 | -------------------------------------------------------------------------------- /include/paxutil/stdutils/Templates.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 20.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_TEMPLATES_H 6 | #define PAXENGINE3_TEMPLATES_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace Util { 12 | template 13 | using conditional_t_cpp14 = typename std::conditional::type; 14 | } 15 | } 16 | 17 | #endif //PAXENGINE3_TEMPLATES_H 18 | -------------------------------------------------------------------------------- /libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Polypropylene) -------------------------------------------------------------------------------- /libs/setupLinks.bat: -------------------------------------------------------------------------------- 1 | mklink /J Polypropylene "../../polypropylene/" 2 | pause -------------------------------------------------------------------------------- /libs/setupLinks.sh: -------------------------------------------------------------------------------- 1 | ln -s "../../Polypropylene/" "Polypropylene" 2 | read -p "Press enter to continue" 3 | -------------------------------------------------------------------------------- /license/README-SDL.txt: -------------------------------------------------------------------------------- 1 | 2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library 5 | designed to make it easy to write multi-media software, such as games 6 | and emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | https://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the zlib license: 12 | http://www.zlib.net/zlib_license.html 13 | 14 | -------------------------------------------------------------------------------- /license/SDL2_ttf/LICENSE.freetype.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/license/SDL2_ttf/LICENSE.freetype.txt -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(paxsdl) 2 | add_subdirectory(paxopengl) 3 | add_subdirectory(paxphysics) 4 | add_subdirectory(paxtiles) 5 | add_subdirectory(paxassetimport) 6 | add_subdirectory(paxfont) 7 | add_subdirectory(paximgui) 8 | 9 | add_subdirectory(games/PlatformerDemo) 10 | add_subdirectory(games/TileDemo) 11 | add_subdirectory(games/PlaygroundDemo) 12 | add_subdirectory(games/RayMarcher) -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/include/platformerdemo/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXPLATFORMERDEMO_PLUGIN_H 6 | #define PAXENGINE3_PAXPLATFORMERDEMO_PLUGIN_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace PlatformerDemo { 12 | class Plugin : public PAX::EnginePlugin { 13 | public: 14 | void checkDependencies(const std::vector & plugins) const override; 15 | void registerProperties() override; 16 | }; 17 | } 18 | } 19 | 20 | #endif //PAXENGINE3_PAXPLATFORMERDEMO_PLUGIN_H 21 | -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/src/behaviour/Dance2D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include "platformerdemo/behaviour/Dance2D.h" 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::Dance2D) 9 | } -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/src/behaviour/DragNDrop.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include "platformerdemo/behaviour/DragNDrop.h" 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::DragNDrop) 9 | } -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/src/behaviour/PlayerControls.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include "platformerdemo/behaviour/PlayerControls.h" 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::PlayerControls) 9 | } -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/src/behaviour/PlayerSpriteAnimation.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include "platformerdemo/behaviour/PlayerSpriteAnimation.h" 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::PlayerSpriteAnimation) 9 | } -------------------------------------------------------------------------------- /plugins/games/PlatformerDemo/src/behaviour/ProfileGameLoopBehaviour.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include "platformerdemo/behaviour/ProfileGameLoopBehaviour.h" 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::ProfileGameLoopBehaviour) 9 | } -------------------------------------------------------------------------------- /plugins/games/PlaygroundDemo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(PlaygroundDemo) 2 | 3 | set(PAX_PLAYGROUNDDEMO_SOURCE_FILES src/main.cpp src/Plugin.cpp) 4 | 5 | include_directories(include) 6 | include_directories(../../paxsdl/include) 7 | include_directories(../../paxopengl/include) 8 | include_directories(../../paxassetimport/include) 9 | set(HEADERS_FOR_CLION 10 | include/playgrounddemo/Plugin.h 11 | include/playgrounddemo/Demo.h) 12 | 13 | add_executable(PlaygroundDemo ${PAX_PLAYGROUNDDEMO_SOURCE_FILES} ${HEADERS_FOR_CLION}) 14 | target_link_libraries(PlaygroundDemo paxassimp paxutil paxsdl paxopengl paxcore) 15 | set_target_properties(PlaygroundDemo PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/Demo) -------------------------------------------------------------------------------- /plugins/games/PlaygroundDemo/include/playgrounddemo/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXPLAYGROUNDDEMO_PLUGIN_H 6 | #define PAXENGINE3_PAXPLAYGROUNDDEMO_PLUGIN_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace PlaygroundDemo { 12 | class Plugin : public PAX::EnginePlugin { 13 | public: 14 | Plugin(); 15 | }; 16 | } 17 | } 18 | 19 | #endif //PAXENGINE3_PAXPLAYGROUNDDEMO_PLUGIN_H 20 | -------------------------------------------------------------------------------- /plugins/games/PlaygroundDemo/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include "playgrounddemo/Plugin.h" 6 | 7 | #include 8 | 9 | namespace PAX { 10 | namespace PlaygroundDemo { 11 | Plugin::Plugin() : EnginePlugin() {} 12 | } 13 | } -------------------------------------------------------------------------------- /plugins/games/RayMarcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(RayMarcher) 2 | 3 | set(PAX_RAYMARCHER_SOURCE_FILES 4 | src/main.cpp 5 | src/Plugin.cpp) 6 | 7 | include_directories(include) 8 | include_directories(../../paxsdl/include) 9 | include_directories(../../paxopengl/include) 10 | 11 | set(HEADERS_FOR_CLION 12 | include/raymarcher/Plugin.h 13 | include/raymarcher/Demo.h) 14 | 15 | add_executable(RayMarcher ${PAX_RAYMARCHER_SOURCE_FILES} ${HEADERS_FOR_CLION}) 16 | target_link_libraries(RayMarcher paxutil paxsdl paxopengl paxcore) 17 | set_target_properties(RayMarcher PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/Demo) -------------------------------------------------------------------------------- /plugins/games/RayMarcher/include/raymarcher/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXTILEDEMO_PLUGIN_H 6 | #define PAXENGINE3_PAXTILEDEMO_PLUGIN_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace RayMarcher { 12 | class Plugin : public PAX::EnginePlugin { 13 | public: 14 | void checkDependencies(const std::vector & plugins) const override; 15 | }; 16 | } 17 | } 18 | 19 | #endif //PAXENGINE3_PAXTILEDEMO_PLUGIN_H 20 | -------------------------------------------------------------------------------- /plugins/games/RayMarcher/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include "raymarcher/Plugin.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | namespace RayMarcher { 13 | void Plugin::checkDependencies(const std::vector &plugins) const { 14 | EnginePlugin::checkDependencies(plugins); 15 | static EnginePluginTypedDependencies< 16 | PAX::SDL::SDLPlugin, 17 | PAX::OpenGL::OpenGLPlugin, 18 | PAX::SDL::OpenGL::SDLOpenGLPlugin> dependencies("PAX::RayMarcher::Plugin"); 19 | dependencies.checkDependencies(plugins); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /plugins/games/TileDemo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(TileDemo) 2 | 3 | set(PAX_TILEDEMO_SOURCE_FILES 4 | src/main.cpp 5 | src/Plugin.cpp) 6 | 7 | include_directories(include) 8 | include_directories(../../paxsdl/include) 9 | include_directories(../../paxopengl/include) 10 | include_directories(../../paxphysics/include) 11 | include_directories(../../paxtiles/include) 12 | 13 | set(HEADERS_FOR_CLION 14 | include/tiledemo/Plugin.h 15 | include/tiledemo/Demo.h) 16 | 17 | add_executable(TileDemo ${PAX_TILEDEMO_SOURCE_FILES} ${HEADERS_FOR_CLION}) 18 | target_link_libraries(TileDemo paxutil paxsdl paxopengl paxtiles paxcore) 19 | set_target_properties(TileDemo PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/Demo) -------------------------------------------------------------------------------- /plugins/games/TileDemo/include/tiledemo/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXTILEDEMO_PLUGIN_H 6 | #define PAXENGINE3_PAXTILEDEMO_PLUGIN_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace TileDemo { 12 | class Plugin : public PAX::EnginePlugin { 13 | public: 14 | void checkDependencies(const std::vector & plugins) const override; 15 | }; 16 | } 17 | } 18 | 19 | #endif //PAXENGINE3_PAXTILEDEMO_PLUGIN_H 20 | -------------------------------------------------------------------------------- /plugins/games/TileDemo/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include "tiledemo/Plugin.h" 6 | #include "../../../paxphysics/include/paxphysics/Plugin.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace PAX { 14 | namespace TileDemo { 15 | void Plugin::checkDependencies(const std::vector &plugins) const { 16 | EnginePlugin::checkDependencies(plugins); 17 | static EnginePluginTypedDependencies< 18 | PAX::SDL::SDLPlugin, 19 | PAX::OpenGL::OpenGLPlugin, 20 | PAX::SDL::OpenGL::SDLOpenGLPlugin, 21 | PAX::Physics::Plugin, 22 | PAX::Tiles::Plugin> dependencies("PAX::TileDemo::Plugin"); 23 | dependencies.checkDependencies(plugins); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /plugins/paxassetimport/include/paxassimp/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 6 | #define PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 7 | 8 | #include 9 | #include "AssimpResourceLoader.h" 10 | 11 | namespace PAX { 12 | namespace AssetImport { 13 | class Plugin : public PAX::EnginePlugin { 14 | AssimpResourceLoader assimpResourceLoader; 15 | 16 | public: 17 | void registerResourceLoaders(PAX::Resources &resources) override; 18 | void registerJsonWriters(Json::JsonFieldWriterRegister & writerRegister) override; 19 | }; 20 | } 21 | } 22 | 23 | #endif //PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 24 | -------------------------------------------------------------------------------- /plugins/paxassetimport/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include 6 | #include 7 | #include "paxassimp/Plugin.h" 8 | 9 | namespace PAX { 10 | namespace AssetImport { 11 | void Plugin::registerResourceLoaders(PAX::Resources &resources) { 12 | resources.registerLoader(&assimpResourceLoader); 13 | } 14 | 15 | void Plugin::registerJsonWriters(Json::JsonFieldWriterRegister &writerRegister) { 16 | static JsonResourceFieldWriter assetWriter; 17 | assetWriter.registerAt(writerRegister); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /plugins/paxfont/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(HEADERS_FOR_CLION 2 | include/paxfont/Plugin.h 3 | include/paxfont/bitmap/BitmapFont.h 4 | include/paxfont/bitmap/BitmapText.h 5 | include/paxfont/bitmap/loader/XMLBitmapFontLoader.h) 6 | 7 | set(SOURCE_FILES 8 | src/Plugin.cpp 9 | src/bitmap/BitmapFont.cpp 10 | src/bitmap/BitmapText.cpp 11 | src/bitmap/loader/XMLBitmapFontLoader.cpp) 12 | 13 | include_directories(include) 14 | 15 | add_library(paxfont ${SOURCE_FILES} ${HEADERS_FOR_CLION}) 16 | #target_link_libraries(paxfont) -------------------------------------------------------------------------------- /plugins/paxfont/include/paxfont/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXFONTPLUGIN_PLUGIN_H 6 | #define PAXENGINE3_PAXFONTPLUGIN_PLUGIN_H 7 | 8 | #include 9 | #include 10 | #include "paxutil/resources/JsonResourceFieldWriter.h" 11 | 12 | namespace PAX::Font { 13 | class Plugin : public PAX::EnginePlugin { 14 | XMLBitmapFontLoader xmlBitmapFontLoader; 15 | JsonResourceFieldWriter bitmapFontJsonResourceWriter; 16 | 17 | public: 18 | // void checkDependencies(const std::vector & plugins) const override; 19 | void registerResourceLoaders(PAX::Resources &resources) override; 20 | void registerJsonWriters(::PAX::Json::JsonFieldWriterRegister & writerRegister) override; 21 | void registerProperties() override; 22 | }; 23 | } 24 | 25 | #endif //PAXENGINE3_PAXFONTPLUGIN_PLUGIN_H 26 | -------------------------------------------------------------------------------- /plugins/paxfont/include/paxfont/bitmap/loader/XMLBitmapFontLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 14.03.2021. 3 | // 4 | 5 | #ifndef PAXENGINE3_XMLBITMAPFONTLOADER_H 6 | #define PAXENGINE3_XMLBITMAPFONTLOADER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX::Font { 12 | class XMLBitmapFontLoader : public ResourceLoader { 13 | public: 14 | PAX_NODISCARD bool canLoad(Path p) const override; 15 | PAX_NODISCARD std::shared_ptr load(Path p) override; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_XMLBITMAPFONTLOADER_H 20 | -------------------------------------------------------------------------------- /plugins/paxfont/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include "paxfont/Plugin.h" 6 | #include "paxfont/bitmap/BitmapText.h" 7 | #include "polypropylene/property/PropertyFactory.h" 8 | 9 | namespace PAX::Font { 10 | void Plugin::registerResourceLoaders(Resources &resources) { 11 | resources.registerLoader(&xmlBitmapFontLoader); 12 | } 13 | 14 | void Plugin::registerJsonWriters(::PAX::Json::JsonFieldWriterRegister &writerRegister) { 15 | bitmapFontJsonResourceWriter.registerAt(writerRegister); 16 | 17 | static Json::JsonFieldWriter textLineWriter; 18 | writerRegister.registerWriter(paxtypeid(TextLine), &textLineWriter); 19 | 20 | static Json::JsonFieldWriter textBlockWriter; 21 | writerRegister.registerWriter(paxtypeid(TextBlock), &textBlockWriter); 22 | } 23 | 24 | void Plugin::registerProperties() { 25 | PAX_PROPERTY_REGISTER(BitmapText); 26 | } 27 | } -------------------------------------------------------------------------------- /plugins/paxgeneration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(HEADERS_FOR_CLION 2 | include/generation/terrain/TerrainGenerator.h 3 | include/generation/terrain/Terrain.h 4 | include/generation/grid/GridGenerator.h 5 | include/generation/grid/Grid.h 6 | ) 7 | 8 | add_library(paxgeneration ${HEADERS_FOR_CLION} 9 | src/terrain/TerrainGenerator.cpp src/terrain/Terrain.cpp src/grid/GridGenerator.cpp) 10 | target_link_libraries(paxgeneration) -------------------------------------------------------------------------------- /plugins/paxgeneration/include/grid/Grid.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 07.12.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_GRID_H 6 | #define PAXENGINE3_GRID_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | struct Grid : public CPUMesh { 12 | float width = 0; 13 | float depth = 0; 14 | 15 | int subdivsX = 0, subdivsZ = 0; 16 | 17 | Grid(std::vector &vertices, std::vector faces, float width, float depth, int subdivsX, int subdivsZ) : CPUMesh(vertices, faces), width(width), depth(depth), subdivsX(subdivsX), subdivsZ(subdivsZ) { 18 | } 19 | 20 | glm::vec3& getVertexAt(int x, int z) { 21 | assert(0 <= x && x <= subdivsX); 22 | assert(0 <= z && z <= subdivsZ); 23 | 24 | return vertices[z + x*subdivsZ]; 25 | } 26 | }; 27 | } 28 | 29 | #endif //PAXENGINE3_GRID_H 30 | -------------------------------------------------------------------------------- /plugins/paxgeneration/include/grid/GridGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_GRIDGENERATOR_H 6 | #define PAXENGINE3_GRIDGENERATOR_H 7 | 8 | #include 9 | #include "Grid.h" 10 | 11 | namespace PAX { 12 | class GridGenerator { 13 | public: 14 | Grid generateGrid(float width, float depth, int subdivsX, int subdivsY); 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_GRIDGENERATOR_H 19 | -------------------------------------------------------------------------------- /plugins/paxgeneration/include/terrain/Terrain.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_TERRAIN_H 6 | #define PAXENGINE3_TERRAIN_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class Terrain : public Graphics { 13 | PAX_ENTITYCOMPONENT_BODY(Graphics, false) 14 | private: 15 | Mesh* mesh; 16 | 17 | public: 18 | Terrain(Mesh* mesh); 19 | 20 | void render(RenderOptions& renderOptions) override; 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_TERRAIN_H 25 | -------------------------------------------------------------------------------- /plugins/paxgeneration/include/terrain/TerrainGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_TERRAINGENERATOR_H 6 | #define PAXENGINE3_TERRAINGENERATOR_H 7 | 8 | #include "../grid/Grid.h" 9 | #include "Terrain.h" 10 | 11 | namespace PAX { 12 | class TerrainGenerator { 13 | void randomizeHeights(Grid& grid); 14 | 15 | public: 16 | Terrain* generateTerrain(); 17 | }; 18 | } 19 | 20 | #endif //PAXENGINE3_TERRAINGENERATOR_H 21 | -------------------------------------------------------------------------------- /plugins/paxgeneration/src/terrain/Terrain.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 11/20/17. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace PAX { 10 | Terrain::Terrain(Mesh *mesh) : mesh(mesh) { 11 | 12 | } 13 | 14 | void Terrain::render(RenderOptions &renderOptions) { 15 | Graphics::render(renderOptions); 16 | 17 | Shader *shader = renderOptions.getShaderOptions().getShader(); 18 | 19 | Camera *cam = renderOptions.getCamera(); 20 | glm::mat4 model = renderOptions.getTransformation(); 21 | const glm::mat4 &view = cam->getViewTransform(); 22 | glm::mat4 modelview = view * model; 23 | 24 | shader->setUniform("modelview", modelview); 25 | shader->setUniform("projection", cam->getProjection()->toMatrix()); 26 | 27 | mesh->render(renderOptions); 28 | } 29 | } -------------------------------------------------------------------------------- /plugins/paximgui/ImguiPPParser.g4: -------------------------------------------------------------------------------- 1 | parser grammar ImguiPPParser; 2 | 3 | options { tokenVocab=ImguiPPLexer; } 4 | 5 | program: imgui_uniform* EOF; 6 | 7 | imgui_annotation : IMGUI; 8 | imgui_ranged_annotation: IMGUI_RANGED BRACKET_L from=IDENTIFIER COMMA to=IDENTIFIER BRACKET_R; 9 | 10 | imgui_uniform: (imgui_annotation | imgui_ranged_annotation) type=IDENTIFIER name=IDENTIFIER (EQUALS initialValue=UNIFORM_INITIAL_VALUE UNIFORM_INITIALIZATION_END | SEMICOLON); 11 | -------------------------------------------------------------------------------- /plugins/paximgui/genImguiPPAntlrFiles.sh: -------------------------------------------------------------------------------- 1 | java -jar ../../res/antlr/antlr-4.10.1-complete.jar -Dlanguage="Cpp" -package Antlr -listener -visitor -o "imguipp_antlr/" "ImguiPPParser.g4" "ImguiPPLexer.g4" -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/cpp/README.txt: -------------------------------------------------------------------------------- 1 | 2 | imgui_stdlib.h + imgui_stdlib.cpp 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | imgui_scoped.h 7 | [Experimental, not currently in main repository] 8 | Additional header file with some RAII-style wrappers for common Dear ImGui functions. 9 | Try by merging: https://github.com/ocornut/imgui/pull/2197 10 | Discuss at: https://github.com/ocornut/imgui/issues/2096 11 | 12 | See more C++ related extension on Wiki 13 | https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness 14 | -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/debuggers/README.txt: -------------------------------------------------------------------------------- 1 | 2 | HELPER FILES FOR POPULAR DEBUGGERS 3 | 4 | imgui.gdb 5 | GDB: disable stepping into trivial functions. 6 | (read comments inside file for details) 7 | 8 | imgui.natstepfilter 9 | Visual Studio Debugger: disable stepping into trivial functions. 10 | (read comments inside file for details) 11 | 12 | imgui.natvis 13 | Visual Studio Debugger: describe Dear ImGui types for better display. 14 | With this, types like ImVector<> will be displayed nicely in the debugger. 15 | (read comments inside file for details) 16 | 17 | -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/debuggers/imgui.gdb: -------------------------------------------------------------------------------- 1 | # GDB configuration to aid debugging experience 2 | 3 | # To enable these customizations edit $HOME/.gdbinit (or ./.gdbinit if local gdbinit is enabled) and add: 4 | # add-auto-load-safe-path /path/to/imgui.gdb 5 | # source /path/to/imgui.gdb 6 | # 7 | # More Information at: 8 | # * https://sourceware.org/gdb/current/onlinedocs/gdb/gdbinit-man.html 9 | # * https://sourceware.org/gdb/current/onlinedocs/gdb/Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory 10 | 11 | # Disable stepping into trivial functions 12 | skip -rfunction Im(Vec2|Vec4|Strv|Vector|Span)::.+ 13 | -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/plugins/paximgui/imgui/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /plugins/paximgui/imgui/misc/single_file/imgui_single_file.h: -------------------------------------------------------------------------------- 1 | // dear imgui: single-file wrapper include 2 | // We use this to validate compiling all *.cpp files in a same compilation unit. 3 | // Users of that technique (also called "Unity builds") can generally provide this themselves, 4 | // so we don't really recommend you use this in your projects. 5 | 6 | // Do this: 7 | // #define IMGUI_IMPLEMENTATION 8 | // Before you include this file in *one* C++ file to create the implementation. 9 | // Using this in your project will leak the contents of imgui_internal.h and ImVec2 operators in this compilation unit. 10 | #include "../../imgui.h" 11 | 12 | #ifdef IMGUI_IMPLEMENTATION 13 | #include "../../imgui.cpp" 14 | #include "../../imgui_demo.cpp" 15 | #include "../../imgui_draw.cpp" 16 | #include "../../imgui_tables.cpp" 17 | #include "../../imgui_widgets.cpp" 18 | #endif 19 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPLexer.tokens: -------------------------------------------------------------------------------- 1 | WS=1 2 | SINGLELINE_COMMENT=2 3 | MULTILINE_COMMENT=3 4 | MACRO_LINE=4 5 | LINEBREAK=5 6 | IMGUI=6 7 | IMGUI_RANGED=7 8 | ANYTHING_ELSE=8 9 | WS2=9 10 | BRACKET_L=10 11 | BRACKET_R=11 12 | IDENTIFIER=12 13 | COMMA=13 14 | EQUALS=14 15 | SEMICOLON=15 16 | UNIFORM_INITIAL_VALUE=16 17 | UNIFORM_INITIALIZATION_END=17 18 | 'IMGUI_RANGED'=7 19 | '('=10 20 | ')'=11 21 | ','=13 22 | '='=14 23 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParser.tokens: -------------------------------------------------------------------------------- 1 | WS=1 2 | SINGLELINE_COMMENT=2 3 | MULTILINE_COMMENT=3 4 | MACRO_LINE=4 5 | LINEBREAK=5 6 | IMGUI=6 7 | IMGUI_RANGED=7 8 | ANYTHING_ELSE=8 9 | WS2=9 10 | BRACKET_L=10 11 | BRACKET_R=11 12 | IDENTIFIER=12 13 | COMMA=13 14 | EQUALS=14 15 | SEMICOLON=15 16 | UNIFORM_INITIAL_VALUE=16 17 | UNIFORM_INITIALIZATION_END=17 18 | 'IMGUI_RANGED'=7 19 | '('=10 20 | ')'=11 21 | ','=13 22 | '='=14 23 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParserBaseListener.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Generated from ImguiPPParser.g4 by ANTLR 4.10.1 3 | 4 | 5 | #include "ImguiPPParserBaseListener.h" 6 | 7 | 8 | using namespace Antlr; 9 | 10 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParserBaseVisitor.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Generated from ImguiPPParser.g4 by ANTLR 4.10.1 3 | 4 | 5 | #include "ImguiPPParserBaseVisitor.h" 6 | 7 | 8 | using namespace Antlr; 9 | 10 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParserListener.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Generated from ImguiPPParser.g4 by ANTLR 4.10.1 3 | 4 | 5 | #include "ImguiPPParserListener.h" 6 | 7 | 8 | using namespace Antlr; 9 | 10 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParserVisitor.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Generated from ImguiPPParser.g4 by ANTLR 4.10.1 3 | 4 | 5 | #include "ImguiPPParserVisitor.h" 6 | 7 | 8 | using namespace Antlr; 9 | 10 | -------------------------------------------------------------------------------- /plugins/paximgui/imguipp_antlr/ImguiPPParserVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | // Generated from ImguiPPParser.g4 by ANTLR 4.10.1 3 | 4 | #pragma once 5 | 6 | 7 | #include "antlr4-runtime.h" 8 | #include "ImguiPPParser.h" 9 | 10 | 11 | namespace Antlr { 12 | 13 | /** 14 | * This class defines an abstract visitor for a parse tree 15 | * produced by ImguiPPParser. 16 | */ 17 | class ImguiPPParserVisitor : public antlr4::tree::AbstractParseTreeVisitor { 18 | public: 19 | 20 | /** 21 | * Visit parse trees produced by ImguiPPParser. 22 | */ 23 | virtual std::any visitProgram(ImguiPPParser::ProgramContext *context) = 0; 24 | 25 | virtual std::any visitImgui_annotation(ImguiPPParser::Imgui_annotationContext *context) = 0; 26 | 27 | virtual std::any visitImgui_ranged_annotation(ImguiPPParser::Imgui_ranged_annotationContext *context) = 0; 28 | 29 | virtual std::any visitImgui_uniform(ImguiPPParser::Imgui_uniformContext *context) = 0; 30 | 31 | 32 | }; 33 | 34 | } // namespace Antlr 35 | -------------------------------------------------------------------------------- /plugins/paximgui/include/paximgui/ImguiRenderer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.08.2022. 3 | // 4 | 5 | #ifndef PAXENGINE3_IMGUIRENDERER_H 6 | #define PAXENGINE3_IMGUIRENDERER_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace Imgui { 12 | class ImguiPlugin; 13 | 14 | class ImguiRenderer : public SceneGraph { 15 | const ImguiPlugin & plugin; 16 | 17 | public: 18 | ImguiRenderer(const ImguiPlugin & plugin); 19 | 20 | virtual void render(RenderOptions &renderOptions) override; 21 | }; 22 | } 23 | } 24 | 25 | #endif //PAXENGINE3_IMGUIRENDERER_H 26 | -------------------------------------------------------------------------------- /plugins/paximgui/include/paximgui/ImguiUniformDetectorVisitor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.09.2022. 3 | // 4 | 5 | #ifndef PAXENGINE3_IMGUIUNIFORMDETECTORVISITOR_H 6 | #define PAXENGINE3_IMGUIUNIFORMDETECTORVISITOR_H 7 | 8 | #include "ImguiPPParserVisitor.h" 9 | #include "Variable.h" 10 | 11 | namespace PAX { 12 | namespace Imgui { 13 | class ImguiUniformDetectorVisitor : public Antlr::ImguiPPParserVisitor { 14 | public: 15 | Variables variables; 16 | 17 | antlrcpp::Any visitProgram(Antlr::ImguiPPParser::ProgramContext *context) override; 18 | antlrcpp::Any visitImgui_annotation(Antlr::ImguiPPParser::Imgui_annotationContext *context) override; 19 | antlrcpp::Any visitImgui_ranged_annotation(Antlr::ImguiPPParser::Imgui_ranged_annotationContext *context) override; 20 | antlrcpp::Any visitImgui_uniform(Antlr::ImguiPPParser::Imgui_uniformContext *context) override; 21 | }; 22 | } 23 | } 24 | 25 | #endif //PAXENGINE3_IMGUIUNIFORMDETECTORVISITOR_H 26 | -------------------------------------------------------------------------------- /plugins/paximgui/src/ImguiRenderer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.08.2022. 3 | // 4 | 5 | #include "paximgui/ImguiRenderer.h" 6 | #include "paximgui/ImguiPlugin.h" 7 | 8 | #include "imgui.h" 9 | 10 | namespace PAX { 11 | namespace Imgui { 12 | ImguiRenderer::ImguiRenderer(const PAX::Imgui::ImguiPlugin &plugin) : plugin(plugin) {} 13 | 14 | void ImguiRenderer::render(PAX::RenderOptions &renderOptions) { 15 | // At the beginning of your frame: 16 | plugin.ImGui_ImplXXXX_NewFrame(); 17 | ImGui::NewFrame(); 18 | 19 | SceneGraph::render(renderOptions); 20 | 21 | // At the end of your frame: 22 | ImGui::Render(); 23 | plugin.ImGui_ImplXXXX_RenderDrawData(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/Conversion.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 06.03.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_CONVERSION_H 6 | #define MESHFOLD_CONVERSION_H 7 | 8 | #include 9 | #include "paxcore/rendering/data/Texture.h" 10 | 11 | namespace PAX::OpenGL { 12 | GLint ToOpenGL(Texture::PixelFormat pixelFormat); 13 | GLint ToOpenGL(Texture::WrapMode wrapMode); 14 | GLint ToOpenGL(Texture::FilterMode filterMode); 15 | } 16 | 17 | #endif //MESHFOLD_CONVERSION_H 18 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/OpenGLMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.07.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLMACROS_H 6 | #define PAXENGINE3_OPENGLMACROS_H 7 | 8 | #define PAX_OPENGL_doesUniformExist(uniformLocation) (uniformLocation != -1) 9 | 10 | #endif //PAXENGINE3_OPENGLMACROS_H 11 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/OpenGLPointCloudSettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLPOINTCLOUDSETTINGS_H 6 | #define PAXENGINE3_OPENGLPOINTCLOUDSETTINGS_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace OpenGL { 12 | class OpenGLPointCloudSettings : public PointCloudSettings { 13 | public: 14 | void initialize(); 15 | void setPointSize(float pointSize) override; 16 | 17 | void init(Shader * shader) override; 18 | }; 19 | } 20 | } 21 | 22 | #endif //PAXENGINE3_OPENGLPOINTCLOUDSETTINGS_H 23 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/OpenGLViewport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLVIEWPORT_H 6 | #define PAXENGINE3_OPENGLVIEWPORT_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace OpenGL { 12 | class OpenGLViewport : public Viewport { 13 | public: 14 | OpenGLViewport(); 15 | 16 | OpenGLViewport(int x, int y, int w, int h, ResizePolicy resizePolicy); 17 | 18 | virtual void apply() override; 19 | }; 20 | } 21 | } 22 | 23 | #endif //PAXENGINE3_OPENGLVIEWPORT_H 24 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/factory/OpenGLMeshFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 19.05.18. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLMESHFACTORY_H 6 | #define PAXENGINE3_OPENGLMESHFACTORY_H 7 | 8 | #include 9 | #include 10 | #include "../resource/OpenGLMesh.h" 11 | 12 | namespace PAX { 13 | namespace OpenGL { 14 | class OpenGLMeshFactory : public MeshFactory { 15 | public: 16 | std::shared_ptr create(const std::vector & vertices, const std::vector & faces) override { 17 | return std::make_shared(vertices, faces); 18 | } 19 | 20 | std::shared_ptr create(const std::vector & vertices, const std::vector & faces) override { 21 | return std::make_shared(vertices, faces); 22 | } 23 | }; 24 | } 25 | } 26 | 27 | #endif //PAXENGINE3_OPENGLMESHFACTORY_H 28 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/factory/OpenGLRenderPassFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 12.04.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLRENDERPASSFACTORY_H 6 | #define PAXENGINE3_OPENGLRENDERPASSFACTORY_H 7 | 8 | #include 9 | #include "../rendernodes/OpenGLRenderPass.h" 10 | 11 | namespace PAX { 12 | namespace OpenGL { 13 | class OpenGLRenderPassFactory : public RenderPassFactory { 14 | public: 15 | PAX_NODISCARD OpenGLRenderPass * create(const glm::ivec2 &resolution) override; 16 | }; 17 | } 18 | } 19 | 20 | #endif //PAXENGINE3_OPENGLRENDERPASSFACTORY_H 21 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/factory/OpenGLTextureFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 10/07/2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLTEXTUREFACTORY_H 6 | #define PAXENGINE3_OPENGLTEXTUREFACTORY_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace OpenGL { 12 | class OpenGLTextureFactory : public TextureFactory { 13 | public: 14 | PAX_NODISCARD std::shared_ptr create(int width, int height) override; 15 | PAX_NODISCARD std::shared_ptr create(int width, int height, Texture::PixelFormat pixelFormat, Texture::ColourType colourType) override; 16 | }; 17 | } 18 | } 19 | 20 | #endif //PAXENGINE3_OPENGLTEXTUREFACTORY_H 21 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/factory/OpenGLViewportFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 20.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLVIEWPORTFACTORY_H 6 | #define PAXENGINE3_OPENGLVIEWPORTFACTORY_H 7 | 8 | #include "../OpenGLViewport.h" 9 | #include 10 | 11 | namespace PAX { 12 | namespace OpenGL { 13 | class OpenGLViewportFactory : public ViewportFactory { 14 | public: 15 | Viewport * create() override { 16 | return new OpenGLViewport(); 17 | } 18 | 19 | Viewport * create(int x, int y, int w, int h, Viewport::ResizePolicy resizePolicy) override { 20 | return new OpenGLViewport(x, y, w, h, resizePolicy); 21 | } 22 | }; 23 | } 24 | } 25 | #endif //PAXENGINE3_OPENGLVIEWPORTFACTORY_H 26 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/glslpreprocessor/GLSLPreprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 04.09.2022. 3 | // 4 | 5 | #ifndef PAXENGINE3_GLSLPREPROCESSOR_H 6 | #define PAXENGINE3_GLSLPREPROCESSOR_H 7 | 8 | #include 9 | #include "polypropylene/io/Path.h" 10 | 11 | namespace PAX { 12 | namespace OpenGL { 13 | class GLSLPreprocessor { 14 | public: 15 | virtual ~GLSLPreprocessor() = 0 {}; 16 | virtual std::string preprocess(const Path & codeFile, const std::string& code) = 0; 17 | }; 18 | } 19 | } 20 | 21 | #endif //PAXENGINE3_GLSLPREPROCESSOR_H 22 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/io/FreeImageOpenGLTextureLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.10.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLTEXTURELOADER_H 6 | #define PAXENGINE3_OPENGLTEXTURELOADER_H 7 | 8 | #ifdef PAX_WITH_FREEIMAGE 9 | 10 | #include 11 | #include 12 | 13 | namespace PAX { 14 | namespace OpenGL { 15 | class FreeImageOpenGLTextureLoader : public ResourceLoader { 16 | public: 17 | FreeImageOpenGLTextureLoader(); 18 | ~FreeImageOpenGLTextureLoader(); 19 | 20 | PAX_NODISCARD bool canLoad(const char * path) const override; 21 | PAX_NODISCARD std::shared_ptr load(const char * path) override; 22 | 23 | virtual std::shared_ptr loadToOrGetFromResources(Resources & resources, const VariableHierarchy & parameters); 24 | }; 25 | } 26 | } 27 | #endif // PAX_WITH_FREEIMAGE 28 | 29 | #endif //PAXENGINE3_OPENGLTEXTURELOADER_H 30 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/rendernodes/OpenGLContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 17.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLCONTEXT_H 6 | #define PAXENGINE3_OPENGLCONTEXT_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace OpenGL{ 12 | class OpenGLContext : public SceneGraph { 13 | public: 14 | OpenGLContext(); 15 | void initialize(); 16 | virtual void render(RenderOptions &renderOptions) override; 17 | }; 18 | } 19 | } 20 | 21 | #endif //PAXENGINE3_OPENGLCONTEXT_H 22 | -------------------------------------------------------------------------------- /plugins/paxopengl/include/paxopengl/rendernodes/OpenGLDefaultWorldSceneGraph.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.07.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_OPENGLDEFAULTWORLDSCENEGRAPH_H 6 | #define PAXENGINE3_OPENGLDEFAULTWORLDSCENEGRAPH_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace OpenGL{ 12 | class OpenGLDefaultWorldSceneGraph : public WorldSceneGraph { 13 | public: 14 | OpenGLDefaultWorldSceneGraph(); 15 | virtual void render(RenderOptions &renderOptions) override; 16 | }; 17 | } 18 | } 19 | 20 | #endif //PAXENGINE3_OPENGLDEFAULTWORLDSCENEGRAPH_H 21 | -------------------------------------------------------------------------------- /plugins/paxopengl/src/OpenGLPointCloudSettings.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX::OpenGL { 9 | void OpenGLPointCloudSettings::initialize() { 10 | //glEnable( GL_POINT_SMOOTH ); 11 | //glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); 12 | //glEnable(GL_POINT_SPRITE); 13 | } 14 | 15 | void OpenGLPointCloudSettings::setPointSize(float pointSize) { 16 | PointCloudSettings::setPointSize(pointSize); 17 | glPointSize(pointSize); 18 | } 19 | 20 | void OpenGLPointCloudSettings::init(PAX::Shader *shader) { 21 | shader->bind(); 22 | glEnable(GL_PROGRAM_POINT_SIZE); 23 | shader->unbind(); 24 | } 25 | } -------------------------------------------------------------------------------- /plugins/paxopengl/src/OpenGLViewport.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.06.2017. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include "paxopengl/OpenGLViewport.h" 10 | 11 | namespace PAX { 12 | namespace OpenGL { 13 | OpenGLViewport::OpenGLViewport() : Viewport() {} 14 | 15 | OpenGLViewport::OpenGLViewport(int x, int y, int w, int h, ResizePolicy resizePolicy) : Viewport(x, y, w, h, resizePolicy) {} 16 | 17 | void OpenGLViewport::apply() { 18 | glViewport(_x, _y, _w, _h); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /plugins/paxopengl/src/factory/OpenGLRenderPassFactory.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 12.04.2020. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::OpenGL { 8 | OpenGLRenderPass * OpenGLRenderPassFactory::create(const glm::ivec2 &resolution) { 9 | return new OpenGLRenderPass(resolution); 10 | } 11 | } -------------------------------------------------------------------------------- /plugins/paxopengl/src/glslpreprocessor/GLSLPreprocessorService.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 04.09.2022. 3 | // 4 | 5 | #include "paxopengl/glslpreprocessor/GLSLPreprocessorService.h" 6 | 7 | namespace PAX { 8 | namespace OpenGL { 9 | GLSLPreprocessorService::~GLSLPreprocessorService() { 10 | for (GLSLPreprocessor* pp : preprocessors) { 11 | delete pp; 12 | } 13 | } 14 | 15 | void GLSLPreprocessorService::addAndOwnPreprocessor(GLSLPreprocessor * preprocessor) { 16 | preprocessors.push_back(preprocessor); 17 | } 18 | 19 | std::string GLSLPreprocessorService::preprocess(const Path & codeFile, const std::string& code) { 20 | std::string c = code; 21 | for (GLSLPreprocessor* pp : preprocessors) { 22 | c = pp->preprocess(codeFile, c); 23 | } 24 | return c; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /plugins/paxopengl/src/rendernodes/OpenGLDefaultWorldSceneGraph.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.07.2017. 3 | // 4 | 5 | #include 6 | 7 | #include "paxopengl/rendernodes/OpenGLDefaultWorldSceneGraph.h" 8 | #include "paxcore/world/World.h" 9 | 10 | namespace PAX { 11 | namespace OpenGL { 12 | OpenGLDefaultWorldSceneGraph::OpenGLDefaultWorldSceneGraph() : WorldSceneGraph() {} 13 | 14 | void OpenGLDefaultWorldSceneGraph::render(RenderOptions &renderOptions) { 15 | // Clear Depth buffer for each WorldLayer to not let them interfere. Each one should be unconditionally rendered on top of the previous. 16 | glClear(GL_DEPTH_BUFFER_BIT); 17 | 18 | const bool is2D = this->getWorld()->getDimensions() == 2; 19 | if (is2D) 20 | glDisable(GL_DEPTH_TEST); 21 | 22 | WorldSceneGraph::render(renderOptions); 23 | 24 | if (is2D) 25 | glEnable(GL_DEPTH_TEST); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/PhysicsSystem2D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 07.02.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_PHYSICSSYSTEM2D_H 6 | #define MESHFOLD_PHYSICSSYSTEM2D_H 7 | 8 | #include "paxcore/system/GameSystem.h" 9 | 10 | namespace PAX::Physics { 11 | class PhysicsSystem2D : public GameSystem { 12 | public: 13 | virtual void toggleShowHitboxes() = 0; 14 | virtual bool isShowingHitboxes() const = 0; 15 | }; 16 | } 17 | 18 | #endif //MESHFOLD_PHYSICSSYSTEM2D_H 19 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/RigidBody2D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 21.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PHYSICS_H 6 | #define PAXENGINE3_PHYSICS_H 7 | 8 | #include 9 | 10 | namespace PAX::Physics { 11 | class RigidBody2D : public GameEntityProperty { 12 | PAX_PROPERTY(PAX::Physics::RigidBody2D, PAX_PROPERTY_IS_ABSTRACT) 13 | PAX_PROPERTY_DERIVES(GameEntityProperty) 14 | PAX_PROPERTY_IS_SINGLE 15 | 16 | bool fixedRotation = false; 17 | 18 | public: 19 | PAX_NODISCARD ClassMetadata getMetadata() override; 20 | 21 | virtual void setFixedRotation(bool fixedRotation); 22 | PAX_NODISCARD bool hasFixedRotation() const; 23 | }; 24 | } 25 | 26 | #endif //PAXENGINE3_PHYSICS_H 27 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/box2d/Box2DUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 24.01.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_BOX2DUTILS_H 6 | #define PAXENGINE3_BOX2DUTILS_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace PAX::Physics { 14 | glm::vec2 ToGLM(const b2Vec2 & b2vec); 15 | b2Vec2 ToBox2D(const glm::vec2 &glmvec); 16 | b2Vec2 ToBox2D(const glm::vec3 &glmvec); 17 | 18 | b2Shape * ToBox2D(const Shape2D & shape, float metersPerPixel); 19 | b2BodyType ToBox2D(MotionType motionType); 20 | } 21 | 22 | #endif //PAXENGINE3_BOX2DUTILS_H 23 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/gravityfields/GravityFieldSensitive.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 07.02.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_GRAVITYFIELDSENSITIVE_H 6 | #define MESHFOLD_GRAVITYFIELDSENSITIVE_H 7 | 8 | #include 9 | #include "paxcore/gameentity/GameEntityProperty.h" 10 | 11 | namespace PAX::Physics { 12 | class GravityFieldSensitive : public GameEntityProperty { 13 | PAX_PROPERTY(GravityFieldSensitive, PAX_PROPERTY_IS_CONCRETE) 14 | PAX_PROPERTY_DERIVES(GameEntityProperty) 15 | PAX_PROPERTY_IS_SINGLE 16 | 17 | PAX_PROPERTY_DEPENDS_ON(Movement2D) 18 | }; 19 | } 20 | 21 | #endif //MESHFOLD_GRAVITYFIELDSENSITIVE_H 22 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/gravityfields/GravityFieldSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 07.02.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_GRAVITYFIELDSYSTEM_H 6 | #define MESHFOLD_GRAVITYFIELDSYSTEM_H 7 | 8 | #include "paxcore/system/GameSystem.h" 9 | #include "paxcore/system/gameentity/GameEntityPropertyPool.h" 10 | #include "GravityFieldSensitive.h" 11 | #include "GravityField.h" 12 | 13 | namespace PAX::Physics { 14 | class GravityFieldSystem : public GameSystem { 15 | public: 16 | void update(UpdateOptions & options) override; 17 | }; 18 | } 19 | 20 | #endif //MESHFOLD_GRAVITYFIELDSYSTEM_H 21 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/json/JsonShape2DParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 28.01.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_JSONSHAPE2DPARSER_H 6 | #define MESHFOLD_JSONSHAPE2DPARSER_H 7 | 8 | #include 9 | #include "../shape/Shape2D.h" 10 | 11 | PAX_DECLARE_JSON_CONVERTER_FOR(std::shared_ptr) 12 | 13 | #endif //MESHFOLD_JSONSHAPE2DPARSER_H 14 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/material/PhysicsMaterial.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_PHYSICSMATERIAL_H 6 | #define PAXENGINE3_PHYSICSMATERIAL_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX::Physics { 12 | class PhysicsMaterial { 13 | public: 14 | PAX_NODISCARD static const std::shared_ptr & GetDefaultMaterial(); 15 | 16 | const float density; // [0, inf] 17 | const float friction; // [0, inf], 0 = no friction, 1 = strong friction 18 | const float elasticity; // aka restitution, bouncyness, [0, 1], 0 = no bounce, 1 = perfect elastic collisions 19 | 20 | explicit PhysicsMaterial(float density = 1, float friction = 0, float elasticity = 0); 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_PHYSICSMATERIAL_H 25 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/material/PhysicsMaterialLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_PHYSICSMATERIALLOADER_H 6 | #define PAXENGINE3_PHYSICSMATERIALLOADER_H 7 | 8 | #include 9 | #include "PhysicsMaterial.h" 10 | 11 | namespace PAX::Physics { 12 | class PhysicsMaterialLoader : public ResourceLoader { 13 | public: 14 | PAX_NODISCARD bool canLoad(Path p) const override; 15 | std::shared_ptr load(Path p) override; 16 | }; 17 | } 18 | 19 | #endif //PAXENGINE3_PHYSICSMATERIALLOADER_H 20 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/shape/Circle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 01.02.2021. 3 | // 4 | 5 | #ifndef MESHFOLD_CIRCLE_H 6 | #define MESHFOLD_CIRCLE_H 7 | 8 | #include "Shape2D.h" 9 | 10 | namespace PAX::Physics { 11 | class Circle : public Shape2D { 12 | float radius = 1; 13 | 14 | public: 15 | explicit Circle(float radius); 16 | ~Circle() override; 17 | 18 | float getRadius() const; 19 | }; 20 | } 21 | 22 | #endif //MESHFOLD_CIRCLE_H 23 | -------------------------------------------------------------------------------- /plugins/paxphysics/include/paxphysics/2d/shape/Rectangle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_RECTANGLE_H 6 | #define PAXENGINE3_RECTANGLE_H 7 | 8 | #include "Shape2D.h" 9 | 10 | namespace PAX::Physics { 11 | class Rectangle : public Shape2D { 12 | public: 13 | explicit Rectangle(const glm::vec2 & size); 14 | ~Rectangle() override; 15 | }; 16 | } 17 | 18 | #endif //PAXENGINE3_RECTANGLE_H 19 | -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/RigidBody2D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 21.01.2018. 3 | // 4 | 5 | #include "paxphysics/2d/RigidBody2D.h" 6 | 7 | namespace PAX::Physics { 8 | PAX_PROPERTY_IMPL(PAX::Physics::RigidBody2D) 9 | 10 | ClassMetadata RigidBody2D::getMetadata() { 11 | ClassMetadata m = Super::getMetadata(); 12 | m.add(paxfieldof(fixedRotation)); 13 | return m; 14 | } 15 | 16 | bool RigidBody2D::hasFixedRotation() const { 17 | return fixedRotation; 18 | } 19 | 20 | void RigidBody2D::setFixedRotation(bool fixedRotation) { 21 | this->fixedRotation = fixedRotation; 22 | } 23 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/event/Collision.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 03.03.2021. 3 | // 4 | 5 | #include "paxphysics/2d/event/Collision.h" 6 | 7 | namespace PAX::Physics { 8 | Collision::Collision(Hitbox2D * a, Hitbox2D * b) 9 | : a(a), b(b) {} 10 | 11 | bool Collision::operator==(const Collision &other) const { 12 | return a==other.a && b==other.b; 13 | } 14 | 15 | Hitbox2D * Collision::getMe(const GameEntity *me) const { 16 | if (a->getOwner() == me) { 17 | return a; 18 | } 19 | return b; 20 | } 21 | 22 | Hitbox2D * Collision::getOther(const GameEntity *me) const { 23 | if (a->getOwner() == me) { 24 | return b; 25 | } 26 | return a; 27 | } 28 | 29 | CollisionBegin::CollisionBegin(const Collision &collision) : collision(collision) {} 30 | CollisionEnd::CollisionEnd(const Collision &collision) : collision(collision) {} 31 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/gravityfields/GravityFieldSensitive.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 07.02.2021. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Physics { 8 | PAX_PROPERTY_IMPL(GravityFieldSensitive) 9 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/material/PhysicsMaterial.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Physics { 8 | const std::shared_ptr & PhysicsMaterial::GetDefaultMaterial() { 9 | static std::shared_ptr mat 10 | = std::make_shared(1.f, 1.f, 0.f); 11 | return mat; 12 | } 13 | 14 | PhysicsMaterial::PhysicsMaterial(float density, float friction, float elasticity) 15 | : density(density), friction(friction), elasticity(elasticity) 16 | { 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/material/PhysicsMaterialLoader.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace PAX::Physics { 10 | bool PhysicsMaterialLoader::canLoad(PAX::Path p) const { 11 | static Util::FileTypeChecker f({"psxmat"}); 12 | return f.check(p); 13 | } 14 | 15 | std::shared_ptr PhysicsMaterialLoader::load(PAX::Path p) { 16 | Settings s(p.toString()); 17 | return std::make_shared( 18 | s.getOrDefault("density", 0), 19 | s.getOrDefault("friction", 0), 20 | s.getOrDefault("elasticity", 1)); 21 | } 22 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/shape/Circle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 01.02.2021. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Physics { 8 | Circle::Circle(float radius) : Shape2D(), radius(radius) { 9 | const glm::vec2 aabbSize = glm::vec2(2) * radius; 10 | aabb = FloatBoundingBox2D(aabbSize); 11 | } 12 | 13 | Circle::~Circle() = default; 14 | 15 | float Circle::getRadius() const { 16 | return radius; 17 | } 18 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/shape/Rectangle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Physics { 8 | Rectangle::Rectangle(const glm::vec2 & size) : Shape2D() { 9 | aabb = FloatBoundingBox2D(size); 10 | } 11 | 12 | Rectangle::~Rectangle() = default; 13 | } -------------------------------------------------------------------------------- /plugins/paxphysics/src/2d/shape/Shape2D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 28.07.2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Physics { 8 | Shape2D::Shape2D() : offset(0) {} 9 | 10 | Shape2D::Shape2D(const PAX::Physics::Shape2D &other) : 11 | aabb(other.aabb), synchroniseToSize(other.synchroniseToSize), offset(other.offset) 12 | { 13 | 14 | } 15 | 16 | Shape2D::~Shape2D() = default; 17 | 18 | const FloatBoundingBox2D &Shape2D::getAABB() const { 19 | return aabb; 20 | } 21 | 22 | bool Shape2D::synchronisesToSize() const { 23 | return synchroniseToSize; 24 | } 25 | 26 | void Shape2D::setSynchroniseToSize(bool synchroniseToSize) { 27 | this->synchroniseToSize = synchroniseToSize; 28 | } 29 | 30 | const glm::vec2 &Shape2D::getOffset() const { 31 | return offset; 32 | } 33 | 34 | void Shape2D::setOffset(const glm::vec2 &offset) { 35 | Shape2D::offset = offset; 36 | } 37 | } -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/SDLImageLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 18.03.2020. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLIMAGELOADER_H 6 | #define PAXENGINE3_SDLIMAGELOADER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class SDLImageLoader : public ResourceLoader { 13 | public: 14 | SDLImageLoader(); 15 | ~SDLImageLoader() override; 16 | 17 | PAX_NODISCARD bool canLoad(Path path) const override; 18 | PAX_NODISCARD std::shared_ptr load(Path path) override; 19 | PAX_NODISCARD std::shared_ptr loadOrGetFromJson(Resources & resources, const nlohmann::json & j) const override; 20 | }; 21 | } 22 | 23 | #endif //PAXENGINE3_SDLIMAGELOADER_H 24 | -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/SDLKeyboard.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 9/28/17. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLKEYBOARD_H 6 | #define PAXENGINE3_SDLKEYBOARD_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace PAX { 13 | namespace SDL { 14 | class SDLKeyboard : public Keyboard { 15 | const Uint8 *_keyState = nullptr; 16 | 17 | public: 18 | virtual bool isKeyDown(Key key) override; 19 | bool isKeyDown(SDL_Scancode key); 20 | void setKeyStates(const Uint8 *keyState); 21 | }; 22 | } 23 | } 24 | 25 | #endif //PAXENGINE3_SDLKEYBOARD_H 26 | -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/SDLPureContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 01.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLPURECONTEXT_H 6 | #define PAXENGINE3_SDLPURECONTEXT_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | namespace SDL { 13 | /** 14 | * Context for pure SDL rendering without OpenGL. 15 | */ 16 | class SDLPureContext : public SceneGraph { 17 | SDL_Renderer *_renderer = nullptr; 18 | 19 | public: 20 | SDLPureContext(); 21 | ~SDLPureContext() override; 22 | 23 | void initialize(); 24 | 25 | void render(RenderOptions &renderOptions) override; 26 | 27 | SDL_Renderer *getSDLRenderer(); 28 | }; 29 | } 30 | } 31 | 32 | #endif //PAXENGINE3_SDLPURECONTEXT_H 33 | -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/SDLTextureLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.11.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLTEXTURELOADER_H 6 | #define PAXENGINE3_SDLTEXTURELOADER_H 7 | 8 | #include 9 | #include 10 | 11 | namespace PAX { 12 | class SDLTextureLoader : public ResourceLoader { 13 | public: 14 | SDLTextureLoader(); 15 | ~SDLTextureLoader() override; 16 | 17 | PAX_NODISCARD bool canLoad(Path path) const override; 18 | PAX_NODISCARD std::shared_ptr load(Path path) override; 19 | PAX_NODISCARD std::shared_ptr loadOrGetFromJson(Resources & resources, const nlohmann::json & j) const override; 20 | }; 21 | } 22 | 23 | #endif //PAXENGINE3_SDLTEXTURELOADER_H 24 | -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/opengl/SDLOpenGLContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 17.06.2017. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLOPENGLCONTEXT_H 6 | #define PAXENGINE3_SDLOPENGLCONTEXT_H 7 | 8 | #include 9 | 10 | namespace PAX { 11 | namespace SDL { 12 | namespace OpenGL { 13 | class SDLOpenGLContext : public SceneGraph { 14 | public: 15 | SDLOpenGLContext(); 16 | 17 | void initialize(); 18 | void render(RenderOptions &renderOptions) override; 19 | }; 20 | } 21 | } 22 | } 23 | 24 | #endif //PAXENGINE3_SDLOPENGLCONTEXT_H 25 | -------------------------------------------------------------------------------- /plugins/paxsdl/include/paxsdl/opengl/SDLOpenGLWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 15.06.17. 3 | // 4 | 5 | #ifndef PAXENGINE3_SDLOPENGLWINDOW_H 6 | #define PAXENGINE3_SDLOPENGLWINDOW_H 7 | 8 | #include "../SDLWindow.h" 9 | 10 | namespace PAX { 11 | namespace SDL { 12 | namespace OpenGL { 13 | class SDLOpenGLWindow : public SDL::SDLWindow { 14 | private: 15 | SDL_GLContext _context; 16 | 17 | protected: 18 | Uint32 flags() override; 19 | 20 | public: 21 | SDLOpenGLWindow(); 22 | ~SDLOpenGLWindow() override; 23 | 24 | bool create(const std::string& title, int width, int height) override; 25 | PAX_NODISCARD const SDL_GLContext & getContext() const; 26 | }; 27 | } 28 | } 29 | } 30 | 31 | #endif //PAXENGINE3_SDLOPENGLWINDOW_H 32 | -------------------------------------------------------------------------------- /plugins/paxsdl/src/SDLKeyboard.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by bittner on 9/28/17. 3 | // 4 | 5 | #include "paxsdl/SDLKeyboard.h" 6 | 7 | namespace PAX { 8 | namespace SDL { 9 | bool SDLKeyboard::isKeyDown(Key key) { 10 | return isKeyDown((SDL_Scancode)key); 11 | } 12 | 13 | void SDLKeyboard::setKeyStates(const Uint8* keyState) { 14 | _keyState = keyState; 15 | } 16 | 17 | bool SDLKeyboard::isKeyDown(SDL_Scancode key) { 18 | return _keyState[key]; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /plugins/paxsdl/src/opengl/SDLOpenGLContext.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 17.06.2017. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | #include "paxsdl/opengl/SDLOpenGLContext.h" 9 | #include "paxsdl/SDLWindow.h" 10 | 11 | namespace PAX { 12 | namespace SDL { 13 | namespace OpenGL { 14 | SDLOpenGLContext::SDLOpenGLContext() = default; 15 | 16 | void SDLOpenGLContext::initialize() {} 17 | 18 | void SDLOpenGLContext::render(RenderOptions &renderOptions) { 19 | SceneGraph::render(renderOptions); 20 | 21 | // Unpack the shared pointer and static cast, as its validity was alread checked in SDLPureContext::initialize 22 | SDLWindow *window = static_cast(Services::GetWindowService().getWindow().get()); 23 | SDL_GL_SwapWindow(window->getSDL_Window()); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /plugins/paxtiles/include/paxtiles/Tile.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 03.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_TILE_H 6 | #define PAXENGINE3_TILE_H 7 | 8 | namespace PAX::Tiles { 9 | struct TileInfo { 10 | bool isSolid = false; 11 | }; 12 | 13 | struct Tile { 14 | int tileSetIndex = -1; 15 | int textureColumn = 0; 16 | int textureRow = 0; 17 | bool isEmpty = false; 18 | }; 19 | } 20 | 21 | #endif //PAXENGINE3_TILE_H 22 | -------------------------------------------------------------------------------- /plugins/paxtiles/include/paxtiles/TileMapGraphics.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 03.01.19. 3 | // 4 | 5 | #ifndef PAXENGINE3_TILEMAPGRAPHICS_H 6 | #define PAXENGINE3_TILEMAPGRAPHICS_H 7 | 8 | #include 9 | #include 10 | #include "TileMap.h" 11 | 12 | namespace PAX { 13 | namespace Tiles { 14 | class TileMapGraphics : public Graphics { 15 | PAX_PROPERTY(::PAX::Tiles::TileMapGraphics, PAX_PROPERTY_IS_ABSTRACT) 16 | PAX_PROPERTY_DERIVES(::PAX::Graphics) 17 | PAX_PROPERTY_IS_MULTIPLE 18 | 19 | TileMap::Layer & tileLayer; 20 | 21 | public: 22 | explicit TileMapGraphics(TileMap::Layer & tileLayer); 23 | 24 | void attached(GameEntity& entity) override; 25 | void detached(GameEntity& entity) override; 26 | 27 | void render(RenderOptions &renderOptions) override; 28 | }; 29 | } 30 | } 31 | 32 | #endif //PAXENGINE3_TILEMAPGRAPHICS_H 33 | -------------------------------------------------------------------------------- /plugins/paxtiles/include/paxtiles/tiled/TileSetJsonLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 31.03.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_TILESETJSONLOADER_H 6 | #define PAXENGINE3_TILESETJSONLOADER_H 7 | 8 | #include 9 | #include "../TileSet.h" 10 | 11 | namespace PAX { 12 | namespace Tiles { 13 | class TileSetJsonLoader : public ResourceLoader { 14 | public: 15 | PAX_NODISCARD bool canLoad(Path) const override; 16 | PAX_NODISCARD std::shared_ptr load(Path) override; 17 | PAX_NODISCARD std::shared_ptr loadOrGetFromJson(Resources &resources, const nlohmann::json & j) const override; 18 | }; 19 | } 20 | } 21 | 22 | #endif //PAXENGINE3_TILESETJSONLOADER_H 23 | -------------------------------------------------------------------------------- /plugins/paxtiles/include/paxtiles/topdown/CharacterOrientation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 21.05.2019. 3 | // 4 | 5 | #ifndef PAXENGINE3_CHARACTERORIENTATION_H 6 | #define PAXENGINE3_CHARACTERORIENTATION_H 7 | 8 | #include 9 | 10 | namespace PAX::Tiles { 11 | class CharacterOrientation : public GameEntityProperty { 12 | PAX_PROPERTY(CharacterOrientation, PAX_PROPERTY_IS_CONCRETE) 13 | PAX_PROPERTY_DERIVES(GameEntityProperty) 14 | PAX_PROPERTY_IS_SINGLE 15 | 16 | glm::vec2 facingDirection; 17 | 18 | public: 19 | CharacterOrientation(); 20 | ~CharacterOrientation() override; 21 | 22 | const glm::vec2 & getFacingDirection() const; 23 | void setFacingDirection(const glm::vec2 & dir); 24 | }; 25 | } 26 | 27 | #endif //PAXENGINE3_CHARACTERORIENTATION_H 28 | -------------------------------------------------------------------------------- /plugins/paxtiles/src/topdown/CharacterOrientation.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 21.05.2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Tiles { 8 | PAX_PROPERTY_IMPL(CharacterOrientation) 9 | 10 | CharacterOrientation::CharacterOrientation() : GameEntityProperty(), facingDirection(0, 0) {} 11 | 12 | CharacterOrientation::~CharacterOrientation() = default; 13 | 14 | void CharacterOrientation::setFacingDirection(const glm::vec2 & dir) { 15 | facingDirection = dir; 16 | } 17 | 18 | const glm::vec2 & CharacterOrientation::getFacingDirection() const { 19 | return facingDirection; 20 | } 21 | } -------------------------------------------------------------------------------- /plugins/template/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(PaxTemplatePlugin) 2 | 3 | set(HEADERS_FOR_CLION include/Plugin.h include/FollowGameEntityBehaviour.h) 4 | set(SOURCE_FILES src/Plugin.cpp ${HEADERS_FOR_CLION}) 5 | 6 | include_directories(include) 7 | add_library(TemplatePlugin ${SOURCE_FILES}) -------------------------------------------------------------------------------- /plugins/template/include/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #ifndef PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 6 | #define PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 7 | 8 | #include 9 | 10 | /// Don't forget to change the header include guards, if you copy this Plugin! 11 | namespace PaxTemplatePlugin { 12 | class Plugin : public PAX::EnginePlugin { 13 | PAX_ENGINEPLUGIN_CONTAINS_ENTITYCOMPONENTS 14 | public: 15 | virtual void initialize(PAX::Engine& engine) override; 16 | virtual void postInitialize(PAX::Engine& engine) override; 17 | 18 | virtual void registerServices(PAX::Services& services) override; 19 | virtual void registerResourceLoaders(PAX::Resources& resources) override; 20 | virtual void registerFactories(PAX::FactoryService& factoryService) override; 21 | }; 22 | } 23 | 24 | #endif //PAXENGINE3_PAXTEMPLATEPLUGIN_PLUGIN_H 25 | -------------------------------------------------------------------------------- /plugins/template/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 13.08.2018. 3 | // 4 | 5 | #include "../include/Plugin.h" 6 | 7 | #include 8 | 9 | namespace PaxTemplatePlugin { 10 | void Plugin::initialize(PAX::Engine &engine) {} 11 | 12 | void Plugin::postInitialize(PAX::Engine &engine) {} 13 | 14 | void Plugin::registerFactories(PAX::FactoryService &factoryService) {} 15 | 16 | void Plugin::registerResourceLoaders(PAX::Resources &resources) {} 17 | 18 | void Plugin::registerServices(PAX::Services &services) {} 19 | } -------------------------------------------------------------------------------- /res/antlr/antlr-4.10.1-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/antlr/antlr-4.10.1-complete.jar -------------------------------------------------------------------------------- /res/antlr/antlr-4.8-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/antlr/antlr-4.8-complete.jar -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Block/Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Block/Center.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Block/Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Block/Left.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Block/Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Block/Right.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Bush/bush1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Bush/bush1.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Bush/bush2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Bush/bush2.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/Bush/bush3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/Bush/bush3.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/GreenBot16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/GreenBot16.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlatformerDemo/img/bg.png -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/img/thanksto.txt: -------------------------------------------------------------------------------- 1 | GrafxKid 2 | https://opengameart.org/users/grafxkid?page=1 -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/material/GreenGuy.psxmat: -------------------------------------------------------------------------------- 1 | density = 1 2 | friction = 0 3 | elasticity = 0 -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/prefabs/entity/DemoGameObject.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Transform": { 3 | "position": [0, 0, 2] 4 | } 5 | } -------------------------------------------------------------------------------- /res/demos/PlatformerDemo/prefabs/entity/Player.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Inherits": [ 3 | "GreenGuy.paxprefab.json" 4 | ], 5 | "Properties": [ 6 | { 7 | "PlayerControls": {} 8 | }, 9 | { 10 | "Movement2D": { 11 | "velocity": [0, 0], 12 | "angularVelocityInDegrees": 0 13 | } 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /res/demos/PlaygroundDemo/mesh/lowpolytree/lowpolytree.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 4 3 | 4 | newmtl Material.029 5 | Ns 96.078431 6 | Ka 0.143089 0.080556 0.000000 7 | Kd 0.143089 0.080556 0.000000 8 | Ks 0.500000 0.500000 0.500000 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | 13 | newmtl Material.030 14 | Ns 96.078431 15 | Ka 0.267444 0.640000 0.000000 16 | Kd 0.267444 0.640000 0.000000 17 | Ks 0.500000 0.500000 0.500000 18 | Ni 1.000000 19 | d 1.000000 20 | illum 2 21 | 22 | newmtl Material.031 23 | Ns 96.078431 24 | Ka 0.267444 0.640000 0.000000 25 | Kd 0.267444 0.640000 0.000000 26 | Ks 0.500000 0.500000 0.500000 27 | Ni 1.000000 28 | d 1.000000 29 | illum 2 30 | 31 | newmtl Material.032 32 | Ns 96.078431 33 | Ka 0.267444 0.640000 0.000000 34 | Kd 0.267444 0.640000 0.000000 35 | Ks 0.500000 0.500000 0.500000 36 | Ni 1.000000 37 | d 1.000000 38 | illum 2 39 | -------------------------------------------------------------------------------- /res/demos/PlaygroundDemo/mesh/ltp/LTP.mtl: -------------------------------------------------------------------------------- 1 | # 2 | # LTP.mtl 3 | # 4 | 5 | newmtl Material01 6 | illum 2 7 | Kd 0.800000 0.800000 0.800000 8 | Ka 0.200000 0.200000 0.200000 9 | Ks 0.000000 0.000000 0.000000 10 | Ke 0.000000 0.000000 0.000000 11 | Ns 0.000000 12 | map_Kd T-50_2_track.png 13 | 14 | newmtl Material02 15 | illum 2 16 | Kd 0.800000 0.800000 0.800000 17 | Ka 0.200000 0.200000 0.200000 18 | Ks 0.000000 0.000000 0.000000 19 | Ke 0.000000 0.000000 0.000000 20 | Ns 0.000000 21 | map_Kd LTP.png 22 | -------------------------------------------------------------------------------- /res/demos/PlaygroundDemo/mesh/ltp/LTP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlaygroundDemo/mesh/ltp/LTP.png -------------------------------------------------------------------------------- /res/demos/PlaygroundDemo/mesh/ltp/T-50_2_track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/PlaygroundDemo/mesh/ltp/T-50_2_track.png -------------------------------------------------------------------------------- /res/demos/RayMarcher/raymarcher.paxconfig: -------------------------------------------------------------------------------- 1 | vertfile = ${CURRENT_DIR}/vert.glsl 2 | 3 | # raymarcher settings 4 | camerapos = (0, 0, 2) 5 | fragfile = ${CURRENT_DIR}/raymarcher_frag.glsl 6 | 7 | # 4d raymarcher settings 8 | #camerapos = (0, 0, 2) 9 | #fragfile = ${CURRENT_DIR}/raymarcher4d_frag.glsl 10 | 11 | # mandelbrot settings 12 | #camerapos = (0, 0, 0) 13 | #fragfile = ${CURRENT_DIR}/mandelbrot_frag.glsl -------------------------------------------------------------------------------- /res/demos/RayMarcher/vert.glsl: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | 5 | void main(void) { 6 | gl_Position = vec4(position, 1.0); 7 | } -------------------------------------------------------------------------------- /res/demos/TileDemo/entities/glenys.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Transform": { 3 | "position": [0, 0, 2], 4 | "scale": [1.33, 1.33, 1] 5 | }, 6 | "Properties": [ 7 | { 8 | "SpriteSheetGraphics": { 9 | "Sprite": "${EngineResourceDir}/demos/TileDemo/img/Glenys-the-Demonswordsman.png", 10 | "rows": 4, 11 | "columns": 3, 12 | "Shader": { 13 | "Vertex": "${EngineResourceDir}/shader/sprite/sprite.vert", 14 | "Fragment": "${EngineResourceDir}/shader/sprite/sprite.frag", 15 | "Flags": { 16 | "Vertex": "#define SPRITE_SHEET" 17 | } 18 | } 19 | } 20 | }, 21 | { 22 | "Movement2D": { 23 | "velocity": [0, 0] 24 | } 25 | }, 26 | { 27 | "CharacterOrientation": {} 28 | }, 29 | { 30 | "CharacterSpriteAnimation": {} 31 | }, 32 | { 33 | "SimpleCharacterKeyboardControls": { 34 | "speed": 50 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /res/demos/TileDemo/entities/transitionarea.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Properties": [ 3 | { 4 | "SpriteGraphics": { 5 | "Sprite": "${EngineResourceDir}/demos/TileDemo/img/orangepixel.png", 6 | "Shader": { 7 | "Vertex": "${EngineResourceDir}/shader/sprite/sprite.vert", 8 | "Fragment": "${EngineResourceDir}/shader/sprite/sprite.frag" 9 | } 10 | } 11 | }, 12 | { 13 | "TileMapTransition": { 14 | "transition_target_id": "${transition_target_id}", 15 | "transition_target_map": "${transition_target_map}" 16 | } 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /res/demos/TileDemo/game.paxconfig: -------------------------------------------------------------------------------- 1 | startworld = ${CURRENT_DIR}/worlds/SmallForest.paxprefab.json 2 | playerprefab = ${CURRENT_DIR}/entities/glenys.paxprefab.json -------------------------------------------------------------------------------- /res/demos/TileDemo/img/Glenys-the-Demonswordsman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/TileDemo/img/Glenys-the-Demonswordsman.png -------------------------------------------------------------------------------- /res/demos/TileDemo/img/orangepixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/TileDemo/img/orangepixel.png -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/DenseForest.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Constructor": { 3 | "name": "DenseForest", 4 | "dimensions": 2, 5 | "z": 0 6 | }, 7 | "Properties": [ 8 | { 9 | "TileMap": { 10 | "map": "${EngineResourceDir}/demos/TileDemo/worlds/tiled/SmallForest/DenseForest.json" 11 | } 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/tiled/Platforms/PlatformsTileMapSnowExpansion.json: -------------------------------------------------------------------------------- 1 | { "columns":22, 2 | "image":"snow-expansion.png", 3 | "imageheight":224, 4 | "imagewidth":352, 5 | "margin":0, 6 | "name":"PlatformsTileMapSnowExpansion", 7 | "spacing":0, 8 | "tilecount":308, 9 | "tiledversion":"1.2.3", 10 | "tileheight":16, 11 | "tilewidth":16, 12 | "type":"tileset", 13 | "version":1.2 14 | } -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/tiled/Platforms/snow-expansion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/TileDemo/worlds/tiled/Platforms/snow-expansion.png -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/tiled/Platforms/tiles_packed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/TileDemo/worlds/tiled/Platforms/tiles_packed.png -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/tiled/SmallForest/SolidTile.tx: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /res/demos/TileDemo/worlds/tiled/SmallForest/Tiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/demos/TileDemo/worlds/tiled/SmallForest/Tiles.png -------------------------------------------------------------------------------- /res/font/BoxyBold/boxy_bold_regular_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/font/BoxyBold/boxy_bold_regular_8.png -------------------------------------------------------------------------------- /res/font/BoxyBold/boxy_bold_regular_8_transp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/font/BoxyBold/boxy_bold_regular_8_transp.PNG -------------------------------------------------------------------------------- /res/font/Pixeled.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/font/Pixeled.ttf -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x128.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x128.ico -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x128.png -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x16.ico -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x16.png -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x32.ico -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x32.png -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x64.ico -------------------------------------------------------------------------------- /res/icon/PaxEngine2/PaxEngine2x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine2/PaxEngine2x64.png -------------------------------------------------------------------------------- /res/icon/PaxEngine3/PaxEngine3_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/icon/PaxEngine3/PaxEngine3_128.png -------------------------------------------------------------------------------- /res/img/Black16.png: -------------------------------------------------------------------------------- 1 | BM66( -------------------------------------------------------------------------------- /res/img/PaxEngine3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/img/PaxEngine3.png -------------------------------------------------------------------------------- /res/img/White16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/img/White16.png -------------------------------------------------------------------------------- /res/prefabs/gravityfields/Circle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Properties": [ 3 | { 4 | "SphereGravityField": { 5 | "intensity": "${gf_intensity}", 6 | "priority": "${gf_priority}", 7 | "offset": [0, 0], 8 | "radius": "${gf_radius}", 9 | "shape": { 10 | "type": "Circle", 11 | "radius": "${gf_radius}" 12 | } 13 | } 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /res/prefabs/gravityfields/DirectedBox.json: -------------------------------------------------------------------------------- 1 | { 2 | "Properties": [ 3 | { 4 | "DirectionalGravityField": { 5 | "intensity": "${gf_intensity}", 6 | "priority": "${gf_priority}", 7 | "direction": "[${gf_dir_x}, ${gf_dir_y}]", 8 | "shape": { 9 | "type": "Rectangle", 10 | "size": "[${width}, ${height}]" 11 | } 12 | } 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /res/prefabs/playerspawn.paxprefab.json: -------------------------------------------------------------------------------- 1 | { 2 | "Tags": [ 3 | "PlayerSpawn" 4 | ] 5 | } -------------------------------------------------------------------------------- /res/screenshots/3d.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/screenshots/3d.PNG -------------------------------------------------------------------------------- /res/screenshots/meshfold.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/screenshots/meshfold.PNG -------------------------------------------------------------------------------- /res/screenshots/platformer.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/screenshots/platformer.PNG -------------------------------------------------------------------------------- /res/screenshots/raymarcher.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/screenshots/raymarcher.PNG -------------------------------------------------------------------------------- /res/screenshots/tiled.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmbittner/PaxEngine3/f45574e950c22f2c6267fd79e3c9a4284ded2e64/res/screenshots/tiled.PNG -------------------------------------------------------------------------------- /res/shader/conventions.txt: -------------------------------------------------------------------------------- 1 | Naming conventions for vertex shader: 2 | mat4 projection 3 | mat4 view 4 | mat4 modelview 5 | mat4 transposedInvModelView 6 | 7 | Naming conventions for Light values: 8 | 9 | 10 | Naming conventions for material values: 11 | vec3 material_diffuse_color 12 | vec3 material_specular_color 13 | vec3 material_ambient_color 14 | float material_specular_exponent 15 | float material_opacity 16 | bool material_hasDiffuseTexture 17 | 18 | SpriteSheet: 19 | definition SPRITE_SHEET 20 | 21 | struct SpriteSheet { 22 | ivec2 offset; 23 | ivec2 size; 24 | }; -------------------------------------------------------------------------------- /res/shader/default.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | 5 | uniform mat4 projection; 6 | uniform mat4 modelview; 7 | 8 | void main(void) { 9 | gl_Position = projection * modelview * vec4(position, 1.0); 10 | } -------------------------------------------------------------------------------- /res/shader/font/BitmapFont.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in vec2 fragTextureCoords; 4 | out vec4 out_Color; 5 | 6 | uniform sampler2D textureSampler; 7 | uniform float opacity; 8 | 9 | void main(void) { 10 | vec2 uv = fragTextureCoords; 11 | vec4 color = texture(textureSampler, uv); 12 | color.w *= opacity; 13 | // color = vec4(0, 1, 0, 1); 14 | // color = vec4(fragTextureCoords, 0, 1); 15 | out_Color = color; 16 | } -------------------------------------------------------------------------------- /res/shader/font/BitmapFont.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec2 position; 4 | layout(location = 1) in vec2 texCoords; 5 | 6 | out vec2 fragTextureCoords; 7 | 8 | uniform mat4 projection; 9 | uniform mat4 modelview; 10 | 11 | uniform ivec2 spriteResolution; 12 | 13 | void main(void) { 14 | fragTextureCoords = texCoords; 15 | gl_Position = 16 | projection * 17 | modelview * 18 | vec4(position, 0.0, 1.0); 19 | } -------------------------------------------------------------------------------- /res/shader/gui/PlainTexture.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in vec2 fragTextureCoords; 4 | out vec4 outColor; 5 | 6 | uniform sampler2D textureSampler; 7 | 8 | void main(void) { 9 | //out_Color = vec4(fragTextureCoords, 1.0, 1.0);//texture(textureSampler, fragTextureCoords); 10 | outColor = texture(textureSampler, fragTextureCoords); 11 | } -------------------------------------------------------------------------------- /res/shader/gui/PlainTexture.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec2 texCoords; 5 | 6 | out vec2 fragTextureCoords; 7 | 8 | uniform mat4 projection; 9 | uniform mat4 modelview; 10 | 11 | void main(void) { 12 | fragTextureCoords = texCoords; 13 | gl_Position = projection * modelview * vec4(position, 1.0); 14 | } -------------------------------------------------------------------------------- /res/shader/hitbox/rect.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | uniform vec4 color; 4 | 5 | out vec4 outColor; 6 | 7 | void main(void) { 8 | outColor = color; 9 | } -------------------------------------------------------------------------------- /res/shader/hitbox/rect.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | 5 | uniform mat4 projection; 6 | uniform mat4 modelview; 7 | 8 | void main(void) { 9 | gl_Position = projection * modelview * vec4(position, 1.0); 10 | } -------------------------------------------------------------------------------- /res/shader/material/simple/simplemat.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec3 normal; 5 | layout(location = 2) in vec2 uv; 6 | 7 | out ShaderData 8 | { 9 | vec3 eyeDirection; 10 | vec3 normal; 11 | vec2 textureCoord; 12 | } lightProperties; 13 | 14 | uniform mat4 projection; 15 | uniform mat4 model; 16 | uniform mat4 view; 17 | uniform mat4 modelview; 18 | uniform mat4 transposedInvModel; 19 | 20 | 21 | void main(void) { 22 | lightProperties.eyeDirection = -view[3].xyz - (model * vec4(position, 1.0)).xyz; 23 | lightProperties.normal = (transposedInvModel * vec4(normal, 0)).xyz; 24 | lightProperties.textureCoord = uv; 25 | 26 | gl_Position = projection * modelview * vec4(position, 1.0); 27 | } -------------------------------------------------------------------------------- /res/shader/sprite/sprite.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in vec2 fragTextureCoords; 4 | out vec4 outColor; 5 | 6 | uniform sampler2D textureSampler; 7 | 8 | void main(void) { 9 | outColor = texture(textureSampler, fragTextureCoords); 10 | } -------------------------------------------------------------------------------- /res/shader/sprite/sprite.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec2 texCoords; 5 | 6 | out vec2 fragTextureCoords; 7 | 8 | uniform mat4 projection; 9 | uniform mat4 modelview; 10 | 11 | uniform ivec2 spriteResolution; 12 | 13 | #ifdef SPRITE_SHEET 14 | struct SpriteSheet { 15 | ivec2 offset; 16 | ivec2 size; 17 | }; 18 | 19 | uniform SpriteSheet spriteSheet; 20 | #endif 21 | 22 | void main(void) { 23 | /* 24 | vec2 halfPixelSize = 0.5f / spriteResolution; 25 | vec2 clampedTexCoords = clamp(texCoords, halfPixelSize, 1.0f-halfPixelSize); 26 | /*/ 27 | vec2 clampedTexCoords = texCoords; 28 | //*/ 29 | 30 | #ifdef SPRITE_SHEET 31 | fragTextureCoords = (spriteSheet.offset + clampedTexCoords) / spriteSheet.size; 32 | #else 33 | fragTextureCoords = clampedTexCoords; 34 | #endif 35 | 36 | gl_Position = projection * modelview * vec4(position, 1.0); 37 | } -------------------------------------------------------------------------------- /res/shader/terrain/terrain.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in float height; 4 | 5 | out vec4 out_Color; 6 | 7 | vec4 minColor = vec4(0, 0, 1, 1); 8 | vec4 maxColor = vec4(1, 0, 0, 1); 9 | 10 | void main(void) { 11 | out_Color = mix(minColor, maxColor, height); 12 | } -------------------------------------------------------------------------------- /res/shader/terrain/terrain.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | 5 | uniform mat4 projection; 6 | uniform mat4 modelview; 7 | 8 | out float height; 9 | 10 | void main(void) { 11 | height = position.y; 12 | gl_Position = projection * modelview * vec4(position, 1.0); 13 | } -------------------------------------------------------------------------------- /res/shader/test/PlainTexture.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in vec2 fragTextureCoords; 4 | out vec4 out_Color; 5 | 6 | uniform sampler2D textureSampler; 7 | 8 | void main(void) { 9 | out_Color = texture(textureSampler, fragTextureCoords); 10 | //out_Color = vec4(fragTextureCoords, 0, 1); 11 | } -------------------------------------------------------------------------------- /res/shader/test/PlainTexture.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec3 normal; 5 | layout(location = 2) in vec2 uv; 6 | 7 | out vec2 fragTextureCoords; 8 | 9 | uniform mat4 projection; 10 | uniform mat4 modelview; 11 | 12 | void main(void) { 13 | fragTextureCoords = uv; 14 | gl_Position = projection * modelview * vec4(position, 1.0); 15 | } -------------------------------------------------------------------------------- /res/shader/test/red/red.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | out vec4 outColor; 4 | 5 | void main(void) { 6 | outColor = vec4(1, 0, 0, 1); 7 | } -------------------------------------------------------------------------------- /res/shader/test/red/red.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec3 position; 4 | 5 | uniform mat4 projection; 6 | uniform mat4 modelview; 7 | 8 | void main(void) { 9 | gl_Position = projection * modelview * vec4(position, 1.0); 10 | } -------------------------------------------------------------------------------- /res/shader/test/thinmatrix/tut5.frag: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec3 colour; 4 | 5 | out vec4 out_Color; 6 | 7 | void main(void){ 8 | 9 | out_Color = vec4(colour,1.0); 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /res/shader/test/thinmatrix/tut5.vert: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec3 position; 4 | 5 | out vec3 colour; 6 | 7 | void main(void){ 8 | 9 | gl_Position = vec4(position,1.0); 10 | colour = vec3(position.x+0.5,0.0,position.y+0.5); 11 | } -------------------------------------------------------------------------------- /res/shader/tilemap/tilemap.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | in vec2 fragTextureCoords; 4 | in float tileSetIndex; 5 | out vec4 outColor; 6 | 7 | uniform sampler2D tileSets[NUM_MAX_TILESETS]; 8 | 9 | void main(void) { 10 | if (tileSetIndex >= 0) { 11 | //#ifdef DISPLAY_MODE_UV 12 | //outColor = vec4(fragTextureCoords, 0, 1); 13 | //return; 14 | //#endif 15 | 16 | /* 17 | if (tileSetIndex > 1) { 18 | outColor = vec4(1, 0, 0, 1); 19 | return; 20 | }//*/ 21 | 22 | int i = int(tileSetIndex); 23 | 24 | //vec2 halfPixel = 0.5 / textureSize(tileSets[i], 0); 25 | //vec2 insetFragTexCoords = clamp(fragTextureCoords, halfPixel, vec2(1, 1) - halfPixel); 26 | outColor = texture(tileSets[i], fragTextureCoords); 27 | } else { 28 | discard; 29 | } 30 | } -------------------------------------------------------------------------------- /res/shader/tilemap/tilemap.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout(location = 0) in vec2 position; 4 | layout(location = 1) in vec2 texCoords; 5 | layout(location = 2) in float tileSetIndexIn; 6 | 7 | out vec2 fragTextureCoords; 8 | out float tileSetIndex; 9 | 10 | uniform mat4 projection; 11 | uniform mat4 modelview; 12 | 13 | void main(void) { 14 | fragTextureCoords = texCoords; 15 | tileSetIndex = tileSetIndexIn; 16 | gl_Position = projection * modelview * vec4(position, 0.0, 1.0); 17 | } -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(paxutil) 2 | add_subdirectory(paxcore) -------------------------------------------------------------------------------- /src/EngineMain.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #include 6 | 7 | 8 | int PAX::Engine_Main(int argc, char *argv[]) { 9 | int exitcode = 0; 10 | 11 | Platformer::PlatformerDemo game; 12 | 13 | PAX::SDL::SDLEnginePlugin sdl; 14 | PAX::OpenGL::OpenGLEnginePlugin openGL; 15 | PAX::OpenGL::OpenGL2DEnginePlugin openGL2DFeatures; 16 | PAX::SDL::OpenGL::SDLOpenGLEnginePlugin sdlOpenGLLink; 17 | PAX::Physics::Plugin physics; 18 | 19 | Engine &engine = Engine::Instance(); 20 | engine.initialize( 21 | &game, 22 | { 23 | &sdl, 24 | &openGL, 25 | &openGL2DFeatures, 26 | &sdlOpenGLLink, 27 | &physics 28 | } 29 | ); 30 | exitcode = engine.run(); 31 | 32 | return exitcode; 33 | } -------------------------------------------------------------------------------- /src/paxcore/animation/AnimationBehaviour.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 05.03.2021. 3 | // 4 | 5 | #include 6 | #include "paxcore/animation/AnimationBehaviour.h" 7 | 8 | std::ostream & operator<<(std::ostream & str, const PAX::AnimationBehaviour & ab) { 9 | switch (ab) { 10 | case PAX::AnimationBehaviour::ONCE: return str << "ONCE"; 11 | case PAX::AnimationBehaviour::LOOP: return str << "LOOP"; 12 | case PAX::AnimationBehaviour::PINGPONG: return str << "PINGPONG"; 13 | default: PAX_NOT_IMPLEMENTED_EXCEPTION(); 14 | } 15 | } -------------------------------------------------------------------------------- /src/paxcore/animation/Timing.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 31.01.2021. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX::Time { 9 | Timespan Modulo(Timespan lhs, Timespan rhs) { 10 | return Timespan(std::fmod(lhs.count(), rhs.count())); 11 | } 12 | } -------------------------------------------------------------------------------- /src/paxcore/animation/json/AnimationBehaviourParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 04.03.2021. 3 | // 4 | 5 | #include "paxcore/animation/json/AnimationBehaviourParser.h" 6 | #include "polypropylene/serialisation/json/nlohmann/Json.h" 7 | 8 | namespace PAX { 9 | PAX_IMPLEMENT_JSON_CONVERT_TO(AnimationBehaviour) { 10 | const std::string str = String::LowerCase(JsonToString(x)); 11 | if ("once" == str) { 12 | return AnimationBehaviour::ONCE; 13 | } else if ("loop" == str) { 14 | return AnimationBehaviour::LOOP; 15 | } else if ("pingpong" == str) { 16 | return AnimationBehaviour::PINGPONG; 17 | } 18 | 19 | PAX_THROW_RUNTIME_ERROR("Could not parse AnimationBehaviour from \"" << str << "\"!"); 20 | } 21 | 22 | PAX_IMPLEMENT_JSON_CONVERT_FROM_WITH_OSTREAM(AnimationBehaviour) 23 | } -------------------------------------------------------------------------------- /src/paxcore/function/UpdateOptions.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 17/07/2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | UpdateOptions::UpdateOptions(float dt, float actual_dt) 9 | : dt(dt), actual_dt(actual_dt) 10 | {} 11 | } -------------------------------------------------------------------------------- /src/paxcore/function/Updateable.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 17/07/2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | Updateable::~Updateable() = default; 9 | 10 | void Updateable::update(PAX::UpdateOptions &options) {} 11 | } -------------------------------------------------------------------------------- /src/paxcore/gameentity/GameEntityProperty.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 04.01.2020. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(GameEntityProperty) 9 | 10 | void GameEntityProperty::spawned() {} 11 | void GameEntityProperty::despawned() {} 12 | 13 | World * GameEntityProperty::getWorld() const { 14 | GameEntity * owner = getOwner(); 15 | if (owner) { 16 | return owner->getWorld(); 17 | } 18 | return nullptr; 19 | } 20 | } -------------------------------------------------------------------------------- /src/paxcore/gameentity/prefab/JsonGameEntityPrefabTagsParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.11.2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | void JsonGameEntityPrefabTagsParser::parse( 9 | nlohmann::json &node, 10 | GameEntity &e, 11 | Json::JsonEntityPrefab &prefab, 12 | const VariableRegister &v) 13 | { 14 | if (node.is_array()) { 15 | for (auto & element : node) { 16 | e.addTag(JsonToString(element)); 17 | } 18 | } else { 19 | PAX_THROW_RUNTIME_ERROR("Json element \"Tags\" is not an array!"); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/paxcore/gameentity/property/Ability.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 30.01.2021. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(Ability) 9 | 10 | Ability::Ability(const AbilityIdentifier & name) : name(name) {} 11 | 12 | AbilityResult Ability::start() { 13 | isActive = true; 14 | return AbilityResult::Success; 15 | } 16 | 17 | void Ability::act(UpdateOptions &options) {} 18 | 19 | void Ability::update(UpdateOptions &options) { 20 | if (isActive) { 21 | act(options); 22 | } 23 | } 24 | 25 | AbilityResult Ability::stop() { 26 | isActive = false; 27 | return AbilityResult::Success; 28 | } 29 | 30 | const AbilityIdentifier & Ability::getName() { 31 | return name; 32 | } 33 | } -------------------------------------------------------------------------------- /src/paxcore/gameentity/property/Behaviour.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 19.01.2018. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::Behaviour) 9 | } -------------------------------------------------------------------------------- /src/paxcore/io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(paxio 2 | Keyboard.cpp 3 | Mouse.cpp 4 | Window.cpp 5 | event/ResolutionChangedEvent.cpp 6 | properties/InputAbilityController.cpp Keys.cpp) -------------------------------------------------------------------------------- /src/paxcore/io/Keyboard.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.04.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | } -------------------------------------------------------------------------------- /src/paxcore/io/Window.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.07.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | void Window::setFullscreen(bool fullscreen) { 9 | _fullscreen = fullscreen; 10 | } 11 | 12 | bool Window::isFullscreen() { 13 | return _fullscreen; 14 | } 15 | 16 | void Window::setResolution(const glm::ivec2 &resolution) { 17 | this->_resolution = resolution; 18 | } 19 | 20 | glm::ivec2 Window::getResolution() { 21 | return _resolution; 22 | } 23 | 24 | void Window::dispose() {} 25 | } -------------------------------------------------------------------------------- /src/paxcore/io/event/ResolutionChangedEvent.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 09.07.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | ResolutionChangedEvent::ResolutionChangedEvent(int oldWidth, int oldHeight, int newWidth, int newHeight) : 9 | _oldWidth(oldWidth), _oldHeight(oldHeight), _newWidth(newWidth), _newHeight(newHeight) {} 10 | 11 | ResolutionChangedEvent::ResolutionChangedEvent(glm::ivec2 oldRes, glm::ivec2 newRes) : 12 | _oldWidth(oldRes.x), _oldHeight(oldRes.y), _newWidth(newRes.x), _newHeight(newRes.y) {} 13 | 14 | int ResolutionChangedEvent::getOldWidth() { return _oldWidth; } 15 | int ResolutionChangedEvent::getOldHeight() { return _oldHeight; } 16 | int ResolutionChangedEvent::getNewWidth() { return _newWidth; } 17 | int ResolutionChangedEvent::getNewHeight() { return _newHeight; } 18 | } -------------------------------------------------------------------------------- /src/paxcore/json/JsonResourceLoader.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 04.01.2020. 3 | // 4 | 5 | #include 6 | #include 7 | #include "polypropylene/serialisation/json/JsonLoader.h" 8 | #include "polypropylene/serialisation/json/nlohmann/Json.h" 9 | 10 | namespace PAX { 11 | bool JsonResourceLoader::canLoad(PAX::Path p) const { 12 | return Util::FileTypeChecker({"json"}).check(p); 13 | } 14 | 15 | std::shared_ptr JsonResourceLoader::load(Path p) { 16 | Json::JsonLoader l; 17 | return std::make_shared(l.load(p)); 18 | } 19 | } -------------------------------------------------------------------------------- /src/paxcore/plugin/EnginePlugin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.08.2018. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | EnginePlugin::EnginePlugin() = default; 9 | EnginePlugin::~EnginePlugin() = default; 10 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/SceneGraphGraphics.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 08.12.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | SceneGraphGraphics::SceneGraphGraphics() = default; 9 | 10 | SceneGraph & SceneGraphGraphics::getSceneGraph() { 11 | return _scenegraph; 12 | } 13 | 14 | void SceneGraphGraphics::render(RenderOptions &renderOptions) { 15 | Graphics::render(renderOptions); 16 | _scenegraph.render(renderOptions); 17 | } 18 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/camera/FullPixelScreenProjection.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 09.07.2017. 3 | // 4 | #include 5 | #include 6 | 7 | namespace PAX { 8 | FullPixelScreenProjection::FullPixelScreenProjection(int coordinateSystemWidth, int coordinateSystemHeight) : PixelScreenProjection() { 9 | _coordWidth = coordinateSystemWidth; 10 | _coordHeight = coordinateSystemHeight; 11 | } 12 | 13 | void FullPixelScreenProjection::calcMatrix() { 14 | PixelScreenProjection::calcMatrix(); 15 | 16 | float widthScale = getResolution().x / static_cast(_coordWidth); 17 | float heightScale = getResolution().y / static_cast(_coordHeight); 18 | 19 | for (int col = 0; col < 4; ++col) { 20 | _matrix[col][0] *= widthScale; 21 | _matrix[col][1] *= heightScale; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/camera/PixelScreenProjection.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | void PixelScreenProjection::calcMatrix() { 9 | Projection::calcMatrix(); 10 | 11 | _matrix[0][0] = 2.0f / getResolution().x; 12 | _matrix[1][1] = 2.0f / getResolution().y; 13 | 14 | // This is the inverse frustum length. 15 | // In our case it should actually be zero so that all elements get projected to z = 0. 16 | // But then, the matrix would not be invertible. 17 | // Hence, we use this really small value denoting, 18 | // that we have a very large potential frustum, i.e., a very large range for z. 19 | _matrix[2][2] = 0.0000000001f; 20 | } 21 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/camera/Projection.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | const glm::mat4& Projection::toMatrix() { 9 | if (_dirty) { 10 | calcMatrix(); 11 | _dirty = false; 12 | } 13 | 14 | return _matrix; 15 | } 16 | 17 | void Projection::calcMatrix() { 18 | _matrix = glm::mat4(1); 19 | } 20 | 21 | const glm::ivec2& Projection::getResolution() const { 22 | return _resolution; 23 | } 24 | 25 | void Projection::setResolution(const glm::ivec2 &res) { 26 | if (_resolution != res) { 27 | _resolution = res; 28 | _dirty = true; 29 | } 30 | } 31 | 32 | void Projection::makeDirty() { 33 | _dirty = true; 34 | } 35 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/config/PointCloudSettings.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | PointCloudSettings::~PointCloudSettings() = default; 10 | 11 | void PointCloudSettings::setPointSize(float pointSize) { 12 | if (pointSize <= 0) { 13 | PAX_THROW_RUNTIME_ERROR("Point size cannot be smaller or equal to 0!"); 14 | } 15 | this->pointSize = pointSize; 16 | } 17 | 18 | float PointCloudSettings::getPointSize() { 19 | return pointSize; 20 | } 21 | 22 | void PointCloudSettings::init(Shader *shader) {} 23 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/data/Colour.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX::Colours { 8 | 9 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/data/ColourPalette.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 11.04.2020. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | ColourPalette::~ColourPalette() = default; 9 | 10 | Colour ColourPalette::getNext() { 11 | return getColourAt(current++); 12 | } 13 | 14 | Colour ColourPalette::getColourAt(size_t index) { 15 | return get(index); 16 | } 17 | 18 | RandomColourPalette::RandomColourPalette() : rng(), distribution(0, 255) {} 19 | 20 | RandomColourPalette::~RandomColourPalette() = default; 21 | 22 | Colour RandomColourPalette::get(size_t index) { 23 | return {distribution(rng), distribution(rng), distribution(rng), 255}; 24 | } 25 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/data/Material.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.09.2018. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | PAX::Material::Material(const std::string &name) : name(name) {} 9 | 10 | void PAX::Material::applyTo(PAX::Shader* shader) { 11 | shader->setUniform("material_diffuse_color", diffuse.color); 12 | shader->setUniform("material_specular_color", specular.color); 13 | shader->setUniform("material_specular_exponent", specular.exponent); 14 | shader->setUniform("material_ambient_color", ambient.color); 15 | shader->setUniform("material_opacity", opacity); 16 | shader->setUniform("material_hasDiffuseTexture", diffuse.texture.operator bool()); 17 | 18 | if (diffuse.texture) 19 | diffuse.texture->bind(); 20 | } 21 | 22 | void PAX::Material::unapplyFrom(PAX::Shader *shader) { 23 | if (diffuse.texture) 24 | diffuse.texture->unbind(); 25 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/data/Mesh.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.09.2018. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace PAX { 11 | Mesh::~Mesh() = default; 12 | 13 | void Mesh::setName(const std::string &name) { 14 | this->name = name; 15 | } 16 | 17 | const std::string& Mesh::getName() const { 18 | return name; 19 | } 20 | 21 | void Mesh::upload() { 22 | uploaded = true; 23 | } 24 | 25 | bool Mesh::isUploaded() const { 26 | return uploaded; 27 | } 28 | 29 | void Mesh::setFaceMode(PAX::Mesh::FaceMode facemode) { 30 | this->facemode = facemode; 31 | } 32 | 33 | Mesh::FaceMode Mesh::getFaceMode() const { 34 | return facemode; 35 | } 36 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/data/SpriteSheet.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 03.01.19. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | SpriteSheet::SpriteSheet(const std::shared_ptr &texture, int columns, int rows) : texture(texture), dimensions(columns, rows) { 9 | 10 | } 11 | 12 | const std::shared_ptr SpriteSheet::getTexture() const { 13 | return texture; 14 | } 15 | 16 | const glm::ivec2 & SpriteSheet::getDimensions() const { 17 | return dimensions; 18 | } 19 | 20 | glm::vec2 SpriteSheet::getCellSize() const { 21 | return { 22 | texture->getWidth() / static_cast(dimensions.x), 23 | texture->getHeight() / static_cast(dimensions.y)}; 24 | } 25 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/graphics/AssetGraphics.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 02.09.2018. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | PAX_PROPERTY_IMPL(PAX::AssetGraphics) 10 | 11 | AssetGraphics::AssetGraphics() = default; 12 | 13 | ClassMetadata AssetGraphics::getMetadata() { 14 | ClassMetadata m = Super::getMetadata(); 15 | m.add({"asset", paxtypeof(_asset), &_asset, Field::IsMandatory | EngineFieldFlags::IsResource}); 16 | return m; 17 | } 18 | 19 | AssetGraphics::AssetGraphics(const std::shared_ptr &asset) : _asset(asset) { 20 | 21 | } 22 | 23 | void AssetGraphics::render(PAX::RenderOptions &renderOptions) { 24 | Super::render(renderOptions); 25 | _asset->render(renderOptions); 26 | } 27 | 28 | const std::shared_ptr& AssetGraphics::getAsset() const { 29 | return _asset; 30 | } 31 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/graphics/SceneGraphGraphics.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include 6 | 7 | PAX_PROPERTY_IMPL(PAX::SceneGraphGraphics) -------------------------------------------------------------------------------- /src/paxcore/rendering/graphics/nodes/TexturingNode.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | TexturingNode::TexturingNode(const std::shared_ptr &texture) : _texture(texture) { 10 | 11 | } 12 | 13 | void TexturingNode::render(RenderOptions &renderOptions) { 14 | const bool hasTexture = _texture != nullptr; 15 | if (hasTexture) 16 | _texture->bind(); 17 | 18 | SceneGraph::render(renderOptions); 19 | 20 | if (hasTexture) 21 | _texture->unbind(); 22 | } 23 | 24 | void TexturingNode::setTexture(const std::shared_ptr &texture) { 25 | _texture = texture; 26 | } 27 | 28 | const std::shared_ptr& TexturingNode::getTexture() const { 29 | return _texture; 30 | } 31 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/interface/Renderable.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 31.03.19. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | Renderable::~Renderable() = default; 9 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/light/AmbientLight.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 08.11.18. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::AmbientLight) 9 | 10 | ClassMetadata AmbientLight::getMetadata() { 11 | ClassMetadata m = Super::getMetadata(); 12 | m.add(paxfieldof(color)); 13 | return m; 14 | } 15 | 16 | AmbientLight::AmbientLight(const glm::vec3 &color) : color(color) { 17 | 18 | } 19 | 20 | void AmbientLight::uploadTo(PAX::Shader* shader) { 21 | shader->setUniform("lights.ambient.color", this->getColor()); 22 | } 23 | 24 | void AmbientLight::setColor(const glm::vec3 &color) { 25 | this->color = color; 26 | } 27 | 28 | const glm::vec3& AmbientLight::getColor() const { 29 | return color; 30 | } 31 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/light/Light.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 10.09.2018. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::Light) 9 | 10 | Light::Light(const glm::vec4 &color) : color(color) { 11 | 12 | } 13 | 14 | Light::~Light() = default; 15 | 16 | ClassMetadata Light::getMetadata() { 17 | ClassMetadata m = Super::getMetadata(); 18 | m.add(paxfieldof(color)); 19 | return m; 20 | } 21 | 22 | const glm::vec4& Light::getColor() const { 23 | return color; 24 | } 25 | 26 | void Light::setColor(const glm::vec4 &color) { 27 | this->color = color; 28 | } 29 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/light/PointLight.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 13.11.18. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::PointLight) 9 | 10 | PointLight::PointLight(const glm::vec4 &color) : Super(color) {} 11 | PointLight::~PointLight() = default; 12 | 13 | void PointLight::uploadTo(PAX::Shader * shader, int index) { 14 | PAX_NOT_IMPLEMENTED(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/resource/Mesh.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 30.06.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | 9 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/scenegraph/generators/DefaultSceneGraphGeneratorFactory.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 10/07/2019. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace PAX { 10 | SceneGraphGenerator * DefaultSceneGraphGeneratorFactory::create(int dimensions) { 11 | if (dimensions == 2) 12 | return new SortByZSceneGraphGenerator(); 13 | else 14 | return new GroupByShadersSceneGraphGenerator(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/scenegraph/nodes/SortingNode.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.10.2017. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /src/paxcore/rendering/scenegraph/nodes/TransformationNode.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 06.01.2018. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | TransformationNode::TransformationNode(const glm::mat4 &transformation) : _transformation(transformation) { 9 | 10 | } 11 | 12 | void TransformationNode::setTransformation(const glm::mat4 &transformation) { 13 | _transformation = transformation; 14 | } 15 | 16 | glm::mat4& TransformationNode::getTransformation() { 17 | return _transformation; 18 | } 19 | 20 | void TransformationNode::render(RenderOptions &options) { 21 | const glm::mat4 & parentTransform = options.getTransformationMatrix(); 22 | 23 | options.setTransformationMatrix(parentTransform * _transformation); 24 | SceneGraph::render(options); 25 | options.setTransformationMatrix(parentTransform); 26 | } 27 | } -------------------------------------------------------------------------------- /src/paxcore/rendering/scenegraph/sort/GraphicsSort.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 04.05.2017. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace PAX { 10 | namespace Sort { 11 | // TODO: ->getOwner()->getTransformation() might be inefficient 12 | 13 | bool IsAInFrontOfB(Graphics* a, Graphics* b) { 14 | float zA = a->getOwner()->getTransformation().z(); 15 | float zB = b->getOwner()->getTransformation().z(); 16 | return zA < zB || (zA == zB && a < b); // compare pointers as second priority for cache optimization 17 | } 18 | 19 | bool IsBInFrontOfA(Graphics* a, Graphics* b) { 20 | float zA = a->getOwner()->getTransformation().z(); 21 | float zB = b->getOwner()->getTransformation().z(); 22 | return zB < zA || (zA == zB && a < b); // compare pointers as second priority for cache optimization 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/paxcore/state/StateMachine.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 29.01.2021. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | StateMachine::StateMachine(const State & initialState, const std::vector &states) 9 | : initialState(initialState), states(states) 10 | {} 11 | 12 | const StateMachine::State & StateMachine::getCurrentState() const { 13 | return currentState; 14 | } 15 | } -------------------------------------------------------------------------------- /src/paxcore/system/gameentity/BehaviourSystem.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 05.06.2017. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | void BehaviourSystem::update(UpdateOptions & options) { 10 | for (GameEntity * e : getEntities(options.activeWorld)) { 11 | for (const auto &b : e->get()) { 12 | b->update(options); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/paxcore/system/gameentity/GameEntityPropertyPool.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 07.02.2021. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | bool GameEntityChunkValidator::isValid(const PoolAllocator &pool, PoolAllocator::Index i) const { 10 | static DefaultChunkValidator d; 11 | if (d.isValid(pool, i)) { 12 | return static_cast(pool.getData(i))->getWorld(); 13 | } 14 | return false; 15 | } 16 | 17 | // TODO: Maybe also cache a world pointer in the properties to speed things up a bit. 18 | bool GameEntityIsInWorldChunkValidator::isValid(const PoolAllocator &pool, PoolAllocator::Index i) const { 19 | static DefaultChunkValidator d; 20 | if (d.isValid(pool, i)) { 21 | return static_cast(pool.getData(i))->getWorld() == world; 22 | } 23 | return false; 24 | } 25 | } -------------------------------------------------------------------------------- /src/paxcore/system/world/WorldBehaviourSystem.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 24.03.2019. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace PAX { 9 | void WorldBehaviourSystem::update(UpdateOptions & options) { 10 | if (World * w = options.activeWorld) { 11 | for (WorldBehaviour * b : w->get()) { 12 | b->update(options); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/paxcore/world/prefab/JsonWorldPrefabInitParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 01/04/2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | namespace Json { 9 | JsonWorldPrefabInitParser::~JsonWorldPrefabInitParser() = default; 10 | 11 | void JsonWorldPrefabInitParser::parse(nlohmann::json &node, World & w, 12 | PAX::Json::JsonEntityPrefab &prefab, 13 | const VariableRegister & v) { 14 | const std::string & name = node["name"]; 15 | int dimensions = node["dimensions"]; 16 | float z = node["z"]; 17 | 18 | // TODO: Custom SceneGraphGenerator is not supported, yet. 19 | w.initialize(name, dimensions, z); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/paxcore/world/property/WorldBehaviour.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 21/06/2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::WorldBehaviour) 9 | } -------------------------------------------------------------------------------- /src/paxcore/world/property/WorldSize.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bittner on 21/06/2019. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | PAX_PROPERTY_IMPL(PAX::WorldSize) 9 | 10 | ClassMetadata WorldSize::getMetadata() { 11 | ClassMetadata m = Super::getMetadata(); 12 | m.add(paxfieldof(size)); 13 | return m; 14 | } 15 | 16 | WorldSize::WorldSize(const glm::vec3 &size) : size(size) {} 17 | 18 | const glm::vec3 & WorldSize::getSize() const { 19 | return size; 20 | } 21 | 22 | const glm::vec2 & WorldSize::getSize2D() const { 23 | return size2D; 24 | } 25 | 26 | void WorldSize::setSize(const glm::vec3& size) { 27 | this->size = size; 28 | } 29 | 30 | void WorldSize::setSize2D(const glm::vec2& size) { 31 | this->size2D = size; 32 | } 33 | } -------------------------------------------------------------------------------- /src/paxcore/world/scenegraph/WorldSceneGraph.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 07.01.2018. 3 | // 4 | 5 | //#include 6 | 7 | #include 8 | 9 | namespace PAX { 10 | void WorldSceneGraph::render(PAX::RenderOptions &renderOptions) { 11 | renderOptions.setWorld(world); 12 | SceneGraph::render(renderOptions); 13 | renderOptions.setWorld(nullptr); 14 | } 15 | 16 | World* WorldSceneGraph::getWorld() const { 17 | return world; 18 | } 19 | 20 | float WorldSceneGraph::getZ() const { 21 | return z; 22 | } 23 | 24 | bool WorldSceneGraph::operator<(const WorldSceneGraph &other) const { 25 | return z < other.z;// || (z == other.z && this < &other); 26 | } 27 | } -------------------------------------------------------------------------------- /src/paxutil/Signature.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 31.03.19. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | ISignature::~ISignature() = default; 9 | } -------------------------------------------------------------------------------- /src/paxutil/io/PrettyPrint.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 05.09.2022. 3 | // 4 | 5 | #include // std::setw 6 | #include "paxutil/io/PrettyPrint.h" 7 | 8 | namespace PAX { 9 | namespace Util { 10 | void printWithLineNumbersTo(std::stringstream & target, const std::string & text) { 11 | printWithLineNumbersTo(target, text, 4); 12 | } 13 | 14 | void printWithLineNumbersTo(std::stringstream & target, const std::string & text, unsigned int maxLineNoDigits) { 15 | std::stringstream textStream(text); 16 | std::string line; 17 | int lineNo = 0; 18 | while (std::getline(textStream, line, '\n')) { 19 | target << std::setw(4) << std::fixed << lineNo << "| " << line << std::endl; 20 | ++lineNo; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/paxutil/math/Conversion.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 29.12.2017. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | int PAX::Util::Conversion::coordinatesToIndex(int w, int x, int y) { 9 | assert(x < w); 10 | return (w*y)+x; 11 | } -------------------------------------------------------------------------------- /src/paxutil/math/Functions.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul Bittner on 21.03.2020. 3 | // 4 | #include 5 | #include 6 | 7 | namespace PAX::Math { 8 | glm::vec2 angleToDirection(float angleInRadians) { 9 | return {cos(angleInRadians), sin(angleInRadians)}; 10 | } 11 | 12 | float directionToRadians(const glm::vec2 & direction) { 13 | return atan2(direction.y, direction.x); 14 | } 15 | } -------------------------------------------------------------------------------- /src/paxutil/reflection/TypeRegister.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 07.01.19. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | TypeRegister::TypeRegister() = default; 9 | 10 | void TypeRegister::set(const TypeId &type, void *factory) { 11 | factories[type] = factory; 12 | } 13 | } -------------------------------------------------------------------------------- /src/paxutil/resources/ResourceHandle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Paul on 03.10.2017. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | ResourceHandle::ResourceHandle() = default; 9 | 10 | ResourceHandle::~ResourceHandle() { 11 | delete _signature; 12 | } 13 | } -------------------------------------------------------------------------------- /src/paxutil/resources/ResourceLoader.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by paul on 31.03.19. 3 | // 4 | 5 | #include 6 | 7 | namespace PAX { 8 | IResourceLoader::~IResourceLoader() = default; 9 | } --------------------------------------------------------------------------------