载入中...
搜索中...
未找到
SceneVisibility.cpp
浏览该文件的文档.
65 pixels.depth.size() == count && std::all_of(pixels.depth.begin(), pixels.depth.end(), [](float depth) {
83 "Invalid eve.scene.visibility-request v1/v2; bounded viewport, camera, draws and targets required"));
85 if (!fields(request, {"schemaId", "schemaVersion", "sourceRevision", "candidateGeneration", "camera", "width",
90 if (!schema || *schema != "eve.scene.visibility-request" || !number(field(request, "schemaVersion"), version) ||
92 !number(field(request, "height"), height) || width < 1 || height < 1 || width > 2048 || height > 2048 ||
94 !number(field(request, "sourceRevision"), revision) || revision < 0 || std::floor(revision) != revision ||
101 !array(field(*camera, "eye"), 3) || !array(field(*camera, "target"), 3) || !array(field(*camera, "up"), 3) ||
102 !number(field(*camera, "fov"), fov) || fov <= 1 || fov >= 179 || !number(field(*camera, "near"), nearZ) ||
106 if (glm::length(forward) < 1e-6f || glm::length(glm::cross(forward, vec(*field(*camera, "up")))) < 1e-6f)
112 if (!draws || draws->empty() || draws->size() > 4096 || !targets || targets->empty() || targets->size() > 16)
118 if (!fields(draw, {"object", "entityId", "generation", "model"}) || !object || object->empty() ||
155 if (consumed_) return fail(DiagnosticCode::Conflict, "Visibility query has already been consumed");
168 glm::lookAtRH(vec(*field(camera, "eye")), vec(*field(camera, "target")), vec(*field(camera, "up")));
170 perspectiveVulkanRH_ZO(float(fov * 3.141592653589793 / 180), float(width) / height, float(nearZ), float(farZ));
178 ecs::EntityHandle handle{ecs::current(), std::type_index(typeid(Renderable3D)), id, generation};
180 if (!entity) return fail(DiagnosticCode::StaleHandle, "Visibility renderable generation is stale");
205 glm::vec4((packed & 255) / 255.f, ((packed >> 8) & 255) / 255.f, ((packed >> 16) & 255) / 255.f, 1.f);
209 if (!capture) return fail(DiagnosticCode::Unsupported, "Backend has no isolated visibility capture");
349 std::function<SceneVisibilityQuery*()>([]() -> SceneVisibilityQuery* { return nullptr; }), true);
Entity-ID / isolated visibility capture kept off Graphics.h.
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.cpp:28
Definition Graphics.h:134
Single-use, owning visibility request; no ECS/resource pointer survives a call. @thread Prepare and m...
Definition SceneVisibility.h:13
Result< Value > measure(Graphics &graphics)
Consume the request, resolve current generation-qualified meshes and capture private GPU targets....
Definition SceneVisibility.cpp:152
static Result< SceneVisibilityQuery > prepare(const Value &request)
Validate schema v1/v2 and copy the bounded request without drawing.
Definition SceneVisibility.cpp:79
Result< T > fail(std::string message, DiagnosticCode code=DiagnosticCode::InvalidArgument)
Definition BuildingAssemblyInternal.h:35
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
Definition BuildingSnapshot.cpp:96
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
glm::mat4 perspectiveVulkanRH_ZO(float fovyRad, float aspect, float zNear, float zFar)
Right-handed, zero-to-one depth perspective for Vulkan swapchains.
Definition ClipSpace.h:22
void exposeSceneVisibility(ssq::Table &table)
Register the owning two-step visibility query script API, synchronously.
Definition SceneVisibility.cpp:345
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.
Definition SquirrelBinding.cpp:412
@ InvalidArgument
@ Unsupported
@ InvariantViolation
@ StaleHandle
@ Conflict
static Result< SceneLocalRegion > fromValue(const Value &value)
Decode a finite, nonempty local box and immutable geometry revision.
Definition SceneLocalRegion.cpp:4
One mesh contribution to an entity-ID or visibility capture pass.
Definition GraphicsVisibility.h:29