载入中...
搜索中...
未找到
StaticPrefabRenderInstance.cpp
浏览该文件的文档.
17 return std::all_of(values, values + 16, [](float value) { return std::isfinite(value); }) && matrix[0][3] == 0.f &&
19 std::isfinite(glm::length(glm::vec3(matrix[0]))) && std::isfinite(glm::length(glm::vec3(matrix[1]))) &&
34StaticPrefabRenderInstance::StaticPrefabRenderInstance(std::unique_ptr<Impl> impl) : impl_(std::move(impl)) {}
43 if (!preparation || preparation->parts().empty() || !validAffine(matrix) || ecs::current()->is_deferred())
48 if (!part.mesh || !part.material || !validAffine(matrix * glm::make_mat4(part.localTransform.data())))
54 candidate.reset(new StaticPrefabRenderInstance(std::make_unique<Impl>(Impl{std::move(preparation), {}})));
73std::size_t StaticPrefabRenderInstance::rendererCount() const noexcept { return impl_->entities.size(); }
87 Diagnostic::error(DiagnosticCode::PreconditionViolation, "prefab renderer instance was released"));
90 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "invalid prefab world matrix"));
97 Diagnostic::error(DiagnosticCode::InvalidArgument, "prefab composed matrix is not representable"));
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
Own renderer entities and their prepared prefab resources, without owning a Scene node....
Definition StaticPrefabRenderInstance.h:19
Result< void > release()
Destroy surviving entities, then release preparation; cleanup failure retains the lease for retry.
Definition StaticPrefabRenderInstance.cpp:105
std::size_t rendererCount() const noexcept
Return the number of owned renderer handles; externally deleted entries remain counted until release.
Definition StaticPrefabRenderInstance.cpp:73
Result< graphics::Renderable3D * > renderer(std::size_t index) const
Resolve a renderer for synchronous Scene linking or diagnostics.
Definition StaticPrefabRenderInstance.cpp:74
~StaticPrefabRenderInstance()
Destroy surviving renderer entities before releasing their material/mesh preparation lease.
Definition StaticPrefabRenderInstance.cpp:35
static Result< std::unique_ptr< StaticPrefabRenderInstance > > create(std::unique_ptr< PreparedStaticPrefabScene > preparation, const std::array< float, 16 > &world)
Consume preparation and publish all renderer parts after validating composed transforms.
Definition StaticPrefabRenderInstance.cpp:39
StaticPrefabRenderInstance(const StaticPrefabRenderInstance &)=delete
Result< void > setWorldTransform(const std::array< float, 16 > &world)
Update all composed renderer matrices after validating every matrix and live entity handle.
Definition StaticPrefabRenderInstance.cpp:84
Definition CookedMaterial.cpp:5
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ Failed
@ StaleHandle
Definition Container.h:602
std::unique_ptr< PreparedStaticPrefabScene > preparation
Definition StaticPrefabRenderInstance.cpp:31
std::vector< ecs::EntityHandle > entities
Definition StaticPrefabRenderInstance.cpp:32