载入中...
搜索中...
未找到
RenderSystem3D.cpp
浏览该文件的文档.
159Lighting3DPack packLights3D(const std::vector<PackedLight3D>& lights, const Camera3D::Data* cam) {
180void splitLights(const std::vector<PackedLight3D>& packed, std::vector<ClusteredLightGpu>& points,
292void Camera3D::setEnvIntensity(float intensity) { data()->envIntensity = intensity < 0.f ? 0.f : intensity; }
348void Camera3D::setReflectionProbe(int slot, Texture* cubemap, float centerX, float centerY, float centerZ,
374static ReflectionProbeUpload selectReflectionProbes(const Camera3D::Data& camera, const glm::vec3& samplePosition) {
385 const glm::vec3 outside = glm::max(glm::abs(samplePosition - probe.center) - probe.extent, glm::vec3(0.f));
386 candidates[static_cast<size_t>(candidateCount++)] = Candidate{slot, probe.priority, glm::dot(outside, outside)};
481uint64_t RenderSystem3D::addCaptureExtraDrawer(uint32_t reflectionCaptureMask, CaptureExtraDrawer drawer) {
562void selectFrameShadowCasters(const std::vector<PackedLight3D>& packed, const ShadowPagingView& view,
572 selectShadowCasters(lights, isPoint, ShadowSchemeSettings::current(), view, directionalCaster, localSlots);
643CameraView buildCameraView(Camera3D::Data* cd, const std::vector<PackedLight3D>& packed, bool useClustered,
654 cv.proj = cameraProjectionVulkanRH_ZO(cd->orthographic, cv.fovRad, cd->orthoHeight, aspect, cd->nearZ, cd->farZ);
662 cv.clustered = buildClusteredLighting(clusteredPoints, clusteredDirs, cv.view, cd->nearZ, cd->farZ,
759 glm::vec3 dir = shadowCaster ? glm::vec3(shadowCaster->dx, shadowCaster->dy, shadowCaster->dz) : gLightDir;
769 glm::vec3(cd->upX, cd->upY, cd->upZ), fovRad, aspect, cd->nearZ, cd->farZ, shadowBias, shadowStrength);
789 glm::vec4& bank = slot.lightIndex < 4 ? shadowUpload.ubo.localSlot01 : shadowUpload.ubo.localSlot23;
844 cams.push_back(buildCameraView(defaultCam->data().operator->(), packed, useClustered, aspect, clusteredPoints,
857 buildCameraView(d, packed, useClustered, aspect, clusteredPoints, clusteredDirs, gfx, temporalJitter));
886 const float maxScale = std::max(std::abs(xf->sx), std::max(std::abs(xf->sy), std::abs(xf->sz)));
945 item.inDefaultView = defaultCam ? cams[0].frustum.sphereVisible(item.worldC, item.worldR) : true;
983 auto castsAt=[&](int level){return level<0||mr->lodRendererStates[level].shadowCastingMode!=0;};
1032 if (doShadow && !localShadowSlots.empty() && (haveManager || haveExtraShadowCasters) && defaultCam) {
1084 gfx.drawMeshGBufferAlpha(item.mesh, cv.viewProj * item.model, item.model, cv.data->nearZ, cv.data->farZ,
1088 gfx.drawMeshGBuffer(item.mesh, cv.viewProj * item.model, item.model, cv.data->nearZ, cv.data->farZ, alb,
1119 const bool gpuDrivenWanted = !doDeferredLighting && rc->isEnabled("gpuDriven") && gfx.supportsGpuDriven3D();
1171 context.viewportSize = glm::ivec2(gfx.getPixelWidth() > 0 ? gfx.getPixelWidth() : gfx.getWidth(),
1203 std::stable_sort(transparentItems.begin(), transparentItems.end(), [](const CulledItem* a, const CulledItem* b) {
1237 gfx.setMesh3DSurface(mr->isHair ? SurfaceMode::Transparent : SurfaceMode::Opaque, BlendMode::Alpha, false,
1276 gfx.setMesh3DSurface(SurfaceMode::Transparent,BlendMode::Alpha,mat&&mat->getDoubleSided(),false,0.5f);
1283 const bool clustered = lit && useClustered && !shader && item.lightProbeUsage == 0 && !item.speedTreeFade;
1354 auto drawn = gfx.drawMeshShaderInstances(*drawMesh, *shader, model, tint, range.first, range.count);
1387 if (it->mesh->hasGpuSkinning() || it->camIdx != 0 || !it->material || it->mr->camera != nullptr ||
1492 for (const CulledItem* item : cpuOpaque) drawMeshWithMaterial(*item, cams[size_t(item->camIdx)]);
1550 fx->setCamera(cd->eyeX, cd->eyeY, cd->eyeZ, cd->targetX, cd->targetY, cd->targetZ, cd->upX, cd->upY,
1562 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
1576 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
1580 const int depthBudget = reflectionQuality == "low" ? 4 : reflectionQuality == "medium" ? 6 : 8;
1586 const float dh = gfx.getCanvas() ? float(gfx.getCanvas()->getHeight()) : float(gfx.getHeight());
1588 fx->setCamera(cd->eyeX, cd->eyeY, cd->eyeZ, cd->targetX, cd->targetY, cd->targetZ, cd->upX, cd->upY,
1598 if (gi->getQuality() != rc->getReflectionQuality()) gi->setQuality(rc->getReflectionQuality());
1668 if (ssr->getQuality() != rc->getReflectionQuality()) ssr->setQuality(rc->getReflectionQuality());
1722 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
1728void RenderSystem3D::renderToCanvas(Graphics& gfx, Canvas* target, Camera3D* camera, uint32_t reflectionCaptureMask,
1733 const float aspect = target->getWidth() > 0 ? float(target->getWidth()) / float(target->getHeight()) : 1.f;
1741 cameraProjectionVulkanRH_ZO(cd->orthographic, fovRad, cd->orthoHeight, aspect, cd->nearZ, cd->farZ);
1775 clusteredPoints, clusteredDirections, viewM, cd->nearZ, cd->farZ, target->getWidth(), target->getHeight(),
1776 cd->fovYDeg * 0.017453292519943295f, glm::vec4(cd->ambientR, cd->ambientG, cd->ambientB, 0.f));
1803 gfx.drawMeshShader(skyQuad, skyModel, skyFaceTexture, Color(skyScale, skyScale, skyScale, 1.f), nullptr);
1812 glm::lookAtRH(eye, glm::vec3(cd->targetX, cd->targetY, cd->targetZ), glm::vec3(cd->upX, cd->upY, cd->upZ));
1854 if (!meshInstanceRangeVisible(*mr->instances, model, captureProjection * captureView, eye)) return;
#define EV_PARAM_CHECK(cond,...)
Validate a function parameter / public API precondition.
Definition Assert.h:30
bool clusteredUploaded
Whether the clustered SSBOs were uploaded for this camera this frame.
Definition RenderSystem3D.cpp:640
Structured operation status used by the common Result foundation.
void applyFromGBuffer(Graphics *gfx, Texture *hwDepth, Texture *worldNormal)
Applies from g buffer.
Definition AmbientOcclusion.cpp:434
void setQuality(const std::string &quality)
"low" | "medium" | "high" (unknown → medium).
Definition AmbientOcclusion.cpp:217
void setTemporalCamera(const glm::vec3 &eye, const glm::vec3 &target, float fovYDeg)
Detect camera cuts and invalidate incompatible temporal history.
Definition AntiAliasing.cpp:390
glm::vec2 prepareTemporalJitter(int width, int height)
Return this frame's Halton projection jitter in NDC units.
Definition AntiAliasing.cpp:373
glm::vec2 prepareTemporalObjectMotion(const void *objectKey, const glm::mat4 &model)
Per-object UV correction relative to static-world camera reprojection.
Definition AntiAliasing.cpp:423
void setTemporalViewProjection(const glm::mat4 &viewProjection, float nearZ, float farZ)
Set the jittered camera matrix used for depth-based history reprojection.
Definition AntiAliasing.cpp:416
void setBloom(float intensity, float threshold=1.f)
Configure HDR bloom. Zero intensity disables it.
Definition RenderSystem3D.cpp:307
float getScreenRayOriginY()
Definition RenderSystem3D.cpp:463
void setShadowLayerCullDistance(int layer, float distance)
Set the shadow-caster cull distance for one render layer; zero disables it.
Definition RenderSystem3D.cpp:267
float getEnvProbeExtentX()
Definition RenderSystem3D.cpp:344
void setDepthOfField(float focusDistance, float maxBlurPx, float focusRange=8.f)
Configure Gaussian depth-of-field on the final HDR resolve.
Definition RenderSystem3D.cpp:316
float getFocalLength()
Return physical-camera focal length in millimetres.
Definition RenderSystem3D.cpp:252
void setLayerCullDistance(int layer, float distance)
Set the camera cull distance for one render layer; zero disables the override.
Definition RenderSystem3D.cpp:253
float getDofMaxBlur()
Return DOF max blur in texels (0 when disabled).
Definition RenderSystem3D.cpp:326
float getScreenRayOriginZ()
Definition RenderSystem3D.cpp:464
void setReflectionProbe(int slot, Texture *cubemap, float centerX, float centerY, float centerZ, float extentX, float extentY, float extentZ, float intensity=1.f, float blendDistance=1.f, int priority=0)
Configure one local reflection probe slot.
Definition RenderSystem3D.cpp:348
float getBloomThreshold()
Return bloom threshold in linear HDR units.
Definition RenderSystem3D.cpp:314
void setPerspective()
Return to perspective projection, retaining the configured field of view.
Definition RenderSystem3D.cpp:235
float getExposure()
Return exposure compensation in photographic stops.
Definition RenderSystem3D.cpp:296
float getEnvProbeCenterY()
Definition RenderSystem3D.cpp:342
float getEnvProbeCenterX()
Definition RenderSystem3D.cpp:341
void setUp(float x, float y, float z)
Definition RenderSystem3D.cpp:219
void setOrthographic(float height)
Enable an orthographic projection with the given vertical world-space span.
Definition RenderSystem3D.cpp:230
void clearEnvProbe()
Disable box projection and return to an infinite-distance environment.
Definition RenderSystem3D.cpp:335
float getEnvProbeExtentZ()
Definition RenderSystem3D.cpp:346
void clearReflectionProbe(int slot)
Disable one local reflection probe slot.
Definition RenderSystem3D.cpp:362
void setPhysicalLens(float aperture, float focalLength)
Set positive physical-camera aperture and focal length metadata.
Definition RenderSystem3D.cpp:244
float getEnvProbeExtentY()
Definition RenderSystem3D.cpp:345
void screenToRay(float screenX, float screenY, float viewW, float viewH)
Build a world-space picking ray from a screen pixel. Stores origin (camera eye) and normalized direct...
Definition RenderSystem3D.cpp:410
void setExposure(float ev)
Set exposure compensation in photographic stops. Positive values brighten.
Definition RenderSystem3D.cpp:294
float getLayerCullDistance(int layer)
Return the camera cull-distance override for one render layer.
Definition RenderSystem3D.cpp:261
void setEnvIntensity(float intensity)
Definition RenderSystem3D.cpp:292
void setEnvProbe(float centerX, float centerY, float centerZ, float extentX, float extentY, float extentZ)
Enable box-projected IBL for the camera environment cubemap.
Definition RenderSystem3D.cpp:329
void setAutoExposure(bool enabled, float minEV=-8.f, float maxEV=8.f)
Enable log-average automatic exposure and set its EV clamp range.
Definition RenderSystem3D.cpp:298
void setTarget(float x, float y, float z)
Definition RenderSystem3D.cpp:208
float getShadowLayerCullDistance(int layer)
Return the shadow-caster cull-distance override for one render layer.
Definition RenderSystem3D.cpp:275
void clearDepthOfField()
Disable depth-of-field while retaining the current focus settings.
Definition RenderSystem3D.cpp:323
void setAmbient(float r, float g, float b)
Definition RenderSystem3D.cpp:283
int getReflectionProbeCount()
Return the number of enabled local reflection probes.
Definition RenderSystem3D.cpp:367
void setEye(float x, float y, float z)
Definition RenderSystem3D.cpp:197
bool hasEnvProbe()
True when all three box-probe extents are positive.
Definition RenderSystem3D.cpp:337
float getEnvProbeCenterZ()
Definition RenderSystem3D.cpp:343
void setEnvMap(Texture *cube)
Specular IBL cubemap (Graphics::newCubemap). nullptr disables IBL.
Definition RenderSystem3D.cpp:290
void setClipPlanes(float nearZ, float farZ)
Set positive near/far clipping distances; far is kept beyond near.
Definition RenderSystem3D.cpp:237
float getScreenRayOriginX()
Definition RenderSystem3D.cpp:462
Cross-backend min/max hardware-depth pyramid packed into one texture atlas.
Definition DepthPyramid.h:13
Texture * build(Texture *depth, int maxLevels=8)
Build the min/max hierarchy from a hardware depth texture.
Definition DepthPyramid.cpp:75
static DiffuseLightProbeRegistry & instance()
Return the process-wide graphics-owned registry.
Definition DiffuseLightProbeRegistry.cpp:65
Result< DiffuseLightProbeVolumeSample > selectVolume(const glm::vec3 &position) const
Select an object-local proxy volume; fragment shading performs the spatial interpolation.
Definition DiffuseLightProbeRegistry.cpp:124
Result< DiffuseLightProbeSample > sample(const glm::vec3 &position, int maxSamples) const
Blend up to maxSamples probes whose influence volumes contain position.
Definition DiffuseLightProbeRegistry.cpp:77
Screen-space buffers for mid/post effects and Hybrid deferred lighting.
Definition GBuffer.h:28
Screen-space single-bounce GI (SSGI). @lifetime All texture arguments are borrowed for the duration o...
Definition GlobalIllumination.h:30
void setTemporalMotionTexture(Texture *motionDepth)
Set packed linear-depth and motion texture used by temporal GI resolve.
Definition GlobalIllumination.h:60
void applyFromSceneTo(Graphics *gfx, Texture *color, Texture *hwDepth, Canvas *dest)
Applies from scene to.
Definition GlobalIllumination.cpp:414
Texture * getWorkingTexture()
Temporally resolved GI texture, or the raw working texture before history exists. @lifetime Returned ...
Definition GlobalIllumination.cpp:346
void setQuality(const std::string &quality)
"low" | "medium" | "high" | "ultra" (unknown becomes medium).
Definition GlobalIllumination.cpp:133
void setDepthPyramid(Texture *atlas, int levels)
Set the shared horizontally packed RG min/max depth hierarchy.
Definition GlobalIllumination.h:62
void setWorldNormalTexture(Texture *worldNormal)
Set the GBuffer world-normal texture used for guided GI sampling.
Definition GlobalIllumination.h:56
void setAlbedoTexture(Texture *albedo)
Set receiver albedo used for energy-conserving diffuse GI response.
Definition GlobalIllumination.h:58
Definition Graphics.h:125
ScreenSpaceReflection * pipelineScreenSpaceReflection()
Pipeline screen space reflection.
Definition Graphics.cpp:1601
virtual void beginShadowPass(int cascadeIndex)=0
Depth-only shadow pass for one cascade layer (0..2). Draws are recorded into the next begin3DFrame co...
virtual void setMesh3DEnvProbe(const glm::vec3 ¢er, const glm::vec3 &extent)=0
Box projection bounds for the active environment; zero extent disables it.
virtual void setMesh3DReflectionProbes(const ReflectionProbeUpload &upload)=0
Upload the two dominant local reflection probes for subsequent mesh draws.
virtual bool gpuDrivenSubmitOpaque(const GpuInstance *instances, uint32_t instanceCount)
Upload + record GPU-driven opaque draws (call inside the open 3D frame). The backend sorts instances ...
Definition Graphics.h:365
virtual std::string getBackendName() const =0
Renderer backend id used by sibling modules (e.g. Gpgpu).
virtual bool gpuDrivenCullEnabled() const
True when the stage-2 GPU cull chain will run this frame.
Definition Graphics.h:388
virtual void setMesh3DShadows(const ShadowUpload &upload)=0
Upload CSM constants for subsequent default mesh draws (active=false disables).
virtual void setMesh3DClip(float nearZ, float farZ)=0
Near/far used to pack linear depth into scene color A (SSGI).
virtual void gpuDrivenOpenScenePass()
Open the scene color pass that begin3DFrame deferred (cull path).
Definition Graphics.h:411
virtual void setMesh3DMaterial(float metallic, float roughness)=0
Metallic (0..1) and roughness (0..1) for the next default mesh draw.
virtual bool gpuDrivenVgSetInstance(std::uint32_t vgAssetId, const glm::mat4 &model, std::uint32_t materialId)
Register one instance of a VG asset this frame (model + material). The first instance per asset wins;...
Definition Graphics.h:458
virtual std::uint32_t gpuDrivenVgAssetId(Mesh *mesh) const
VG asset id attached to a mesh (kInvalidGpuDrivenSlot when none).
Definition Graphics.h:440
virtual void drawTexturedRectShaderUV(Texture *texture, Shader *shader, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha)=0
UV draw with an explicit Shader (nullptr = default textured pipeline).
virtual void setMesh3DViewProj(const glm::mat4 &viewProj)=0
Sets the mesh 3 d view proj.
virtual void drawMeshShadow(Mesh *mesh, const glm::mat4 &lightMVP, bool doubleSided=true)=0
Queue an opaque shadow caster.
virtual void drawMeshShadowAlpha(Mesh *mesh, const glm::mat4 &lightMVP, Texture *albedo=nullptr, bool doubleSided=true, float lodWeight=1.f, bool lodFadeReverse=false, bool lodDither=false)=0
Shadow pass draw with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): tra...
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 setMesh3DCameraPos(const glm::vec3 &eye)=0
Camera eye used by mesh shaders that need view/rim (stored in Mesh3DUBO).
virtual uint32_t gpuDrivenMeshRecord(Mesh *mesh)
GPU mesh-table slot for a mesh (kInvalidGpuDrivenSlot when not uploaded).
Definition Graphics.h:274
virtual void setMesh3DPackedNormalMask(bool enabled)=0
Interpret normal texture RG as tangent XY, B as AO and A as smoothness for terrain surfaces.
GlobalIllumination * pipelineGlobalIllumination()
Pipeline global illumination.
Definition Graphics.cpp:1507
virtual void setMesh3DClusteredActive(bool active)=0
Cheap per-draw toggle for the already-uploaded clustered light table. Unlike setMesh3DClusteredLighti...
virtual void begin3DFrameToCanvas(Canvas *canvas)=0
Open a 3D render pass targeting an offscreen Canvas (color + depth) at the canvas size....
virtual void setMesh3DEnv(Texture *cube, float intensity)=0
Specular IBL environment for subsequent default mesh draws. cube must be from newCubemap (or nullptr ...
virtual bool gpuDrivenMaterialUsable(Material *material)
Whether a material can be shaded by the GPU-driven opaque path. Backends/drivers with descriptor-inde...
Definition Graphics.h:304
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 beginDecalPass(int width, int height)=0
Open the decal pass (reads G-buffer hwDepth + normal, writes the screen-space DecalLayer targets)....
virtual void setSceneExposure(float exposure)=0
Set linear exposure multiplier used by the final scene tone-map resolve.
virtual void beginGBufferPass(int width, int height)=0
Depth/normal(/albedo) fill pass for mid/post effects. One-shot submit (like shadow); call before begi...
virtual void setMesh3DClusteredLighting(const ClusteredLightingUpload &upload)=0
Enable clustered forward path for subsequent default mesh draws (SSBO light lists)....
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 setSceneBloom(float intensity, float threshold)=0
Configure final HDR bloom intensity and linear threshold.
Outline * pipelineOutline()
Pipeline-owned Outline used by RenderSystem3D when the "outline" feature is on.
Definition Graphics.cpp:1606
std::shared_ptr< PrimitiveScene > getPrimitiveScene() const noexcept
Returns the authoritative persistent spatial-primitive scene.
Definition Graphics.h:521
virtual void setMesh3DView(const glm::mat4 &view)=0
Camera view matrix for subsequent drawMesh (view-space depth / CSM select).
virtual bool gpuDrivenScenePassPending() const
Scene pass opening deferred until after the compute cull section.
Definition Graphics.h:391
virtual void gpuDrivenResolve()
Record the fullscreen vis resolve inside the open scene color pass.
Definition Graphics.h:427
virtual void drawMeshGBufferAlpha(Mesh *mesh, const glm::mat4 &mvp, const glm::mat4 &model, float nearZ, float farZ, Texture *albedo=nullptr, float tintR=1.f, float tintG=1.f, float tintB=1.f, float motionX=0.f, float motionY=0.f, float roughness=0.45f, float metallic=0.f)=0
GBuffer fill with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): same ou...
virtual void setCanvas(Canvas *canvas)=0
nullptr or this → screen. Switching flushes pending draws to the previous target.
virtual Result< void > drawMeshShaderInstances(Mesh &mesh, Shader &shader, const glm::mat4 &model, const Color &tint, std::uint32_t first, std::uint32_t count)
Draw a checked range from a resource shader's immutable instance matrix buffer. @ownership Mesh and S...
Definition Graphics.h:1116
virtual void setDecalCamera(const glm::mat4 &viewProj, float nearZ, float farZ)=0
Per-frame camera constants for the decal pass (world-space reconstruction from the G-buffer depth)....
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 setSceneAutoExposure(bool enabled, float minEV, float maxEV)=0
Configure log-average scene auto exposure and its EV clamp range.
virtual void setMesh3DSceneDepth(Texture *depth)=0
Optional scene hardware depth (G-buffer hwDepth, Vulkan NDC z) bound to mesh3d shader binding 7....
AmbientOcclusion * pipelineAmbientOcclusion()
Pipeline-owned AO / GI / AA used by RenderSystem3D when features "ao" / "gi" / "aa" are enabled....
Definition Graphics.cpp:1502
virtual void gpuDrivenSetEnabled(bool enabled)
Enable/disable the GPU-driven opaque path (no-op when unsupported).
Definition Graphics.h:271
virtual uint32_t gpuDrivenMaterialRecord(Material *material)
GPU material-table slot for a material (lazily created).
Definition Graphics.h:280
virtual void setMesh3DSkinInfluenceLimit(SkinInfluenceLimit count)=0
Limit GPU skinning to the strongest one, two or four vertex influences.
virtual bool gpuDrivenResolveWanted() const
True when the stage-3 vis+resolve path should run this frame.
Definition Graphics.h:421
virtual void gpuDrivenRecordVisPass()
Record the GBuffer vis pass (opaque indirect draws write visID/visBary).
Definition Graphics.h:424
virtual void setMesh3DShadowReceive(bool receive)=0
Per-draw: when false, shadow sampling is forced off for the next mesh draw.
virtual bool supportsGBufferPost() const
Whether gbuffer-based post-process shaders (AO, GI) can be created on this backend....
Definition Graphics.h:238
virtual void begin3DFrame()=0
Begin a 3D frame: shadow/gbuffer (if pending) then a sampleable scene color pass (color+depth)....
void setFinalSceneTexture(Texture *texture)
Override the HDR source consumed by the next backend scene resolve.
Definition Graphics.h:2070
virtual bool supportsGpuDriven3D() const
True when the backend can run GPU-driven opaque draws.
Definition Graphics.h:255
virtual uint32_t gpuDrivenReflectionProbeSlot(Texture *cubemap)
Return/register a bindless cubemap slot for a GPU-driven local probe.
Definition Graphics.h:310
virtual void drawMeshGBuffer(Mesh *mesh, const glm::mat4 &mvp, const glm::mat4 &model, float nearZ, float farZ, Texture *albedo=nullptr, float tintR=1.f, float tintG=1.f, float tintB=1.f, float motionX=0.f, float motionY=0.f, float roughness=0.45f, float metallic=0.f)=0
Draws mesh g buffer.
DepthPyramid * pipelineDepthPyramid()
Pipeline-owned shared min/max depth hierarchy for screen-space effects. @lifetime Returned effect rem...
Definition Graphics.cpp:1532
virtual void gpuDrivenCullEmit(const glm::mat4 &viewProj, const glm::vec3 &eye, float fovYDeg, float nearZ, float farZ)
Record the cull + emit compute dispatches for the current frame.
Definition Graphics.h:401
virtual void gpuDrivenDrawOpaque()
Draw the opaque geometry with GPU-written indirect commands.
Definition Graphics.h:414
virtual Texture * getSceneColorTexture()
Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFr...
Definition Graphics.h:1047
virtual void drawMeshShader(Mesh *mesh, const glm::mat4 &model, Texture *texture, const Color &tint, Shader *shader)=0
Draw mesh with an explicit Mesh3D Shader (nullptr = default PBR pipeline).
RenderControl * getRenderControl()
Shared compilable 3D render control (features → pass list + GBuffer). Owned by Graphics; valid for th...
Definition Graphics.cpp:254
virtual void setSceneDepthOfField(float focusDistance, float maxBlurPx, float focusRange, float nearZ, float farZ)=0
Configure final-scene Gaussian depth-of-field.
Definition Graphics.cpp:1537
virtual void gpuDrivenVgComputeSection(const glm::mat4 &viewProj, const glm::vec3 &eye, float fovYDeg, float nearZ, float farZ)
Record the HZB build + cull-params section (VG-only frames).
Definition Graphics.h:467
virtual void drawDeferredLighting()
Fullscreen deferred lighting into the open scene-color pass. Samples GBuffer + clustered lights + CSM...
Definition Graphics.h:252
virtual bool supportsDecal() const
True when the backend can render the screen-space decal layer (box-projected decals writing albedo/no...
Definition Graphics.h:1274
Canvas * pipelineReflectionComposite(int width, int height)
Return a reusable HDR target for composing screen-space lighting. @lifetime Returned canvas is Graphi...
Definition Graphics.cpp:1590
virtual void setMesh3DNormalTexture(Texture *normal)=0
Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat).
virtual bool gpuDrivenCullBegin(const GpuInstance *instances, uint32_t instanceCount)
Upload sorted instances + bucket metadata for the cull chain.
Definition Graphics.h:394
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.
virtual void drawPrimitiveScene(const PrimitiveSceneCanvas3D &canvas)=0
Submits an owning frame-local primitive canvas into the active 3D pass.
Packages shading method + surface parameters into one attachable asset.
Definition Material.h:35
bool hasPbrSurface() const
Whether full PBR texture/extension rendering is requested.
Definition Material.h:64
Texture * getAlbedoTexture() const
Get the borrowed material texture. @ownership Graphics factory owns the resource. @lifetime Keep aliv...
Definition Material.h:117
PbrSurface pbrSurface() const
Return an owning parameter snapshot; texture resources remain borrowed.
Definition Material.h:58
bool isTransparentHair() const
True when this material should go through the hair transparent pass.
Definition Material.cpp:162
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
Shader * effectiveShader() const
Return the borrowed effective shader, or nullptr for the default PBR pipeline. @lifetime The pointer ...
Definition Material.cpp:157
float boundsCx
Model-space bounding sphere used for view/cascade frustum culling. Computed from vertex positions at ...
Definition Mesh.h:59
bool hasBounds() const
True when a valid bounding sphere is available for culling.
Definition Mesh.h:65
Screen-space model outline (t3ssel8r-style), computed from the GBuffer hardware depth + world-normal ...
Definition Outline.h:33
void setClip(float nearZ, float farZ)
Near/far used to linearize the hardware depth.
Definition Outline.cpp:110
bool apply(Graphics *gfx, Texture *hwDepth, Texture *worldNormal)
Draw the outline over the currently bound canvas / screen. hwDepth is the D32 GBuffer (Vulkan NDC z),...
Definition Outline.cpp:147
Frame-local scene recorder for 3D line primitives.
Definition PrimitiveDrawList.h:114
const std::vector< TriangleCommand3D > & triangles() const noexcept
Triangles.
Definition PrimitiveDrawList.h:179
const std::vector< PolylineCommand3D > & commands() const noexcept
Commands.
Definition PrimitiveDrawList.h:177
std::string getReflectionQuality() const
Return the shared TAA/RTGI/SSR quality preset.
Definition RenderControl.h:149
static void setDirectionalLight(float dx, float dy, float dz, float r, float g, float b)
Legacy single directional light used when no enabled Light3D exists.
Definition RenderSystem3D.cpp:469
static void removeShadowExtraDrawer(uint64_t token)
Remove one shadow callback before destroying its captured state.
Definition RenderSystem3D.cpp:533
static void removeForwardExtraDrawer(uint64_t token)
Unregister a main forward-pass contributor.
Definition RenderSystem3D.cpp:503
static void addDecalExtraDrawer(DecalExtraDrawer drawer)
Adds decal extra drawer.
Definition RenderSystem3D.cpp:540
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.
Definition RenderSystem3D.h:572
static uint64_t addShadowExtraDrawer(ShadowExtraDrawer drawer)
Adds shadow extra drawer.
Definition RenderSystem3D.cpp:526
static void removeCaptureExtraDrawer(uint64_t token)
Unregister an offscreen capture contributor.
Definition RenderSystem3D.cpp:488
static void addGBufferExtraDrawer(GBufferExtraDrawer drawer)
Adds g buffer extra drawer.
Definition RenderSystem3D.cpp:476
static uint64_t addCaptureExtraDrawer(uint32_t reflectionCaptureMask, CaptureExtraDrawer drawer)
Register custom forward geometry for offscreen captures.
Definition RenderSystem3D.cpp:481
static void renderToCanvas(Graphics &gfx, Canvas *target, Camera3D *camera, uint32_t reflectionCaptureMask=0xffffffffu, float lodDistanceScale=1.f, bool includeTransparent=true, bool useClusteredLighting=true, Texture *skyFaceTexture=nullptr, Mesh *skyQuad=nullptr, float skyFaceTextureScale=1.f)
Forward 3D pass into an offscreen canvas using multipart materials, LOD, masked surfaces and sorted t...
Definition RenderSystem3D.cpp:1728
static uint64_t addForwardExtraDrawer(ForwardExtraDrawer drawer)
Register a main forward-pass contributor.
Definition RenderSystem3D.cpp:496
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.
Definition RenderSystem3D.h:528
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....
Definition RenderSystem3D.h:627
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...
Definition RenderSystem3D.h:551
static void removeGpuOpaqueCollector(uint64_t token)
Unregister a GPU-driven opaque contributor.
Definition RenderSystem3D.cpp:518
static uint64_t addGpuOpaqueCollector(GpuOpaqueCollector collector)
Register a GPU-driven opaque contributor.
Definition RenderSystem3D.cpp:511
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...
Definition RenderSystem3D.h:600
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...
Definition RenderSystem3D.h:588
Screen-space reflections (SSR) as a fullscreen post pass. @lifetime All Graphics and texture argument...
Definition ScreenSpaceReflection.h:30
std::string getQuality() const
Return the active SSR quality preset.
Definition ScreenSpaceReflection.h:64
void applyFromSceneTo(Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Canvas *dest)
Write the SSR result into the currently bound canvas / dest.
Definition ScreenSpaceReflection.h:95
void setQuality(const std::string &quality)
Set "low", "medium", "high" or "ultra" SSR quality preset.
Definition ScreenSpaceReflection.cpp:188
Texture * getReflectionTexture()
The reflection texture from the owned canvas, or nullptr before first apply.
Definition ScreenSpaceReflection.cpp:321
void setEnabled(bool enabled)
Enable/disable the pass. When disabled it emits transparent (0 hit).
Definition ScreenSpaceReflection.cpp:182
Canvas * getReflectionCanvas()
Owned reflection canvas (created on first use at the current target size).
Definition ScreenSpaceReflection.cpp:306
void setDepthPyramid(Texture *atlas, int levels)
Set the shared horizontally packed RG min/max depth hierarchy.
Definition ScreenSpaceReflection.h:49
void setTemporalMotionTexture(Texture *motionDepth)
Set packed linear-depth and motion texture used by temporal SSR resolve.
Definition ScreenSpaceReflection.h:47
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
EVENGINE_API_BACKENDS Result< void > prepareViewResources(Graphics &graphics, const glm::mat4 &viewProjection, const glm::vec3 &eye)
Dispatch preparers before opening the destination; no callbacks means success. @thread Graphics threa...
Definition ViewPreparation.cpp:36
Result< void > validateInstancedRenderable(const Renderable3D::MeshRenderer &mr)
Validate instanced renderable.
Definition RenderableInstances.cpp:7
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
bool meshInstanceRangeVisible(const MeshInstanceRange &range, const glm::mat4 &model, const glm::mat4 &vp, const glm::vec3 &eye)
Test transformed bounds against Vulkan clip planes and horizontal distance.
Definition MeshInstanceRange.cpp:20
void selectShadowCasters(const std::vector< Light3D::Data * > &lights, const std::vector< bool > &isPointFlags, const ShadowSchemeSettings &settings, const ShadowPagingView &view, Light3D::Data *&directionalCaster, std::vector< LocalShadowSlot > &localSlots)
Select directional CSM caster + paged local spot slots for one frame.
Definition ShadowScheme.cpp:216
ClusteredLightingUpload buildClusteredLighting(const std::vector< ClusteredLightGpu > &points, const std::vector< ClusteredLightGpu > &dirs, const glm::mat4 &view, float nearZ, float farZ, int screenW, int screenH, float fovYRad, const glm::vec4 &ambient)
Build clustered tables for point lights in view space.
Definition ClusteredLight.cpp:9
@ Transparent
glm::mat4 cameraProjectionVulkanRH_ZO(bool orthographic, float fovyRad, float orthoHeight, float aspect, float zNear, float zFar)
Camera projection shared by rendering, picking, and diagnostic passes.
Definition ClipSpace.h:38
glm::mat4 perspectiveVulkanRH_ZO(float fovyRad, float aspect, float zNear, float zFar)
Right-handed, zero-to-one depth perspective for Vulkan swapchains.
Definition ClipSpace.h:22
ShadowUpload buildDirectionalCSM(const glm::vec3 &lightDirTowardSurface, const glm::vec3 &eye, const glm::vec3 &target, const glm::vec3 &up, float fovYRad, float aspect, float nearZ, float farZ, float bias, float strength)
Build 3 cascade light view-proj matrices for a directional light.
Definition Shadow.cpp:83
eve::Color Color
RGBA color used by every graphics draw call. Lives inside eve::graphics so including a graphics heade...
Definition Color.h:13
void lightSpotCosines(float angleDeg, float softness, float &cosOuter, float &cosInner)
Convert spot angle/softness into GPU cosines (outer < inner). Shared by Light2D and Light3D flashligh...
Definition Light.h:28
constexpr uint32_t kInvalidGpuDrivenSlot
GPU-driven rendering shared constants + std430 GPU layouts.
Definition GpuDrivenTypes.h:19
SkinInfluenceLimit
Number of strongest vertex influences retained by GPU skinning.
Definition IGraphics3D.h:19
@ NoOp
@ Premultiplied
@ Additive
@ Alpha
@ Opaque
std::array< float, 32 > shadowLayerCullDistances
Definition RenderSystem3D.h:59
static constexpr int kMaxReflectionProbes
Definition RenderSystem3D.h:39
static constexpr int kMaxLights
Definition ClusteredLight.h:17
CPU-built clustered lighting upload for one frame/camera. Point lights are clustered; directional lig...
Definition ClusteredLight.h:33
Per-instance GPU record (std430). Mirrors GLSL GpuInstance.
Definition GpuDrivenTypes.h:106
GPU light packing for mesh3d / PBR (std140-friendly).
Definition Light.h:161
std::array< glm::vec4, 9 > diffuseProbeSh
Definition Light.h:177
One allocated local (spot/point-face) shadow slot for the frame. @ownership Ephemeral CPU descriptor;...
Definition ShadowScheme.h:92
One mesh + material slot on a multi-part model (Assimp mesh / body region). When Material* is null,...
Definition Material.h:330
Owning material parameter snapshot; texture pointers remain borrowed. Base color/metallic/roughness c...
Definition PbrSurface.h:218
static constexpr int kMaxProbes
Definition IGraphics3D.h:27
Immutable camera and viewport facts used to resolve one 3D draw list. Projection uses the engine's RH...
Definition PrimitiveTypes.h:98
static constexpr int kLocalSlots
Extra depth-array layers for spot (perspective) local shadows.
Definition Shadow.h:26
Camera context used to score local shadow candidates for atlas paging. @ownership Ephemeral; valid on...
Definition ShadowScheme.h:40
static ShadowSchemeSettings & current()
Borrow the process-wide settings object.
Definition ShadowScheme.cpp:85