Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
probe_view_constants.h
Go to the documentation of this file.
1// probe_view_constants.h — デバッグ表示(render/probe_view)のフレームの定数。CPU がフレームごとにアップロードのバッファへ書き、
2// shaders/render/probe_view.hlsl が ByteAddressBuffer で読む(並びと値の意味は両方で同じにする)。D3D12 に依存しない(単体テストから使う)。
3#pragma once
4
5#include <array>
6#include <cstdint>
7
8namespace bicameral::render {
9
10 // 表示の仕方(probe_view.hlsl の VIEW_MODE_*)
11 enum class DebugViewMode : uint8_t {
12 Volume = 0, // 吸収と発光(熱い所ほど明るく、濃い)
13 MaximumProjection = 1, // 光線の上の最大値(どこに熱があるか)
14 Slice = 2, // 断面だけ
15 };
16
17 // 色分けする量(probe_view.hlsl の VIEW_QUANTITY_*。T-0089)
18 enum class DebugViewQuantity : uint8_t {
19 Temperature = 0, // 300 K より上の分
20 OxygenDepletion = 1, // 空気の O2 からの減り
22 Carbon = 3, // 炭
23 };
24
25 inline constexpr uint32_t DEBUG_VIEW_QUANTITY_COUNT = 4;
26
27 // flags のビット(probe_view.hlsl の VIEW_FLAG_*)。ビット 8〜9 は色分けする量、16〜19 は潜っている段
28 inline constexpr uint32_t VIEW_FLAG_ACTIVE_BLOCKS = 1u << 0; // 活性なブロックを重ねる
29 inline constexpr uint32_t VIEW_FLAG_LOGARITHMIC = 1u << 1; // 色は対数(無ければ線形)
30 inline constexpr uint32_t VIEW_QUANTITY_SHIFT = 8;
31 inline constexpr uint32_t
32 VIEW_PEEK_DEPTH_SHIFT = 16; // ビット 16〜19 = 覗き窓で潜っている段(0 = 潜っていない。T-0096)
33
34 // 並びは probe_view.hlsl の LoadConstants と同じにする(16 バイトずつ読む)
36 // --- 何をどこに描くか ---
37 uint32_t extractionIndex = 0; // 読む抽出(0〜2)
38 uint32_t width = 0; // 描く大きさ(画素)
39 uint32_t height = 0;
40 uint32_t flags = 0; // VIEW_FLAG_* の組み合わせ
41
42 // --- 表示の仕方 ---
43 uint32_t mode = 0; // DebugViewMode
44 uint32_t sliceAxis = 2; // 断面の軸(0 = x・1 = y・2 = z)
45 uint32_t slicePosition = 0; // 断面のセルの番号(クリックがつつく面)
46
47 // --- カメラ(render/debug_camera.h の CameraBasis。w は使わない)---
48 uint32_t orthographic = 0; // 平行投影なら 1(0 なら透視)
49 std::array<float, 4> position{};
50 std::array<float, 4> forward{};
51 std::array<float, 4> right{};
52 std::array<float, 4> up{};
53 };
54
55 static_assert(sizeof(ProbeViewConstants) == 96, "probe_view.hlsl の読み方と合わせる");
56
57} // namespace bicameral::render
constexpr uint32_t VIEW_FLAG_LOGARITHMIC
constexpr uint32_t VIEW_PEEK_DEPTH_SHIFT
constexpr uint32_t VIEW_QUANTITY_SHIFT
constexpr uint32_t VIEW_FLAG_ACTIVE_BLOCKS
constexpr uint32_t DEBUG_VIEW_QUANTITY_COUNT