载入中...
搜索中...
未找到
Lightning.cpp
浏览该文件的文档.
17Result<void> invalid(const char* message, DiagnosticCode code = DiagnosticCode::InvalidArgument) {
35 return lifetime.expired() ? nullptr : static_cast<graphics::Renderable3D*>(ecs::try_get(entity));
55Result<std::unique_ptr<Lightning>> Lightning::prepare(graphics::Graphics& graphics, const LightningSettings& settings) {
70 impl->shader = graphics.newMeshShaderFromSpv({bolt_vert_spv, bolt_vert_spv + bolt_vert_spv_count},
106 return Result<std::unique_ptr<Lightning>>::success(std::unique_ptr<Lightning>(new Lightning(std::move(impl))));
108Result<void> Lightning::setEndpoints(float ax, float ay, float az, float bx, float by, float bz) {
122 if (!impl_->renderable()) return invalid("Lightning renderer retired", DiagnosticCode::StaleHandle);
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
Move-only RAII token that owns one observer registration.
Definition Subscription.h:27
Definition Graphics.h:134
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:935
virtual bool releaseShader(Shader *shader)
Eagerly releases a shader created by this Graphics.
Definition Graphics.h:1976
Independently owned, pooled visual effect; main/render thread only, no callbacks or gameplay damage....
Definition Lightning.h:44
Result< void > trigger()
Restart the pulse, selecting the next prebuilt variant; no allocation.
Definition Lightning.cpp:129
Result< void > update(float dt)
Advance with caller-supplied seconds before render3D; finite nonnegative dt required.
Definition Lightning.cpp:142
float amplitude() const
Current visual amplitude; zero after stop or retirement.
Definition Lightning.cpp:161
Result< void > setEndpoints(float ax, float ay, float az, float bx, float by, float bz)
Copy finite, distinct world endpoints; cheap transform update, width stays constant....
Definition Lightning.cpp:108
Lightning(const Lightning &)=delete
~Lightning()
Release the internal entity and meshes on the main thread.
static Result< std::unique_ptr< Lightning > > prepare(graphics::Graphics &graphics, const LightningSettings &settings)
Validate and prepare hidden geometry; Graphics must be live during this call.
Definition Lightning.cpp:55
Result< void > setColor(float r, float g, float b)
Set nonnegative finite RGB tint; cheap material update, no environment mutation.
Definition Lightning.cpp:121
Status invalid(const char *message)
Definition OceanBindingInternal.h:21
Definition LightingTarget.h:19
EVENGINE_API_ORCHESTRATION float lightningEnvelope(float age)
Weather return-stroke envelope, normalized age [0,1]; side-effect free.
Definition LightningGeometry.cpp:15
EVENGINE_API_ORCHESTRATION Result< void > validateLightning(const LightningSettings &settings)
Validate bounded finite settings without modifying live instances.
Definition LightningGeometry.cpp:6
EVENGINE_API_ORCHESTRATION Result< LightningGeometry > buildLightningGeometry(const LightningSettings &settings, unsigned variant)
Deterministic CPU preparation, explicit variant stream; identical inputs give identical geometry on o...
Definition LightningGeometry.cpp:23
@ InvalidArgument
@ StaleHandle
Definition Container.h:602
Copied preparation settings. Width and displacement are world units, independent of endpoint distance...
Definition Lightning.h:16
std::vector< graphics::Mesh * > meshes
Definition Lightning.cpp:28
graphics::Renderable3D * renderable() const
Definition Lightning.cpp:34
std::unique_ptr< graphics::Material > material
Definition Lightning.cpp:26
std::weak_ptr< const void > lifetime
Definition Lightning.cpp:23