Adding skeleton

This commit is contained in:
Dynamitos
2024-04-22 12:47:05 +02:00
parent ad8f30f26e
commit 3895fbb3d3
19 changed files with 491 additions and 35 deletions
+244
View File
@@ -0,0 +1,244 @@
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...
View File
+3
View File
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/Microsoft/vcpkg.git
+11 -1
View File
@@ -4,6 +4,9 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif() endif()
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(VCPKG_INSTALL_OPTIONS "--allow-unsupported")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
project(MeshShadingDemo) project(MeshShadingDemo)
@@ -24,7 +27,14 @@ find_package(Ktx CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED) find_package(nlohmann_json CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED)
find_package(VulkanMemoryAllocator CONFIG REQUIRED) find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(glslang CONFIG REQUIRED)
find_package(Seele REQUIRED) find_package(Seele REQUIRED)
add_library(MeshShadingDemo main.cpp) add_library(MeshShadingDemo SHARED "")
target_link_libraries(MeshShadingDemo PUBLIC Seele::Engine) target_link_libraries(MeshShadingDemo PUBLIC Seele::Engine)
target_include_directories(MeshShadingDemo PRIVATE src/)
target_compile_definitions(MeshShadingDemo PRIVATE BUILD_DLL)
add_subdirectory(src/)
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
{
"code": [
{
"exp": "Const",
"value": "input.vertexColor.xyz"
},
{
"exp": "Const",
"value": "float3(0, 0, 1)"
},
{
"exp": "BRDF",
"profile": "CelShading",
"values": {
"baseColor": 0,
"normal": 1
}
}
],
"name": "cubeMaterial0",
"profile": "CelShading"
}
+4
View File
@@ -0,0 +1,4 @@
target_sources(MeshShadingDemo
PUBLIC
FlyCam.h
FlyCam.cpp)
+21
View File
@@ -0,0 +1,21 @@
#include "FlyCam.h"
FlyCam::FlyCam(PScene scene)
: Actor(scene)
{
attachComponent<Component::Camera>().mainCamera = true;
attachComponent<Component::KeyboardInput>();
}
FlyCam::~FlyCam()
{}
Component::Camera& FlyCam::getCamera()
{
return accessComponent<Component::Camera>();
}
Component::KeyboardInput& FlyCam::getKeyboardInput()
{
return accessComponent<Component::KeyboardInput>();
}
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include "Define.h"
#include "Seele/MinimalEngine.h"
#include <Seele/Actor/Actor.h>
#include <Seele/Component/KeyboardInput.h>
#include <Seele/Component/Camera.h>
class FlyCam : public Actor
{
public:
FlyCam(PScene scene);
virtual ~FlyCam();
Component::KeyboardInput& getKeyboardInput();
Component::Camera& getCamera();
private:
};
DEFINE_REF(FlyCam)
+8
View File
@@ -0,0 +1,8 @@
target_sources(MeshShadingDemo
PUBLIC
Define.h
MeshShadingDemoGame.h
MeshShadingDemoGame.cpp)
add_subdirectory(Actor/)
add_subdirectory(System/)
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include "Seele/MinimalEngine.h"
using namespace Seele;
#ifdef WIN32
#ifdef BUILD_DLL
#define MESHSHADINGDEMO_API __declspec(dllexport)
#else
#define MESHSHADINGDEMO_API __declspec(dllimport)
#endif
#else
#define MESHSHADINGDEMO_API
#endif
+32
View File
@@ -0,0 +1,32 @@
#include "MeshShadingDemoGame.h"
#include "Actor/FlyCam.h"
#include "Seele/Asset/AssetRegistry.h"
#include "Seele/Component/Transform.h"
#include "System/FlyCamSystem.h"
MeshShadingDemoGame::MeshShadingDemoGame()
{
}
MeshShadingDemoGame::~MeshShadingDemoGame()
{
}
void MeshShadingDemoGame::setupScene(PScene scene, PSystemGraph graph)
{
cube = new StaticMeshActor(scene, AssetRegistry::findMesh("cube"));
// cube->accessComponent<Component::Transform>().setScale(Vector(50, 50, 50));
camera = new FlyCam(scene);
light = new DirectionalLightActor(scene, Vector4(1, 1, 1, 1), Vector(0, -1, 0));
graph->addSystem(new FlyCamSystem(scene));
}
Game* createInstance()
{
return new MeshShadingDemoGame();
}
void destroyInstance(Game *game)
{
delete game;
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "Actor/FlyCam.h"
#include "Define.h"
#include <Seele/Actor/StaticMeshActor.h>
#include <Seele/Actor/DirectionalLightActor.h>
#include <Seele/Game.h>
class MESHSHADINGDEMO_API MeshShadingDemoGame : public Game {
public:
MeshShadingDemoGame();
virtual ~MeshShadingDemoGame();
virtual void setupScene(PScene scene, PSystemGraph graph) override;
private:
OStaticMeshActor cube;
OFlyCam camera;
ODirectionalLightActor light;
};
extern "C" MESHSHADINGDEMO_API Game *createInstance();
extern "C" MESHSHADINGDEMO_API void destroyInstance(Game *game);
+4
View File
@@ -0,0 +1,4 @@
target_sources(MeshShadingDemo
PUBLIC
FlyCamSystem.h
FlyCamSystem.cpp)
+48
View File
@@ -0,0 +1,48 @@
#include "FlyCamSystem.h"
#include "Seele/System/ComponentSystem.h"
FlyCamSystem::FlyCamSystem(PScene scene)
: System::ComponentSystem<Component::KeyboardInput, Component::Camera, Component::Transform>(scene) {}
FlyCamSystem::~FlyCamSystem() {}
void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& camera, Component::Transform& transform) {
float cameraMove = static_cast<float>(deltaTime);
if(input.keys[KeyCode::KEY_LEFT_SHIFT])
{
cameraMove *= 100;
}
Vector forward = transform.getForward();
Vector side = transform.getRight();
Vector moveVector = Vector();
if(input.keys[KeyCode::KEY_W])
{
moveVector += forward * cameraMove;
}
if(input.keys[KeyCode::KEY_S])
{
moveVector += forward * -cameraMove;
}
if(input.keys[KeyCode::KEY_A])
{
moveVector += side * cameraMove;
}
if(input.keys[KeyCode::KEY_D])
{
moveVector += side * -cameraMove;
}
if(input.keys[KeyCode::KEY_E])
{
moveVector += Vector(0, cameraMove, 0);
}
if(input.keys[KeyCode::KEY_Q])
{
moveVector += Vector(0, -cameraMove, 0);
}
transform.translate(moveVector);
if(input.mouse2)
{
camera.mouseMove(input.deltaX, input.deltaY);
}
}
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include "Define.h"
#include "Seele/MinimalEngine.h"
#include <Seele/Scene/Scene.h>
#include <Seele/System/ComponentSystem.h>
#include <Seele/Component/Camera.h>
#include <Seele/Component/KeyboardInput.h>
class FlyCamSystem : public System::ComponentSystem<
Component::KeyboardInput,
Component::Camera,
Component::Transform>
{
public:
FlyCamSystem(PScene scene);
virtual ~FlyCamSystem();
virtual void update(Seele::Component::KeyboardInput& input, Seele::Component::Camera& camera, Seele::Component::Transform& transform) override;
private:
float lastMouseX;
float lastMouseY;
};
DEFINE_REF(FlyCamSystem)
-34
View File
@@ -1,34 +0,0 @@
#include <Window/WindowManager.h>
#include <Asset/AssetRegistry.h>
#include <Window/GameView.h>
#include <Graphics/Vulkan/VulkanGraphics.h>
using namespace Seele;
int main()
{
Gfx::PGraphics graphics = new Vulkan::Graphics();
GraphicsInitializer initializer;
graphics->init(initializer);
PWindowManager windowManager = new WindowManager();
AssetRegistry::init("Assets", graphics);
WindowCreateInfo mainWindowInfo;
mainWindowInfo.title = "MeshShadingDemo";
mainWindowInfo.width = 1280;
mainWindowInfo.height = 720;
mainWindowInfo.bFullscreen = false;
mainWindowInfo.numSamples = 1;
mainWindowInfo.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM;
auto window = windowManager->addWindow(graphics, mainWindowInfo);
ViewportCreateInfo sceneViewInfo;
sceneViewInfo.dimensions.size.x = 1280;
sceneViewInfo.dimensions.size.y = 720;
sceneViewInfo.dimensions.offset.x = 0;
sceneViewInfo.dimensions.offset.y = 0;
PGameView sceneView = new GameView(graphics, window, sceneViewInfo, "");
sceneView->setFocused();
window->render();
return 0;
}
Submodule
+1
Submodule vcpkg added at 501cb01e51
+19
View File
@@ -0,0 +1,19 @@
{
"dependencies": [
"assimp",
"entt",
"stb",
"entt",
"freetype",
"glfw3",
"glm",
"ktx",
"nlohmann-json",
"fmt",
"gtest",
"vulkan-memory-allocator",
"shader-slang",
"spirv-cross",
"glslang"
]
}