Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
lab_panel.h
Go to the documentation of this file.
1
// lab_panel.h — エディタの「実験室」のパネル(14 §2・T-0142・ADR-0037)。小さな箱(sim/lab_box。8³ セル・4 m 角・300 K の空気)に
2
// 物質と温度を置いて反応を試し、GPU と CPU リファレンスを刻みごとに並べて比べる。食い違ったら最初の刻みとセルを出す。
3
//
4
// データの流れ:
5
// パネルの操作(置く・温度・刻む・戻す)→ sim::LabSession(置く操作はコマンド。箱のセルを CPU から書かない。D-107)
6
// → 読み戻した GPU の箱と CPU リファレンスの箱 → パネルに断面の温度・選んだセルの成分を並べて出す。
7
// 記録の保存・読み込み(コマンドの列 + ハッシュの列。sim::SerializeLabRecording)→ 再生で同じ実験を流し直す。
8
// 箱は仮の世界(ProbeSim)とは別の世界で、自分の compute キューで 1 刻みずつ待って進める(エディタの道具。ADR-0001)。
9
// GPU の箱は「箱を作る」を押した時に作る(debug では多重解像度のパイプラインの作成に時間がかかるので、使わない時は作らない)。
10
#pragma once
11
12
#include <array>
13
#include <cstdint>
14
#include <expected>
15
#include <memory>
16
#include <optional>
17
#include <string>
18
#include <vector>
19
20
#include "
gpu/com_ptr.h
"
21
#include "
sim/lab_session.h
"
22
23
namespace
bicameral::editor
{
24
25
class
LabPanel
{
26
public
:
27
explicit
LabPanel
(ID3D12Device* device);
28
29
// ImGui のフレームの中で呼ぶ
30
void
Build
();
31
32
// --- 人がいない確認(--auto-lab): 最初の Build で、木を置いて火を付ける実験 → 記録 → 再生を流して確かめる ---
33
void
StartAuto
() {
m_autoPending
=
true
; }
34
[[nodiscard]]
bool
AutoFailed
()
const
{
return
m_autoFailed
; }
35
36
private
:
37
bool
CreateSession
();
38
void
RunAuto
();
39
40
void
BuildControls
();
41
void
BuildStatus
();
42
void
BuildSlice
();
43
void
BuildCell
()
const
;
44
void
BuildRecording
();
45
void
Report
(
const
std::expected<void, std::string>& result);
46
47
ComPtr<ID3D12Device5>
m_device
;
48
std::optional<sim::LabSession>
m_session
;
49
std::vector<sim::LabMaterial>
m_materials
;
50
std::string
m_error
;
// 最後の失敗(GPU・ファイル)
51
std::string
m_message
;
// 最後の操作の結果
52
53
// --- 操作の状態(View。世界に入らない)---
54
std::array<int, 3>
m_cell
= {3, 3, 3};
55
int
m_material
= 1;
56
int
m_temperatureKelvin
= 300;
57
bool
m_running
=
false
;
// 毎フレーム 1 刻み
58
std::string
m_recordingPath
=
"lab_recording.blab"
;
59
60
bool
m_autoPending
=
false
;
61
bool
m_autoFailed
=
false
;
62
};
63
64
}
// namespace bicameral::editor
bicameral::editor::LabPanel::m_temperatureKelvin
int m_temperatureKelvin
Definition
lab_panel.h:56
bicameral::editor::LabPanel::BuildStatus
void BuildStatus()
Definition
lab_panel.cpp:123
bicameral::editor::LabPanel::m_device
ComPtr< ID3D12Device5 > m_device
Definition
lab_panel.h:47
bicameral::editor::LabPanel::RunAuto
void RunAuto()
Definition
lab_panel.cpp:308
bicameral::editor::LabPanel::BuildSlice
void BuildSlice()
Definition
lab_panel.cpp:191
bicameral::editor::LabPanel::m_autoPending
bool m_autoPending
Definition
lab_panel.h:60
bicameral::editor::LabPanel::m_autoFailed
bool m_autoFailed
Definition
lab_panel.h:61
bicameral::editor::LabPanel::m_recordingPath
std::string m_recordingPath
Definition
lab_panel.h:58
bicameral::editor::LabPanel::m_cell
std::array< int, 3 > m_cell
Definition
lab_panel.h:54
bicameral::editor::LabPanel::BuildRecording
void BuildRecording()
Definition
lab_panel.cpp:273
bicameral::editor::LabPanel::m_session
std::optional< sim::LabSession > m_session
Definition
lab_panel.h:48
bicameral::editor::LabPanel::BuildControls
void BuildControls()
Definition
lab_panel.cpp:146
bicameral::editor::LabPanel::CreateSession
bool CreateSession()
Definition
lab_panel.cpp:51
bicameral::editor::LabPanel::AutoFailed
bool AutoFailed() const
Definition
lab_panel.h:34
bicameral::editor::LabPanel::Report
void Report(const std::expected< void, std::string > &result)
Definition
lab_panel.cpp:77
bicameral::editor::LabPanel::BuildCell
void BuildCell() const
Definition
lab_panel.cpp:224
bicameral::editor::LabPanel::m_error
std::string m_error
Definition
lab_panel.h:50
bicameral::editor::LabPanel::m_materials
std::vector< sim::LabMaterial > m_materials
Definition
lab_panel.h:49
bicameral::editor::LabPanel::StartAuto
void StartAuto()
Definition
lab_panel.h:33
bicameral::editor::LabPanel::LabPanel
LabPanel(ID3D12Device *device)
Definition
lab_panel.cpp:46
bicameral::editor::LabPanel::Build
void Build()
Definition
lab_panel.cpp:90
bicameral::editor::LabPanel::m_running
bool m_running
Definition
lab_panel.h:57
bicameral::editor::LabPanel::m_material
int m_material
Definition
lab_panel.h:55
bicameral::editor::LabPanel::m_message
std::string m_message
Definition
lab_panel.h:51
com_ptr.h
lab_session.h
bicameral::editor
Definition
editor_overlay.cpp:25
engine
src
editor
lab_panel.h
Generated by
1.15.0