42 constexpr std::array<char, 3>
AXIS_NAMES = {
'x',
'y',
'z'};
45 return {vector.
x, vector.
y, vector.
z, 0.0f};
59 std::vector<CellCoordinate> pokes;
75 std::vector<CellCoordinate>& pokes) {
78 const auto deltaX =
static_cast<float>(
event.x -
m_lastX);
79 const auto deltaY =
static_cast<float>(
event.y -
m_lastY);
84 m_camera.Pan(deltaX, deltaY, height);
92 static_cast<float>(event.
y) + 0.5f, width, height);
97 if (cell && !event.
shift)
98 pokes.push_back(*cell);
108 if (event.
key ==
'P' || event.
key == KEY_PAGE_UP || event.
key == KEY_PAGE_DOWN) {
114 const uint32_t step =
event.shift ? SLICE_FAST_STEP : 1;
155 if (event.
key ==
'P' && event.
shift) {
162 if (event.
key ==
'P') {
164 static_cast<float>(
m_lastY) + 0.5f, width, height);
175 const uint32_t before =
m_peek.depth;
176 if (event.
key == KEY_PAGE_DOWN)
181 if (
m_peek.depth == before)
199 const uint32_t depth =
m_peek.depth;
200 const auto scale =
static_cast<float>(1u << depth);
201 const auto center = [depth, scale](uint32_t cell) {
203 return static_cast<float>(cell) + 0.5f;
205 const uint64_t point = (uint64_t{cell} << depth) + (uint64_t{1} << (depth - 1));
206 const uint64_t blockCenter = (point & ~uint64_t{7}) + 4;
208 return static_cast<float>(blockCenter) / scale;
212 PEEK_BASE_DISTANCE / scale);
248 return {.extractionIndex = extractionIndex,
252 .mode =
static_cast<uint32_t
>(
m_settings.mode),
256 .position = ToFloat4(basis.
position),
257 .forward = ToFloat4(basis.
forward),
258 .right = ToFloat4(basis.
right),
259 .up = ToFloat4(basis.
up)};
263 return std::format(
"{} 断面 {} = {} 活性なブロック {} 色 {}({})", ModeName(
m_settings.mode),
270 if (name ==
"volume")
272 else if (name ==
"mip")
274 else if (name ==
"slice")
std::vector< CameraRay > m_pushRays
std::vector< CellCoordinate > HandleInput(std::span< const InputEvent > events, uint32_t width, uint32_t height)
std::string Describe() const
void HandlePeekKey(const InputEvent &event, uint32_t width, uint32_t height)
void HandlePointer(const InputEvent &event, uint32_t width, uint32_t height, std::vector< CellCoordinate > &pokes)
std::vector< CameraRay > TakePushRays()
void HandleKey(const InputEvent &event, uint32_t width, uint32_t height)
void Peek(CellCoordinate cell, uint32_t depth)
DebugViewController(uint32_t gridSize, const DebugViewSettings &settings, const OrbitCameraState &camera)
ProbeViewConstants Constants(uint32_t extractionIndex, uint32_t width, uint32_t height) const
DebugViewSettings m_settings
constexpr uint32_t KEY_PAGE_UP
std::array< float, 4 > ToFloat4(Vector3 vector)
constexpr std::array< char, 3 > AXIS_NAMES
std::string_view ModeName(DebugViewMode mode)
constexpr float PEEK_BASE_DISTANCE
constexpr uint32_t SLICE_FAST_STEP
std::string_view QuantityName(DebugViewQuantity quantity)
constexpr uint32_t KEY_PAGE_DOWN
constexpr uint32_t VIEW_FLAG_LOGARITHMIC
constexpr uint32_t PEEK_MAX_DEPTH
CameraRay RayThroughPixel(const CameraBasis &basis, float pixelX, float pixelY, uint32_t width, uint32_t height)
constexpr uint32_t VIEW_PEEK_DEPTH_SHIFT
bool ParseDebugViewMode(std::string_view name, DebugViewMode &mode)
std::optional< CellCoordinate > PickSliceCell(const CameraRay &ray, uint32_t axis, uint32_t plane, uint32_t gridSize)
constexpr uint32_t VIEW_QUANTITY_SHIFT
constexpr uint32_t VIEW_FLAG_ACTIVE_BLOCKS
constexpr uint32_t DEBUG_VIEW_QUANTITY_COUNT
void Log(Channel channel, Level level, FormatWithLocation< std::type_identity_t< Args >... > pattern, Args &&... args)
DebugViewQuantity quantity