14#include <glm/mat4x4.hpp>
34 void release()
override {}
38 static constexpr int kMaxReflectionProbes = 8;
43 glm::vec3 extent{0.f};
44 float intensity = 0.f;
45 float blendDistance = 0.f;
49 float eyeX = 0.f, eyeY = 0.f, eyeZ = 3.f;
50 float targetX = 0.f, targetY = 0.f, targetZ = 0.f;
51 float upX = 0.f, upY = 1.f, upZ = 0.f;
52 float fovYDeg = 60.f, nearZ = 0.1f, farZ = 100.f;
53 float aperture = 19.f, focalLength = 50.f;
56 std::array<float, 32> layerCullDistances{};
58 std::array<float, 32> shadowLayerCullDistances{};
59 bool orthographic =
false;
60 float orthoHeight = 20.f;
62 float pixelsPerUnit = 0.f;
64 int pixelRefWidth = 0;
66 int pixelRefHeight = 0;
70 bool pixelSnap =
true;
73 float envIntensity = 1.f;
74 glm::vec3 envProbeCenter{0.f};
75 glm::vec3 envProbeExtent{0.f};
76 std::array<ReflectionProbe, kMaxReflectionProbes> reflectionProbes{};
77 float exposureEV = 0.f;
78 bool autoExposure =
false;
79 float autoExposureMinEV = -8.f;
80 float autoExposureMaxEV = 8.f;
81 float bloomIntensity = 0.f;
82 float bloomThreshold = 1.f;
83 float dofFocusDistance = 0.f;
84 float dofMaxBlurPx = 0.f;
85 float dofFocusRange = 8.f;
89 float screenRayOx = 0.f, screenRayOy = 0.f, screenRayOz = 0.f;
90 float screenRayDx = 0.f, screenRayDy = 0.f, screenRayDz = -1.f;
103 static Camera3D* createCamera(ecs::Table& table = *ecs::current());
105 void setEye(
float x,
float y,
float z);
110 void setTarget(
float x,
float y,
float z);
115 void setUp(
float x,
float y,
float z);
116 void setFov(
float fovYDeg);
120 void setOrthographic(
float height);
122 void setPerspective();
124 bool isOrthographic();
126 float getOrthoHeight();
135 [[nodiscard]]
Result<void> setPixelConfig(
float pixelsPerUnit,
int refWidth = 0,
int refHeight = 0);
137 void clearPixelConfig();
139 bool hasPixelConfig();
141 void setPixelSnap(
bool enabled);
145 float getPixelsPerUnit();
147 int getPixelRefWidth();
149 int getPixelRefHeight();
159 [[nodiscard]]
Result<void> applyPixelPerfect(
int viewWidth,
int viewHeight);
168 [[nodiscard]]
Result<void> setPixelOrthographic(
float pixelsPerUnit,
int viewWidth,
int viewHeight,
169 int refWidth = 0,
int refHeight = 0);
175 void snapToPixelGrid(
int viewWidth,
int viewHeight);
178 void setClipPlanes(
float nearZ,
float farZ);
float getNearClip();
float getFarClip();
void setPhysicalLens(
float aperture,
float focalLength);
float getAperture();
float getFocalLength();
187 float getLayerCullDistance(
int layer);
191 float getShadowLayerCullDistance(
int layer);
192 void setActive(
bool active);
193 void setAmbient(
float r,
float g,
float b);
196 void setEnvIntensity(
float intensity);
198 void setExposure(
float ev);
202 void setAutoExposure(
bool enabled,
float minEV = -8.f,
float maxEV = 8.f);
204 bool isAutoExposure();
206 void setBloom(
float intensity,
float threshold = 1.f);
208 float getBloomIntensity();
210 float getBloomThreshold();
217 void setDepthOfField(
float focusDistance,
float maxBlurPx,
float focusRange = 8.f);
219 void clearDepthOfField();
221 float getDofFocusDistance();
223 float getDofMaxBlur();
225 float getDofFocusRange();
227 void setEnvProbe(
float centerX,
float centerY,
float centerZ,
float extentX,
float extentY,
float extentZ);
229 void clearEnvProbe();
232 float getEnvProbeCenterX();
233 float getEnvProbeCenterY();
234 float getEnvProbeCenterZ();
235 float getEnvProbeExtentX();
236 float getEnvProbeExtentY();
237 float getEnvProbeExtentZ();
245 void setReflectionProbe(
int slot,
Texture* cubemap,
float centerX,
float centerY,
float centerZ,
float extentX,
246 float extentY,
float extentZ,
float intensity = 1.f,
float blendDistance = 1.f,
249 void clearReflectionProbe(
int slot);
251 int getReflectionProbeCount();
258 void screenToRay(
float screenX,
float screenY,
float viewW,
float viewH);
259 float getScreenRayOriginX();
260 float getScreenRayOriginY();
261 float getScreenRayOriginZ();
262 float getScreenRayDirX();
263 float getScreenRayDirY();
264 float getScreenRayDirZ();
274 void release()
override {}
278 float x = 0,
y = 0,
z = 0;
285 glm::mat4 linkedWorld{1.f};
286 bool hasLinkedWorld =
false;
290 static constexpr int kMaxLodLevels = 4;
291 static constexpr int kMaxParts = Material::kMaxPartsHint;
296 bool packedNormalMask =
false;
312 bool xrayHighlight =
false;
313 float r = 1,
g = 1,
b = 1,
a = 1;
316 float texBombScale = 4.f;
317 float texBombStrength = 0.f;
318 float texBombRot = 1.f;
319 float parallaxScale = 0.f;
320 float parallaxMinLayers = 8.f;
321 float parallaxMaxLayers = 32.f;
324 uint32_t reflectionCaptureMask = 1u;
325 bool receiveLight =
true;
326 bool castShadow =
true;
328 bool castOcclusion =
true;
329 bool customLightProbe =
false;
330 std::array<glm::vec4, 9> customLightProbeSh{};
348 Mesh* lodMeshes[kMaxLodLevels] = {};
349 float lodDistances[kMaxLodLevels - 1] = {25.f, 60.f, 120.f};
351 float lodCullDistance = 0.f;
354 bool configured =
false;
356 int shadowCastingMode = 1;
357 bool receiveShadows =
true;
358 int motionVectorMode = 1;
359 bool skinnedMotionVectors =
true;
361 int reflectionProbeUsage = 1;
364 float lodFadeWidths[kMaxLodLevels] = {};
366 bool lodAnimateCrossFading =
false;
367 float lodCrossFadeDuration = 0.5f;
368 int lodAnimatedCurrent = -2;
369 int lodAnimatedPrevious = -2;
370 float lodAnimatedProgress = 1.f;
376 if (lodCullDistance > 0.f &&
distance >= lodCullDistance)
return nullptr;
377 if (lodCount <= 0)
return mesh;
381 return picked ? picked :
mesh;
386 if (lodCullDistance > 0.f &&
distance >= lodCullDistance)
return -1;
387 if (lodCount <= 0)
return 0;
394 void lodBlendForDistance(
float distance,
int& primary,
int&
secondary,
float& secondaryWeight)
const;
412 COMPONENT(Transform3D, transform)
413 COMPONENT(MeshRenderer, meshRenderer)
415 void setPosition(
float x,
float y,
float z);
421 void setYaw(
float yaw);
423 void setScale(
float sx,
float sy,
float sz);
438 void clearInstanceRange();
445 void setPackedNormalMask(
bool enabled);
462 void setXRayHighlight(
bool on);
463 bool getXRayHighlight();
472 void clearPartSortPriority(
int index);
474 int getPartSortPriority(
int index);
477 std::string getPartName(
int index);
480 void setHair(
bool hair);
482 void setTint(
float r,
float g,
float b,
float a = 1.f);
499 void setTexCellBomb(
float cellScale,
float strength,
float rotAmount = 1.f);
500 float getTexCellBombScale();
501 float getTexCellBombStrength();
502 float getTexCellBombRotation();
507 void setParallax(
float scale,
float minLayers = 8.f,
float maxLayers = 32.f);
508 float getParallaxScale();
509 float getParallaxMinLayers();
510 float getParallaxMaxLayers();
515 void setLayer(
int layer);
519 void setReflectionCaptureMask(
int mask);
521 int getReflectionCaptureMask();
522 void setReceiveLight(
bool receive);
524 [[nodiscard]]
Result<void> setCustomLightProbe(
float r,
float g,
float b);
526 [[nodiscard]]
Result<void> setCustomLightProbeCoefficient(
int coefficient,
float r,
float g,
float b);
528 void clearCustomLightProbe();
529 void setCastShadow(
bool cast);
530 void setReceiveShadow(
bool receive);
531 void setCastOcclusion(
bool cast);
532 bool getCastOcclusion();
540 void setMeshLod(
int index,
Mesh*
mesh,
float switchDistance = 0.f);
542 [[nodiscard]]
Result<void> setMeshLodRendererState(
int index,
int skinQuality,
int shadowCastingMode,
543 bool receiveShadows,
int motionVectorMode,
545 int reflectionProbeUsage);
547 int getMeshLodRendererState(
int index,
int field);
555 int getMeshLodSecondaryLevelAtDistance(
float distance);
557 float getMeshLodSecondaryWeightAtDistance(
float distance);
559 void setMeshLodCullDistance(
float distance);
561 float getMeshLodCullDistance();
563 int getMeshLodCount();
564 int getMeshLodLevelAtDistance(
float distance);
588 uint32_t reflectionCaptureMask = 0xffffffffu,
float lodDistanceScale = 1.f,
589 bool includeTransparent =
true,
bool useClusteredLighting =
true,
590 Texture* skyFaceTexture =
nullptr,
Mesh* skyQuad =
nullptr,
591 float skyFaceTextureScale = 1.f,
bool includePrimitives =
false);
610 float aspect, uint32_t reflectionCaptureMask)>;
624 static void removeCaptureExtraDrawer(uint64_t
token);
639 static void removeForwardExtraDrawer(uint64_t
token);
654 std::vector<GpuInstance>& instances)>;
660 static void removeGpuOpaqueCollector(uint64_t
token);
720 static void removeShadowExtraDrawer(uint64_t
token);
723 static void setDirectionalLight(
float dx,
float dy,
float dz,
float r,
float g,
float b);
726 enum class CanvasShadows { Disabled,
Directional };
728 float lodDistanceScale,
bool includeTransparent,
bool useClusteredLighting,
729 Texture* skyFaceTexture,
Mesh* skyQuad,
float skyFaceTextureScale,
730 CanvasShadows shadows,
bool includePrimitives);
std::vector< eve::artifact::PartView > parts
#define EVENGINE_API_BACKENDS
std::array< float, 3 > scale
std::array< uint32_t, 16 > material
const EntityFact * entity
RenderSystem3D::ShadowExtraDrawer drawer
RenderSystem3D::GpuOpaqueCollector collector
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
EVENGINE_API_BACKENDS public API.
Packages shading method + surface parameters into one attachable asset.
GPU mesh handle (+ optional CPU morph targets).
EVENGINE_API_BACKENDS public API.
std::function< void(Graphics &gfx, const Camera3D::Data &cam, const glm::mat4 &viewProj, float aspect, std::vector< GpuInstance > &instances)> GpuOpaqueCollector
Collect non-ECS geometry for the normal GPU-driven opaque submission.
std::function< void(Graphics &gfx, const Camera3D::Data &cam, const glm::mat4 &viewProj, float aspect, uint32_t reflectionCaptureMask)> CaptureExtraDrawer
Draw custom forward geometry into reflection-probe and preview captures.
std::function< void(Graphics &gfx, const glm::mat4 &lightVP, const Camera3D::Data &cam)> ShadowExtraDrawer
Register a callback that casts shadows for geometry outside the Renderable3D ECS (e....
std::function< void(Graphics &gfx, const Camera3D::Data &cam, const glm::mat4 &viewProj, float aspect)> ForwardExtraDrawer
Draw custom opaque geometry after the main scene pass is open. @thread Register, unregister and invok...
std::function< void(Graphics &gfx, const Camera3D::Data &cam, const glm::mat4 &viewProj, float aspect)> DecalExtraDrawer
Register a callback that draws screen-space decals (box-projected volumes writing the DecalLayer) aft...
std::function< void(Graphics &gfx, const Camera3D::Data &cam, const glm::mat4 &viewProj, float aspect)> GBufferExtraDrawer
Register a callback that fills the G-buffer (depth/normal/albedo) for geometry outside the Renderable...
EVENGINE_API_BACKENDS public API.
float getRoughness()
Return the field-backed material roughness.
float getTintG()
Return the field-backed material tint green channel.
float getTintR()
Return the field-backed material tint red channel.
float getTintB()
Return the field-backed material tint blue channel.
float getMetallic()
Read the current material metallic scalar on the render thread.
uint32_t getEntityId() const
Return the table-local entity id used with getEntityGeneration().
bool getVisible()
Return whether this renderable participates in scene rendering.
uint32_t getEntityGeneration() const
Return the generation required to reject stale entity ids.
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
ReflectionProbe public API.
Value-owned subset of a resource shader's static instances.
One mesh + material slot on a multi-part model (Assimp mesh / body region). When Material* is null,...
LodRendererState public API.
bool usesParts() const
Uses parts.
std::optional< MeshInstanceRange > instances
Optional value-owned instance range; forward custom shader path only.
int lodLevelForDistance(float distance) const
Lod level for distance.
bool effectiveCastShadow() const
Effective cast shadow.
bool effectiveHair() const
Effective hair.
Mesh * meshForDistance(float distance) const
Pick LOD mesh for a camera distance; falls back to mesh when LOD disabled.