Owning static-prefab GPU leases and immutable draw transforms; no ECS or Scene mutation. @ownership Mesh/image factories must outlive this object and its explicit release; the factories own GPU allocations. @lifetime Release before backend shutdown/device loss. Reimport builds a separate candidate; swap only after success. @thread Creation, drawing, release and destruction are graphics-thread affine. @reentrancy No scripts or caller callbacks and no locks; do not reenter from backend methods. 更多...
#include <EvpackStaticPrefab.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| ~EvpackStaticPrefab () | |
| Evpack static prefab. | |
| EvpackStaticPrefab (const EvpackStaticPrefab &)=delete | |
| EvpackStaticPrefab & | operator= (const EvpackStaticPrefab &)=delete |
| std::size_t | drawCount () const noexcept |
| Number of enabled static renderer bindings prepared for drawing. | |
| Result< std::array< float, 6 > > | localBounds (PrefabRootPose rootPose=PrefabRootPose::Authored) const |
| Copy prefab-local min XYZ/max XYZ enclosing enabled renderer geometry and hierarchy transforms. | |
| AssetRef | sourceAsset () const |
| Copy the admitted source asset identity; immutable and valid after GPU release. @thread Any thread after successful load; caller keeps this object alive. No callbacks or IO. | |
| PersistentId | sourceBuildId () const noexcept |
| Copy the admitted deterministic package build identity; constant-time, no IO or callbacks. @thread Any thread after successful load; caller keeps this object alive, including after GPU release. | |
| Result< std::vector< StaticPrefabGpuPart > > | prepareGpuDriven (graphics::Graphics &graphics) |
| Register every opaque or masked prefab draw in GPU-driven tables transactionally. | |
| Result< void > | draw (graphics::Graphics &graphics, const std::array< float, 16 > &transform, const std::array< float, 16 > &cameraView) const |
| Draw in an already-open 3D pass using its camera/light state and a column-major instance transform. | |
| Result< void > | drawShadow (graphics::Graphics &graphics, const std::array< float, 16 > &transform, const std::array< float, 16 > &lightViewProjection) const |
| Submit enabled source shadow casters inside an active cascade shadow pass. | |
| Result< void > | release () |
| Invalidate draw packets and release all leases; failed releases remain owned for retry. | |
静态 Public 成员函数 | |
| static Result< std::unique_ptr< EvpackStaticPrefab > > | load (const asset::EvpackResourceReader &reader, graphics::IMeshResourceFactory &meshes, graphics::IImageResourceFactory &images, const AssetRef &asset, const asset::EvpackCapabilities &capabilities) |
| Validate a template and stage its mesh, material and image dependencies; failures release staged uploads. | |
| static Result< std::unique_ptr< StaticPrefabResourcePin > > | pinResources (const std::shared_ptr< EvpackStaticPrefab > &owner) |
| Retain loaded resources for an admitted version without creating renderer/material inputs. | |
| static Result< std::unique_ptr< PreparedStaticPrefabScene > > | prepareScene (const std::shared_ptr< EvpackStaticPrefab > &owner, graphics::Graphics &graphics, PrefabRootPose rootPose=PrefabRootPose::Authored) |
| Prepare complete scene-renderer materials and local transforms while pinning loaded prefab resources. | |
友元 | |
| class | PreparedStaticPrefabScene |
| class | StaticPrefabResourcePin |
详细描述
Owning static-prefab GPU leases and immutable draw transforms; no ECS or Scene mutation. @ownership Mesh/image factories must outlive this object and its explicit release; the factories own GPU allocations. @lifetime Release before backend shutdown/device loss. Reimport builds a separate candidate; swap only after success. @thread Creation, drawing, release and destruction are graphics-thread affine. @reentrancy No scripts or caller callbacks and no locks; do not reenter from backend methods.
在文件 EvpackStaticPrefab.h 第 91 行定义.
构造及析构函数说明
◆ ~EvpackStaticPrefab()
| eve::asset_graphics::EvpackStaticPrefab::~EvpackStaticPrefab | ( | ) |
◆ EvpackStaticPrefab()
|
delete |
成员函数说明
◆ draw()
| Result< void > eve::asset_graphics::EvpackStaticPrefab::draw | ( | graphics::Graphics & | graphics, |
| const std::array< float, 16 > & | transform, | ||
| const std::array< float, 16 > & | cameraView | ||
| ) | const |
Draw in an already-open 3D pass using its camera/light state and a column-major instance transform.
- 参数
-
graphics Borrowed backend corresponding to the factories used at load. transform Finite column-major instance transform; borrowed only during this call. cameraView Finite right-handed column-major view matrix, borrowed for per-prefab transparent sorting.
- 返回
- Success or invalid-transform/released-state error before issuing draws.
- 备注
- Draws opaque PBR first, then transparent submeshes back-to-front by node origin within this prefab; caller orders separate prefab instances for transparency. Sets material state; caller restores any state needed by subsequent custom draws. No shadow pass is submitted.
在文件 EvpackStaticPrefab.cpp 第 474 行定义.
引用了 a, b, color, draw, eve::graphics::Graphics::drawMesh(), eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, eve::graphics::Masked, eve::graphics::Opaque, order, eve::graphics::Graphics::setMesh3DHeightTexture(), eve::graphics::Graphics::setMesh3DMaterial(), eve::graphics::Graphics::setMesh3DNormalTexture(), eve::graphics::Graphics::setMesh3DParallax(), eve::graphics::Graphics::setMesh3DPbrSurface(), eve::graphics::Graphics::setMesh3DShadowReceive(), eve::graphics::Graphics::setMesh3DSurface(), eve::graphics::Graphics::setMesh3DTexCellBomb(), eve::graphics::Graphics::setMesh3DVirtualTexture(), eve::graphics::Transparent, value , 以及 view.
◆ drawCount()
|
noexcept |
Number of enabled static renderer bindings prepared for drawing.
在文件 EvpackStaticPrefab.cpp 第 225 行定义.
◆ drawShadow()
| Result< void > eve::asset_graphics::EvpackStaticPrefab::drawShadow | ( | graphics::Graphics & | graphics, |
| const std::array< float, 16 > & | transform, | ||
| const std::array< float, 16 > & | lightViewProjection | ||
| ) | const |
Submit enabled source shadow casters inside an active cascade shadow pass.
- 参数
-
graphics Borrowed backend corresponding to the factories used at load. transform Finite column-major prefab instance transform. lightViewProjection Finite column-major cascade light view-projection matrix.
- 返回
- Success, or a structured released/transform error before issuing draws. @thread Graphics thread only; synchronous and non-reentrant.
在文件 EvpackStaticPrefab.cpp 第 520 行定义.
引用了 doubleSided, draw, eve::graphics::Graphics::drawMeshShadow(), eve::graphics::Graphics::drawMeshShadowAlpha(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::Inherit, eve::InvalidArgument, lightVP, eve::graphics::None, eve::Result< T >::success() , 以及 value.
◆ load()
|
static |
Validate a template and stage its mesh, material and image dependencies; failures release staged uploads.
- 返回
- Owning renderer candidate or structured error; existing renderers are untouched.
- 参数
-
reader Borrowed only during load; returned data does not retain the reader or package. meshes Borrowed backend factory that must outlive the returned object. images Borrowed backend factory that must outlive the returned object.
在文件 EvpackStaticPrefab.cpp 第 357 行定义.
引用了 axis, build, eve::asset::EvpackResourceReader::buildId(), caps, eve::asset_scene::EvpackSceneTemplateLoader::load(), node, out, parent, root , 以及 scene.
被这些函数引用 eve::asset_procgen::TerrainDetailGpuResolver::resolve().
◆ localBounds()
| Result< std::array< float, 6 > > eve::asset_graphics::EvpackStaticPrefab::localBounds | ( | PrefabRootPose | rootPose = PrefabRootPose::Authored | ) | const |
Copy prefab-local min XYZ/max XYZ enclosing enabled renderer geometry and hierarchy transforms.
- 参数
-
rootPose Source-root convention, identical to the scene preparation convention.
- 返回
- Owning CPU-derived bounds, or NotFound when no enabled renderer exists. @cost Constant-time copy; vertex scanning and transformed corner aggregation are amortized at load. @thread Any thread after successful load; no callbacks. Bounds remain valid after GPU release.
- 备注
- Conservative transformed mesh AABB; excludes animated deformation and instance transforms.
在文件 EvpackStaticPrefab.cpp 第 228 行定义.
引用了 eve::Authored, eve::Diagnostic::error(), eve::InvalidArgument, eve::NotFound , 以及 eve::ReplaceTranslationRotation.
◆ operator=()
|
delete |
◆ pinResources()
|
static |
Retain loaded resources for an admitted version without creating renderer/material inputs.
- 参数
-
owner Owning live prefab reference, retained by a successful pin; factories outlive the returned token.
- 返回
- Owning pin, or released/null/overflow failure without mutation. @cost Fixed allocation and counter increment per admitted version, after explicit expensive load. @thread Graphics-owner affine, synchronous, non-reentrant, no scripts or locks.
在文件 EvpackStaticPrefab.cpp 第 133 行定义.
引用了 eve::Diagnostic::error(), owner, eve::PreconditionViolation , 以及 StaticPrefabResourcePin.
被这些函数引用 eve::asset_graphics::ProcgenPrefabSceneSink::admit().
◆ prepareGpuDriven()
| Result< std::vector< StaticPrefabGpuPart > > eve::asset_graphics::EvpackStaticPrefab::prepareGpuDriven | ( | graphics::Graphics & | graphics | ) |
Register every opaque or masked prefab draw in GPU-driven tables transactionally.
- 参数
-
graphics Borrowed backend corresponding to the factories used during load.
- 返回
- Owning part descriptors; material objects remain owned by this prefab until release. @thread Graphics thread only; synchronous and non-reentrant.
在文件 EvpackStaticPrefab.cpp 第 274 行定义.
引用了 binding, count, draw, eve::Diagnostic::error(), eve::graphics::Graphics::gpuDrivenMaterialRecord(), eve::graphics::Graphics::gpuDrivenMaterialUsable(), eve::graphics::Graphics::gpuDrivenMeshRecord(), eve::graphics::Graphics::gpuDrivenReleaseMaterialRecord(), image, eve::InvalidArgument, eve::graphics::kInvalidGpuDrivenSlot, eve::asset_graphics::StaticPrefabGpuPart::localTransform, material, eve::asset_graphics::StaticPrefabGpuPart::materialId, eve::asset_graphics::StaticPrefabGpuPart::meshId, eve::graphics::Normal, owned, parts, eve::Result< T >::success() , 以及 eve::graphics::TangentXYZ.
◆ prepareScene()
|
static |
Prepare complete scene-renderer materials and local transforms while pinning loaded prefab resources.
- 参数
-
owner Owning prefab reference, borrowed during preparation and retained only by a successful lease. graphics Borrowed graphics owner used for material-record cleanup; must outlive the returned lease. rootPose Placement convention; replaces root translation/rotation only when explicitly selected.
- 返回
- Owning preparation lease or a structured error; no ECS/Scene mutation occurs. @cost Linear in enabled renderer count, with material allocations amortized per prefab preparation. @thread Graphics thread only; synchronous, non-reentrant, no scripts or locks.
在文件 EvpackStaticPrefab.cpp 第 172 行定义.
引用了 eve::Authored, eve::asset_graphics::StaticPrefabScenePart::castShadows, draw, eve::Diagnostic::error(), graphics, eve::InvalidArgument, local, eve::asset_graphics::StaticPrefabScenePart::localTransform, eve::asset_graphics::StaticPrefabScenePart::material, material, eve::asset_graphics::StaticPrefabScenePart::mesh, owner, eve::PreconditionViolation, eve::asset_graphics::StaticPrefabScenePart::receiveShadows, eve::ReplaceTranslationRotation , 以及 eve::Unsupported.
被这些函数引用 eve::asset_graphics::ProcgenPrefabSceneSink::Impl::prepare().
◆ release()
| Result< void > eve::asset_graphics::EvpackStaticPrefab::release | ( | ) |
Invalidate draw packets and release all leases; failed releases remain owned for retry.
- 返回
- Backend failure if any release fails. Destructor retries and reports remaining errors to stderr.
在文件 EvpackStaticPrefab.cpp 第 238 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::isFailure(), material, eve::PreconditionViolation, result , 以及 eve::Result< T >::success().
被这些函数引用 ~EvpackStaticPrefab().
◆ sourceAsset()
| AssetRef eve::asset_graphics::EvpackStaticPrefab::sourceAsset | ( | ) | const |
Copy the admitted source asset identity; immutable and valid after GPU release. @thread Any thread after successful load; caller keeps this object alive. No callbacks or IO.
在文件 EvpackStaticPrefab.cpp 第 226 行定义.
◆ sourceBuildId()
|
noexcept |
Copy the admitted deterministic package build identity; constant-time, no IO or callbacks. @thread Any thread after successful load; caller keeps this object alive, including after GPU release.
在文件 EvpackStaticPrefab.cpp 第 227 行定义.
友元及相关函数文档
◆ PreparedStaticPrefabScene
|
friend |
在文件 EvpackStaticPrefab.h 第 177 行定义.
◆ StaticPrefabResourcePin
|
friend |
在文件 EvpackStaticPrefab.h 第 178 行定义.
被这些函数引用 pinResources().
该类的文档由以下文件生成:
- src/modules/asset/graphics/EvpackStaticPrefab.h
- src/modules/asset/graphics/EvpackStaticPrefab.cpp