VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
glbContainerResource.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 20.12.2025.
5//
6#pragma once
7#include <memory>
8#include <string>
9#include <unordered_map>
10#include <vector>
11
13#include "core/math/vector3.h"
16#include "scene/mesh.h"
18
19namespace visutwin::canvas
20{
21 class Texture;
22
24 {
25 std::shared_ptr<Mesh> mesh;
26 std::shared_ptr<Material> material;
27 bool castShadow = true; // Set false for point cloud meshes.
28 };
29
31 {
32 std::string name;
33 Vector3 translation = Vector3(0.0f, 0.0f, 0.0f);
34 Quaternion rotation = Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
35 Vector3 scale = Vector3(1.0f, 1.0f, 1.0f);
36 std::vector<size_t> meshPayloadIndices;
37 std::vector<int> children;
38 bool skip = false; // When true, no Entity is created (e.g., consumed POINTS leaf).
39 };
40
45 {
46 public:
47 void addMeshPayload(const GlbMeshPayload& payload) { _meshPayloads.push_back(payload); }
48 void addNodePayload(const GlbNodePayload& payload) { _nodePayloads.push_back(payload); }
49 void addRootNodeIndex(const int index) { _rootNodeIndices.push_back(index); }
50 void addOwnedTexture(const std::shared_ptr<Texture>& texture) { _ownedTextures.push_back(texture); }
51
52 void addAnimTrack(const std::string& name, const std::shared_ptr<AnimTrack>& track) { _animTracks[name] = track; }
53 const std::unordered_map<std::string, std::shared_ptr<AnimTrack>>& animTracks() const { return _animTracks; }
54
56
57 private:
58 std::vector<GlbMeshPayload> _meshPayloads;
59 std::vector<GlbNodePayload> _nodePayloads;
60 std::vector<int> _rootNodeIndices;
61 std::vector<std::shared_ptr<Texture>> _ownedTextures;
62 std::unordered_map<std::string, std::shared_ptr<AnimTrack>> _animTracks;
63 };
64}
ECS entity — a GraphNode that hosts components defining its behavior.
Definition entity.h:32
void addMeshPayload(const GlbMeshPayload &payload)
const std::unordered_map< std::string, std::shared_ptr< AnimTrack > > & animTracks() const
void addOwnedTexture(const std::shared_ptr< Texture > &texture)
void addNodePayload(const GlbNodePayload &payload)
void addAnimTrack(const std::string &name, const std::shared_ptr< AnimTrack > &track)
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57
std::shared_ptr< Material > material
Unit quaternion for rotation representation with SIMD-accelerated slerp and multiply.
Definition quaternion.h:20
3D vector for positions, directions, and normals with multi-backend SIMD acceleration.
Definition vector3.h:29