载入中...
搜索中...
未找到
eve::graphics::hair::GroomInstance类 参考

Runtime groom drawable (UE UGroomComponent analogue). 更多...

#include <GroomInstance.h>

Public 成员函数

 GroomInstance (Graphics *gfx)
 Groom instance.
 
 ~GroomInstance ()
 Groom instance.
 
 GroomInstance (const GroomInstance &)=delete
 
GroomInstance & operator= (const GroomInstance &)=delete
 
Result< void > setAsset (const GroomAsset &asset)
 Replace runtime strands from a shared asset (deep copy of groups). @ownership Asset remains owned by the caller; instance stores a copy.
 
Result< void > bakeProceduralPlane (float sizeX, float sizeZ, const ProceduralParams &params={})
 Bake a procedural plane groom into a single default group.
 
Result< void > bakeProceduralMesh (const float *posXYZ, const float *nrmXYZ, int vertexCount, const uint32_t *indices, int indexCount, const ProceduralParams &params={})
 Bake procedural strands on an indexed triangle mesh.
 
void setForcedLod (int lod)
 Force LOD index; -1 restores automatic selection.
 
int getForcedLod () const
 Returns the forced lod.
 
void setScreenSize (float screenSize)
 Screen-size hint in [0,1] used when forced LOD is disabled.
 
float getScreenSize () const
 Returns the screen size.
 
void setWidthScale (float scale)
 Sets the width scale.
 
float getWidthScale () const
 Returns the width scale.
 
void setSideHint (float x, float y, float z)
 Sets the side hint.
 
void setClusterCullingEnabled (bool enabled)
 Enable/disable CPU cluster frustum filtering before mesh bake. When enabled, call updateVisibility with the current view-projection.
 
bool isClusterCullingEnabled () const
 True when cluster culling enabled.
 
Result< void > updateVisibility (const float *viewProj16)
 Frustum-cull every group's cluster grid and rebuild GPU mesh.
 
void setMarschnerLobes (float r, float tt, float trt)
 Marschner-approximate lobe weights (R / TT / TRT) applied to the hair shader. Defaults: 1 / 0.45 / 0.25. Values are clamped to >= 0.
 
float getMarschnerR () const
 Returns the marschner r.
 
float getMarschnerTT () const
 Returns the marschner tt.
 
float getMarschnerTRT () const
 Returns the marschner trt.
 
void setSelfShadow (float strength, float bias, float rootAo)
 Cheap analytical self-shadow (fiber wrap + along-strand root AO).
 
float getSelfShadowStrength () const
 Returns the self shadow strength.
 
float getSelfShadowBias () const
 Returns the self shadow bias.
 
float getRootAoStrength () const
 Returns the root ao strength.
 
Result< void > rebuild ()
 Rebuild GPU mesh from all groups (LOD + optional visibility).
 
Result< void > enableGuideSimulation (const GuideSimParams &params={}, float guideFraction=0.15f, InterpolationMode mode=InterpolationMode::Offset)
 Enable lightweight guide XPBD/Verlet for every group.
 
Result< void > disableGuideSimulation ()
 Disable guide simulation and restore rest strands on next rebuild.
 
bool isGuideSimulationEnabled () const
 
void setGuideSimParams (const GuideSimParams &params)
 
const GuideSimParams & getGuideSimParams () const
 Returns the guide sim params.
 
Result< void > update (float dt)
 Advance guide simulation by dt and rebuild the GPU mesh. No-op success when simulation is disabled.
 
void draw (const glm::mat4 &model)
 
void draw ()
 Draws .
 
Mesh * getMesh () const
 Returns the mesh.
 
Shader * getShader () const
 Returns the shader.
 
Texture * getTexture () const
 Returns the texture.
 
int getCurveCount () const
 Returns the curve count.
 
int getPointCount () const
 Returns the point count.
 
size_t getGroupCount () const
 Returns the group count.
 
int getActiveLodIndex () const
 Returns the active lod index.
 
int getActiveRepresentation () const
 Returns the active representation.
 
size_t getClusterCount () const
 Returns the cluster count.
 
int getVisibleCurveCount () const
 Returns the visible curve count.
 

详细描述

Runtime groom drawable (UE UGroomComponent analogue).

Rebuilds all groups into one combined GPU mesh (per-group LOD + optional cluster cull). Representation::Cards expands strands through graphics/HairCards polylines; Strands uses ribbon quads. Phase 3 exposes Marschner R/TT/TRT lobe weights and a cheap analytical self-shadow / root AO on the hair shader push constants. Phase 5 adds optional guide XPBD/Verlet via update(dt) (no physics-module include).

Caller owns the instance; Graphics owns Mesh / Shader / Texture.

@thread Render-thread affine; not safe to share across threads. @reentrancy draw must not re-enter Graphics resource creation.

在文件 GroomInstance.h 第 40 行定义.

构造及析构函数说明

◆ GroomInstance() [1/2]

eve::graphics::hair::GroomInstance::GroomInstance ( Graphics *  gfx)
explicit

Groom instance.

在文件 GroomInstance.cpp 第 47 行定义.

◆ ~GroomInstance()

eve::graphics::hair::GroomInstance::~GroomInstance ( )
default

Groom instance.

◆ GroomInstance() [2/2]

eve::graphics::hair::GroomInstance::GroomInstance ( const GroomInstance &  )
delete

成员函数说明

◆ bakeProceduralMesh()

Result< void > eve::graphics::hair::GroomInstance::bakeProceduralMesh ( const float *  posXYZ,
const float *  nrmXYZ,
int  vertexCount,
const uint32_t *  indices,
int  indexCount,
const ProceduralParams &  params = {} 
)

Bake procedural strands on an indexed triangle mesh.

在文件 GroomInstance.cpp 第 163 行定义.

引用了 eve::Result< T >::failure(), eve::graphics::hair::generateOnMesh(), indexCount, indices, params, strands, value , 以及 vertexCount.

◆ bakeProceduralPlane()

Result< void > eve::graphics::hair::GroomInstance::bakeProceduralPlane ( float  sizeX,
float  sizeZ,
const ProceduralParams &  params = {} 
)

Bake a procedural plane groom into a single default group.

在文件 GroomInstance.cpp 第 156 行定义.

引用了 eve::Result< T >::failure(), eve::graphics::hair::generateOnPlane(), params, strands , 以及 value.

◆ disableGuideSimulation()

Result< void > eve::graphics::hair::GroomInstance::disableGuideSimulation ( )

Disable guide simulation and restore rest strands on next rebuild.

在文件 GroomInstance.cpp 第 270 行定义.

引用了 eve::graphics::hair::GroomAsset::groupCount(), rebuild() , 以及 eve::Result< T >::success().

◆ draw() [1/2]

void eve::graphics::hair::GroomInstance::draw ( )

Draws .

在文件 GroomInstance.cpp 第 502 行定义.

引用了 draw().

被这些函数引用 draw().

◆ draw() [2/2]

void eve::graphics::hair::GroomInstance::draw ( const glm::mat4 &  model)

在文件 GroomInstance.cpp 第 504 行定义.

引用了 eve::graphics::Graphics::drawMeshShader(), model , 以及 tint.

◆ enableGuideSimulation()

Result< void > eve::graphics::hair::GroomInstance::enableGuideSimulation ( const GuideSimParams &  params = {},
float  guideFraction = 0.15f,
InterpolationMode  mode = InterpolationMode::Offset 
)

Enable lightweight guide XPBD/Verlet for every group.

Uses each group's guides when non-empty; otherwise extracts a guide subset from strands (guideFraction, default 0.15). Rest strands/guides and kNN weights are captured at enable time. Does not include the physics module — SoftBody3D can bridge later via capability.

在文件 GroomInstance.cpp 第 254 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::hair::GroomAsset::groupCount(), eve::InvalidArgument, params , 以及 rebuild().

被这些函数引用 setAsset().

◆ getActiveLodIndex()

int eve::graphics::hair::GroomInstance::getActiveLodIndex ( ) const

Returns the active lod index.

在文件 GroomInstance.cpp 第 317 行定义.

◆ getActiveRepresentation()

int eve::graphics::hair::GroomInstance::getActiveRepresentation ( ) const

Returns the active representation.

在文件 GroomInstance.cpp 第 319 行定义.

◆ getClusterCount()

size_t eve::graphics::hair::GroomInstance::getClusterCount ( ) const

Returns the cluster count.

在文件 GroomInstance.cpp 第 321 行定义.

引用了 state.

◆ getCurveCount()

int eve::graphics::hair::GroomInstance::getCurveCount ( ) const

Returns the curve count.

在文件 GroomInstance.cpp 第 512 行定义.

引用了 g, eve::graphics::hair::GroomAsset::groupAt() , 以及 eve::graphics::hair::GroomAsset::groupCount().

◆ getForcedLod()

int eve::graphics::hair::GroomInstance::getForcedLod ( ) const

Returns the forced lod.

在文件 GroomInstance.cpp 第 173 行定义.

◆ getGroupCount()

size_t eve::graphics::hair::GroomInstance::getGroupCount ( ) const

Returns the group count.

在文件 GroomInstance.cpp 第 315 行定义.

引用了 eve::graphics::hair::GroomAsset::groupCount().

◆ getGuideSimParams()

const GuideSimParams & eve::graphics::hair::GroomInstance::getGuideSimParams ( ) const

Returns the guide sim params.

在文件 GroomInstance.cpp 第 285 行定义.

◆ getMarschnerR()

float eve::graphics::hair::GroomInstance::getMarschnerR ( ) const

Returns the marschner r.

在文件 GroomInstance.cpp 第 198 行定义.

◆ getMarschnerTRT()

float eve::graphics::hair::GroomInstance::getMarschnerTRT ( ) const

Returns the marschner trt.

在文件 GroomInstance.cpp 第 202 行定义.

◆ getMarschnerTT()

float eve::graphics::hair::GroomInstance::getMarschnerTT ( ) const

Returns the marschner tt.

在文件 GroomInstance.cpp 第 200 行定义.

◆ getMesh()

Mesh * eve::graphics::hair::GroomInstance::getMesh ( ) const

Returns the mesh.

在文件 GroomInstance.cpp 第 309 行定义.

◆ getPointCount()

int eve::graphics::hair::GroomInstance::getPointCount ( ) const

Returns the point count.

在文件 GroomInstance.cpp 第 521 行定义.

引用了 g, eve::graphics::hair::GroomAsset::groupAt() , 以及 eve::graphics::hair::GroomAsset::groupCount().

◆ getRootAoStrength()

float eve::graphics::hair::GroomInstance::getRootAoStrength ( ) const

Returns the root ao strength.

在文件 GroomInstance.cpp 第 215 行定义.

◆ getScreenSize()

float eve::graphics::hair::GroomInstance::getScreenSize ( ) const

Returns the screen size.

在文件 GroomInstance.cpp 第 179 行定义.

◆ getSelfShadowBias()

float eve::graphics::hair::GroomInstance::getSelfShadowBias ( ) const

Returns the self shadow bias.

在文件 GroomInstance.cpp 第 213 行定义.

◆ getSelfShadowStrength()

float eve::graphics::hair::GroomInstance::getSelfShadowStrength ( ) const

Returns the self shadow strength.

在文件 GroomInstance.cpp 第 211 行定义.

◆ getShader()

Shader * eve::graphics::hair::GroomInstance::getShader ( ) const

Returns the shader.

在文件 GroomInstance.cpp 第 311 行定义.

◆ getTexture()

Texture * eve::graphics::hair::GroomInstance::getTexture ( ) const

Returns the texture.

在文件 GroomInstance.cpp 第 313 行定义.

◆ getVisibleCurveCount()

int eve::graphics::hair::GroomInstance::getVisibleCurveCount ( ) const

Returns the visible curve count.

在文件 GroomInstance.cpp 第 327 行定义.

引用了 g, eve::graphics::hair::GroomAsset::groupAt(), eve::graphics::hair::GroomAsset::groupCount() , 以及 state.

◆ getWidthScale()

float eve::graphics::hair::GroomInstance::getWidthScale ( ) const

Returns the width scale.

在文件 GroomInstance.cpp 第 183 行定义.

◆ isClusterCullingEnabled()

bool eve::graphics::hair::GroomInstance::isClusterCullingEnabled ( ) const

True when cluster culling enabled.

在文件 GroomInstance.cpp 第 189 行定义.

◆ isGuideSimulationEnabled()

bool eve::graphics::hair::GroomInstance::isGuideSimulationEnabled ( ) const

在文件 GroomInstance.cpp 第 276 行定义.

◆ operator=()

GroomInstance & eve::graphics::hair::GroomInstance::operator= ( const GroomInstance &  )
delete

◆ rebuild()

◆ setAsset()

Result< void > eve::graphics::hair::GroomInstance::setAsset ( const GroomAsset &  asset)

Replace runtime strands from a shared asset (deep copy of groups). @ownership Asset remains owned by the caller; instance stores a copy.

在文件 GroomInstance.cpp 第 140 行定义.

引用了 enableGuideSimulation(), eve::Result< T >::failure(), ok, rebuild(), eve::Result< T >::success() , 以及 eve::graphics::hair::GroomAsset::validate().

◆ setClusterCullingEnabled()

void eve::graphics::hair::GroomInstance::setClusterCullingEnabled ( bool  enabled)

Enable/disable CPU cluster frustum filtering before mesh bake. When enabled, call updateVisibility with the current view-projection.

在文件 GroomInstance.cpp 第 187 行定义.

引用了 enabled.

◆ setForcedLod()

void eve::graphics::hair::GroomInstance::setForcedLod ( int  lod)

Force LOD index; -1 restores automatic selection.

在文件 GroomInstance.cpp 第 171 行定义.

引用了 lod.

◆ setGuideSimParams()

void eve::graphics::hair::GroomInstance::setGuideSimParams ( const GuideSimParams &  params)

在文件 GroomInstance.cpp 第 278 行定义.

引用了 params , 以及 state.

◆ setMarschnerLobes()

void eve::graphics::hair::GroomInstance::setMarschnerLobes ( float  r,
float  tt,
float  trt 
)

Marschner-approximate lobe weights (R / TT / TRT) applied to the hair shader. Defaults: 1 / 0.45 / 0.25. Values are clamped to >= 0.

在文件 GroomInstance.cpp 第 191 行定义.

引用了 r.

◆ setScreenSize()

void eve::graphics::hair::GroomInstance::setScreenSize ( float  screenSize)

Screen-size hint in [0,1] used when forced LOD is disabled.

在文件 GroomInstance.cpp 第 175 行定义.

◆ setSelfShadow()

void eve::graphics::hair::GroomInstance::setSelfShadow ( float  strength,
float  bias,
float  rootAo 
)

Cheap analytical self-shadow (fiber wrap + along-strand root AO).

Not a deep shadow map / transmittance volume — see design doc vs UE groom deep shadows. Strength / bias / rootAo are clamped to [0,1]. Defaults: 0.35 / 0.25 / 0.3. Set strength to 0 to disable.

在文件 GroomInstance.cpp 第 204 行定义.

引用了 bias , 以及 strength.

◆ setSideHint()

void eve::graphics::hair::GroomInstance::setSideHint ( float  x,
float  y,
float  z 
)

Sets the side hint.

在文件 GroomInstance.cpp 第 185 行定义.

引用了 x, y , 以及 z.

◆ setWidthScale()

void eve::graphics::hair::GroomInstance::setWidthScale ( float  scale)

Sets the width scale.

在文件 GroomInstance.cpp 第 181 行定义.

引用了 scale.

◆ update()

Result< void > eve::graphics::hair::GroomInstance::update ( float  dt)

Advance guide simulation by dt and rebuild the GPU mesh. No-op success when simulation is disabled.

在文件 GroomInstance.cpp 第 287 行定义.

引用了 eve::Result< T >::failure(), eve::graphics::hair::GroomAsset::groupCount(), eve::graphics::hair::interpolateStrands(), rebuild(), state, strands , 以及 eve::Result< T >::success().

◆ updateVisibility()

Result< void > eve::graphics::hair::GroomInstance::updateVisibility ( const float *  viewProj16)

Frustum-cull every group's cluster grid and rebuild GPU mesh.

参数
viewProj16Column-major 4x4 view-projection (glm::mat4 layout).

在文件 GroomInstance.cpp 第 376 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::hair::GroomAsset::groupCount(), eve::InvalidArgument, rebuild() , 以及 state.


该类的文档由以下文件生成: