载入中...
搜索中...
未找到
ReflectionProbeVisualizer.cpp
浏览该文件的文档.
2
4
5#include <algorithm>
6#include <array>
7#include <sstream>
8
9namespace eve::editor {
10namespace {
11
12constexpr std::array<std::array<int, 2>, 12> kEdges{{
13 {{0, 1}},
14 {{1, 3}},
15 {{3, 2}},
16 {{2, 0}},
17 {{4, 5}},
18 {{5, 7}},
19 {{7, 6}},
20 {{6, 4}},
21 {{0, 4}},
22 {{1, 5}},
23 {{2, 6}},
24 {{3, 7}},
25}};
26
27} // namespace
28
30
31void ReflectionProbeVisualizer::setExtents(float x, float y, float z) {
32 if (!probe_) return;
34 probe_->getInfluencePriority());
35}
36
37float ReflectionProbeVisualizer::coordinate(int corner, int component) const {
38 if (!probe_ || corner < 0 || corner >= 8 || component < 0 || component >= 3) return 0.f;
39 const float center[3] = {probe_->getCenterX(), probe_->getCenterY(), probe_->getCenterZ()};
40 const float extent[3] = {probe_->getInfluenceExtentX(), probe_->getInfluenceExtentY(),
41 probe_->getInfluenceExtentZ()};
42 return center[component] + ((corner & (1 << component)) ? extent[component] : -extent[component]);
43}
44
45float ReflectionProbeVisualizer::getLineStart(int line, int component) const {
46 if (line < 0 || line >= int(kEdges.size())) return 0.f;
47 return coordinate(kEdges[static_cast<size_t>(line)][0], component);
48}
49
50float ReflectionProbeVisualizer::getLineEnd(int line, int component) const {
51 if (line < 0 || line >= int(kEdges.size())) return 0.f;
52 return coordinate(kEdges[static_cast<size_t>(line)][1], component);
53}
54
56 if (!probe_) return 1.f;
57 if (probe_->isCapturePending()) return 1.f;
58 if (probe_->getPublishedRevision() == probe_->getRevision()) return 0.2f;
59 return 0.15f;
60}
61
63 if (!probe_) return 0.15f;
64 if (probe_->isCapturePending()) return 0.55f;
65 if (probe_->getPublishedRevision() == probe_->getRevision()) return 1.f;
66 return 0.8f;
67}
68
70 if (!probe_) return 0.15f;
71 if (probe_->isCapturePending()) return 0.1f;
72 if (probe_->getPublishedRevision() == probe_->getRevision()) return 0.35f;
73 return 1.f;
74}
75
76float ReflectionProbeVisualizer::getCenterX() const { return probe_ ? probe_->getCenterX() : 0.f; }
77float ReflectionProbeVisualizer::getCenterY() const { return probe_ ? probe_->getCenterY() : 0.f; }
78float ReflectionProbeVisualizer::getCenterZ() const { return probe_ ? probe_->getCenterZ() : 0.f; }
79
81 if (!probe_) return "Reflection probe: detached";
82 std::ostringstream label;
83 label << "Reflection probe " << probe_->getRevision() << '/' << probe_->getStagedRevision() << '/'
84 << probe_->getPublishedRevision();
85 if (probe_->isCapturePending())
86 label << " capture " << (6 - probe_->getPendingFaceCount()) << "/6";
87 else if (probe_->getPublishedRevision() != probe_->getRevision())
88 label << " filtering";
89 else
90 label << " ready";
91 if (probe_->isRecaptureQueued()) label << " +queued";
92 return label.str();
93}
94
95} // namespace eve::editor
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
std::string label
float getColorB() const
Return status color blue channel.
float getColorR() const
Return status color red channel.
void setExtents(float x, float y, float z)
Set positive influence-box half extents.
ReflectionProbeVisualizer(graphics::ReflectionProbeCapture *probe)
Construct a visualizer attached to a runtime reflection probe.
float getLineStart(int line, int component) const
Return one line start coordinate, where component is 0=x,1=y,2=z.
float getLineEnd(int line, int component) const
Return one line end coordinate, where component is 0=x,1=y,2=z.
std::string getStatusLabel() const
Return a concise capture/staging/publication status annotation.
float getCenterY() const
Return probe center Y.
float getColorG() const
Return status color green channel.
float getCenterZ() const
Return probe center Z.
float getCenterX() const
Return probe center X.
Incremental six-face HDR scene capture for a runtime reflection probe.
float getInfluenceExtentY() const
Return persistent influence half extent Y.
float getInfluenceExtentX() const
Return persistent influence half extent X.
float getCenterY() const
Return probe world-space center Y.
uint32_t getPublishedRevision() const
Last capture revision atomically published for lighting.
uint32_t getRevision() const
Monotonic revision incremented after each complete six-face capture.
uint32_t getStagedRevision() const
Last capture revision fully copied into the staging cubemap.
bool isCapturePending() const
True while one or more faces still need capture.
int getInfluencePriority() const
Return persistent overlap-selection priority.
float getInfluenceExtentZ() const
Return persistent influence half extent Z.
float getInfluenceIntensity() const
Return persistent reflection intensity.
bool isRecaptureQueued() const
True when changed capture inputs are queued behind the current revision.
void configureInfluence(float extentX, float extentY, float extentZ, float intensity=1.f, float blendDistance=1.f, int priority=0)
Configure the persistent box influence used for lighting and editor display.
float getCenterZ() const
Return probe world-space center Z.
float getCenterX() const
Return probe world-space center X.
float getInfluenceBlendDistance() const
Return persistent edge blend distance.
int getPendingFaceCount() const
Number of cubemap faces remaining in the current capture revision.