Getting Started with Kuesa Serenity
For a C++ applications that performs 3D rendering leveraging the Kuesa Studio C++ Vulkan renderer (Serenity):
CMakeLists.txt
| find_package(Kuesa REQUIRED)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Kuesa::Kuesa
Kuesa::KuesaSerenity)
|
To include the definitions of the module's classes, use the following directives:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 | int main(int ac, char **av)
{
KDGui::GuiApplication app;
// Setup Window
Kuesa::Serenity::Window w;
auto engine = std::make_unique<::Serenity::AspectEngine>();
w.visible.valueChanged().connect([&app](const bool &visible) {
if (visible == false)
app.quit();
});
w.title = makeBinding(makeTitle(w.width, w.height, engine->fps));
w.width = 1920;
w.height = 1080;
w.visible = true;
// Setup Serenity Engine
auto renderAspect = engine->createAspect<::Serenity::RenderAspect>(std::make_unique<::Serenity::VulkanDevice>());
auto spatialAspect = engine->createAspect<::Serenity::SpatialAspect>();
auto logicAspect = engine->createAspect<::Serenity::LogicAspect>();
auto animationAspect = engine->createAspect<::Serenity::AnimationAspect>();
// Create Render Algo
auto algo = std::make_unique<::Serenity::ForwardAlgorithm>();
renderAspect->setRenderAlgorithm(std::move(algo));
// Setup Kuesa Scene
Kuesa::Serenity::AssetCollections collections;
Kuesa::Serenity::GLTF2Importer importer;
importer.assetCollections = assetCollections;
importer.layerManager = layerManager;
importer.source = String("file:///path/to/file.gltf");
std::unique_ptr<::Serenity::Entity> root = std::make_unique<::Serenity::Entity>();
for (std::unique_ptr<::Serenity::Entity> &sceneRoot : importer.sceneRoots()) {
// Take ownership
root->addChildEntity(std::move(sceneRoot));
}
engine->setRootEntity(std::move(root));
engine->running = true;
return app.exec();
}
|
Kuesa Serenity Examples
Updated on 2023-07-03 at 11:02:17 +0000