Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
physics_scene.h
Go to the documentation of this file.
1// physics_scene.h — 物理の原理の確認(T-0016、08 §6 の場面 A・C の小さい版)に使う場面の定義。
2// 値はすべて整数(04 §2 の単位)で決め、浮動小数点の試作(tools/physics_lab)と整数のソルバーの両方が同じ場面を読む。
3// 試験用の場面で、ゲームの中身ではない(D-006)。
4#pragma once
5
6#include <array>
7#include <cstdint>
8#include <string>
9#include <vector>
10
11namespace bicameral::sim {
12
13 // 物の 1 つ。形は直方体(T-0016 の範囲。ボクセルの物は T-0043)
15 // --- 形 ---
16 std::array<int64_t, 3> halfExtent{}; // 半分の辺(2^-20 m)
17
18 // --- 質量(0 = 動かない物: 地面・壁)---
19 uint64_t massMilligrams = 0;
20
21 // --- 初めの状態 ---
22 std::array<int64_t, 3> position{}; // 重心(2^-20 m、y が上)
23 std::array<int32_t, 4> rotation{0, 0, 0, 1 << 30}; // 四元数 (x, y, z, w)、Q1.30
24
25 // --- 現れる・消える刻み(0 = 初めから / UINT64_MAX = 消えない)---
26 uint64_t spawnTick = 0;
27 uint64_t removeTick = UINT64_MAX;
28 };
29
30 struct PhysicsScene {
31 std::string name;
32 std::vector<PhysicsSceneBody> bodies;
33
34 uint64_t tickCount = 0;
35 uint32_t frictionQ16 = 1u << 15; // 摩擦係数(Q16.16。全部の組で同じ)
36 };
37
38 // 場面 A: 1 m の立方体 10 段(各 500 kg)を地面に積む。60 s
39 [[nodiscard]] PhysicsScene MakeStackScene();
40
41 // 仮の世界の積み木(T-0098): 場面 A と同じ 10 段を、仮の世界の格子の中(物理の座標 x = 10 m・z = 16.25 m。格子の左寄り、
42 // 既定の断面を通る位置)に積む。地面は格子の床。窓のクリックで押して崩す
43 [[nodiscard]] PhysicsScene MakeProbeStackScene();
44
45 // 質量比: 1 kg の箱の上に 100 kg の箱。10 s
46 [[nodiscard]] PhysicsScene MakeMassRatioScene();
47
48 // C 小: 囲い(内側 3 m 四方)の中に大きさ 0.25〜1 m の箱 50 個を 0.25 s ごとに落として山にし、16 s で囲いの壁を 1 枚消して崩す。30 s
49 [[nodiscard]] PhysicsScene MakePileScene(uint64_t seed);
50
51 // 大きな島(T-0094): 地面の上にれんが(1 × 0.5 × 1 m・500 kg)を 20 個 × 15 段、段ごとに半分ずらして積んだ壁。300 個が全部つながる。5 s
52 [[nodiscard]] PhysicsScene MakeWallScene();
53
54} // namespace bicameral::sim
PhysicsScene MakeWallScene()
PhysicsScene MakeProbeStackScene()
PhysicsScene MakeStackScene()
PhysicsScene MakePileScene(uint64_t seed)
PhysicsScene MakeMassRatioScene()
std::array< int64_t, 3 > halfExtent
std::array< int64_t, 3 > position
std::array< int32_t, 4 > rotation
std::vector< PhysicsSceneBody > bodies