VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
sky.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 09.10.2025.
5//
6#pragma once
7
8#include <memory>
9
10#include "core/math/vector3.h"
11#include "scene/constants.h"
12#include "scene/graphNode.h"
13#include "skyMesh.h"
14
15namespace visutwin::canvas
16{
17 class GraphicsDevice;
18 class Scene;
19 class Texture;
20
25 class Sky
26 {
27 public:
28 Sky(const std::shared_ptr<GraphicsDevice>& device, Scene* scene);
29 ~Sky();
30
31 void updateSkyMesh();
32 void resetSkyMesh();
34
35 void setType(int value);
36 int type() const { return _type; }
37
38 void setDepthWrite(bool value);
39 bool depthWrite() const { return _depthWrite; }
40
46 void setCenter(const Vector3& value) { _center = value; }
47 const Vector3& center() const { return _center; }
48
53 Vector3 centerWorldPos() const;
54
55 GraphNode* node() { return &_node; }
56
59 Texture* atmosphereDummyTexture() const { return _atmosphereDummyTexture.get(); }
60
61 private:
62 std::shared_ptr<GraphicsDevice> _device;
63 Scene* _scene = nullptr;
64 int _type = SKYTYPE_INFINITE;
65 bool _depthWrite = false;
66 Vector3 _center = Vector3(0.0f, 1.0f, 0.0f);
67 GraphNode _node = GraphNode("SkyMeshNode");
68 std::unique_ptr<SkyMesh> _skyMesh;
69 std::shared_ptr<Texture> _atmosphereDummyTexture; // 1×1 placeholder for atmosphere-only sky
70 };
71}
Hierarchical scene graph node with local/world transforms and parent-child relationships.
Definition graphNode.h:28
Abstract GPU interface for resource creation, state management, and draw submission.
Container for the scene graph, lighting environment, fog, skybox, and layer composition.
Definition scene.h:29
bool depthWrite() const
Definition sky.h:39
Vector3 centerWorldPos() const
Definition sky.cpp:125
int type() const
Definition sky.h:36
const Vector3 & center() const
Definition sky.h:47
void updateSkyMesh()
Definition sky.cpp:37
SkyMesh * skyMesh()
Definition sky.cpp:117
void setType(int value)
Definition sky.cpp:24
void setCenter(const Vector3 &value)
Definition sky.h:46
void setDepthWrite(bool value)
Definition sky.cpp:32
Sky(const std::shared_ptr< GraphicsDevice > &device, Scene *scene)
Definition sky.cpp:16
Texture * atmosphereDummyTexture() const
Definition sky.h:59
GraphNode * node()
Definition sky.h:55
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57
3D vector for positions, directions, and normals with multi-backend SIMD acceleration.
Definition vector3.h:29