载入中...
搜索中...
未找到
LifeFieldMaterialBinding.cpp
浏览该文件的文档.
12std::uint8_t encode01(float v) { return static_cast<std::uint8_t>(std::clamp(v, 0.f, 1.f) * 255.f + 0.5f); }
69 return Result<graphics::Texture*>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation,
73 auto* tex = gfx->newTexture(uniforms_.resolution, uniforms_.resolution, lifePixels_.data(), false, false);
87 return Result<graphics::Texture*>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation,
91 auto* tex = gfx->newTexture(uniforms_.resolution, uniforms_.resolution, surfacePixels_.data(), false, false);
99Result<void> LifeFieldMaterialBinding::updateTexture(graphics::Graphics* gfx, graphics::Texture* texture,
102 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "graphics or texture is null",
Stable, structured diagnostics shared by engine modules.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Result< void > syncFrom(const SurfaceField &field)
Rebuild CPU pixel buffers from a surface field.
Definition LifeFieldMaterialBinding.cpp:21
Result< void > updateTexture(graphics::Graphics *gfx, graphics::Texture *texture, bool lifeField) const
Update an existing texture in place.
Definition LifeFieldMaterialBinding.cpp:99
Result< graphics::Texture * > uploadSurfaceData(graphics::Graphics *gfx)
Upload surface-data texture.
Definition LifeFieldMaterialBinding.cpp:81
Result< graphics::Texture * > uploadLifeField(graphics::Graphics *gfx)
Upload or refresh Graphics textures from the packed buffers.
Definition LifeFieldMaterialBinding.cpp:63
2.5D surface + life-field textures for Life Network.
Definition SurfaceField.h:16
Definition Graphics.h:125
virtual bool updateTexture(Texture *texture, int width, int height, const uint8_t *rgba)=0
Replace an existing texture's pixels in place (pointer stays stable).
virtual Texture * newTexture(int width, int height, const uint8_t *rgba, bool repeatU=false, bool repeatV=false)=0
Creates a texture. @ownership Caller deletes unless documented otherwise.
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
Definition AgentInstanceRenderer.cpp:5
@ InvalidArgument
@ PreconditionViolation
@ Failed
glm::vec3 origin
Definition LifeFieldMaterialBinding.h:22
int resolution
Definition LifeFieldMaterialBinding.h:24
float worldSize
Definition LifeFieldMaterialBinding.h:23