载入中...
搜索中...
未找到
Graphics.h
浏览该文件的文档.
139 void drawTexturedRectShader(Texture *texture, Shader *shader, float x, float y, float w, float h,
141 void drawTexturedRectUV(Texture *texture, float x, float y, float w, float h, float u0, float v0,
152 void drawTexturedRectShaderDepth(Texture *color, Texture *depth, Shader *shader, float x, float y,
154 void drawTexturedRectLitUV(Texture *albedo, Texture *normal, float x, float y, float w, float h,
160 Shader *newShaderFromSpvFile(const std::string &vertPath, const std::string &fragPath) override;
176 bool updateMeshVertices(Mesh *mesh, const float *posXYZ, const float *nrmXYZ, const float *uvST,
189 void drawMesh(Mesh *mesh, const glm::mat4 &model, Texture *texture, const Color &tint) override;
202 void setCloudShadows(float strength, float worldCell, float time, float windSpeed, float windAngle, float coverage,
213 void drawMeshShadowAlpha(Mesh *mesh, const glm::mat4 &lightMVP, Texture *albedo = nullptr) override;
Accumulates solid / textured quads in logical (Y-down) coordinates. Used by RenderSystem; not a publi...
Definition Batcher.h:22
Definition Canvas.h:16
Definition Graphics.h:56
void(*)(void *userdata, void *commandBuffer) PresentOverlayFn
Optional overlay drawn inside the swapchain render pass (before end). Used by declarative UI (ImGui)....
Definition Graphics.h:672
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:17
void drawMeshShadowAlpha(Mesh *mesh, const glm::mat4 &lightMVP, Texture *albedo=nullptr) override
Shadow pass draw with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): tra...
Definition Graphics.cpp:2319
void pushValidationScope() override
Backend hooks so the platform-independent render3D() can wrap its work in a GPU validation error scop...
Definition Graphics.cpp:2867
Texture * newCubemap(int faceSize, const uint8_t *rgbaFaces) override
Create an RGBA8 cubemap from 6 faces packed as +X,-X,+Y,-Y,+Z,-Z (each faceSize×faceSize,...
Definition Graphics.cpp:1290
void setMesh3DEnv(Texture *cube, float intensity) override
Specular IBL environment for subsequent default mesh draws. cube must be from newCubemap (or nullptr ...
Definition Graphics.cpp:2299
void setMesh3DLight(const glm::vec3 &dir, const glm::vec3 &color) override
Directional light for subsequent drawMesh calls (world-space direction toward surface).
Definition Graphics.cpp:2294
void drawMeshShadow(Mesh *mesh, const glm::mat4 &lightMVP) override
Definition Graphics.cpp:2311
Shader * newMeshShader(const std::string &vertGlsl, const std::string &fragGlsl) override
Definition Graphics.cpp:3468
void flush2DToCanvas(OffscreenCanvas *canvas)
Flush accumulated 2D batches into an offscreen canvas target.
Definition Graphics.cpp:3121
void setMesh3DViewProj(const glm::mat4 &viewProj) override
Definition Graphics.cpp:2233
void draw(eve::graphics::Graphics *gfx, const glm::mat4 &matrix) const override
Draws the object with the specified transformation matrix.
Definition Graphics.cpp:3152
void setMesh3DShadowReceive(bool receive) override
Per-draw: when false, shadow sampling is forced off for the next mesh draw.
Definition Graphics.cpp:2304
Shader * newShaderFromSpvFile(const std::string &vertPath, const std::string &fragPath) override
Load SPIR-V from files via Filesystem (empty vertPath → default textured vert).
Definition Graphics.cpp:3392
float getMaxAnisotropy() const override
Device max supported anisotropy (1 if unsupported). Valid after initWithWindow.
Definition Graphics.cpp:1368
Mesh * newMeshSphere(int slices=32, int stacks=16) override
Procedural UV sphere (radius 1, Y-up). Owned by Graphics. slices = longitude divisions,...
Definition Graphics.cpp:1739
Color getPixelImpl(OffscreenCanvas *canvas, int x, int y)
Blocking CPU readback of an offscreen canvas or scene color target.
Definition Graphics.cpp:3253
void popValidationScope() override
Definition Graphics.cpp:2873
void clear(std::optional< Color > color, std::optional< int > stencil, std::optional< double > depth) override
Definition Graphics.cpp:3162
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) override
GBuffer fill with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): same ou...
Definition Graphics.cpp:2363
void setMesh3DNormalTexture(Texture *normal) override
Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat).
Definition Graphics.cpp:2260
void setMesh3DHeightTexture(Texture *height) override
Optional height map for parallax (R channel; nullptr = flat / off).
Definition Graphics.cpp:2261
void begin3DFrame() override
Begin a 3D frame: shadow/gbuffer (if pending) then a sampleable scene color pass (color+depth)....
Definition Graphics.cpp:2208
Mesh * newMeshFromAssimp(const ::aiMesh &mesh) override
Definition Graphics.cpp:1602
int getMsaaSamples() const override
Definition Graphics.h:114
void setMesh3DCameraPos(const glm::vec3 &eye) override
Camera eye used by mesh shaders that need view/rim (stored in Mesh3DUBO).
Definition Graphics.cpp:2298
eve::graphics::Graphics::PresentOverlayFn PresentOverlayFn
Definition Graphics.h:254
void beginGBufferPass(int width, int height) override
Depth/normal(/albedo) fill pass for mid/post effects. One-shot submit (like shadow); call before begi...
Definition Graphics.cpp:2341
WGPUTextureFormat getSurfaceFormat() const
Definition Graphics.h:248
Shader * newMeshShaderFromWgsl(const std::string &vertWgsl, const std::string &fragWgsl) override
Create a Mesh3D custom shader from WGSL source (WebGPU backend). The WGSL must declare the engine's F...
Definition Graphics.cpp:3436
bool bakeMeshMorph(Mesh *mesh) override
If mesh morph weights are dirty, bake blended positions and upload to the GPU VBO....
Definition Graphics.cpp:1664
Texture * newTextureFromFile(const std::string &filename) override
Definition Graphics.cpp:1370
std::string getBackendName() const override
Renderer backend id used by sibling modules (e.g. Gpgpu).
Definition Graphics.h:105
void setViewportSize(int width, int height, int pixelwidth, int pixelheight) override
Sets the current graphics display viewport dimensions.
Definition Graphics.cpp:258
void setMesh3DLighting(const Lighting3DPack &pack) override
Per-frame ambient + up to 8 lights packed into Mesh3DUBO.
Definition Graphics.cpp:2282
image::ImageData * newImageData() override
Definition Graphics.cpp:3176
void drawMeshShader(Mesh *mesh, const glm::mat4 &model, Texture *texture, const Color &tint, Shader *shader) override
Draw mesh with an explicit Mesh3D Shader (nullptr = default PBR pipeline).
Definition Graphics.cpp:2246
void setMesh3DMaterial(float metallic, float roughness) override
Metallic (0..1) and roughness (0..1) for the next default mesh draw.
Definition Graphics.cpp:2268
void drawSolidRectRotated(float cx, float cy, float w, float h, float degrees, const Color &color, BlendMode blend=BlendMode::Alpha) override
Rotated solid quad degrees clockwise (screen Y-down) around (cx, cy).
Definition Graphics.cpp:1897
void setLighting2D(const Lighting2DUBO &ubo) override
Upload per-frame / per-canvas 2D lighting constants for subsequent lit draws.
Definition Graphics.cpp:1998
void endGBufferPass() override
Definition Graphics.cpp:2371
void setMesh3DShadows(const ShadowUpload &upload) override
Upload CSM constants for subsequent default mesh draws (active=false disables).
Definition Graphics.cpp:2303
Shader * newMeshShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Create a Mesh3D custom shader (MeshVertex + Frame UBO + albedo). Empty vert → default mesh3d....
Definition Graphics.cpp:3428
Texture * newTexture(int width, int height, const uint8_t *rgba, bool repeatU=false, bool repeatV=false) override
Definition Graphics.cpp:1172
void end3DFrameToCanvas() override
Definition Graphics.cpp:2231
bool updateMeshVertices(Mesh *mesh, const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount) override
In-place update of a mesh's vertex/index data (CPU -> host-visible VBO). Mirrors bakeMeshMorph: the u...
Definition Graphics.cpp:1701
void drawMesh(Mesh *mesh, const glm::mat4 &model, Texture *texture, const Color &tint) override
Draw one mesh with model matrix. Requires begin3DFrame() (or an open swapchain pass).
Definition Graphics.cpp:2242
Shader * newHairShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Hair/fur card shader (alpha blend + Kajiya-Kay). Empty vert → mesh3d_hair.vert. Owned by Graphics.
Definition Graphics.cpp:3475
Shader * newShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Create a custom 2D shader from SPIR-V words (vert + frag). Owned by Graphics. Vertex stage may be emp...
Definition Graphics.cpp:3381
void setMesh3DView(const glm::mat4 &view) override
Camera view matrix for subsequent drawMesh (view-space depth / CSM select).
Definition Graphics.cpp:2234
void drawTexturedRect(Texture *texture, float x, float y, float w, float h, const Color &color) override
Definition Graphics.cpp:1909
void begin3DFrameToCanvas(Canvas *canvas) override
Open a 3D render pass targeting an offscreen Canvas (color + depth) at the canvas size....
Definition Graphics.cpp:2228
void drawTexturedRectUV(Texture *texture, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color) override
Draw a textured sub-rect (atlas / tile UVs). texture may be null → solid.
Definition Graphics.cpp:1919
bool releaseShader(Shader *shader) override
Eagerly releases a shader created by this Graphics.
Definition Graphics.cpp:3397
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) override
Definition Graphics.cpp:2349
void setMesh3DClusteredLighting(const ClusteredLightingUpload &upload) override
Enable clustered forward path for subsequent default mesh draws (SSBO light lists)....
Definition Graphics.cpp:2289
void setMesh3DTexCellBomb(float cellScale, float strength, float rotAmount=1.f) override
Texture cell bombing for the next default mesh draw (breaks tiling). cellScale: cells per UV unit (ty...
Definition Graphics.cpp:2272
void initWithWindow(void *nativeWindow) override
Bind to an existing native window (SDL_Window*) and create Vulkan device/swapchain....
Definition Graphics.cpp:90
~Graphics() override
Mesh * newMeshCylinder(int slices=32, int stacks=1, bool caps=true) override
Procedural Y-up cylinder (radius 1, height 2 centered at origin). slices = longitude divisions; stack...
Definition Graphics.cpp:1777
bool supportsGBufferPost() const override
Whether gbuffer-based post-process shaders (AO, GI) can be created on this backend....
Definition Graphics.h:106
image::ImageData * newImageDataImpl(OffscreenCanvas *canvas)
Definition Graphics.cpp:3264
void drawTexturedRectShaderUVRotated(Texture *texture, Shader *shader, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha) override
UV draw rotated degrees clockwise (screen Y-down) around the rect center. texture may be null → solid...
Definition Graphics.cpp:1940
void setMesh3DParallax(float scale, float minLayers=8.f, float maxLayers=32.f) override
Parallax occlusion mapping for the next default mesh draw. scale: UV displacement strength (0=off)....
Definition Graphics.cpp:2277
void drawTexturedRectLitUV(Texture *albedo, Texture *normal, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color) override
Lit 2D draw (albedo + normal map). Uses Lighting2DUBO from setLighting2D. normal may be null → treate...
Definition Graphics.cpp:1980
Mesh * newMeshFromArrays(const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount) override
Upload a triangle mesh from packed CPU arrays. Owned by Graphics. posXYZ required (vertexCount*3)....
Definition Graphics.cpp:1526
Shader * newShader(const std::string &vertGlsl, const std::string &fragGlsl) override
Compile GLSL source with glslc (must be on PATH). Empty vertGlsl → default textured vert....
Definition Graphics.cpp:3421
void setMesh3DClusteredActive(bool active) override
Cheap per-draw toggle for the already-uploaded clustered light table. Unlike setMesh3DClusteredLighti...
Definition Graphics.cpp:2293
bool reloadTextureFromFile(const std::string &filename) override
Reload a path-cached texture from disk in place (pointer stable). False if unbound.
Definition Graphics.cpp:1384
void setCloudShadows(float strength, float worldCell, float time, float windSpeed, float windAngle, float coverage, float detail) override
Dynamic cloud shadows cast on the ground by the default PBR mesh path. strength 0 disables (no change...
Definition Graphics.cpp:2283
void setTextureSampler(Texture *texture, const TextureSampler &sampler) override
Recreate the sampler for an existing texture (keeps image / mip chain). No-op when texture is null or...
Definition Graphics.cpp:1359
bool releaseMesh(Mesh *mesh) override
Eagerly releases a mesh created by this Graphics.
Definition Graphics.cpp:1715
void setMesh3DClip(float nearZ, float farZ) override
Near/far used to pack linear depth into scene color A (SSGI).
Definition Graphics.cpp:2235
void endShadowPass() override
Definition Graphics.cpp:2326
void setMesh3DSceneDepth(Texture *depth) override
Optional scene hardware depth (G-buffer hwDepth, Vulkan NDC z) bound to mesh3d shader binding 7....
Definition Graphics.cpp:2262
bool releaseTexture(Texture *texture) override
Eagerly releases a texture created by this Graphics.
Definition Graphics.cpp:1407
Color getPixel(int x, int y) override
Definition Graphics.cpp:3168
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) override
UV draw with an explicit Shader (nullptr = default textured pipeline).
Definition Graphics.cpp:1924
Texture * getTexture() override
Sampleable color buffer; screen Canvas returns nullptr.
Definition Graphics.cpp:3147
void drawSolidRect(float x, float y, float w, float h, const Color &color, BlendMode blend=BlendMode::Alpha) override
Internal immediate-mode helper used by RenderSystem / Batcher.
Definition Graphics.cpp:1885
void drawVoxelFaceInstances(const uint32_t *packed, int count, float originX, float originY, float originZ, const std::string &faceDir, Texture *atlas, int tilesPerRow=16, const uint32_t *ao=nullptr) override
Instanced voxel face rectangles (32-bit packed instances). ao: optional per-instance ambient-occlusio...
Definition Graphics.cpp:2386
Canvas * newCanvas(int width, int height) override
Create an offscreen render target (sampleable). Owned by Graphics.
Definition Graphics.cpp:3105
void drawTexturedRectShader(Texture *texture, Shader *shader, float x, float y, float w, float h, const Color &color) override
Draw with an explicit Shader (nullptr = default textured pipeline).
Definition Graphics.cpp:1914
void drawTexturedRectShaderDepth(Texture *color, Texture *depth, Shader *shader, float x, float y, float w, float h, const Color &tint) override
Fullscreen/post draw sampling color at binding 0 and depth at binding 1 (hardware D32,...
Definition Graphics.cpp:1961
Canvas * getCanvas() const override
Definition Graphics.cpp:3119
void setVSync(bool enabled) override
Prefer uncapped present (IMMEDIATE/MAILBOX) when false, vsync (MAILBOX/FIFO) when true....
Definition Graphics.cpp:252
bool isCanvasActive() const override
Definition Graphics.cpp:3118
void beginShadowPass(int cascadeIndex) override
Depth-only shadow pass for one cascade layer (0..2). Draws are recorded into the next begin3DFrame co...
Definition Graphics.cpp:2306
void requestSurfaceRecreate() override
Request recreation of the platform render surface on the next frame (Android background/foreground de...
Definition Graphics.h:112
Texture * getSceneColorTexture() override
Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFr...
Definition Graphics.cpp:2240
Offscreen render target (RGBA8Unorm color, optional Depth32Float). 2D batches are flushed into the ca...
Definition Canvas.h:16
Definition Canvas.cpp:10
glm::vec4 Color
RGBA color used by every graphics draw call. Lives inside eve::graphics so including a graphics heade...
Definition Color.h:13
CPU-built clustered lighting upload for one frame/camera. Point lights are clustered; directional lig...
Definition ClusteredLight.h:32
Definition Light.h:20
Definition Light.h:90
Definition Shadow.h:25
Options for Graphics::newTexture / newCubemap. When generateMipmaps is true and sampler....
Definition TextureSampler.h:104
Sampler state for a Texture (filter, wrap, mip LOD, anisotropy). Defaults match historical engine beh...
Definition TextureSampler.h:27
A compiled shader: one WebGPU pipeline + layout. Also holds the WGSL sources so custom shaders can be...
Definition Graphics.h:83
wgpu::RenderPipeline mesh3dPipeline
Definition Graphics.h:86
wgpu::RenderPipeline swapchainPipeline
Definition Graphics.h:84
wgpu::PipelineLayout pipelineLayout
Definition Graphics.h:90
wgpu::RenderPipeline mesh3dXrayPipeline
Definition Graphics.h:87
wgpu::RenderPipeline offscreenPipeline
Definition Graphics.h:85
wgpu::RenderPipeline gbufferPipeline
Definition Graphics.h:89
wgpu::RenderPipeline shadowPipeline
Definition Graphics.h:88
Texture resources backed by a wgpu texture + view + sampler + bind groups.
Definition Graphics.h:51
Frame UBO for the mesh3d pipeline. Mirrors the std140 layout of the WGSL Frame block and the legacy V...
Definition Graphics.h:30
Light3DGpu lights[Lighting3DPack::kMaxLights]
Definition Graphics.h:38