Procedural hair/fur card meshes + material/LOD helpers (no strand simulation). 更多...
类 | |
| struct | CardMeshData |
| CPU-side interleaved mesh arrays for upload via Graphics::newMeshFromArrays. 更多... | |
| struct | CardRoot |
| One root sample expanded into a card. 更多... | |
| class | ClusterGrid |
| Uniform grid over strand roots for CPU frustum culling. 更多... | |
| class | GroomAsset |
Shared CPU groom container (UE UGroomAsset analogue). 更多... | |
| class | GroomBinding |
Root-to-skin binding table (UE UGroomBindingAsset analogue, CPU-only). 更多... | |
| struct | GroomGroup |
One groom group (UE hair group analogue: bangs / scalp / beard …). @ownership Owned by GroomAsset. 更多... | |
| class | GroomInstance |
Runtime groom drawable (UE UGroomComponent analogue). 更多... | |
| struct | GroomLod |
| One LOD entry for a groom group. 更多... | |
| struct | GuideInfluence |
| One guide contributing to a render strand. 更多... | |
| struct | GuideSimParams |
| Parameters for CPU guide-strand dynamics (UE groom sim lite analogue). 更多... | |
| class | GuideSimulator |
| Lightweight Verlet + XPBD simulator for guide curves only. 更多... | |
| struct | HairCluster |
One spatial cluster of strand curves (UE cluster-culling analogue). @ownership Owned by ClusterGrid. 更多... | |
| struct | ProceduralParams |
| Parameters for growing strands on a triangle mesh (scalp / body). 更多... | |
| struct | RibbonMesh |
| Triangle-list ribbon mesh expanded from strand curves. 更多... | |
| struct | RibbonParams |
| RibbonParams public API. 更多... | |
| struct | RootAttach |
One strand root projected onto a skin triangle (UE binding entry analogue). @ownership Owned by GroomBinding. 更多... | |
| struct | SkinTriMesh |
| Borrowed triangle mesh used as a scalp / skin bind target. 更多... | |
| struct | StrandCurve |
One strand as a contiguous point range. @ownership Value type owned by StrandsDatas. 更多... | |
| struct | StrandGuideWeights |
Up to kMaxInfluences guides influencing one render strand. @ownership Owned by the weights table returned from buildGuideWeights. 更多... | |
| struct | StrandPoint |
One control point on a hair curve (UE FHairStrandsDatas point analogue). @ownership Value type owned by StrandsDatas. 更多... | |
| class | StrandsDatas |
CPU-authoritative strand buffer (UE FHairStrandsDatas analogue). 更多... | |
枚举 | |
| enum class | BindingDeformMode : uint8_t { Rigid = 0 , Offset = 1 } |
| How bound strands follow a deformed skin triangle. 更多... | |
| enum class | Representation : uint8_t { Strands = 0 , Cards = 1 , Meshes = 2 , None = 3 } |
| Geometry representation selected by a groom LOD (UE GeometryType analogue). 更多... | |
| enum class | InterpolationMode : uint8_t { Rigid = 0 , Offset = 1 , Smooth = 2 } |
| How render strands follow deformed guides (UE interpolation analogue). 更多... | |
函数 | |
| Result< StrandsDatas > | filterStrandsByCurves (const StrandsDatas &src, const std::vector< uint32_t > &curveIndices) |
Copy a subset of curves into a new StrandsDatas (preserves point order). | |
| size_t | selectLodIndex (const std::vector< GroomLod > &lods, float screenSize) |
| Pick the LOD index for a given screen size (largest screenSize ≤ query). | |
| Result< StrandsDatas > | extractGuides (const StrandsDatas &strands, float guideFraction) |
| Pick a deterministic subset of curves as guides (density thinning). | |
| Result< std::vector< StrandGuideWeights > > | buildGuideWeights (const StrandsDatas &strands, const StrandsDatas &guides, int maxInfluences=3, InterpolationMode mode=InterpolationMode::Offset) |
| Build k-nearest guide weights for every render strand (by root distance). | |
| Result< StrandsDatas > | interpolateStrands (const StrandsDatas &strandsRest, const StrandsDatas &guidesRest, const StrandsDatas &guidesDeformed, const std::vector< StrandGuideWeights > &weights, InterpolationMode mode) |
| Drive rest render strands with deformed guides using precomputed weights. @ownership Returned datas uniquely owned by the caller; inputs unchanged. | |
| Result< StrandsDatas > | generateOnMesh (const float *posXYZ, const float *nrmXYZ, int vertexCount, const uint32_t *indices, int indexCount, const ProceduralParams ¶ms) |
| Grow strands from area-weighted samples on an indexed triangle mesh. | |
| Result< StrandsDatas > | generateOnPlane (float sizeX, float sizeZ, const ProceduralParams ¶ms) |
| Grow strands on a Y-up XZ plane centered at the origin. | |
| Result< RibbonMesh > | buildRibbons (const StrandsDatas &strands, const RibbonParams ¶ms={}) |
| Expand validated strands into stable (non-view-facing) ribbons. | |
| void | appendRibbonMesh (RibbonMesh &dst, const RibbonMesh &src) |
Append src into dst, rebasing triangle indices by dst vertex count. @ownership Both meshes remain caller-owned; src is copied into dst. | |
| CardMeshData | buildCard (float width=0.12f, float height=0.45f) |
| Build a single upright card in local space (origin at root, height along +Y, face +Z). | |
| CardMeshData | buildCardsAlongPolyline (const float *pointsXYZ, int pointCount, float width=0.08f) |
| Build one card per polyline segment, facing a camera-facing side approximated by world up. | |
| CardMeshData | buildCardsFromRoots (const CardRoot *roots, int rootCount) |
| Expand root samples into independent cards. | |
| void | appendCardMesh (CardMeshData &dst, const CardMeshData &src) |
Append src into dst (vertex/index rebase). | |
| Mesh * | uploadCardMesh (Graphics *gfx, const CardMeshData &data) |
| Upload card arrays as a Graphics-owned Mesh. | |
| Mesh * | newCardMesh (Graphics *gfx, float width=0.12f, float height=0.45f) |
| Convenience: single card mesh. | |
| void | applyCardDefaults (Material &mat) |
| Apply transparent hair-card surface defaults (double-sided, no depth write/shadows). Does not create or assign a shader. | |
| Material * | makeCardMaterial (Graphics *gfx, Texture *albedo=nullptr, Shader *hairShader=nullptr) |
| Create a Material configured for hair cards and optionally bind the hair shader + albedo. | |
| void | configureCardLod (Renderable3D *renderable, Mesh *nearCards, Mesh *farProxy, float switchDistance) |
| Wire near/far geometric LOD on a renderable (index 0 = cards, index 1 = proxy). | |
| int | paramCount () |
| Push-constant parameter names (same order as mesh3d_hair.frag). | |
| std::string | paramName (int index) |
| Param name. | |
| void | bindDefaults (Shader *shader) |
| Bind default push-constant knobs on an existing hair shader. | |
| Shader * | createShader (Graphics *gfx) |
| Create the default hair shader (alpha-blended, anisotropic specular). Owned by Graphics. | |
详细描述
Procedural hair/fur card meshes + material/LOD helpers (no strand simulation).
Built-in Kajiya-Kay hair/fur card shader helpers.
Cards are oriented quads suitable for the built-in hair transparent pass. Strand flow is along +V (card height); the hair shader derives tangents from that convention unless strandDir is overridden.
枚举类型说明
◆ BindingDeformMode
|
strong |
◆ InterpolationMode
|
strong |
◆ Representation
|
strong |
Geometry representation selected by a groom LOD (UE GeometryType analogue).
| 枚举值 | |
|---|---|
| Strands | |
| Cards | |
| Meshes | |
| None | |
在文件 GroomAsset.h 第 14 行定义.
函数说明
◆ appendCardMesh()
| void eve::graphics::hair::appendCardMesh | ( | CardMeshData & | dst, |
| const CardMeshData & | src | ||
| ) |
Append src into dst (vertex/index rebase).
在文件 HairCards.cpp 第 115 行定义.
引用了 idx, eve::graphics::hair::CardMeshData::indices, eve::graphics::hair::CardMeshData::normals, eve::graphics::hair::CardMeshData::positions , 以及 eve::graphics::hair::CardMeshData::uvs.
被这些函数引用 buildCardsFromRoots() , 以及 eve::graphics::hair::GroomInstance::rebuild().
◆ appendRibbonMesh()
| EVENGINE_API_BACKENDS void eve::graphics::hair::appendRibbonMesh | ( | RibbonMesh & | dst, |
| const RibbonMesh & | src | ||
| ) |
Append src into dst, rebasing triangle indices by dst vertex count. @ownership Both meshes remain caller-owned; src is copied into dst.
在文件 RibbonBuilder.cpp 第 101 行定义.
引用了 idx, eve::graphics::hair::RibbonMesh::indices, eve::graphics::hair::RibbonMesh::nrmXYZ, eve::graphics::hair::RibbonMesh::posXYZ, eve::graphics::hair::RibbonMesh::uvST , 以及 eve::graphics::hair::RibbonMesh::vertexCount().
◆ applyCardDefaults()
| void eve::graphics::hair::applyCardDefaults | ( | Material & | mat | ) |
Apply transparent hair-card surface defaults (double-sided, no depth write/shadows). Does not create or assign a shader.
在文件 HairCards.cpp 第 136 行定义.
引用了 eve::graphics::Material::getSortPriority(), eve::graphics::Material::setAlphaCutoff(), eve::graphics::Material::setBlendMode(), eve::graphics::Material::setCastShadow(), eve::graphics::Material::setDepthWrite(), eve::graphics::Material::setDoubleSided(), eve::graphics::Material::setHair(), eve::graphics::Material::setShadingModel(), eve::graphics::Material::setSortPriority() , 以及 eve::graphics::Material::setSurfaceMode().
被这些函数引用 makeCardMaterial().
◆ bindDefaults()
| EVENGINE_API_BACKENDS void eve::graphics::hair::bindDefaults | ( | Shader * | shader | ) |
Bind default push-constant knobs on an existing hair shader.
在文件 HairShader.cpp 第 36 行定义.
引用了 shader.
被这些函数引用 createShader().
◆ buildCard()
| EVENGINE_API_BACKENDS CardMeshData eve::graphics::hair::buildCard | ( | float | width = 0.12f, |
| float | height = 0.45f |
||
| ) |
Build a single upright card in local space (origin at root, height along +Y, face +Z).
- 参数
-
width Card width. height Card length along the strand axis.
在文件 HairCards.cpp 第 66 行定义.
引用了 h, height, mesh, w , 以及 width.
被这些函数引用 newCardMesh().
◆ buildCardsAlongPolyline()
| EVENGINE_API_BACKENDS CardMeshData eve::graphics::hair::buildCardsAlongPolyline | ( | const float * | pointsXYZ, |
| int | pointCount, | ||
| float | width = 0.08f |
||
| ) |
Build one card per polyline segment, facing a camera-facing side approximated by world up.
- 参数
-
pointsXYZ Interleaved xyz, length >= 2. pointCount Number of points. width Card width.
在文件 HairCards.cpp 第 75 行定义.
引用了 a, b, dx, dy, dz, mesh, nx, ny, nz, sx, sy, sz, w , 以及 width.
被这些函数引用 buildCardsFromRoots().
◆ buildCardsFromRoots()
| EVENGINE_API_BACKENDS CardMeshData eve::graphics::hair::buildCardsFromRoots | ( | const CardRoot * | roots, |
| int | rootCount | ||
| ) |
Expand root samples into independent cards.
在文件 HairCards.cpp 第 100 行定义.
引用了 appendCardMesh(), buildCardsAlongPolyline(), eve::graphics::hair::CardRoot::dirX, dx, dy, dz, mesh, r , 以及 tip.
◆ buildGuideWeights()
| Result< std::vector< StrandGuideWeights > > EVENGINE_API_BACKENDS eve::graphics::hair::buildGuideWeights | ( | const StrandsDatas & | strands, |
| const StrandsDatas & | guides, | ||
| int | maxInfluences = 3, |
||
| InterpolationMode | mode = InterpolationMode::Offset |
||
| ) |
Build k-nearest guide weights for every render strand (by root distance).
Weights are inverse-distance (Smooth uses a softer exponent). Each row sums to 1 when at least one guide exists.
- 参数
-
maxInfluences Clamped to [1, StrandGuideWeights::kMaxInfluences].
在文件 Guides.cpp 第 103 行定义.
引用了 a, b, eve::graphics::hair::StrandsDatas::curveCount(), d, eve::Diagnostic::error(), index, eve::InvalidArgument, eve::graphics::hair::StrandGuideWeights::kMaxInfluences, root, strands, eve::graphics::hair::StrandsDatas::validate() , 以及 w.
◆ buildRibbons()
| EVENGINE_API_BACKENDS Result< RibbonMesh > eve::graphics::hair::buildRibbons | ( | const StrandsDatas & | strands, |
| const RibbonParams & | params = {} |
||
| ) |
Expand validated strands into stable (non-view-facing) ribbons.
Deterministic for unit tests. A later phase can rebuild per frame for true camera-facing billboards.
- 参数
-
strands Must already be structurally valid (or validate() is called).
在文件 RibbonBuilder.cpp 第 21 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), halfW, i0, i1, i2, eve::InvalidArgument, left, mesh, p, params, pos, eve::graphics::hair::RibbonMesh::posXYZ, right, s, side, strands, eve::Result< T >::success() , 以及 tangent.
◆ configureCardLod()
| EVENGINE_API_BACKENDS void eve::graphics::hair::configureCardLod | ( | Renderable3D * | renderable, |
| Mesh * | nearCards, | ||
| Mesh * | farProxy, | ||
| float | switchDistance | ||
| ) |
Wire near/far geometric LOD on a renderable (index 0 = cards, index 1 = proxy).
- 参数
-
switchDistance Camera distance that selects the far mesh.
在文件 HairCards.cpp 第 158 行定义.
引用了 eve::graphics::Renderable3D::setHair() , 以及 eve::graphics::Renderable3D::setMeshLod().
◆ createShader()
Create the default hair shader (alpha-blended, anisotropic specular). Owned by Graphics.
在文件 HairShader.cpp 第 67 行定义.
引用了 bindDefaults(), frag, eve::graphics::Graphics::getBackendName(), eve::graphics::Shader::gpuHandle, eve::graphics::shaders::kHairFragWgsl, eve::graphics::Graphics::newHairShaderFromSpv(), eve::graphics::Graphics::newHairShaderFromWgsl() , 以及 vert.
被这些函数引用 makeCardMaterial().
◆ extractGuides()
| EVENGINE_API_BACKENDS Result< StrandsDatas > eve::graphics::hair::extractGuides | ( | const StrandsDatas & | strands, |
| float | guideFraction | ||
| ) |
Pick a deterministic subset of curves as guides (density thinning).
Keeps about guideFraction of curves (clamped to [1/curveCount, 1]), strided from index 0. Useful when an asset has no imported guides.
@ownership Returned datas uniquely owned by the caller.
在文件 Guides.cpp 第 56 行定义.
引用了 curve, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, ok, eve::graphics::hair::StrandCurve::pointOffset, points, position, eve::graphics::hair::StrandsDatas::setCurves(), eve::graphics::hair::StrandsDatas::setPoints(), step, strands, eve::Result< T >::success(), valid , 以及 eve::graphics::hair::StrandsDatas::validate().
◆ filterStrandsByCurves()
| EVENGINE_API_BACKENDS Result< StrandsDatas > eve::graphics::hair::filterStrandsByCurves | ( | const StrandsDatas & | src, |
| const std::vector< uint32_t > & | curveIndices | ||
| ) |
Copy a subset of curves into a new StrandsDatas (preserves point order).
- 参数
-
curveIndices Must be in-range; duplicates are ignored after first keep.
在文件 ClusterGrid.cpp 第 188 行定义.
引用了 curve, eve::graphics::hair::StrandsDatas::curveCount(), eve::graphics::hair::StrandsDatas::curvePoints(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, ok, eve::graphics::hair::StrandsDatas::pointCount(), eve::graphics::hair::StrandCurve::pointOffset, points, position, eve::graphics::hair::StrandsDatas::setCurves(), eve::graphics::hair::StrandsDatas::setPoints(), eve::Result< T >::success(), valid , 以及 eve::graphics::hair::StrandsDatas::validate().
◆ generateOnMesh()
| Result< StrandsDatas > eve::graphics::hair::generateOnMesh | ( | const float * | posXYZ, |
| const float * | nrmXYZ, | ||
| int | vertexCount, | ||
| const uint32_t * | indices, | ||
| int | indexCount, | ||
| const ProceduralParams & | params | ||
| ) |
Grow strands from area-weighted samples on an indexed triangle mesh.
- 参数
-
posXYZ Vertex positions (xyz packed). Borrowed only for this call. nrmXYZ Vertex normals (xyz packed); may be null → geometric normals. @ownership Returned StrandsDatasis uniquely owned by the caller.
在文件 Procedural.cpp 第 104 行定义.
引用了 curve, eve::Diagnostic::error(), eve::Result< T >::failure(), indexCount, indices, eve::InvalidArgument, n, p, params, eve::graphics::hair::StrandCurve::pointOffset, points, pos, eve::graphics::hair::StrandPoint::position, eve::graphics::hair::StrandPoint::radius, root, s, seed, eve::graphics::hair::StrandsDatas::setCurves(), eve::graphics::hair::StrandsDatas::setPoints(), eve::Result< T >::success(), t, tangent, eve::graphics::hair::StrandPoint::u, eve::graphics::hair::StrandsDatas::validate() , 以及 vertexCount.
被这些函数引用 eve::graphics::hair::GroomInstance::bakeProceduralMesh() , 以及 generateOnPlane().
◆ generateOnPlane()
| EVENGINE_API_BACKENDS Result< StrandsDatas > eve::graphics::hair::generateOnPlane | ( | float | sizeX, |
| float | sizeZ, | ||
| const ProceduralParams & | params | ||
| ) |
Grow strands on a Y-up XZ plane centered at the origin.
- 参数
-
sizeX / sizeZ Full plane extents.
在文件 Procedural.cpp 第 204 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), generateOnMesh(), idx, eve::InvalidArgument, params , 以及 pos.
被这些函数引用 eve::graphics::hair::GroomInstance::bakeProceduralPlane().
◆ interpolateStrands()
| Result< StrandsDatas > EVENGINE_API_BACKENDS eve::graphics::hair::interpolateStrands | ( | const StrandsDatas & | strandsRest, |
| const StrandsDatas & | guidesRest, | ||
| const StrandsDatas & | guidesDeformed, | ||
| const std::vector< StrandGuideWeights > & | weights, | ||
| InterpolationMode | mode | ||
| ) |
Drive rest render strands with deformed guides using precomputed weights. @ownership Returned datas uniquely owned by the caller; inputs unchanged.
在文件 Guides.cpp 第 154 行定义.
引用了 curve, eve::graphics::hair::StrandsDatas::curveCount(), eve::graphics::hair::StrandsDatas::curves(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvariantViolation, eve::graphics::hair::StrandsDatas::points(), points, eve::graphics::hair::StrandPoint::position, Rigid, eve::graphics::hair::StrandsDatas::setCurves(), eve::graphics::hair::StrandsDatas::setPoints(), eve::Result< T >::success(), eve::graphics::hair::StrandPoint::u, valid, eve::graphics::hair::StrandsDatas::validate() , 以及 weights.
◆ makeCardMaterial()
| Material * eve::graphics::hair::makeCardMaterial | ( | Graphics * | gfx, |
| Texture * | albedo = nullptr, |
||
| Shader * | hairShader = nullptr |
||
| ) |
Create a Material configured for hair cards and optionally bind the hair shader + albedo.
- 参数
-
gfx Graphics factory used to create the default hair shader when hairShaderis null.albedo Optional borrowed albedo texture; Graphics retains ownership. hairShader Optional borrowed hair shader; Graphics retains ownership when non-null. @ownership Caller owns the returned Material*; gfx/albedo/hairShaderare borrowed. @lifetime Material outlives this call; borrowed shader/texture must outlive Material draws.
在文件 HairCards.cpp 第 148 行定义.
引用了 albedo, applyCardDefaults(), createShader() , 以及 shader.
◆ newCardMesh()
| Mesh * eve::graphics::hair::newCardMesh | ( | Graphics * | gfx, |
| float | width = 0.12f, |
||
| float | height = 0.45f |
||
| ) |
Convenience: single card mesh.
- 参数
-
gfx Graphics factory that owns the resulting GPU mesh. @ownership Graphics owns the returned Mesh; gfxis borrowed for the call only. @lifetime Returned mesh remains valid until Graphics releases it;gfxmust outlive the call.
在文件 HairCards.cpp 第 132 行定义.
引用了 buildCard(), height, uploadCardMesh() , 以及 width.
◆ paramCount()
| EVENGINE_API_BACKENDS int eve::graphics::hair::paramCount | ( | ) |
Push-constant parameter names (same order as mesh3d_hair.frag).
在文件 HairShader.cpp 第 29 行定义.
◆ paramName()
| EVENGINE_API_BACKENDS std::string eve::graphics::hair::paramName | ( | int | index | ) |
◆ selectLodIndex()
| EVENGINE_API_BACKENDS size_t eve::graphics::hair::selectLodIndex | ( | const std::vector< GroomLod > & | lods, |
| float | screenSize | ||
| ) |
Pick the LOD index for a given screen size (largest screenSize ≤ query).
- 返回
- 0 when
lodsis empty.
在文件 GroomAsset.cpp 第 75 行定义.
引用了 best.
◆ uploadCardMesh()
| Mesh * eve::graphics::hair::uploadCardMesh | ( | Graphics * | gfx, |
| const CardMeshData & | data | ||
| ) |
Upload card arrays as a Graphics-owned Mesh.
- 参数
-
gfx Graphics factory that owns the resulting GPU mesh. @ownership Graphics owns the returned Mesh; gfxis borrowed for the call only. @lifetime Returned mesh remains valid until Graphics releases it;gfxmust outlive the call.
在文件 HairCards.cpp 第 123 行定义.
引用了 eve::graphics::Graphics::newMeshFromArrays() , 以及 vertexCount.
被这些函数引用 newCardMesh() , 以及 eve::graphics::hair::GroomInstance::rebuild().