载入中...
搜索中...
未找到
Material.cpp
浏览该文件的文档.
17eve::Result<void> Material::setVirtualTexture(Texture* albedoAtlas, Texture* normalAtlas, Texture* pageTable,
27 return eve::Result<void>::failure(invalidMaterial("virtual texture border fraction must be in [0, 0.5)"));
74void Material::setMetallic(float metallic) { metallic_ = metallic < 0.f ? 0.f : (metallic > 1.f ? 1.f : metallic); }
124void Material::setAlphaCutoff(float cutoff) { alphaCutoff_ = cutoff < 0.f ? 0.f : (cutoff > 1.f ? 1.f : cutoff); }
174Result<void> Material::setFoliageTranslucency(float red, float green, float blue, float intensity, float strength,
193Result<void> Material::setFoliageWind(Texture* motionTexture, Texture* noiseTexture, float directionX, float directionZ,
198 if (!motionTexture || !noiseTexture || !std::isfinite(directionLength) || directionLength <= .0001f ||
200 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "invalid foliage wind profile",
242 pbr_.textures[0].texture && pbr_.textures[0].texture->hasPremultipliedAlpha() && blendMode_ == BlendMode::Alpha
245 gfx.setMesh3DSurface(surfaceMode_, effectiveBlend, depthWrite_, doubleSided_, alphaCutoff_, alphaTechnique_);
251 gfx.setMesh3DVirtualTexture(virtualTextureEnabled_, virtualPageCountX_, virtualPageCountY_, virtualAtlasSlotsX_,
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={}, 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
Definition Graphics.h:125
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:1192
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.
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:148
void setAlphaTechnique(const std::string &technique)
Optional masked transparency quality: "cutoff", "dither", "coverage".
Definition Material.cpp:144
void setBlendMode(const std::string &mode)
Set "alpha", "premultiplied", "additive", or "multiply".
Definition Material.cpp:126
void clearVirtualTexture()
Restore conventional albedo/normal/height interpretation.
Definition Material.cpp:40
Result< void > setPbrSurface(const PbrSurface &surface)
Atomically replace validated PBR bindings and enable the extended forward path. Texture pointers are ...
Definition Material.cpp:164
bool isTransparentHair() const
True when this material should go through the hair transparent pass.
Definition Material.cpp:162
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.
Definition Material.cpp:17
void setSurfaceMode(const std::string &mode)
Set "opaque", "masked", or "transparent" surface classification.
Definition Material.cpp:109
void setShadingModel(const std::string &model)
"pbr" | "unlit" | "hair" | "custom" (unknown → pbr).
Definition Material.cpp:49
void setTexCellBomb(float cellScale, float strength, float rotAmount=1.f)
Sets the tex cell bomb.
Definition Material.cpp:80
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:174
void setParallax(float scale, float minLayers=8.f, float maxLayers=32.f)
Sets the parallax.
Definition Material.cpp:86
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:236
Result< void > setFoliageWindTime(float seconds)
Replace only the explicit foliage-motion time in the current material snapshot.
Definition Material.cpp:225
Shader * effectiveShader() const
Return the borrowed effective shader, or nullptr for the default PBR pipeline. @lifetime The pointer ...
Definition Material.cpp:157
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:193
bool hasUniform(const std::string &name) const
Definition Shader.cpp:59
void sendFloat(const std::string &name, float x)
Definition Shader.cpp:95
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
@ Transparent
Result< void > validatePbrSurface(const PbrSurface &s)
Validate finite material factors and sampler enums without changing the input.
Definition PbrSurface.cpp:4
@ InvalidArgument
@ Premultiplied
@ Additive
@ Alpha
@ Multiply
Owning material parameter snapshot; texture pointers remain borrowed. Base color/metallic/roughness c...
Definition PbrSurface.h:218
PbrVegetationMotion vegetationMotion
Definition PbrSurface.h:259
std::array< PbrTextureBinding, std::size_t(PbrTextureSlot::Count)> textures
Definition PbrSurface.h:219
PbrTranslucency translucency
Per-light vegetation backlighting. Native ambient RGB supplies the GI term. Positive maskAmount with ...
Definition PbrSurface.h:253