Loading...
Searching...
No Matches
ExtractTexture.hpp
1#pragma once
2#include <halp/controls.hpp>
3#include <halp/geometry.hpp>
4#include <halp/meta.hpp>
5#include <halp/texture.hpp>
6
7#include <Gfx/Graph/RenderList.hpp>
8
9namespace Threedim
10{
11
12// Sibling to ExtractBuffer2 (name-based buffer extractor) but for
13// texture auxiliaries. Reads `inputs.geometry.mesh.auxiliary_textures`
14// (populated by the halp/ossia bridge from `ossia::geometry::
15// auxiliary_textures` — which ScenePreprocessor fills with skybox,
16// irradiance_map, prefiltered_map, brdf_lut, shadow_map_array,
17// base_color_array, metal_rough_array, normal_array, emissive_array,
18// *_Dyn0..N, and any producer-injected texture) and re-publishes the
19// named entry on a standalone gpu_texture_output.
20//
21// Runtime-detects the texture shape (2D / TextureArray / Cubemap /
22// 3D) from QRhiTexture::flags() and stamps it into the output port's
23// `kind` field so downstream nodes / shader bindings know how to bind
24// (sampler2D / sampler2DArray / samplerCube / sampler3D). Width,
25// height, and layer-or-depth count come along from pixelSize() /
26// arraySize() / depth().
27//
28// Primary use case: post-processing shaders that depend on scene
29// aux textures without going through the scene cable themselves. E.g.
30// the shaderlib/depth set wants `camera` + `camera_prev` UBOs
31// (extract via ExtractBuffer2) and sometimes a depth-texture aux
32// (this node).
34{
35public:
36 halp_meta(name, "Extract texture (by name)")
37 halp_meta(category, "Visuals/Utilities")
38 halp_meta(c_name, "extract_texture_by_name")
39 halp_meta(description, "Extract a named auxiliary texture from geometry as a standalone GPU texture.")
40 halp_meta(authors, "ossia team")
41 halp_meta(
42 manual_url, "https://ossia.io/score-docs/processes/extract-texture.html")
43 halp_meta(uuid, "4d8f2a6b-7c19-4e05-a3d8-1b6f5e9c2a48")
44
45 struct ins
46 {
47 struct
48 {
49 halp_meta(name, "Geometry");
50 halp::dynamic_gpu_geometry mesh;
51 float transform[16]{};
52 bool dirty_mesh = false;
53 bool dirty_transform = false;
54 } geometry;
55
56 struct : halp::lineedit<"Name", "skybox">
57 {
58 halp_meta(symbol, "name")
59 } name;
60 } inputs;
61
62 struct
63 {
64 halp::gpu_texture_output<"Texture"> texture;
65 } outputs;
66
67 void init(score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res);
68 void update(
69 score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res,
71 void release(score::gfx::RenderList& r);
72 void operator()() { }
73
74private:
75 // Last-known resolved values — used to skip work when nothing changed.
76 void* m_lastHandle{};
77 std::string m_lastName;
78};
79
80}
Definition ExtractTexture.hpp:34
List of nodes to be rendered to an output.
Definition RenderList.hpp:33
Definition ExtractTexture.hpp:46
Definition TinyObj.hpp:27
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:236