载入中...
搜索中...
未找到
RenderSystem3D.cpp
浏览该文件的文档.
163Lighting3DPack packLights3D(const std::vector<PackedLight3D>& lights, const Camera3D::Data* cam) {
184void splitLights(const std::vector<PackedLight3D>& packed, std::vector<ClusteredLightGpu>& points,
248 DiagnosticCode::InvalidArgument, "pixelsPerUnit must be finite and > 0", "camera3d.pixelsPerUnit"));
288 Diagnostic::error(DiagnosticCode::InvalidArgument, "viewport size must be > 0", "camera3d.viewport"));
292 DiagnosticCode::InvalidArgument, "pixel config requires pixelsPerUnit > 0", "camera3d.pixelsPerUnit"));
294 computePixelPerfectScale(d->pixelsPerUnit, d->pixelRefWidth, d->pixelRefHeight, viewWidth, viewHeight);
302Result<void> Camera3D::setPixelOrthographic(float pixelsPerUnit, int viewWidth, int viewHeight, int refWidth,
314 computePixelPerfectScale(d->pixelsPerUnit, d->pixelRefWidth, d->pixelRefHeight, viewWidth, viewHeight);
409void Camera3D::setEnvIntensity(float intensity) { data()->envIntensity = intensity < 0.f ? 0.f : intensity; }
465void Camera3D::setReflectionProbe(int slot, Texture* cubemap, float centerX, float centerY, float centerZ,
491static ReflectionProbeUpload selectReflectionProbes(const Camera3D::Data& camera, const glm::vec3& samplePosition) {
502 const glm::vec3 outside = glm::max(glm::abs(samplePosition - probe.center) - probe.extent, glm::vec3(0.f));
503 candidates[static_cast<size_t>(candidateCount++)] = Candidate{slot, probe.priority, glm::dot(outside, outside)};
598uint64_t RenderSystem3D::addCaptureExtraDrawer(uint32_t reflectionCaptureMask, CaptureExtraDrawer drawer) {
679void selectFrameShadowCasters(const std::vector<PackedLight3D>& packed, const ShadowPagingView& view,
689 selectShadowCasters(lights, isPoint, ShadowSchemeSettings::current(), view, directionalCaster, localSlots);
760CameraView buildCameraView(Camera3D::Data* cd, const std::vector<PackedLight3D>& packed, bool useClustered,
771 cv.proj = cameraProjectionVulkanRH_ZO(cd->orthographic, cv.fovRad, cd->orthoHeight, aspect, cd->nearZ, cd->farZ);
779 cv.clustered = buildClusteredLighting(clusteredPoints, clusteredDirs, cv.view, cd->nearZ, cd->farZ,
849 defaultCam->data()->dofMaxBlurPx > 0.f || !g_forwardDrawers.empty() || !g_gpuOpaqueCollectors.empty() ||
851 rc->pathTracingDiagnostic_ = "Path scene requires a perspective camera and supported contributors";
935 glm::vec3 dir = shadowCaster ? glm::vec3(shadowCaster->dx, shadowCaster->dy, shadowCaster->dz) : gLightDir;
945 glm::vec3(cd->upX, cd->upY, cd->upZ), fovRad, aspect, cd->nearZ, cd->farZ, shadowBias, shadowStrength);
965 glm::vec4& bank = slot.lightIndex < 4 ? shadowUpload.ubo.localSlot01 : shadowUpload.ubo.localSlot23;
1022 cams.push_back(buildCameraView(defaultCam->data().operator->(), packed, useClustered, aspect, clusteredPoints,
1035 buildCameraView(d, packed, useClustered, aspect, clusteredPoints, clusteredDirs, gfx, temporalJitter));
1165 auto castsAt=[&](int level){return level<0||mr->lodRendererStates[level].shadowCastingMode!=0;};
1214 if (doShadow && !localShadowSlots.empty() && (haveManager || haveExtraShadowCasters) && defaultCam) {
1276 gfx.drawMeshGBufferAlpha(item.mesh, cv.viewProj * item.model, item.model, cv.data->nearZ, cv.data->farZ,
1280 gfx.drawMeshGBuffer(item.mesh, cv.viewProj * item.model, item.model, cv.data->nearZ, cv.data->farZ, alb,
1285 if (!resetGBufferMaterial) throw Exception("%s", resetGBufferMaterial.error()->message().c_str());
1317 if (rc->autoInstancingPath() == RenderControl::AutoInstancingPath::Auto && !rc->isEnabled("gpuDriven") &&
1325 item.mesh->hasGpuSkinning() || item.lightProbeUsage != 0 || !gfx.gpuDrivenMaterialUsable(item.material))
1334 !doDeferredLighting && (rc->isEnabled("gpuDriven") || autoInstance) && gfx.supportsGpuDriven3D();
1386 context.viewportSize = glm::ivec2(gfx.getPixelWidth() > 0 ? gfx.getPixelWidth() : gfx.getWidth(),
1418 std::stable_sort(transparentItems.begin(), transparentItems.end(), [](const CulledItem* a, const CulledItem* b) {
1463 gfx.setMesh3DSurface(mr->isHair ? SurfaceMode::Transparent : SurfaceMode::Opaque, BlendMode::Alpha, false,
1481 auto drawMeshWithMaterial = [&](const CulledItem& item, CameraView& cv, std::span<const glm::mat4> models) {
1502 gfx.setMesh3DSurface(SurfaceMode::Transparent,BlendMode::Alpha,mat&&mat->getDoubleSided(),false,0.5f);
1509 const bool clustered = lit && useClustered && !shader && item.lightProbeUsage == 0 && !item.speedTreeFade;
1581 *drawMesh, models, albedo ? OptionalRef<Texture>{std::ref(*albedo)} : OptionalRef<Texture>{}, tint);
1585 auto drawn = gfx.drawMeshShaderInstances(*drawMesh, *shader, model, tint, range.first, range.count);
1720 } else if (rc->isEnabled("gpuDriven") && gfx.gpuDrivenCullEnabled() && instances.empty() && vgAny) {
1747 const bool ordinaryInstances = !doDeferredLighting && !useClustered && gfx.supportsMeshInstancing();
1835 if ((!doAO && !doContactShadow) || !gfx.supportsGBufferPost() || !defaultCam || !gfx.had3DThisFrame()) return;
1841 fx->setCamera(cd->eyeX, cd->eyeY, cd->eyeZ, cd->targetX, cd->targetY, cd->targetZ, cd->upX, cd->upY,
1847 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
1889 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
1893 const int depthBudget = reflectionQuality == "low" ? 4 : reflectionQuality == "medium" ? 6 : 8;
1899 const float dh = gfx.getCanvas() ? float(gfx.getCanvas()->getHeight()) : float(gfx.getHeight());
1901 fx->setCamera(cd->eyeX, cd->eyeY, cd->eyeZ, cd->targetX, cd->targetY, cd->targetZ, cd->upX, cd->upY,
1911 if (gi->getQuality() != rc->getReflectionQuality()) gi->setQuality(rc->getReflectionQuality());
1982 if (ssr->getQuality() != rc->getReflectionQuality()) ssr->setQuality(rc->getReflectionQuality());
2028 Texture* depth = gfx.getBackendName() == "webgpu" ? gb->getDepthTexture() : gb->getHwDepthTexture();
2034void RenderSystem3D::renderToCanvas(Graphics& gfx, Canvas* target, Camera3D* camera, uint32_t reflectionCaptureMask,
2048void RenderSystem3D::renderToCanvasImpl(Graphics& gfx, Canvas* target, Camera3D* camera, uint32_t reflectionCaptureMask,
2054 const float aspect = target->getWidth() > 0 ? float(target->getWidth()) / float(target->getHeight()) : 1.f;
2062 cameraProjectionVulkanRH_ZO(cd->orthographic, fovRad, cd->orthoHeight, aspect, cd->nearZ, cd->farZ);
2164 std::stable_sort(canvasItems.begin(), canvasItems.end(), [](const CanvasItem& a, const CanvasItem& b) {
2178 if (shadows == CanvasShadows::Directional && ShadowSchemeSettings::current().enableDirectionalCsm) {
2189 direction = glm::length(direction) < 1e-6f ? glm::vec3(0.f, 1.f, 0.f) : glm::normalize(direction);
2190 shadowUpload = buildDirectionalCSM(direction, eye, look, up, fovRad, aspect, cd->nearZ, cd->farZ,
2196 if (!item.mr->effectiveCastShadow() || (item.material && !item.material->getCastShadow())) continue;
2225 gfx.setSceneDepthOfField(cd->dofFocusDistance, cd->dofMaxBlurPx, cd->dofFocusRange, cd->nearZ, cd->farZ);
2260 gfx.drawMeshShader(skyQuad, skyModel, skyFaceTexture, Color(skyScale, skyScale, skyScale, 1.f), nullptr);
2358 if (!primitives.commands().empty() || !primitives.triangles().empty()) gfx.drawPrimitiveScene(primitives);
EVEngine assertion entry point, backed by zeroerr.
#define EV_PARAM_CHECK(cond,...)
Validate a function parameter / public API precondition.
Definition Assert.h:30
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:158
Local-probe upload record kept off the high-fanout IGraphics3D header.
bool clusteredUploaded
Whether the clustered SSBOs were uploaded for this camera this frame.
Definition RenderSystem3D.cpp:757
std::map< std::array< int, 4 >, std::vector< const Subject * > > candidates
Definition Sensing.cpp:32
Structured operation status used by the common Result foundation.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
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:394
glm::vec2 prepareTemporalJitter(int width, int height)
Return this frame's Halton projection jitter in NDC units.
Definition AntiAliasing.cpp:377
glm::vec2 prepareTemporalObjectMotion(const void *objectKey, const glm::mat4 &model)
Per-object UV correction relative to static-world camera reprojection.
Definition AntiAliasing.cpp:427
void setTemporalViewProjection(const glm::mat4 &viewProjection, float nearZ, float farZ)
Set the jittered camera matrix used for depth-based history reprojection.
Definition AntiAliasing.cpp:420
void setBloom(float intensity, float threshold=1.f)
Configure HDR bloom. Zero intensity disables it.
Definition RenderSystem3D.cpp:424
float getPixelsPerUnit()
Return configured pixels per world unit, or 0 when unset.
Definition RenderSystem3D.cpp:277
float getScreenRayOriginY()
Definition RenderSystem3D.cpp:580
void snapToPixelGrid(int viewWidth, int viewHeight)
Snap the eye onto the view-plane pixel grid for the current ortho / pixel sizing.
Definition RenderSystem3D.cpp:309
Result< void > setPixelOrthographic(float pixelsPerUnit, int viewWidth, int viewHeight, int refWidth=0, int refHeight=0)
One-shot perfect-pixel orthographic setup: store config then apply for this viewport.
Definition RenderSystem3D.cpp:302
bool hasPixelConfig()
Return whether a pixels-per-unit config is stored.
Definition RenderSystem3D.cpp:271
void setShadowLayerCullDistance(int layer, float distance)
Set the shadow-caster cull distance for one render layer; zero disables it.
Definition RenderSystem3D.cpp:384
int getPixelScale()
Return the last integer upscale from applyPixelPerfect.
Definition RenderSystem3D.cpp:283
float getEnvProbeExtentX()
Definition RenderSystem3D.cpp:461
void setDepthOfField(float focusDistance, float maxBlurPx, float focusRange=8.f)
Configure Gaussian depth-of-field on the final HDR resolve.
Definition RenderSystem3D.cpp:433
float getFocalLength()
Return physical-camera focal length in millimetres.
Definition RenderSystem3D.cpp:369
void setLayerCullDistance(int layer, float distance)
Set the camera cull distance for one render layer; zero disables the override.
Definition RenderSystem3D.cpp:370
float getDofMaxBlur()
Return DOF max blur in texels (0 when disabled).
Definition RenderSystem3D.cpp:443
float getScreenRayOriginZ()
Definition RenderSystem3D.cpp:581
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:465
float getBloomThreshold()
Return bloom threshold in linear HDR units.
Definition RenderSystem3D.cpp:431
void setPerspective()
Return to perspective projection, retaining the configured field of view.
Definition RenderSystem3D.cpp:239
bool isOrthographic()
Return whether the camera currently uses orthographic projection.
Definition RenderSystem3D.cpp:241
float getExposure()
Return exposure compensation in photographic stops.
Definition RenderSystem3D.cpp:413
float getEnvProbeCenterY()
Definition RenderSystem3D.cpp:459
float getEnvProbeCenterX()
Definition RenderSystem3D.cpp:458
void setUp(float x, float y, float z)
Definition RenderSystem3D.cpp:223
void setOrthographic(float height)
Enable a pure orthographic projection with the given vertical world-space span.
Definition RenderSystem3D.cpp:234
void clearEnvProbe()
Disable box projection and return to an infinite-distance environment.
Definition RenderSystem3D.cpp:452
Result< void > applyPixelPerfect(int viewWidth, int viewHeight)
Enable pure orthographic projection sized for crisp pixels from the stored config.
Definition RenderSystem3D.cpp:285
Result< void > setPixelConfig(float pixelsPerUnit, int refWidth=0, int refHeight=0)
Store perfect-pixel sizing for pure orthographic projection.
Definition RenderSystem3D.cpp:245
float getOrthoHeight()
Return the vertical world-space span used by orthographic projection.
Definition RenderSystem3D.cpp:243
float getEnvProbeExtentZ()
Definition RenderSystem3D.cpp:463
void clearReflectionProbe(int slot)
Disable one local reflection probe slot.
Definition RenderSystem3D.cpp:479
void setPhysicalLens(float aperture, float focalLength)
Set positive physical-camera aperture and focal length metadata.
Definition RenderSystem3D.cpp:361
float getEnvProbeExtentY()
Definition RenderSystem3D.cpp:462
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:527
void setExposure(float ev)
Set exposure compensation in photographic stops. Positive values brighten.
Definition RenderSystem3D.cpp:411
float getLayerCullDistance(int layer)
Return the camera cull-distance override for one render layer.
Definition RenderSystem3D.cpp:378
void setEnvIntensity(float intensity)
Definition RenderSystem3D.cpp:409
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:446
void clearPixelConfig()
Clear pixel sizing so applyPixelPerfect / setPixelOrthographic require a fresh config.
Definition RenderSystem3D.cpp:263
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:415
void setTarget(float x, float y, float z)
Definition RenderSystem3D.cpp:212
float getShadowLayerCullDistance(int layer)
Return the shadow-caster cull-distance override for one render layer.
Definition RenderSystem3D.cpp:392
void clearDepthOfField()
Disable depth-of-field while retaining the current focus settings.
Definition RenderSystem3D.cpp:440
void setPixelSnap(bool enabled)
Enable or disable snapping the eye onto the view-plane pixel grid.
Definition RenderSystem3D.cpp:273
void setAmbient(float r, float g, float b)
Definition RenderSystem3D.cpp:400
int getReflectionProbeCount()
Return the number of enabled local reflection probes.
Definition RenderSystem3D.cpp:484
void setEye(float x, float y, float z)
Definition RenderSystem3D.cpp:201
bool hasEnvProbe()
True when all three box-probe extents are positive.
Definition RenderSystem3D.cpp:454
float getEnvProbeCenterZ()
Definition RenderSystem3D.cpp:460
void setEnvMap(Texture *cube)
Specular IBL cubemap (Graphics::newCubemap). nullptr disables IBL.
Definition RenderSystem3D.cpp:407
void setClipPlanes(float nearZ, float farZ)
Set positive near/far clipping distances; far is kept beyond near.
Definition RenderSystem3D.cpp:354
float getScreenRayOriginX()
Definition RenderSystem3D.cpp:579
virtual Texture * getTexture()=0
Sampleable color buffer; screen Canvas returns nullptr.
Screen-space contact shadows for the primary directional light.
Definition ContactShadow.h:23
void setInvViewProj(const glm::mat4 &invViewProj)
Sets the inv view proj.
Definition ContactShadow.cpp:105
void setQuality(const std::string &quality)
"low" | "medium" | "high" (unknown → medium).
Definition ContactShadow.cpp:100
void applyFromGBuffer(Graphics *gfx, Texture *hwDepth, Texture *worldNormal)
Darken the current target using contact shadows from GBuffer depth.
Definition ContactShadow.cpp:159
void setLightDirection(float x, float y, float z)
World-space direction toward the light (normalized on write). Matches Light3D directional convention ...
Definition ContactShadow.cpp:126
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:134
ScreenSpaceReflection * pipelineScreenSpaceReflection()
Pipeline screen space reflection.
Definition Graphics.cpp:1786
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:352
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:375
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:398
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:445
virtual std::uint32_t gpuDrivenVgAssetId(Mesh *mesh) const
VG asset id attached to a mesh (kInvalidGpuDrivenSlot when none).
Definition Graphics.h:427
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:1253
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:296
eve::OptionalRef< IRayTracing > rayTracingService() const noexcept
Borrow the optional ray-tracing service resolved at graphics construction. @ownership Provider-owned;...
Definition Graphics.cpp:186
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:1684
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:326
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:1791
std::shared_ptr< PrimitiveScene > getPrimitiveScene() const noexcept
Returns the authoritative persistent spatial-primitive scene.
Definition Graphics.h:508
virtual void setMesh3DView(const glm::mat4 &view)=0
Camera view matrix for subsequent drawMesh (view-space depth / CSM select).
virtual Result< void > drawMeshInstances(Mesh &mesh, std::span< const glm::mat4 > models, OptionalRef< Texture > texture, const Color &tint)
Draw a batch of static meshes using the current ordinary material and lighting bindings.
Definition Graphics.h:1151
virtual bool gpuDrivenScenePassPending() const
Scene pass opening deferred until after the compute cull section.
Definition Graphics.h:378
virtual void gpuDrivenResolve()
Record the fullscreen vis resolve inside the open scene color pass.
Definition Graphics.h:414
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:1175
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:1674
virtual void gpuDrivenSetEnabled(bool enabled)
Enable/disable the GPU-driven opaque path (no-op when unsupported).
Definition Graphics.h:293
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, float tintA=1.f)=0
GBuffer fill with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): same ou...
virtual uint32_t gpuDrivenMaterialRecord(Material *material)
GPU material-table slot for a material (lazily created).
Definition Graphics.h:302
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:408
virtual void gpuDrivenRecordVisPass()
Record the GBuffer vis pass (opaque indirect draws write visID/visBary).
Definition Graphics.h:411
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:260
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:2147
virtual bool supportsGpuDriven3D() const
True when the backend can run GPU-driven opaque draws.
Definition Graphics.h:277
virtual uint32_t gpuDrivenReflectionProbeSlot(Texture *cubemap)
Return/register a bindless cubemap slot for a GPU-driven local probe.
Definition Graphics.h:332
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, float tintA=1.f)=0
Queue a GBuffer surface using the currently bound PBR material when present.
DepthPyramid * pipelineDepthPyramid()
Pipeline-owned shared min/max depth hierarchy for screen-space effects. @lifetime Returned effect rem...
Definition Graphics.cpp:1709
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:388
virtual void gpuDrivenDrawOpaque()
Draw the opaque geometry with GPU-written indirect commands.
Definition Graphics.h:401
virtual Texture * getSceneColorTexture()
Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFr...
Definition Graphics.h:1075
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:279
virtual void setSceneDepthOfField(float focusDistance, float maxBlurPx, float focusRange, float nearZ, float farZ)=0
Configure final-scene Gaussian depth-of-field.
Definition Graphics.cpp:1714
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:454
virtual void end3DFrameToCanvas()=0
Ends 3 d frame to canvas.
virtual void drawDeferredLighting()
Fullscreen deferred lighting into the open scene-color pass. Samples GBuffer + clustered lights + CSM...
Definition Graphics.h:274
virtual bool supportsMeshInstancing() const
Whether the initialized backend can instance ordinary opaque meshes without bindless textures....
Definition Graphics.h:1136
virtual bool supportsDecal() const
True when the backend can render the screen-space decal layer (box-projected decals writing albedo/no...
Definition Graphics.h:1335
Canvas * pipelineReflectionComposite(int width, int height)
Return a reusable HDR target for composing screen-space lighting. @lifetime Returned canvas is Graphi...
Definition Graphics.cpp:1775
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:381
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:38
bool hasPbrSurface() const
Whether full PBR texture/extension rendering is requested.
Definition Material.h:67
Texture * getAlbedoTexture() const
Get the borrowed material texture. @ownership Graphics factory owns the resource. @lifetime Keep aliv...
Definition Material.h:128
bool isTransparentHair() const
True when this material should go through the hair transparent pass.
Definition Material.cpp:219
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:328
Shader * effectiveShader() const
Return the borrowed effective shader, or nullptr for the default PBR pipeline. @lifetime The pointer ...
Definition Material.cpp:214
float boundsCx
Model-space bounding sphere used for view/cascade frustum culling. Computed from vertex positions at ...
Definition Mesh.h:60
bool hasBounds() const
True when a valid bounding sphere is available for culling.
Definition Mesh.h:66
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
AutoInstancingPath autoInstancingPath() const
Return the automatic instancing selection; render-thread affine, no callbacks.
Definition RenderControl.h:88
std::string getReflectionQuality() const
Return the shared TAA/RTGI/SSR quality preset.
Definition RenderControl.h:195
std::string getPostProcessQuality() const
Return the unified post-process quality for TAA, RTGI and SSR.
Definition RenderControl.h:199
bool isPathTracingRequested() const
True when the pathTracing feature is requested; render-thread query.
Definition RenderControl.h:119
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:586
static void renderWithShadowsToCanvas(Graphics &gfx, Canvas &target, Camera3D &camera)
Render an editor preview with directional cascaded shadows before forward shading....
Definition RenderSystem3D.cpp:2043
static void removeShadowExtraDrawer(uint64_t token)
Remove one shadow callback before destroying its captured state.
Definition RenderSystem3D.cpp:650
static void removeForwardExtraDrawer(uint64_t token)
Unregister a main forward-pass contributor.
Definition RenderSystem3D.cpp:620
static void addDecalExtraDrawer(DecalExtraDrawer drawer)
Adds decal extra drawer.
Definition RenderSystem3D.cpp:657
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:654
static uint64_t addShadowExtraDrawer(ShadowExtraDrawer drawer)
Adds shadow extra drawer.
Definition RenderSystem3D.cpp:643
static void removeCaptureExtraDrawer(uint64_t token)
Unregister an offscreen capture contributor.
Definition RenderSystem3D.cpp:605
static void addGBufferExtraDrawer(GBufferExtraDrawer drawer)
Adds g buffer extra drawer.
Definition RenderSystem3D.cpp:593
static uint64_t addCaptureExtraDrawer(uint32_t reflectionCaptureMask, CaptureExtraDrawer drawer)
Register custom forward geometry for offscreen captures.
Definition RenderSystem3D.cpp:598
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, bool includePrimitives=false)
Forward 3D pass into an offscreen canvas using multipart materials, LOD, masked surfaces and sorted t...
Definition RenderSystem3D.cpp:2034
static uint64_t addForwardExtraDrawer(ForwardExtraDrawer drawer)
Register a main forward-pass contributor.
Definition RenderSystem3D.cpp:613
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:610
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:709
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:633
static void removeGpuOpaqueCollector(uint64_t token)
Unregister a GPU-driven opaque contributor.
Definition RenderSystem3D.cpp:635
static uint64_t addGpuOpaqueCollector(GpuOpaqueCollector collector)
Register a GPU-driven opaque contributor.
Definition RenderSystem3D.cpp:628
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:682
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:670
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:15
@ Exception
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 Renderable3DBindings.cpp:106
glm::mat4 modelFromTransform(const Renderable3D::Transform3D &t)
Resolve the value-owned scene world matrix or the local TRS on the render thread.
Definition RenderTransformProjection.cpp:7
float sphereStretch(const Renderable3D::Transform3D &t)
Conservative sphere stretch; preserves culling under scene-parent shear.
Definition RenderTransformProjection.cpp:24
卡牌游戏 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:26
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 Shadow.cpp:500
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
@ Temporal
@ Spatial
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:27
constexpr uint32_t kInvalidGpuDrivenSlot
GPU-driven API surface without GLM layout records.
Definition GpuDrivenApi.h:17
@ Unavailable
@ SceneRejected
SkinInfluenceLimit
Number of strongest vertex influences retained by GPU skinning.
Definition IGraphics3D.h:20
PixelPerfectScale computePixelPerfectScale(float pixelsPerUnit, int refWidth, int refHeight, int viewWidth, int viewHeight)
Compute integer scale and projection spans for a perfect-pixel camera.
Definition CameraPixel.h:31
Result< PathSceneToken > preparePathWorld(ecs::Table &world, Graphics &graphics, IRayTracing &provider)
Prepare an unculled path scene from the supplied ECS world.
Definition PathSceneCapture.cpp:51
@ InvalidArgument
@ NoOp
std::optional< std::reference_wrapper< T > > OptionalRef
Optional borrowed reference; it does not extend T's lifetime.
Definition BorrowedRef.h:24
@ Premultiplied
@ Additive
@ Alpha
@ Opaque
std::array< float, 32 > shadowLayerCullDistances
Definition RenderSystem3D.h:58
static constexpr int kMaxReflectionProbes
Definition RenderSystem3D.h:38
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:73
GPU light packing for mesh3d / PBR (std140-friendly).
Definition Light.h:160
std::array< glm::vec4, 9 > diffuseProbeSh
Definition Light.h:176
One allocated local (spot/point-face) shadow slot for the frame. @ownership Ephemeral CPU descriptor;...
Definition ShadowScheme.h:201
One mesh + material slot on a multi-part model (Assimp mesh / body region). When Material* is null,...
Definition Material.h:404
Deterministic path sample batch. Zero history starts a new accumulation.
Definition PathTracing.h:146
ReflectionProbeUpload public API.
Definition ReflectionProbeUpload.h:18
Probe probes[kMaxProbes]
Definition ReflectionProbeUpload.h:29
static constexpr int kMaxProbes
Definition ReflectionProbeUpload.h:19
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
bool enableDirectionalCsm
Definition ShadowScheme.h:68
static ShadowSchemeSettings & current()
Borrow the process-wide settings object.
Definition Shadow.cpp:216