载入中...
搜索中...
未找到
GraphicsEntityInspection.cpp
浏览该文件的文档.
1#include <glm/gtc/type_ptr.hpp>
2#include <limits>
7#include "graphics/shaders/primitive3d_frag_spv.inc"
8#include "graphics/shaders/primitive3d_vert_spv.inc"
11
12namespace eve::graphics::vulkan {
13namespace {
14template <class T>
15Result<T> inspectionFailure(DiagnosticCode code, std::string message) {
17}
18bool finitePosition(const glm::vec3& v) { return std::isfinite(v.x) && std::isfinite(v.y) && std::isfinite(v.z); }
19} // namespace
20
21// Owner-thread provider. Graphics owns this service and retires its queue before destruction.
22// No entity/resource pointers survive freeze(); submitted work references only private buffers.
27 std::string token;
28 std::vector<Primitive3DVertex> frozenGeometry;
29 uint64_t frozenFrame = 0;
30 vkb::ColorTarget color;
31 vkb::DepthTarget depth;
32 vkb::HostVertexBuffer vertices;
33 vkb::GenericBuffer staging;
34 vkb::BuiltRenderPass pass;
35 vk::Framebuffer framebuffer{};
36 vk::PipelineLayout layout{};
37 vk::Pipeline pipeline{};
38 vk::CommandPool pool{};
39 vk::Fence fence{};
40 bool submitted = false;
41
44 caps.backend = "vulkan-geometry-inspection";
45 caps.attachments = {FrameAttachment::Final};
47 }
48 ~InspectionService() override { clearGpu(); }
49
50 void clearGpu() {
51 auto& device = graphics.device;
52 if (pool) device->destroyCommandPool(pool);
53 if (fence) device->destroyFence(fence);
54 if (pipeline) device->destroyPipeline(pipeline);
55 if (layout) device->destroyPipelineLayout(layout);
56 if (framebuffer) device->destroyFramebuffer(framebuffer);
57 if (pass) device->destroyRenderPass(pass.handle);
58 pool = nullptr;
59 fence = nullptr;
60 pipeline = nullptr;
61 layout = nullptr;
62 framebuffer = nullptr;
63 pass = {};
64 vertices.release();
65 staging.release();
66 color = {};
67 depth = {};
68 submitted = false;
69 }
71 if (request.cellSize < 64 || request.cellSize > 1024)
72 return inspectionFailure<std::string>(DiagnosticCode::InvalidArgument, "cellSize must be 64..1024");
73 if (!token.empty()) {
74 auto old = store.snapshot(token);
75 const bool found = old.ok();
76 if (submitted ||
77 (found && old.value().phase != FrameCapturePhase::Released &&
78 old.value().phase != FrameCapturePhase::Expired && old.value().phase != FrameCapturePhase::Failed &&
79 old.value().phase != FrameCapturePhase::Cancelled))
80 return inspectionFailure<std::string>(DiagnosticCode::InvalidArgument,
81 "Inspection busy; release the previous token");
82 }
83 evidence = {};
84 evidence.request = std::move(request);
85 auto frozen = freeze();
87 if (!frozen.ok()) return Result<std::string>::failure(frozen.status());
88 FrameCaptureRequest capture;
90 auto queued = store.request(std::move(capture));
91 if (!queued.ok()) return Result<std::string>::failure(queued.status());
92 token = queued.value();
93 frozenGeometry = std::move(frozen.value());
94 frozenFrame = graphics.captureFrameId_;
96 }
97 Result<EntityViewSnapshot> snapshot(std::string_view requested) override {
98 if (requested != token)
99 return inspectionFailure<EntityViewSnapshot>(DiagnosticCode::NotFound, "Unknown inspection token");
100 auto state = store.snapshot(token);
101 if (!state.ok()) return Result<EntityViewSnapshot>::failure(state.status());
102 auto result = evidence;
103 result.capture = std::move(state.value());
105 }
106 Result<FrameCapturePhase> release(std::string_view requested) override {
107 auto result = store.release(requested);
108 if (!result.ok()) return result;
109 if (requested == token) frozenGeometry = {};
110 return result;
111 }
112
114 using Output = std::vector<Primitive3DVertex>;
115 ecs::EntityHandle handle{ecs::current(), std::type_index(typeid(Renderable3D)), evidence.request.entityId,
117 auto* entity = dynamic_cast<Renderable3D*>(ecs::try_get(handle));
118 if (!entity) return inspectionFailure<Output>(DiagnosticCode::StaleHandle, "Renderable3D generation is stale");
119 const auto renderer = entity->meshRenderer();
120 if (renderer->instances || renderer->lodCount || renderer->shader || renderer->isHair ||
121 renderer->heightTexture)
122 return inspectionFailure<Output>(
124 "Geometry inspection does not support instances, LOD, custom shaders, hair or displacement");
125 Camera3D* camera = nullptr;
126 if (ecs::current()->getManager<Camera3D>()) {
127 auto view = ecs::View<Camera3D, Camera3D::Data>();
128 for (auto it = view.begin(); it != view.end(); ++it) {
129 auto [data] = *it;
130 if (data->active && data->entity) {
131 camera = data->entity;
132 break;
133 }
134 }
135 }
136 if (!camera)
137 return inspectionFailure<Output>(DiagnosticCode::NotFound,
138 "No active Camera3D; inspection does not create a camera");
139 if (renderer->camera && renderer->camera != camera)
140 return inspectionFailure<Output>(DiagnosticCode::Unsupported,
141 "Entity uses a camera override; active-camera inspection is ambiguous");
142 const auto cameraData = camera->data();
143 InspectionCamera gameCamera;
144 gameCamera.width = uint32_t(graphics.getPixelWidth());
145 gameCamera.height = uint32_t(graphics.getPixelHeight());
146 if (!gameCamera.width || !gameCamera.height)
147 return inspectionFailure<Output>(DiagnosticCode::InvalidArgument, "Game viewport is empty");
148 gameCamera.view = glm::lookAtRH(glm::vec3(cameraData->eyeX, cameraData->eyeY, cameraData->eyeZ),
149 glm::vec3(cameraData->targetX, cameraData->targetY, cameraData->targetZ),
150 glm::vec3(cameraData->upX, cameraData->upY, cameraData->upZ));
152 cameraData->orthographic, glm::radians(cameraData->fovYDeg), cameraData->orthoHeight,
153 float(gameCamera.width) / float(gameCamera.height), cameraData->nearZ, cameraData->farZ);
154 const auto model = eve::graphics::detail::modelFromTransform(*entity->transform());
155 if (!std::isfinite(glm::determinant(model)) || std::abs(glm::determinant(model)) < 1e-12f)
156 return inspectionFailure<Output>(DiagnosticCode::InvalidArgument,
157 "Entity transform is singular or non-finite");
158 const auto normalModel = glm::transpose(glm::inverse(glm::mat3(model)));
159 struct WorldVertex {
160 glm::vec3 position, normal;
161 };
162 std::vector<WorldVertex> world;
163 InspectionBounds bounds{glm::vec3(std::numeric_limits<float>::max()),
164 glm::vec3(-std::numeric_limits<float>::max())};
165 auto append = [&](Mesh* mesh, Material* material, int part) -> Result<void> {
166 if (!mesh || !graphics.describeMesh(mesh))
167 return inspectionFailure<void>(DiagnosticCode::StaleHandle, "Mesh is unavailable in this backend");
168 if ((material && (material->effectiveShader() || material->getShadingModel() == "hair")) ||
169 mesh->isMorphDirty())
170 return inspectionFailure<void>(DiagnosticCode::Unsupported,
171 "Custom material or unapplied morph cannot be frozen faithfully");
172 auto* gpu = static_cast<GpuMesh*>(mesh->gpuHandle);
173 if (!gpu || gpu->residentVertexOverride || !gpu->vertexCount || !gpu->indexCount || gpu->indexCount % 3 ||
174 gpu->vertexCount > 250000 || gpu->indexCount > 450000 || world.size() + gpu->indexCount > 450000)
175 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
176 "Unsupported geometry or inspection geometry budget exceeded");
177 std::vector<MeshVertex> source(gpu->vertexCount);
178 auto& vb = meshDrawVertices(*gpu);
179 std::memcpy(source.data(), vb.map(), source.size() * sizeof(MeshVertex));
180 vb.unmap();
181 std::vector<uint32_t> indices(gpu->indexCount);
182 auto& ib = meshDrawIndices(*gpu);
183 const auto* bytes = static_cast<const uint8_t*>(ib.map());
184 for (size_t i = 0; i < indices.size(); ++i) {
185 if (gpu->indexType == vk::IndexType::eUint16)
186 indices[i] = reinterpret_cast<const uint16_t*>(bytes)[i];
187 else
188 indices[i] = reinterpret_cast<const uint32_t*>(bytes)[i];
189 }
190 ib.unmap();
191 if (!evidence.request.skinPalettes.empty() && !mesh->hasGpuSkinning())
192 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
193 "Pose override requires a skinned mesh");
194 if (mesh->hasGpuSkinning()) {
195 // Non-LOD Renderable3D draws use four influences, independent of the
196 // backend's mutable last-draw influence limit. Freeze on the owner thread.
197 const auto& selectedPalette = evidence.request.skinPalettes.empty()
198 ? mesh->skinPalette()
199 : evidence.request.skinPalettes[size_t(part)];
200 if (selectedPalette.size() > 65536u * 16u)
201 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
202 "Inspection skin palette exceeds 65536 matrices");
203 const auto palette = selectedPalette;
204 if (palette.empty() || palette.size() % 16)
205 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
206 "Skin palette is empty or malformed");
207 for (size_t bone = 0; bone < palette.size(); bone += 16) {
208 for (size_t element = 0; element < 16; ++element)
209 if (!std::isfinite(palette[bone + element]))
210 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
211 "Skin palette is non-finite");
212 if (palette[bone + 3] != 0.f || palette[bone + 7] != 0.f || palette[bone + 11] != 0.f ||
213 palette[bone + 15] != 1.f)
214 return inspectionFailure<void>(DiagnosticCode::Unsupported,
215 "Skin palette must contain affine matrices");
216 }
217 for (auto& vertex : source) {
218 auto weights = vertex.weights;
219 for (int influence = 0; influence < 4; ++influence) {
220 // Shaders access all four indices, including zero-weight lanes.
221 if (size_t(vertex.joints[influence]) >= palette.size() / 16 ||
222 !std::isfinite(weights[influence]) || weights[influence] < 0.f)
223 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
224 "Invalid skin joint or weight");
225 }
226 const float sum = glm::dot(weights, glm::vec4(1.f));
227 if (!std::isfinite(sum) || sum <= 1e-8f)
228 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
229 "Skin weights have no finite positive sum");
230 weights /= sum;
231 glm::mat4 skin(0.f);
232 for (int influence = 0; influence < 4; ++influence)
233 skin +=
234 weights[influence] * glm::make_mat4(palette.data() + size_t(vertex.joints[influence]) * 16);
235 vertex.pos = glm::vec3(skin * glm::vec4(vertex.pos, 1.f));
236 vertex.normal = glm::mat3(skin) * vertex.normal;
237 }
238 }
239 for (auto index : indices) {
240 if (index >= source.size())
241 return inspectionFailure<void>(DiagnosticCode::InvalidArgument, "Mesh index outside vertex stream");
242 const auto& vertex = source[index];
243 const auto position = glm::vec3(model * glm::vec4(vertex.pos, 1.f));
244 const auto normal = normalModel * vertex.normal;
245 if (!finitePosition(position) || !finitePosition(normal) || glm::length(normal) < 1e-8f)
246 return inspectionFailure<void>(DiagnosticCode::InvalidArgument,
247 "Mesh has non-finite positions or invalid normals");
248 bounds.minimum = glm::min(bounds.minimum, position);
249 bounds.maximum = glm::max(bounds.maximum, position);
250 world.push_back({position, glm::normalize(normal)});
251 }
252 return Result<void>::success();
253 };
254 if (renderer->partCount < 0 || renderer->partCount > Renderable3D::MeshRenderer::kMaxParts)
255 return inspectionFailure<Output>(DiagnosticCode::InvalidArgument, "Invalid model part count");
256 const int count = std::max(1, renderer->partCount);
257 if (!evidence.request.skinPalettes.empty() && evidence.request.skinPalettes.size() != size_t(count))
258 return inspectionFailure<Output>(DiagnosticCode::InvalidArgument,
259 "Pose override must cover every mesh part");
260 for (int part = 0; part < count; ++part) {
261 auto copied = renderer->partCount ? append(renderer->parts[part].mesh, renderer->parts[part].material, part)
262 : append(renderer->mesh, renderer->material, part);
263 if (!copied.ok()) return Result<Output>::failure(copied.status());
264 }
265 const auto size = evidence.request.cellSize;
266 auto planned = planInspectionViews(bounds, gameCamera, size, size, 1.1f);
267 if (!planned.ok()) return Result<Output>::failure(planned.status());
268 evidence.worldUnitsPerPixel = planned.value().worldUnitsPerPixel;
269 for (int axis = 0; axis < 3; ++axis) {
270 evidence.bounds[axis] = bounds.minimum[axis];
271 evidence.bounds[axis + 3] = bounds.maximum[axis];
272 }
273 Output output;
274 output.reserve(world.size() * 4);
275 for (size_t i = 0; i < 4; ++i) {
276 const auto& cam = planned.value().cameras[i];
277 auto& metadata = evidence.cameras[i];
278 std::copy_n(glm::value_ptr(cam.view), 16, metadata.view.begin());
279 std::copy_n(glm::value_ptr(cam.projection), 16, metadata.projection.begin());
280 metadata.width = size;
281 metadata.height = size;
282 if (i == 3) {
283 if (cam.width > cam.height)
284 metadata.height = std::max(1u, uint32_t(uint64_t(size) * cam.height / cam.width));
285 else
286 metadata.width = std::max(1u, uint32_t(uint64_t(size) * cam.width / cam.height));
287 }
288 metadata.x = uint32_t(i % 2) * size + (size - metadata.width) / 2;
289 metadata.y = uint32_t(i / 2) * size + (size - metadata.height) / 2;
290 for (const auto& vertex : world)
291 output.push_back({cam.projection * cam.view * glm::vec4(vertex.position, 1.f),
292 glm::vec4(vertex.normal * .5f + .5f, 1.f)});
293 }
294 return Result<Output>::success(std::move(output));
295 }
296
297 void record(const std::vector<Primitive3DVertex>& geometry) {
298 auto& device = graphics.device;
299 const uint32_t size = evidence.request.cellSize * 2;
300 color = device.createColorTarget(size, size, vk::Format::eR8G8B8A8Unorm);
301 depth = device.createDepthTarget(size, size, vk::Format::eD32Sfloat);
302 pass = device.createRenderPass()
303 .addSampledColorAttachment(vk::Format::eR8G8B8A8Unorm)
304 .addDepthAttachment(vk::Format::eD32Sfloat, vk::AttachmentLoadOp::eClear,
305 vk::AttachmentStoreOp::eDontCare)
306 .addSubpass(vkb::SubpassBuilder()
307 .addAttachmentRef(0, vk::ImageLayout::eColorAttachmentOptimal)
308 .setDepthStencilAttachment(1, vk::ImageLayout::eDepthStencilAttachmentOptimal))
309 .addExternalShaderReadDependencies()
310 .build();
311 framebuffer = pass.createFramebuffer(device, size, size, {color.asAttachment(), depth.asAttachment()});
312 layout = device.createPipelineLayout().build();
313 pipeline = device.createPipeline()
314 .useClassicPipeline(embeddedSpirv(primitive3d_vert_spv), embeddedSpirv(primitive3d_frag_spv))
315 .setPipelineLayout(layout)
316 .setVertexInputState(vkb::VertexInputStateBuilder()
317 .addInputBinding<Primitive3DVertex>()
318 .addAttributeDescription<Primitive3DVertex>())
319 .setDynamicStatesViewportScissor()
320 .setRasterizer(vk::PolygonMode::eFill, false, false, 1.f, vk::CullModeFlagBits::eNone,
321 vk::FrontFace::eCounterClockwise)
322 .setDepthStencil(true, true, vk::CompareOp::eLessOrEqual)
323 .build(pass);
324 vertices.allocate(vkb::FrameSlot::gpuIdle(), device, geometry);
325 staging = vkb::GenericBuffer(device, vk::BufferUsageFlagBits::eTransferDst, vk::DeviceSize(size) * size * 4,
326 kHostVisibleCoherent);
327 pool = device.createCommandPool();
328 vk::CommandBufferAllocateInfo allocate(pool, vk::CommandBufferLevel::ePrimary, 1);
329 auto cb = device->allocateCommandBuffers(allocate).front();
330 fence = device->createFence({});
331 cb.begin(vk::CommandBufferBeginInfo(vk::CommandBufferUsageFlagBits::eOneTimeSubmit));
332 std::array<vk::ClearValue, 2> clears;
333 clears[0].color = vk::ClearColorValue(std::array<float, 4>{.035f, .035f, .035f, 1.f});
334 clears[1].depthStencil = vk::ClearDepthStencilValue(1.f, 0);
335 vk::RenderPassBeginInfo begin(pass.handle, framebuffer, vk::Rect2D({0, 0}, {size, size}), 2, clears.data());
336 color.beginColorAttachment();
337 depth.beginDepthAttachment();
338 cb.beginRenderPass(begin, vk::SubpassContents::eInline);
339 cb.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline);
340 const vk::DeviceSize offset = 0;
341 cb.bindVertexBuffers(0, 1, vertices, &offset);
342 const uint32_t count = uint32_t(geometry.size() / 4);
343 for (uint32_t i = 0; i < 4; ++i) {
344 const auto& camera = evidence.cameras[i];
345 const vk::Viewport viewport(float(camera.x), float(camera.y), float(camera.width), float(camera.height),
346 0.f, 1.f);
347 const vk::Rect2D scissor({int32_t(camera.x), int32_t(camera.y)}, {camera.width, camera.height});
348 cb.setViewport(0, 1, &viewport);
349 cb.setScissor(0, 1, &scissor);
350 cb.draw(count, 1, i * count, 0);
351 }
352 cb.endRenderPass();
353 color.endSampledLayout();
354 detail::recordFrameReadback(cb, color.image(), staging.buffer, {size, size}, vk::ImageAspectFlagBits::eColor, 0,
355 vk::ImageLayout::eShaderReadOnlyOptimal);
356 cb.end();
357 vk::SubmitInfo submit;
358 submit.commandBufferCount = 1;
359 submit.pCommandBuffers = &cb;
360 const auto result = device.getQueue(vkb::QueueType::graphics).submit(1, &submit, fence);
361 if (result != vk::Result::eSuccess) throw Exception("Inspection queue submission failed");
362 submitted = true;
363 }
364
365 void poll() {
366 store.collect();
367 if (token.empty()) return;
368 auto state = store.snapshot(token);
369 if (!state.ok()) return;
370 if (submitted) {
371 const auto status = graphics.device->getFenceStatus(fence);
372 if (status == vk::Result::eNotReady) return;
373 if (status != vk::Result::eSuccess) throw Exception("Inspection fence failed");
374 if (state.value().phase == FrameCapturePhase::ReadbackPending) {
375 const auto size = evidence.request.cellSize * 2;
376 auto bytes = std::make_shared<std::vector<uint8_t>>(size_t(size) * size * 4);
377 std::memcpy(bytes->data(), staging.map(), bytes->size());
378 staging.unmap();
380 buffer.width = buffer.height = size;
381 buffer.producerFrameId = state.value().frameId;
382 buffer.encoding = "isolated-geometry-world-normal-rgb";
383 buffer.colorSpace = "linear-unorm";
384 buffer.bytes = std::move(bytes);
386 result.buffers.push_back(std::move(buffer));
387 auto complete = store.complete(token, std::move(result));
388 if (!complete.ok()) throw Exception("Inspection publication failed");
389 }
390 clearGpu();
391 store.retire(token);
392 } else if (state.value().phase == FrameCapturePhase::Queued) {
393 const size_t side = evidence.request.cellSize * 2;
394 auto begin = store.begin(token, frozenFrame, side * side * 4);
395 if (!begin.ok()) throw Exception("Inspection readback budget exceeded");
396 record(frozenGeometry);
397 frozenGeometry = {};
398 auto pending = store.submitted(token);
399 if (!pending.ok()) throw Exception("Inspection submission state failed");
400 } else
401 frozenGeometry = {};
402 }
403};
404
405void Graphics::pollEntityInspection() {
406 if (!initialized || !device.instance) return;
407 if (!inspectionService_) {
408 inspectionService_ = std::make_shared<InspectionService>(*this);
409 cap::provide<IEntityInspection>(inspectionService_.get());
410 }
411 try {
412 inspectionService_->poll();
413 } catch (const std::exception& exception) {
414 auto failed = inspectionService_->store.fail(inspectionService_->token, exception.what());
415 if (!failed.ok()) return;
416 if (!inspectionService_->submitted) {
417 inspectionService_->clearGpu();
418 inspectionService_->store.retire(inspectionService_->token);
419 }
420 }
421}
422void Graphics::destroyEntityInspection() {
423 if (!inspectionService_) return;
424 cap::revoke<IEntityInspection>(inspectionService_.get());
425 inspectionService_.reset();
426}
427} // namespace eve::graphics::vulkan
std::string output
std::vector< QuestEvent > pending
ScriptComponentRecord record
Definition ECS.cpp:228
std::string palette
std::string layout
std::string message
DiagnosticCode code
const GltfImportRequest & request
vkb::Device & device
float camera[2]
wgpu::PopErrorScopeStatus status
std::vector< std::uint32_t > indices
float v
JointPoint2D axis
size_t offset
std::array< float, 3 > position
std::uint32_t bone
std::string evidence
Poco::JSON::Object::Ptr result
std::uint64_t bytes
Texture * normal
OceanGpuFrameToken token
std::shared_ptr< OceanGpuSpectrum > owner
OceanMeshSettings mesh
std::shared_ptr< OceanRenderer > renderer
std::shared_ptr< OceanGpuSpectrum > gpu
OceanSprayView view
std::unique_ptr< gpgpu::GpuBuffer > buffer
Definition OnnxGpgpu.cpp:26
size_t queued
Definition OnnxGpgpu.cpp:60
std::array< uint32_t, 16 > material
PrimitiveHandle handle
const EntityFact * entity
glm::mat4 model
bool found
std::string geometry
Graphics * graphics
std::string_view source
size_t begin
std::string element
int count
float weights[3]
std::array< double, 2 > vertices[3]
float size
Definition TreeMesh.cpp:158
int caps
Definition TreeMesh.cpp:164
std::uint32_t depth
uint32_t index
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
EVENGINE_API_FOUNDATION public API.
Definition Exception.h:13
Graphics-owned state machine and immutable CPU snapshot authority. @thread Main-thread only; supplied...
Result< void > begin(std::string_view token, uint64_t frameId, size_t bytes)
Reserve CPU plus GPU storage before recording any commands.
Result< void > complete(std::string_view token, FrameCaptureSnapshot snapshot)
Atomically publish all copied attachments; no partial ready result.
void retire(std::string_view token)
Release staging reservations after GPU completion, including cancelled work.
Result< std::string > request(FrameCaptureRequest request) override
Reserve a request. @cost Selected attachments require per-pixel readback at recording.
void configure(FrameCaptureCapabilities capabilities)
Set backend support at provider initialization.
Result< void > submitted(std::string_view token)
Mark a recorded batch submitted to the GPU.
Result< FrameCaptureSnapshot > snapshot(std::string_view token) override
Return immutable owning metadata without GPU access.
Result< FrameCapturePhase > release(std::string_view token) override
Release a snapshot or cancel an in-flight request.
void collect()
Expire queued and ready entries; also called by tool operations.
Optional native geometry-inspection provider, independent of graphics types. @thread Engine owner thr...
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
EVENGINE_API_BACKENDS public API.
int getPixelHeight() const
Returns the pixel height.
Definition Graphics.h:495
int getPixelWidth() const
Returns the pixel width.
Definition Graphics.h:493
Packages shading method + surface parameters into one attachable asset.
Definition Material.h:38
GPU mesh handle (+ optional CPU morph targets).
Definition Mesh.h:26
EVENGINE_API_BACKENDS public API.
EVENGINE_API_BACKENDS public API.
Definition Graphics.h:360
eve::Result< eve::graphics::MeshBackendDescriptor > describeMesh(Mesh *mesh) const override
Return layout facts from the owned Vulkan mesh upload.
glm::mat4 modelFromTransform(const Renderable3D::Transform3D &t)
Resolve the value-owned scene world matrix or the local TRS on the render thread.
void recordFrameReadback(vk::CommandBuffer cb, vk::Image source, vk::Buffer destination, vk::Extent2D extent, vk::ImageAspectFlags aspect, uint32_t layer, vk::ImageLayout originalLayout)
glm::mat4 cameraProjectionVulkanRH_ZO(bool orthographic, float fovyRad, float orthoHeight, float aspect, float zNear, float zFar)
Camera projection shared by rendering, picking, and diagnostic passes.
Definition ClipSpace.h:38
Result< InspectionViews > planInspectionViews(const InspectionBounds &bounds, const InspectionCamera &camera, uint32_t cellWidth, uint32_t cellHeight, float padding)
DiagnosticCode
Stable machine-readable diagnostic codes.
Definition Diagnostic.h:47
Generation-qualified Renderable3D request; geometry diagnostics, world axes, isolated entity.
std::vector< std::vector< float > > skinPalettes
Optional owned per-part palettes for an independently sampled pose. Empty uses the live pose....
Atomic four-view CPU atlas with metadata from the same owner-thread freeze operation.
FrameCaptureSnapshot capture
EntityViewRequest request
std::array< float, 6 > bounds
std::array< EntityViewCamera, 4 > cameras
Immutable CPU attachment with producer-provided decoding metadata.
Backend support is explicit; candidates need not be produced in every frame.
Owning request; timeout uses monotonic wall time, never gameplay time.
std::vector< FrameAttachment > attachments
Owning snapshot metadata; byte storage is immutable and lease-owned.
std::vector< FrameCaptureBuffer > buffers
World-space bounds, supplied from one frozen pose or a union of sampled poses.
Owning camera value snapshot; matrices use engine RH, zero-to-one, Y-down clip space.
GpuMesh public API.
Definition Graphics.h:298
void record(const std::vector< Primitive3DVertex > &geometry)
Result< EntityViewSnapshot > snapshot(std::string_view requested) override
Poll token without waiting; returns owning metadata and CPU lease only when ready.
Result< FrameCapturePhase > release(std::string_view requested) override
Cancel/release; submitted resources survive until their fence completes.
Result< std::string > request(EntityViewRequest request) override
Queue a bounded geometry-only capture; never wait for GPU completion.
Result< std::vector< Primitive3DVertex > > freeze()
MeshVertex public API.
Definition Graphics.h:148
glm::vec4 bounds
glm::vec4 color