载入中...
搜索中...
未找到
eve::graphics::hair 命名空间参考

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 &params)
 Grow strands from area-weighted samples on an indexed triangle mesh.
 
Result< StrandsDatas > generateOnPlane (float sizeX, float sizeZ, const ProceduralParams &params)
 Grow strands on a Y-up XZ plane centered at the origin.
 
Result< RibbonMesh > buildRibbons (const StrandsDatas &strands, const RibbonParams &params={})
 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

enum class eve::graphics::hair::BindingDeformMode : uint8_t
strong

How bound strands follow a deformed skin triangle.

  • Rigid: translate the whole curve by (skinnedRoot − restRoot).
  • Offset: also rotate the rest offset by the rest→deformed triangle normal.

Neither mode is a full skinned RBF (UE optional path); see design doc Phase 4.

枚举值
Rigid 
Offset 

在文件 Binding.h 第 37 行定义.

◆ InterpolationMode

enum class eve::graphics::hair::InterpolationMode : uint8_t
strong

How render strands follow deformed guides (UE interpolation analogue).

  • Rigid: weighted guide root translation applied to the whole strand.
  • Offset: per-point delta sampled along each guide at the same u.
  • Smooth: Offset with softer distance weights (more guides influence).
枚举值
Rigid 
Offset 
Smooth 

在文件 Guides.h 第 19 行定义.

◆ Representation

enum class eve::graphics::hair::Representation : uint8_t
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 
)

◆ 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().

被这些函数引用 eve::graphics::hair::GroomInstance::rebuild().

◆ applyCardDefaults()

◆ 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).

参数
widthCard width.
heightCard 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.

参数
pointsXYZInterleaved xyz, length >= 2.
pointCountNumber of points.
widthCard 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.

参数
maxInfluencesClamped 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.

参数
strandsMust 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.

被这些函数引用 eve::graphics::hair::GroomInstance::rebuild().

◆ 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).

参数
switchDistanceCamera distance that selects the far mesh.

在文件 HairCards.cpp 第 158 行定义.

引用了 eve::graphics::Renderable3D::setHair() , 以及 eve::graphics::Renderable3D::setMeshLod().

◆ createShader()

Shader * eve::graphics::hair::createShader ( Graphics *  gfx)

◆ 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()

◆ 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.

参数
posXYZVertex positions (xyz packed). Borrowed only for this call.
nrmXYZVertex normals (xyz packed); may be null → geometric normals. @ownership Returned StrandsDatas is 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()

◆ 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.

参数
gfxGraphics factory used to create the default hair shader when hairShader is null.
albedoOptional borrowed albedo texture; Graphics retains ownership.
hairShaderOptional borrowed hair shader; Graphics retains ownership when non-null. @ownership Caller owns the returned Material*; gfx/albedo/hairShader are 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.

参数
gfxGraphics factory that owns the resulting GPU mesh. @ownership Graphics owns the returned Mesh; gfx is borrowed for the call only. @lifetime Returned mesh remains valid until Graphics releases it; gfx must 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)

Param name.

在文件 HairShader.cpp 第 31 行定义.

引用了 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 lods is empty.

在文件 GroomAsset.cpp 第 75 行定义.

引用了 best.

◆ uploadCardMesh()

Mesh * eve::graphics::hair::uploadCardMesh ( Graphics *  gfx,
const CardMeshData &  data 
)

Upload card arrays as a Graphics-owned Mesh.

参数
gfxGraphics factory that owns the resulting GPU mesh. @ownership Graphics owns the returned Mesh; gfx is borrowed for the call only. @lifetime Returned mesh remains valid until Graphics releases it; gfx must outlive the call.
返回
Mesh pointer owned by Graphics, or null on failure.

在文件 HairCards.cpp 第 123 行定义.

引用了 eve::graphics::Graphics::newMeshFromArrays() , 以及 vertexCount.

被这些函数引用 newCardMesh() , 以及 eve::graphics::hair::GroomInstance::rebuild().