载入中...
搜索中...
未找到
Material.cpp
浏览该文件的文档.
48eve::Result<void> Material::setVirtualTexture(Texture* albedoAtlas, Texture* normalAtlas, Texture* pageTable,
58 return eve::Result<void>::failure(invalidMaterial("virtual texture border fraction must be in [0, 0.5)"));
86 if (virtualStreamingEpoch_ == epoch && virtualTextureEnabled_) return eve::Result<void>::success();
96 // Engine-owned feedback: request the full mip-zero domain; decode budget + LRU stream residency.
131void Material::setMetallic(float metallic) { metallic_ = metallic < 0.f ? 0.f : (metallic > 1.f ? 1.f : metallic); }
181void Material::setAlphaCutoff(float cutoff) { alphaCutoff_ = cutoff < 0.f ? 0.f : (cutoff > 1.f ? 1.f : cutoff); }
231Result<void> Material::setFoliageTranslucency(float red, float green, float blue, float intensity, float strength,
279 DiagnosticCode::InvalidArgument, "albedo UV rotation must be finite", {}, {}, "graphics.material"));
285Result<void> Material::setFoliageWind(Texture* motionTexture, Texture* noiseTexture, float directionX, float directionZ,
290 if (!motionTexture || !noiseTexture || !std::isfinite(directionLength) || directionLength <= .0001f ||
292 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "invalid foliage wind profile",
336 pbr_.textures[0].texture && pbr_.textures[0].texture->hasPremultipliedAlpha() && blendMode_ == BlendMode::Alpha
339 gfx.setMesh3DSurface(surfaceMode_, effectiveBlend, depthWrite_, doubleSided_, alphaCutoff_, alphaTechnique_);
345 gfx.setMesh3DVirtualTexture(virtualTextureEnabled_, virtualPageCountX_, virtualPageCountY_, virtualAtlasSlotsX_,
std::array< std::uint64_t, kPixelChunkSize *kPixelChunkSize > updated
Definition PixelWorld.cpp:53
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
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
Definition Graphics.h:134
virtual void setMesh3DMaterial(float metallic, float roughness)=0
Metallic (0..1) and roughness (0..1) for the next default mesh draw.
virtual Result< void > setMesh3DPbrSurface(const PbrSurface *surface)
Copy a validated extended surface for subsequent draws; null resets to legacy shading.
Definition Graphics.h:1253
virtual void setMesh3DPackedNormalMask(bool enabled)=0
Interpret normal texture RG as tangent XY, B as AO and A as smoothness for terrain surfaces.
virtual void setMesh3DClusteredActive(bool active)=0
Cheap per-draw toggle for the already-uploaded clustered light table. Unlike setMesh3DClusteredLighti...
virtual void setMesh3DTexCellBomb(float cellScale, float strength, float rotAmount=1.f)=0
Texture cell bombing for the next default mesh draw (breaks tiling). cellScale: cells per UV unit (ty...
virtual void setMesh3DParallax(float scale, float minLayers=8.f, float maxLayers=32.f)=0
Parallax occlusion mapping for the next default mesh draw. scale: UV displacement strength (0=off)....
virtual void setMesh3DVirtualTexture(bool enabled, int pageCountX, int pageCountY, int atlasSlotsX, int atlasSlotsY, float borderFraction)=0
Configure page-table sampling for the next mesh draw.
virtual void setMesh3DSurface(SurfaceMode mode, BlendMode blend, bool depthWrite, bool doubleSided, float alphaCutoff, const std::string &alphaTechnique="cutoff")=0
Select pipeline state for subsequent mesh draws.
virtual void setMesh3DShadowReceive(bool receive)=0
Per-draw: when false, shadow sampling is forced off for the next mesh draw.
std::uint64_t mesh3dDrawEpoch() const noexcept
Monotonic epoch advanced at the start of each render3D() submission. Materials use this to run virtua...
Definition Graphics.h:947
virtual void setMesh3DNormalTexture(Texture *normal)=0
Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat).
virtual void setMesh3DHeightTexture(Texture *height)=0
Optional height map for parallax (R channel; nullptr = flat / off).
virtual void setMesh3DLighting(const Lighting3DPack &pack)=0
Per-frame ambient + up to 8 lights packed into Mesh3DUBO.
bool hasParam(const std::string &name) const
Optional named float knobs (style / custom shader params).
Definition Material.cpp:205
void setAlphaTechnique(const std::string &technique)
Optional masked transparency quality: "cutoff", "dither", "coverage".
Definition Material.cpp:201
void setBlendMode(const std::string &mode)
Set "alpha", "premultiplied", "additive", or "multiply".
Definition Material.cpp:183
Result< void > setAlbedoUvRotation(float radians)
Publish base-color UV rotation (radians, around UV origin) and enable PBR.
Definition Material.cpp:276
void clearVirtualTexture()
Restore conventional albedo/normal/height interpretation and drop any owned streaming session.
Definition Material.cpp:71
Result< void > setPbrSurface(const PbrSurface &surface)
Atomically replace validated PBR bindings and enable the extended forward path. Texture pointers are ...
Definition Material.cpp:221
bool isTransparentHair() const
True when this material should go through the hair transparent pass.
Definition Material.cpp:219
eve::Result< void > enableVirtualTexture(const VirtualTextureStreamingConfig &config)
Author a layered virtual texture; residency is driven automatically on bind.
Definition Material.cpp:23
Result< void > setAlbedoUvOffset(float u, float v)
Publish base-color UV offset and enable the extended PBR surface path. Sampling uses ‘uv’ = rotate(uv...
Definition Material.cpp:257
eve::Result< void > setVirtualTexture(Texture *albedoAtlas, Texture *normalAtlas, Texture *pageTable, int pageCountX, int pageCountY, int atlasSlotsX, int atlasSlotsY, float borderFraction)
Opt this material into physical-atlas virtual-texture sampling. @ownership Internal Graphics upload p...
Definition Material.cpp:48
void setSurfaceMode(const std::string &mode)
Set "opaque", "masked", or "transparent" surface classification.
Definition Material.cpp:166
void setShadingModel(const std::string &model)
"pbr" | "unlit" | "hair" | "custom" (unknown → pbr).
Definition Material.cpp:106
void setTexCellBomb(float cellScale, float strength, float rotAmount=1.f)
Sets the tex cell bomb.
Definition Material.cpp:137
Result< void > setFoliageTranslucency(float red, float green, float blue, float intensity, float strength, float normalDistortion, float scattering, float direct, float ambient, float shadow)
Enable validated two-sided foliage translucency while preserving imported PBR textures and factors.
Definition Material.cpp:231
Result< void > setClearcoat(float factor, float roughness)
Publish clearcoat layer factors on the current PBR surface snapshot.
Definition Material.cpp:250
void setParallax(float scale, float minLayers=8.f, float maxLayers=32.f)
Sets the parallax.
Definition Material.cpp:143
Result< void > bind(Graphics &gfx) const
Push this material onto Graphics mesh3d state for the next draw. Does not issue the draw itself....
Definition Material.cpp:328
Result< void > setFoliageWindTime(float seconds)
Replace only the explicit foliage-motion time in the current material snapshot.
Definition Material.cpp:317
Result< void > setAlbedoUvScale(float u, float v)
Publish base-color UV scale (tiling) and enable the extended PBR surface path.
Definition Material.cpp:266
Shader * effectiveShader() const
Return the borrowed effective shader, or nullptr for the default PBR pipeline. @lifetime The pointer ...
Definition Material.cpp:214
Result< void > setFoliageWind(Texture *motionTexture, Texture *noiseTexture, float directionX, float directionZ, float strength, float bending, float bendingSpeed, float branch, float branchSpeed, float flutter, float flutterSpeed, float fadeDistance, float bendFactor)
Publish object-space foliage wind while preserving the current PBR material snapshot.
Definition Material.cpp:285
eve::Result< std::uint32_t > addVirtualTextureLayer(const VirtualTextureBlendLayer &layer)
Append one immutable source layer to the material-owned virtual texture.
Definition Material.cpp:41
bool hasUniform(const std::string &name) const
Definition Shader.cpp:71
void sendFloat(const std::string &name, float x)
Definition Shader.cpp:107
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:15
static eve::Result< std::unique_ptr< VirtualTextureStreaming > > create(const VirtualTextureStreamingConfig &config)
Validate config and create an empty streaming session.
Definition VirtualTextureStreaming.cpp:65
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
@ Transparent
@ BaseColor
Result< void > validatePbrSurface(const PbrSurface &s)
Validate finite material factors and sampler enums without changing the input.
Definition PbrGpuUniform.cpp:124
@ InvalidArgument
@ Premultiplied
@ Additive
@ Alpha
@ Multiply
Owning material parameter snapshot; texture pointers remain borrowed. Base color/metallic/roughness c...
Definition PbrSurface.h:240
PbrVegetationMotion vegetationMotion
Definition PbrSurface.h:281
std::array< PbrTextureBinding, std::size_t(PbrTextureSlot::Count)> textures
Definition PbrSurface.h:241
PbrTranslucency translucency
Per-light vegetation backlighting. Native ambient RGB supplies the GI term. Positive maskAmount with ...
Definition PbrSurface.h:275
One immutable source layer copied into a VirtualTextureBlend.
Definition VirtualTextureBlend.h:25
Runtime streaming budgets over a VirtualTextureBlend producer.
Definition VirtualTextureStreaming.h:35