MCPcopy Create free account
hub / github.com/MethanePowered/MethaneKit / CubeMapArrayApp

Method CubeMapArrayApp

Apps/06-CubeMapArray/CubeMapArrayApp.cpp:51–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49constexpr float g_model_scale = 6.F;
50
51CubeMapArrayApp::CubeMapArrayApp()
52 : UserInterfaceApp(
53 []() {
54 Graphics::CombinedAppSettings settings = GetGraphicsTutorialAppSettings("Methane Cube Map Array", AppOptions::GetDefaultWithColorDepthAndAnim());
55 settings.graphics_app.device_capabilities.features.SetBitOn(rhi::DeviceFeature::ImageCubeArray);
56 settings.render_context.clear_depth_stencil = gfx::DepthStencilValues(0.F, {}); // Clear depth with 0.F to support reversed depth rendering
57 settings.render_context.clear_color = {}; // Disable color clearing, use sky-box instead
58 return settings;
59 }(),
60 GetUserInterfaceTutorialAppSettings(AppOptions::GetDefaultWithColorDepthAndAnim()),
61 "Methane tutorial of cube-map array texturing")
62 , m_model_matrix(hlslpp::mul(hlslpp::float4x4::scale(g_model_scale), // NOSONAR - do not use in-class initializer
63 hlslpp::float4x4::rotation_z(std::numbers::pi_v<float>)))
64{
65 // NOTE: Near and Far values are swapped in camera parameters (1st value is near = max depth, 2nd value is far = min depth)
66 // for Reversed-Z buffer values range [ near: 1, far 0], instead of [ near 0, far 1]
67 // which is used for "from near to far" drawing order for reducing pixels overdraw
68 m_camera.ResetOrientation({ { 13.F, 13.F, -13.F }, { 0.F, 0.F, 0.F }, { 0.F, 1.F, 0.F } });
69 m_camera.SetParameters({ 600.F /* near = max depth */, 0.01F /*far = min depth*/, 90.F /* FOV */ });
70
71 // Setup animations
72 GetAnimations().emplace_back(Data::MakeTimeAnimationPtr([this](double elapsed_seconds, double delta_seconds)
73 {
74 return Animate(elapsed_seconds, delta_seconds);
75 }));
76}
77
78CubeMapArrayApp::~CubeMapArrayApp()
79{

Callers

nothing calls this directly

Calls 5

MakeTimeAnimationPtrFunction · 0.85
ResetOrientationMethod · 0.80
SetParametersMethod · 0.80

Tested by

no test coverage detected