#include <Graphics.h>
类 | |
| struct | LitBatch |
Public 成员函数 | |
| ~Graphics () override | |
| std::string | getBackendName () const override |
| Renderer backend id used by sibling modules (e.g. Gpgpu). | |
| void | initWithWindow (void *nativeWindow) override |
| Bind to an existing native window (SDL_Window*) and create Vulkan device/swapchain. Must be called after the window exists (SDL_WINDOW_VULKAN). | |
| void | present () override |
| void | requestSurfaceRecreate () override |
| Request recreation of the platform render surface on the next frame (Android background/foreground destroys the native window). Safe to call from a non-render thread; the actual work happens on the render thread. | |
| void | onNativeWindowDestroyed () override |
| Called by the Window module when the native window backing the render surface is destroyed (window close / recreation). Backends that keep a platform surface tied to the native window must drop it here so the next initWithWindow() rebuilds it against a fresh window — even when SDL hands back the same pointer for the recreated window. | |
| void | setScreenReadbackEnabled (bool enabled) override |
| When true, each present copies the swapchain to a CPU buffer for getPixel/newImageData. Default false — full-frame readback is expensive; enable only for tests / tools. | |
| void | setVSync (bool enabled) override |
| Prefer uncapped present (IMMEDIATE/MAILBOX) when false, vsync (MAILBOX/FIFO) when true. Takes effect on the next swapchain recreate. | |
| void | setMsaaSamples (int samples) override |
| Hardware MSAA sample count for the 3D scene color pass (0 disables, then 2/4/8 are used when the device supports them). 0 or 1 mean no MSAA. Takes effect on the next begin3DFrame. | |
| int | getMsaaSamples () const override |
| void | setViewportSize (int width, int height, int pixelwidth, int pixelheight) override |
| Sets the current graphics display viewport dimensions. | |
| 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. | |
| 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). | |
| void | pushValidationScope () override |
| Backend hooks so the platform-independent render3D() can wrap its work in a GPU validation error scope (used on WebGPU to catch early device errors). | |
| void | popValidationScope () override |
| Texture * | newTexture (int width, int height, const uint8_t *rgba, bool repeatU=false, bool repeatV=false) override |
| Texture * | newTexture (int width, int height, const uint8_t *rgba, const TextureCreateInfo &info) override |
| 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, total bytes = faceSize²×4×6). Owned by Graphics. | |
| Texture * | newCubemap (int faceSize, const uint8_t *rgbaFaces, const TextureCreateInfo &info) override |
| Cubemap with mipmap / sampler options (IBL-friendly when generateMipmaps=true). | |
| Texture * | newTexture (image::ImageData *data) override |
| Create texture from ImageData (RGBA8 required for now). | |
| Texture * | newTexture (image::ImageData *data, const TextureCreateInfo &info) override |
| Create texture from ImageData with sampler / mipmap options. | |
| 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 not owned by this Graphics. | |
| float | getMaxAnisotropy () const override |
| Device max supported anisotropy (1 if unsupported). Valid after initWithWindow. | |
| Texture * | newTextureFromFile (const std::string &filename) override |
| bool | reloadTextureFromFile (const std::string &filename) override |
| Reload a path-cached texture from disk in place (pointer stable). False if unbound. | |
| bool | releaseTexture (Texture *texture) override |
| Eagerly releases a texture created by this Graphics. | |
| bool | replaceTexturePixels (Texture *tex, image::ImageData *data) |
| void | drawTexturedRect (Texture *texture, float x, float y, float w, float h, const Color &color) override |
| 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). | |
| 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. | |
| 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). | |
| 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. Shader nullptr = default textured pipeline. | |
| 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, .r = Vulkan NDC z). depth may be null → color is bound twice. | |
| 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 → treated as flat (0.5,0.5,1) only if a default normal tex exists. | |
| void | setLighting2D (const Lighting2DUBO &ubo) override |
| Upload per-frame / per-canvas 2D lighting constants for subsequent lit draws. | |
| 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 empty → uses the default textured vertex shader. | |
| Shader * | newShaderFromSpvFile (const std::string &vertPath, const std::string &fragPath) override |
| Load SPIR-V from files via Filesystem (empty vertPath → default textured vert). | |
| 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. Throws if compilation fails. | |
| 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.vert. Owned by Graphics. | |
| 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 Frame UBO (group 0 binding 0) and the shared mesh3d bindings (albedo 1, normal 2, env 3, shadow UBO 4, shadow depth 5, height 6, main sampler 7, shadow compare sampler 8, scene depth 9). Vulkan throws (uses SPIR-V via newMeshShaderFromSpv). | |
| Shader * | newMeshShader (const std::string &vertGlsl, const std::string &fragGlsl) override |
| 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. | |
| bool | releaseShader (Shader *shader) override |
| Eagerly releases a shader created by this Graphics. | |
| Mesh * | newMeshFromAssimp (const ::aiMesh &mesh) override |
| Mesh * | newMeshFromAssimp (const ::aiMesh &mesh, const aiMatrix4x4 &worldTransform) override |
| Like newMeshFromAssimp, but bakes an Assimp node world transform into positions and transforms normals by the inverse-transpose of the upper 3x3. Required for hierarchical glTF/FBX scenes — raw aiMesh verts are in local space. | |
| 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). nrmXYZ/uvST may be null (flat normal / zero UV). indices required (indexCount, triangles). | |
| bool | bakeMeshMorph (Mesh *mesh) override |
| If mesh morph weights are dirty, bake blended positions and upload to the GPU VBO. Returns true when an upload happened. No-op when no morph data / not dirty / null. | |
| 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 update synchronizes with in-flight GPU work, so prefer rebuilding only when content actually changes. The mesh's buffer is reused while it fits (stable GPU handle) and reallocated when the new size grows. Returns false when unsupported (WebGPU backend). posXYZ/nrmXYZ follow newMeshFromArrays layout (uvST may be null); indices/indexCount may be null/0 to keep the mesh's existing indices. | |
| Mesh * | newMeshSphere (int slices=32, int stacks=16) override |
| Procedural UV sphere (radius 1, Y-up). Owned by Graphics. slices = longitude divisions, stacks = latitude divisions. | |
| 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; stacks = height bands; caps = include end discs. Owned by Graphics. | |
| bool | releaseMesh (Mesh *mesh) override |
| Eagerly releases a mesh created by this Graphics. | |
| void | begin3DFrame () override |
| Begin a 3D frame: shadow/gbuffer (if pending) then a sampleable scene color pass (color+depth). Leaves the pass open for drawMesh and a following RenderSystem::render (2D). Does not present. flushToSwapchain resolves the scene color (FXAA when "aa" is on) into the swapchain, then draws 2D overlays. Soft-fails (no throw) when the swapchain cannot be acquired yet — check had3DThisFrame(). | |
| void | begin3DFrameToCanvas (Canvas *canvas) override |
Open a 3D render pass targeting an offscreen Canvas (color + depth) at the canvas size. Uses setMesh3DViewProj/View/CameraPos/Env as the camera. Draw meshes with drawMeshShader, then call end3DFrameToCanvas(). The canvas texture then holds the rendered scene (e.g. a planar reflection). Unsupported if canvas is not an offscreen canvas (screen). | |
| void | end3DFrameToCanvas () override |
| void | setMesh3DViewProj (const glm::mat4 &viewProj) override |
| void | setMesh3DView (const glm::mat4 &view) override |
| Camera view matrix for subsequent drawMesh (view-space depth / CSM select). | |
| void | setMesh3DClip (float nearZ, float farZ) override |
| Near/far used to pack linear depth into scene color A (SSGI). | |
| Texture * | getSceneColorTexture () override |
| Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFrame until present; nullptr when 3D did not run offscreen. | |
| image::ImageData * | renderEntityIdMask (const std::vector< eve::graphics::Graphics::EntityIdDraw > &draws, const glm::mat4 &viewProj, int width, int height) override |
| image::ImageData * | readGBufferToImageData (const std::string &name) override |
| Read a G-buffer attachment back to CPU as RGBA8. name is one of "depth" (RGBA8 linear depth), "normal" (world normal*0.5+0.5), "albedo". Valid only after a G-buffer or entity-ID offscreen pass filled it. Caller owns the returned ImageData*. Returns nullptr when unsupported. | |
| 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). | |
| 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). | |
| 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-occlusion words (2 bits per corner, 0..3, shader corner order); null → full bright. faceDir: "posX"|"negX"|"posY"|"negY"|"posZ"|"negZ" (also "+x"/"-x"/…). Requires begin3DFrame(); uses viewProj from setMesh3DViewProj. atlas may be null → white; tilesPerRow subdivides atlas for texture indices. | |
| void | setMesh3DNormalTexture (Texture *normal) override |
| Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat). | |
| void | setMesh3DHeightTexture (Texture *height) override |
| Optional height map for parallax (R channel; nullptr = flat / off). | |
| void | setMesh3DSceneDepth (Texture *depth) override |
| Optional scene hardware depth (G-buffer hwDepth, Vulkan NDC z) bound to mesh3d shader binding 7. X-ray mesh shaders sample it to discard visible (non-occluded) fragments. nullptr falls back to a placeholder. | |
| void | setMesh3DMaterial (float metallic, float roughness) override |
| Metallic (0..1) and roughness (0..1) for the next default mesh draw. | |
| 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 (typical 2..16). strength: 0=off, 1=full. rotAmount: 0..1 per-cell rotation scale (default 1). | |
| 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). Typical 0.02..0.08. minLayers / maxLayers: adaptive POM ray-march steps (more when glancing). | |
| void | setMesh3DLighting (const Lighting3DPack &pack) override |
| Per-frame ambient + up to 8 lights packed into Mesh3DUBO. | |
| 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 to rendering). time advances wind drift. Packed into Mesh3DUBO.cloud / cloudWind and consumed by mesh3d shaders. | |
| void | setMesh3DClusteredLighting (const ClusteredLightingUpload &upload) override |
| Enable clustered forward path for subsequent default mesh draws (SSBO light lists). Pass upload.active=false (or empty) to disable and return to the ≤8 UBO path. | |
| void | setMesh3DClusteredActive (bool active) override |
| Cheap per-draw toggle for the already-uploaded clustered light table. Unlike setMesh3DClusteredLighting it never re-uploads SSBO data, so the per-frame clustered build happens exactly once per camera. | |
| void | setMesh3DLight (const glm::vec3 &dir, const glm::vec3 &color) override |
| Directional light for subsequent drawMesh calls (world-space direction toward surface). | |
| void | setMesh3DCameraPos (const glm::vec3 &eye) override |
| Camera eye used by mesh shaders that need view/rim (stored in Mesh3DUBO). | |
| void | setMesh3DEnv (Texture *cube, float intensity) override |
| Specular IBL environment for subsequent default mesh draws. cube must be from newCubemap (or nullptr → black / intensity 0). intensity is packed into Mesh3DUBO lightColor.w. | |
| void | setMesh3DShadows (const ShadowUpload &upload) override |
| Upload CSM constants for subsequent default mesh draws (active=false disables). | |
| void | setMesh3DShadowReceive (bool receive) override |
| Per-draw: when false, shadow sampling is forced off for the next mesh draw. | |
| void | beginShadowPass (int cascadeIndex) override |
| Depth-only shadow pass for one cascade layer (0..2). Draws are recorded into the next begin3DFrame command buffer (ping-pong map per frame slot). Call before begin3DFrame. | |
| void | drawMeshShadow (Mesh *mesh, const glm::mat4 &lightMVP) override |
| 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): transparent texels of albedo are discarded so the slice casts a silhouette shadow instead of a solid quad. Requires an active shadow pass (beginShadowPass). No-op on backends without the alpha shadow pipeline (WebGPU). | |
| void | endShadowPass () override |
| void | beginGBufferPass (int width, int height) override |
| Depth/normal(/albedo) fill pass for mid/post effects. One-shot submit (like shadow); call before begin3DFrame when enabled. After endGBufferPass, textures are available via getRenderControl()->getGBuffer(). | |
| 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 |
| 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 outputs as drawMeshGBuffer, but transparent texels are discarded so depth/normal follow the silhouette. No-op on backends without the alpha pipeline (WebGPU). | |
| void | endGBufferPass () override |
| Canvas * | newCanvas (int width, int height) override |
| Create an offscreen render target (sampleable). Owned by Graphics. | |
| void | setCanvas (Canvas *canvas) override |
| nullptr or this → screen. Switching flushes pending draws to the previous target. | |
| bool | isCanvasActive () const override |
| Canvas * | getCanvas () const override |
| Texture * | getTexture () override |
| Sampleable color buffer; screen Canvas returns nullptr. | |
| image::ImageData * | newImageData () override |
| void | draw (eve::graphics::Graphics *gfx, const glm::mat4 &matrix) const override |
| Draws the object with the specified transformation matrix. | |
| void | draw (Canvas *C, const glm::mat4 &matrix) const override |
| void | clear (std::optional< Color > color, std::optional< int > stencil, std::optional< double > depth) override |
| Color | getPixel (int x, int y) override |
| vkb::Device & | getDevice () |
| vk::CommandPool | getUploadPool () const |
| vk::DescriptorSetLayout | getTexSetLayout () const |
| vk::DescriptorPool | getDescriptorPool () const |
| const vkb::BuiltRenderPass & | getOffscreenRenderPass () const |
| const vkb::BuiltRenderPass & | getOffscreen3DRenderPass () |
| vk::Format | getDepthFormat () const |
| vk::RenderPass | getSwapchainRenderPass () const |
| vk::RenderPass | getUiMsaaRenderPass () const |
| vk::SampleCountFlagBits | getUiMsaaSamples () const |
| Sample count the UI MSAA pass runs with (matches getUiMsaaRenderPass). | |
| void | ensureUiColorResources () |
| Create the UI MSAA render pass (once) and its color targets for ImGui init. | |
| vkb::Instance & | getInstance () |
| vkb::Swapchain & | getSwapchain () |
| void * | getSdlWindow () const |
| uint32_t | getSwapchainImageCount () const |
Public 成员函数 继承自 eve::graphics::Graphics | |
| Module_REG (Graphics) | |
| Graphics () | |
| ~Graphics () override | |
| virtual void | reset () |
| Resets the current color, background color, line style, and so forth. | |
| virtual void | clearScreen () |
| Script-friendly wrappers (r,g,b[,a] floats — no Color type in Squirrel). | |
| virtual void | setBackgroundColorRGBA (float r, float g, float b, float a=1.f) |
| virtual void | drawSolidRectRGBA (float x, float y, float w, float h, float r, float g, float b, float a=1.f) |
| virtual void | drawTexturedRectRGBA (Texture *texture, float x, float y, float w, float h, float r, float g, float b, float a=1.f) |
| Texture * | newTextureFromImageData (image::ImageData *data, bool repeatU=false, bool repeatV=false) |
| Texture * | newTextureFromImageData (image::ImageData *data, const TextureCreateInfo &info) |
| Upload RGBA8 ImageData with mipmaps / filter / anisotropy options. | |
| Texture * | newTextureWithSampler (image::ImageData *data, bool repeatU, bool repeatV, bool generateMipmaps, float maxAnisotropy, const std::string &filter, const std::string &mipmap, float lodBias=0.f) |
| Script-friendly texture create: filter = "linear"|"nearest", mipmap = "none"|"linear"|"nearest". generateMipmaps builds a full mip chain; maxAnisotropy > 1 enables anisotropic filtering. | |
| virtual void | setTextureSamplerParams (Texture *texture, const std::string &filter, const std::string &mipmap, float maxAnisotropy, float lodBias) |
| Update sampler state without re-uploading pixels (filter / mip / aniso / LOD bias). | |
| virtual bool | supportsGBufferPost () const |
| Whether gbuffer-based post-process shaders (AO, GI) can be created on this backend. False on WebGPU, whose custom post shaders are WGSL-only (the built-in AO/GI use SPIR-V), so RenderSystem3D skips them there. | |
| int | getWidth () const |
| int | getHeight () const |
| int | getPixelWidth () const |
| int | getPixelHeight () const |
| double | getCurrentDPIScale () const |
| double | getScreenDPIScale () const |
| Texture * | newTextureFromFileRepeated (const std::string &filename, bool repeatU, bool repeatV) |
| Quad * | newQuad (int x, int y, int w, int h) |
| Pixel-space atlas rect. Caller owns Quad* (not tracked by Graphics). | |
| Mesh * | newMeshCube (float size=1.f) |
Procedural cube (edge length size, centered at origin, outward CCW for RH Y-up), with per-face normals and a full 0..1 UV per face. Owned by Graphics. | |
| virtual void | render3D () |
| Run RenderSystem3D (begin3DFrame + draw visible Renderable3D). | |
| virtual void | renderScene3DToCanvas (Canvas *canvas, Camera3D *camera) |
| virtual void | setDirectionalLight (float dx, float dy, float dz, float r=1.f, float g=1.f, float b=1.f) |
| virtual void | drawScene3DRGBA (float x, float y, float w, float h, float r=1.f, float g=1.f, float b=1.f, float a=1.f) |
| Composite this frame's 3D scene color into a rect (screen or active Canvas). virtual * Call after render3D(); order vs drawSolidRect / drawTexturedRect is preserved. If never called, present() still blits the 3D scene fullscreen under 2D. RGB is blitted opaque (scene A is linear depth, not transparency). | |
| void | drawScene3D (float x, float y, float w, float h) |
| Script-friendly 4-arg form (simplesquirrel does not apply C++ defaults). | |
| virtual void | drawCanvasRGBA (Canvas *canvas, float x, float y, float w, float h, float r=1.f, float g=1.f, float b=1.f, float a=1.f) |
| Draw a Canvas color buffer as a textured rect (same batch order as other 2D). | |
| void | drawCanvas (Canvas *canvas, float x, float y, float w, float h) |
| Material * | newMaterial () |
| Create a Material asset (shading model + textures + PBR knobs). Caller owns Material*; not tracked by Graphics. | |
| RenderControl * | getRenderControl () |
| Shared compilable 3D render control (features → pass list + GBuffer). Owned by Graphics; valid for the module lifetime. | |
| virtual image::ImageData * | renderEntityIdMask (const std::vector< EntityIdDraw > &draws, const glm::mat4 &viewProj, int width, int height) |
| bool | consumeFrameHad3D () |
| True after begin3DFrame until present completes. | |
| bool | had3DThisFrame () const |
| Color | getBackgroundColor () const |
| void | setBackgroundColor (const Color &c) |
| bool | isScreenReadbackEnabled () const |
| bool | saveFramePng (const std::string &path) |
Save the last presented frame to a PNG at path. Enables screen readback if needed. Returns false if no presented frame is available or encoding fails. | |
| bool | isVSync () const |
| void | setActive (bool active) override |
| Pause/resume presenting (Android background / foreground). | |
| bool | isActive () const |
| void | clearPresentOverlay () |
| Drop the present overlay callback (window gone; re-register on UI init). | |
| void | addWindowDestroyedCallback (WindowDestroyedCallback cb, void *userdata) |
| void | setPresentOverlay (PresentOverlayFn fn, void *userdata) |
| PresentOverlayFn | getPresentOverlay () const |
| void * | getPresentOverlayUser () const |
| Font * | newFont (font::FontData *data, std::string charset=Font::defaultCharset()) |
Build a GPU font (glyph atlas texture) from decoded font data. Rasterizes charset (UTF-8, default: printable ASCII) up front; virtual * codepoints outside it still advance in print() but aren't drawn. Caller owns Font* (not tracked by Graphics — unlike newTexture / newMesh / newShader handles, which Graphics owns). | |
| virtual void | setFont (Font *font) |
| Font used by subsequent print() calls; nullptr = none set. | |
| Font * | getFont () const |
| virtual void | print (const std::string &text, float x, float y, const Color &color=Color(1.f, 1.f, 1.f, 1.f), float scale=1.f) |
Draws UTF-8 text with the current font (see setFont), baseline-aligned so that (x,y) is the top-left of the line. Throws if no font is set. | |
| virtual void | setShader (Shader *shader) |
| Custom fragment pipeline for subsequent textured 2D draws. | |
| virtual void | setShader () |
| Shader * | getShader () const |
| Shader * | newShaderFromSpvFile (const std::string &fragPath) |
| Shader * | newShader (const std::string &fragGlsl) |
| Shader * | newMeshShader (const std::string &fragGlsl) |
| Shader * | newHairShader () |
| Built-in hair shader with default anisotropic parameters. | |
| Shader * | newGrassShader () |
| t3ssel8r-style grass billboard shader (alpha test + shadow two-tone). Owned by Graphics. See grass:: / GrassField. | |
| GrassField * | newGrassField () |
| Dense + sparse stylized grass field. Caller owns GrassField*; its Mesh / Shader / Texture are owned by Graphics. | |
| Waterfall * | newWaterfall () |
| Flowing waterfall (falling water sheet) with sky reflection, downward velocity streaks and animated foam at the top lip and bottom splash pool. Caller owns Waterfall*; its Mesh / Shader are owned by Graphics. | |
| Water * | newWater () |
| Dynamic water surface (sky reflection + animated edge waves + middle drop ripples). Caller owns Water*; its Mesh / Shader are owned by Graphics. | |
| void | setCanvas () |
| Volumetric * | newVolumetric () |
| Volumetric light + fog (screenspace / raymarch / fog). Caller owns Volumetric*; its Shaders are owned by Graphics. | |
| AmbientOcclusion * | newAmbientOcclusion () |
| Screen-space ambient occlusion (ssao / hbao / gtao). Caller owns AmbientOcclusion*; its Shaders are owned by Graphics. | |
| Outline * | newOutline () |
| Screen-space model outline (t3ssel8r-style) from GBuffer depth + normal. Caller owns Outline*; its Shader is owned by Graphics. | |
| GlobalIllumination * | newGlobalIllumination () |
| Screen-space single-bounce GI. Caller owns GlobalIllumination*; its Shaders are owned by Graphics. | |
| ScreenSpaceReflection * | newScreenSpaceReflection () |
| Screen-space reflections (ray-marched over scene color + hw depth). Caller owns ScreenSpaceReflection*; its Shader is owned by Graphics. | |
| AmbientOcclusion * | pipelineAmbientOcclusion () |
| Pipeline-owned AO / GI / AA used by RenderSystem3D when features "ao" / "gi" / "aa" are enabled. Created on first use; Graphics owns them. | |
| GlobalIllumination * | pipelineGlobalIllumination () |
| AntiAliasing * | pipelineAntiAliasing () |
| Outline * | pipelineOutline () |
| Pipeline-owned Outline used by RenderSystem3D when the "outline" feature is on. | |
| AntiAliasing * | newAntiAliasing () |
| Classic image-space AA (FXAA / SMAA / SSAA / NFAA). Caller owns AntiAliasing*; its Shaders are owned by Graphics. | |
| virtual void | draw (Drawable *drawable, const glm::mat4 &m) |
| virtual void | drawOcclusion (Drawable *drawable, const glm::mat4 &m) |
| Volumetric occlusion helpers (shadow-pass analogue for light shafts). drawOcclusion skips drawables with castOcclusion=false. | |
| virtual void | drawOcclusionSolid (float x, float y, float w, float h) |
| virtual void | drawOcclusionTexture (Texture *texture, float x, float y, float w, float h) |
| void | points (const std::vector< glm::vec2 > &positions, const std::vector< Color > &colors) |
| Draws a series of points at the specified positions. | |
| void | polyline (const glm::mat4 *vertices, size_t count) |
| Draws a series of lines connecting the given vertices. | |
| void | rectangle (std::string mode, float x, float y, float w, float h) |
| Draws a rectangle. | |
| void | rectangle (std::string mode, float x, float y, float w, float h, float rx, float ry, int points) |
| Variant of rectangle that draws a rounded rectangle. | |
| void | rectangle (std::string mode, float x, float y, float w, float h, float rx, float ry) |
| void | circle (std::string mode, float x, float y, float radius, int points) |
| Draws a circle using the specified arguments. | |
| void | circle (std::string mode, float x, float y, float radius) |
| void | ellipse (std::string mode, float x, float y, float a, float b, int points) |
| Draws an ellipse using the specified arguments. | |
| void | ellipse (std::string mode, float x, float y, float a, float b) |
| void | arc (std::string mode, std::string arcmode, float x, float y, float radius, float angle1, float angle2, int points) |
| Draws an arc using the specified arguments. | |
| void | arc (std::string mode, std::string arcmode, float x, float y, float radius, float angle1, float angle2) |
| void | polygon (std::string mode, const std::vector< glm::vec2 > &vertices, bool skipLastFilledVertex=true) |
| Draws a polygon with an arbitrary number of vertices. | |
| void | push (bool all) |
| void | pop () |
| const glm::mat4 & | getTransform () const |
| const glm::mat4 & | getProjection () const |
| void | rotate (float r) |
| void | scale (float x, float y=1.0f) |
| void | translate (float x, float y) |
| void | origin () |
| glm::vec2 | transformPoint (glm::vec2 point) |
| glm::vec2 | inverseTransformPoint (glm::vec2 point) |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
Public 成员函数 继承自 eve::graphics::Canvas | |
| Canvas () | |
| ~Canvas () override | |
Public 成员函数 继承自 eve::graphics::Drawable | |
| virtual | ~Drawable () |
| bool | getCastOcclusion () const |
| When false, skipped by Graphics::drawOcclusion / volumetric occluder passes. | |
| void | setCastOcclusion (bool cast) |
| virtual void | drawOcclusion (Graphics *gfx, const glm::mat4 &matrix) const |
| Draw as an opaque black silhouette for volumetric occlusion maps (screen-space god rays / light shafts). Default is a no-op; Texture / Mesh override with 2D black rects (alpha preserved for textures). | |
Public 成员函数 继承自 eve::IWindowSurfaceHost | |
| virtual | ~IWindowSurfaceHost ()=default |
Public 成员函数 继承自 eve::graphics::IGraphics2D | |
| virtual | ~IGraphics2D ()=default |
Public 成员函数 继承自 eve::graphics::IGraphics3D | |
| virtual | ~IGraphics3D ()=default |
Public 成员函数 继承自 eve::graphics::IResourceFactory | |
| virtual | ~IResourceFactory ()=default |
Public 成员函数 继承自 eve::graphics::IPostFX | |
| virtual | ~IPostFX ()=default |
友元 | |
| class | OffscreenCanvas |
额外继承的成员函数 | |
Public 类型 继承自 eve::graphics::Graphics | |
| using | WindowDestroyedCallback = void(*)(void *userdata) |
| Register a callback invoked when the native window is destroyed. Used by the UI backend to tear down its ImGui context; callbacks are cleared (and invoked) on onNativeWindowDestroyed(). | |
| using | PresentOverlayFn = void(*)(void *userdata, void *commandBuffer) |
Optional overlay drawn inside the swapchain render pass (before end). Used by declarative UI (ImGui). commandBuffer is a VkCommandBuffer as void*. | |
静态 Public 属性 继承自 eve::IWindowSurfaceHost | |
| static constexpr const char * | capabilityName = "IWindowSurfaceHost" |
Protected 成员函数 继承自 eve::graphics::Graphics | |
| Shader * | prepareSceneColorResolveShader (Texture *scene) |
| FXAA resolve shader that writes opaque RGB (ignores scene-color depth alpha). | |
Protected 属性 继承自 eve::graphics::Graphics | |
| int | width = 0 |
| int | height = 0 |
| int | pixelWidth = 0 |
| int | pixelHeight = 0 |
| Color | backgroundColor {0.1f, 0.1f, 0.12f, 1.0f} |
| bool | frameHad3D = false |
| bool | recordingEngine3D_ = false |
| True while RenderSystem3D is submitting (AO / engine overlays). | |
| bool | screenReadbackEnabled = false |
| bool | vsyncEnabled = true |
| bool | graphicsActive = true |
| int | msaaSamples = 4 |
| PresentOverlayFn | presentOverlayFn_ = nullptr |
| void * | presentOverlayUser_ = nullptr |
| std::vector< std::pair< WindowDestroyedCallback, void * > > | windowDestroyedCallbacks_ |
| Shader * | currentShader = nullptr |
| Font * | currentFont = nullptr |
| std::unique_ptr< RenderControl > | renderControl_ |
| std::unique_ptr< AmbientOcclusion > | pipelineAO_ |
| std::unique_ptr< GlobalIllumination > | pipelineGI_ |
| std::unique_ptr< AntiAliasing > | pipelineAA_ |
| std::unique_ptr< Outline > | pipelineOutline_ |
详细描述
在文件 Graphics.h 第 171 行定义.
构造及析构函数说明
◆ ~Graphics()
|
override |
成员函数说明
◆ bakeMeshMorph()
|
overridevirtual |
If mesh morph weights are dirty, bake blended positions and upload to the GPU VBO. Returns true when an upload happened. No-op when no morph data / not dirty / null.
在文件 GraphicsMesh.cpp 第 244 行定义.
引用了 eve::graphics::Mesh::computeMorphedPositions(), getDevice(), mesh, eve::graphics::vulkan::MeshVertex::pos, pos, v , 以及 verts.
◆ begin3DFrame()
|
overridevirtual |
Begin a 3D frame: shadow/gbuffer (if pending) then a sampleable scene color pass (color+depth). Leaves the pass open for drawMesh and a following RenderSystem::render (2D). Does not present. flushToSwapchain resolves the scene color (FXAA when "aa" is on) into the swapchain, then draws 2D overlays. Soft-fails (no throw) when the swapchain cannot be acquired yet — check had3DThisFrame().
在文件 Graphics3D.cpp 第 59 行定义.
引用了 eve::graphics::Graphics::backgroundColor, eve::graphics::Graphics::frameHad3D , 以及 isCanvasActive().
◆ begin3DFrameToCanvas()
|
overridevirtual |
Open a 3D render pass targeting an offscreen Canvas (color + depth) at the canvas size. Uses setMesh3DViewProj/View/CameraPos/Env as the camera. Draw meshes with drawMeshShader, then call end3DFrameToCanvas(). The canvas texture then holds the rendered scene (e.g. a planar reflection). Unsupported if canvas is not an offscreen canvas (screen).
在文件 Graphics3D.cpp 第 169 行定义.
引用了 eve::graphics::Graphics::backgroundColor , 以及 eve::graphics::Graphics::frameHad3D.
◆ beginGBufferPass()
|
overridevirtual |
Depth/normal(/albedo) fill pass for mid/post effects. One-shot submit (like shadow); call before begin3DFrame when enabled. After endGBufferPass, textures are available via getRenderControl()->getGBuffer().
在文件 Graphics3D.cpp 第 548 行定义.
引用了 eve::graphics::Graphics::height , 以及 eve::graphics::Graphics::width.
◆ beginShadowPass()
|
overridevirtual |
Depth-only shadow pass for one cascade layer (0..2). Draws are recorded into the next begin3DFrame command buffer (ping-pong map per frame slot). Call before begin3DFrame.
在文件 Graphics3D.cpp 第 504 行定义.
◆ clear()
|
overridevirtual |
在文件 Graphics2D.cpp 第 481 行定义.
引用了 eve::graphics::Graphics::backgroundColor, clearColor, color , 以及 eve::graphics::Graphics::frameHad3D.
◆ draw() [1/2]
|
overridevirtual |
在文件 Graphics.cpp 第 578 行定义.
◆ draw() [2/2]
|
overridevirtual |
Draws the object with the specified transformation matrix.
在文件 Graphics.cpp 第 577 行定义.
◆ drawMesh()
|
overridevirtual |
Draw one mesh with model matrix. Requires begin3DFrame() (or an open swapchain pass).
在文件 GraphicsMesh.cpp 第 531 行定义.
引用了 drawMeshShader(), mesh , 以及 model.
◆ drawMeshGBuffer()
◆ drawMeshGBufferAlpha()
|
overridevirtual |
GBuffer fill with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): same outputs as drawMeshGBuffer, but transparent texels are discarded so depth/normal follow the silhouette. No-op on backends without the alpha pipeline (WebGPU).
在文件 Graphics3D.cpp 第 578 行定义.
◆ drawMeshShader()
|
overridevirtual |
Draw mesh with an explicit Mesh3D Shader (nullptr = default PBR pipeline).
在文件 GraphicsMesh.cpp 第 535 行定义.
引用了 eve::graphics::ShadowUpload::active, eve::graphics::ClusteredLightingUpload::ambient, eve::graphics::Lighting3DPack::ambient, eve::graphics::vulkan::Mesh3DUBO::ambient, eve::graphics::ShadowUBO::bias, eve::graphics::vulkan::Mesh3DUBO::cameraPos, eve::graphics::ClusteredLightingUpload::clipInfo, eve::graphics::Light3DGpu::color, eve::graphics::Lighting3DPack::count, d, eve::graphics::Shader::eMesh3D, eve::graphics::Texture::gpuHandle, eve::graphics::ClusteredLightingUpload::gridInfo, eve::graphics::Lighting3DPack::kMaxLights, eve::graphics::Shader::kPushConstantBytes, eve::graphics::vulkan::Mesh3DUBO::lightColor, eve::graphics::vulkan::Mesh3DUBO::lightDir, eve::graphics::Lighting3DPack::lights, eve::graphics::vulkan::Mesh3DUBO::lights, mesh, model, eve::graphics::vulkan::Mesh3DUBO::model, eve::graphics::vulkan::Mesh3DClusteredUBO::model, eve::graphics::vulkan::Mesh3DUBO::mvp, eve::graphics::vulkan::Mesh3DUBO::parallax, eve::graphics::Light3DGpu::posRadius, eve::graphics::ClusteredLightingUpload::primaryColor, eve::graphics::ClusteredLightingUpload::primaryDir, s, shader, eve::graphics::vulkan::Mesh3DUBO::texBomb, eve::graphics::vulkan::Mesh3DUBO::tint, eve::graphics::ShadowUpload::ubo , 以及 eve::graphics::ClusteredLightingUpload::view.
被这些函数引用 drawMesh().
◆ drawMeshShadow()
|
overridevirtual |
◆ drawMeshShadowAlpha()
|
overridevirtual |
Shadow pass draw with alpha-cutout discard (card/billboard geometry such as sprite-stack slices): transparent texels of albedo are discarded so the slice casts a silhouette shadow instead of a solid quad. Requires an active shadow pass (beginShadowPass). No-op on backends without the alpha shadow pipeline (WebGPU).
在文件 Graphics3D.cpp 第 520 行定义.
◆ drawSolidRect()
|
overridevirtual |
Internal immediate-mode helper used by RenderSystem / Batcher.
在文件 Graphics2D.cpp 第 492 行定义.
◆ drawSolidRectRotated()
|
overridevirtual |
Rotated solid quad degrees clockwise (screen Y-down) around (cx, cy).
在文件 Graphics2D.cpp 第 504 行定义.
◆ drawTexturedRect()
|
overridevirtual |
Draw a textured quad (full UV 0..1). texture may be null → solid. Uses currentShader when set (or per-call override via drawTexturedRectShader).
在文件 Graphics2D.cpp 第 857 行定义.
引用了 color, eve::graphics::Graphics::drawTexturedRectUV(), h, w, x , 以及 y.
◆ drawTexturedRectLitUV()
|
overridevirtual |
Lit 2D draw (albedo + normal map). Uses Lighting2DUBO from setLighting2D. normal may be null → treated as flat (0.5,0.5,1) only if a default normal tex exists.
在文件 Graphics2D.cpp 第 934 行定义.
引用了 albedo, color, eve::graphics::Graphics::drawSolidRect(), h, normal, w, x , 以及 y.
◆ drawTexturedRectShader()
|
overridevirtual |
Draw with an explicit Shader (nullptr = default textured pipeline).
在文件 Graphics2D.cpp 第 861 行定义.
引用了 color, eve::graphics::Graphics::drawTexturedRectShaderUV(), h, shader, w, x , 以及 y.
◆ drawTexturedRectShaderDepth()
|
overridevirtual |
Fullscreen/post draw sampling color at binding 0 and depth at binding 1 (hardware D32, .r = Vulkan NDC z). depth may be null → color is bound twice.
在文件 Graphics2D.cpp 第 907 行定义.
引用了 eve::graphics::Alpha, color, depth, eve::graphics::Graphics::drawSolidRect(), eve::graphics::Graphics::drawTexturedRectShader(), h, shader, w, x , 以及 y.
◆ drawTexturedRectShaderUV()
|
overridevirtual |
UV draw with an explicit Shader (nullptr = default textured pipeline).
在文件 Graphics2D.cpp 第 871 行定义.
引用了 color, eve::graphics::Texture::depth, eve::graphics::Graphics::drawSolidRect(), h, shader, w, x , 以及 y.
◆ drawTexturedRectShaderUVRotated()
|
overridevirtual |
UV draw rotated degrees clockwise (screen Y-down) around the rect center. texture may be null → solid. Shader nullptr = default textured pipeline.
在文件 Graphics2D.cpp 第 888 行定义.
引用了 color, cx, cy, degrees, eve::graphics::Texture::depth, eve::graphics::Graphics::drawSolidRect(), h, shader , 以及 w.
◆ drawTexturedRectUV()
|
overridevirtual |
Draw a textured sub-rect (atlas / tile UVs). texture may be null → solid.
在文件 Graphics2D.cpp 第 866 行定义.
引用了 color, eve::graphics::Graphics::currentShader, eve::graphics::Graphics::drawTexturedRectShaderUV(), h, w, x , 以及 y.
◆ drawVoxelFaceInstances()
|
overridevirtual |
Instanced voxel face rectangles (32-bit packed instances). ao: optional per-instance ambient-occlusion words (2 bits per corner, 0..3, shader corner order); null → full bright. faceDir: "posX"|"negX"|"posY"|"negY"|"posZ"|"negZ" (also "+x"/"-x"/…). Requires begin3DFrame(); uses viewProj from setMesh3DViewProj. atlas may be null → white; tilesPerRow subdivides atlas for texture indices.
在文件 Graphics3D.cpp 第 402 行定义.
引用了 eve::graphics::Texture::gpuHandle, eve::graphics::vulkan::Mesh3DUBO::mvp , 以及 eve::graphics::vulkan::Mesh3DUBO::tint.
◆ end3DFrameToCanvas()
|
overridevirtual |
在文件 Graphics3D.cpp 第 224 行定义.
◆ endGBufferPass()
|
overridevirtual |
在文件 Graphics3D.cpp 第 599 行定义.
◆ endShadowPass()
|
overridevirtual |
在文件 Graphics3D.cpp 第 531 行定义.
◆ ensureUiColorResources()
|
inline |
Create the UI MSAA render pass (once) and its color targets for ImGui init.
在文件 Graphics.h 第 332 行定义.
◆ getBackendName()
|
overridevirtual |
Renderer backend id used by sibling modules (e.g. Gpgpu).
在文件 Graphics.cpp 第 56 行定义.
◆ getCanvas()
|
overridevirtual |
在文件 Graphics2D.cpp 第 426 行定义.
◆ getDepthFormat()
|
inline |
在文件 Graphics.h 第 326 行定义.
◆ getDescriptorPool()
|
inline |
在文件 Graphics.h 第 323 行定义.
被这些函数引用 eve::graphics::vulkan::OffscreenCanvas::OffscreenCanvas().
◆ getDevice()
|
inline |
在文件 Graphics.h 第 320 行定义.
被这些函数引用 bakeMeshMorph(), eve::gpgpu::computeQueue(), eve::gpgpu::VulkanSequence::destroy(), eve::graphics::vulkan::OffscreenCanvas::ensure3D(), eve::gpgpu::VulkanSequence::ensureCommandBuffer(), eve::ui::ImGuiBackend::init(), eve::graphics::vulkan::OffscreenCanvas::OffscreenCanvas(), eve::gpgpu::VulkanSequence::ready(), updateMeshVertices(), eve::gpgpu::vulkanSequenceRecordDispatch(), eve::gpgpu::vulkanSequenceRecordUpload(), eve::gpgpu::vulkanSequenceSubmit() , 以及 eve::graphics::vulkan::OffscreenCanvas::~OffscreenCanvas().
◆ getInstance()
|
inline |
在文件 Graphics.h 第 335 行定义.
◆ getMaxAnisotropy()
|
overridevirtual |
Device max supported anisotropy (1 if unsupported). Valid after initWithWindow.
在文件 Graphics2D.cpp 第 517 行定义.
◆ getMsaaSamples()
|
inlineoverridevirtual |
◆ getOffscreen3DRenderPass()
|
inline |
在文件 Graphics.h 第 325 行定义.
◆ getOffscreenRenderPass()
|
inline |
在文件 Graphics.h 第 324 行定义.
被这些函数引用 eve::graphics::vulkan::OffscreenCanvas::OffscreenCanvas().
◆ getPixel()
|
overridevirtual |
在文件 Graphics2D.cpp 第 217 行定义.
引用了 a, b, cx, cy, eve::graphics::Graphics::height, eve::graphics::Graphics::pixelHeight, eve::graphics::Graphics::pixelWidth, u, eve::graphics::Graphics::width, x , 以及 y.
◆ getSceneColorTexture()
|
overridevirtual |
Sampleable 3D color target for the current frame (RGB = lit, A = linear depth). Valid after begin3DFrame until present; nullptr when 3D did not run offscreen.
在文件 Graphics.cpp 第 410 行定义.
◆ getSdlWindow()
|
inline |
在文件 Graphics.h 第 337 行定义.
◆ getSwapchain()
|
inline |
在文件 Graphics.h 第 336 行定义.
◆ getSwapchainImageCount()
|
inline |
在文件 Graphics.h 第 338 行定义.
◆ getSwapchainRenderPass()
|
inline |
在文件 Graphics.h 第 327 行定义.
◆ getTexSetLayout()
|
inline |
在文件 Graphics.h 第 322 行定义.
被这些函数引用 eve::graphics::vulkan::OffscreenCanvas::OffscreenCanvas().
◆ getTexture()
|
overridevirtual |
Sampleable color buffer; screen Canvas returns nullptr.
在文件 GraphicsPipeline.cpp 第 1384 行定义.
◆ getUiMsaaRenderPass()
|
inline |
在文件 Graphics.h 第 328 行定义.
◆ getUiMsaaSamples()
|
inline |
Sample count the UI MSAA pass runs with (matches getUiMsaaRenderPass).
在文件 Graphics.h 第 330 行定义.
◆ getUploadPool()
|
inline |
在文件 Graphics.h 第 321 行定义.
被这些函数引用 eve::gpgpu::computeCommandPool().
◆ initWithWindow()
|
overridevirtual |
Bind to an existing native window (SDL_Window*) and create Vulkan device/swapchain. Must be called after the window exists (SDL_WINDOW_VULKAN).
在文件 Graphics.cpp 第 139 行定义.
引用了 name, newTexture() , 以及 setViewportSize().
◆ isCanvasActive()
|
overridevirtual |
◆ newCanvas()
|
overridevirtual |
Create an offscreen render target (sampleable). Owned by Graphics.
在文件 Graphics2D.cpp 第 398 行定义.
◆ newCubemap() [1/2]
|
overridevirtual |
Create an RGBA8 cubemap from 6 faces packed as +X,-X,+Y,-Y,+Z,-Z (each faceSize×faceSize, total bytes = faceSize²×4×6). Owned by Graphics.
在文件 Graphics2D.cpp 第 626 行定义.
引用了 eve::graphics::Graphics::newCubemap() , 以及 eve::graphics::TextureCreateInfo::withMipmaps().
◆ newCubemap() [2/2]
|
overridevirtual |
Cubemap with mipmap / sampler options (IBL-friendly when generateMipmaps=true).
在文件 Graphics2D.cpp 第 631 行定义.
引用了 device, eve::graphics::TextureCreateInfo::generateMipmaps, eve::graphics::mipmapCountForSize(), eve::graphics::TextureSampler::repeatU, eve::graphics::TextureSampler::repeatV, eve::graphics::TextureSampler::repeatW , 以及 eve::graphics::TextureCreateInfo::sampler.
◆ newHairShaderFromSpv()
|
overridevirtual |
Hair/fur card shader (alpha blend + Kajiya-Kay). Empty vert → mesh3d_hair.vert. Owned by Graphics.
在文件 Graphics2D.cpp 第 1128 行定义.
引用了 eve::graphics::Shader::eMesh3D , 以及 vert.
◆ newImageData()
|
overridevirtual |
Full RGBA8 copy; caller owns ImageData*.
在文件 Graphics2D.cpp 第 208 行定义.
引用了 eve::graphics::Graphics::pixelHeight , 以及 eve::graphics::Graphics::pixelWidth.
◆ newMeshCylinder()
|
overridevirtual |
◆ newMeshFromArrays()
|
overridevirtual |
Upload a triangle mesh from packed CPU arrays. Owned by Graphics. posXYZ required (vertexCount*3). nrmXYZ/uvST may be null (flat normal / zero UV). indices required (indexCount, triangles).
在文件 GraphicsMesh.cpp 第 207 行定义.
引用了 eve::graphics::Mesh::computeBounds(), idx, eve::graphics::vulkan::MeshVertex::pos, v , 以及 verts.
◆ newMeshFromAssimp() [1/2]
|
overridevirtual |
Upload triangulated mesh from Assimp (pos/normal/uv + indices). Owned by Graphics. Also captures Assimp morph targets (aiAnimMesh) into Mesh CPU morph data when present.
在文件 GraphicsMesh.cpp 第 51 行定义.
引用了 f, m, mesh, name, eve::graphics::vulkan::MeshVertex::pos, v , 以及 verts.
被这些函数引用 newMeshFromAssimp().
◆ newMeshFromAssimp() [2/2]
|
overridevirtual |
Like newMeshFromAssimp, but bakes an Assimp node world transform into positions and transforms normals by the inverse-transpose of the upper 3x3. Required for hierarchical glTF/FBX scenes — raw aiMesh verts are in local space.
在文件 GraphicsMesh.cpp 第 134 行定义.
引用了 f, idx, mesh , 以及 newMeshFromAssimp().
◆ newMeshShader()
|
overridevirtual |
在文件 Graphics2D.cpp 第 1192 行定义.
引用了 frag, eve::graphics::Graphics::newMeshShaderFromSpv() , 以及 vert.
◆ newMeshShaderFromSpv()
|
overridevirtual |
Create a Mesh3D custom shader (MeshVertex + Frame UBO + albedo). Empty vert → default mesh3d.vert. Owned by Graphics.
在文件 Graphics2D.cpp 第 1092 行定义.
引用了 eve::graphics::Shader::eMesh3D , 以及 vert.
◆ newMeshShaderFromWgsl()
|
overridevirtual |
Create a Mesh3D custom shader from WGSL source (WebGPU backend). The WGSL must declare the engine's Frame UBO (group 0 binding 0) and the shared mesh3d bindings (albedo 1, normal 2, env 3, shadow UBO 4, shadow depth 5, height 6, main sampler 7, shadow compare sampler 8, scene depth 9). Vulkan throws (uses SPIR-V via newMeshShaderFromSpv).
在文件 Graphics2D.cpp 第 1200 行定义.
◆ newMeshSphere()
|
overridevirtual |
◆ newShader()
|
overridevirtual |
Compile GLSL source with glslc (must be on PATH). Empty vertGlsl → default textured vert. Throws if compilation fails.
在文件 Graphics2D.cpp 第 1084 行定义.
引用了 frag, eve::graphics::Graphics::newShaderFromSpv() , 以及 vert.
◆ newShaderFromSpv()
|
overridevirtual |
Create a custom 2D shader from SPIR-V words (vert + frag). Owned by Graphics. Vertex stage may be empty → uses the default textured vertex shader.
在文件 Graphics2D.cpp 第 1045 行定义.
引用了 vert.
◆ newShaderFromSpvFile()
|
overridevirtual |
Load SPIR-V from files via Filesystem (empty vertPath → default textured vert).
在文件 Graphics2D.cpp 第 1076 行定义.
引用了 frag, eve::graphics::Graphics::newShaderFromSpv() , 以及 vert.
◆ newTexture() [1/4]
|
overridevirtual |
Create texture from ImageData (RGBA8 required for now).
在文件 Graphics2D.cpp 第 680 行定义.
引用了 data , 以及 eve::graphics::Graphics::newTexture().
◆ newTexture() [2/4]
|
overridevirtual |
Create texture from ImageData with sampler / mipmap options.
在文件 Graphics2D.cpp 第 689 行定义.
引用了 data , 以及 eve::graphics::Graphics::newTexture().
◆ newTexture() [3/4]
|
overridevirtual |
Create RGBA8 texture from CPU pixels (size = width*height*4). Borrowed handle: Graphics owns the texture (freed at shutdown or via releaseTexture); callers must not delete it.
在文件 Graphics2D.cpp 第 572 行定义.
引用了 h, eve::graphics::Graphics::newTexture(), eve::graphics::TextureSampler::repeatU, repeatU, eve::graphics::TextureSampler::repeatV, repeatV, eve::graphics::TextureCreateInfo::sampler , 以及 w.
被这些函数引用 initWithWindow().
◆ newTexture() [4/4]
|
overridevirtual |
Create RGBA8 texture with explicit sampler / mipmap options. Borrowed handle: Graphics owns the texture (freed at shutdown or via releaseTexture); callers must not delete it.
在文件 Graphics2D.cpp 第 579 行定义.
引用了 device, eve::graphics::TextureCreateInfo::generateMipmaps, h, eve::graphics::mipmapCountForSize(), eve::graphics::TextureCreateInfo::sampler , 以及 w.
◆ newTextureFromFile()
|
overridevirtual |
Load file via Filesystem + Image decode, then upload (RGBA8). Throws on failure. Same path returns the same Texture* and reloads pixels in place on repeat calls.
在文件 Graphics2D.cpp 第 819 行定义.
引用了 data , 以及 eve::graphics::Graphics::newTexture().
◆ onNativeWindowDestroyed()
|
overridevirtual |
Called by the Window module when the native window backing the render surface is destroyed (window close / recreation). Backends that keep a platform surface tied to the native window must drop it here so the next initWithWindow() rebuilds it against a fresh window — even when SDL hands back the same pointer for the recreated window.
The present overlay is bound to the destroyed window, so it is also dropped here: a stale ImGui callback would otherwise keep drawing into later presents of unrelated windows. Registered window-destroyed callbacks (e.g. the UI backend's ImGui teardown) fire first so they can release their ImGui context while the surface is still valid.
在文件 Graphics.cpp 第 272 行定义.
引用了 eve::graphics::Graphics::clearPresentOverlay() , 以及 eve::graphics::Graphics::windowDestroyedCallbacks_.
◆ popValidationScope()
|
inlineoverridevirtual |
在文件 Graphics.h 第 203 行定义.
◆ present()
|
overridevirtual |
在文件 Graphics.cpp 第 560 行定义.
引用了 eve::graphics::Graphics::isActive() , 以及 isCanvasActive().
◆ pushValidationScope()
|
inlineoverridevirtual |
Backend hooks so the platform-independent render3D() can wrap its work in a GPU validation error scope (used on WebGPU to catch early device errors).
在文件 Graphics.h 第 202 行定义.
◆ readGBufferToImageData()
|
overridevirtual |
Read a G-buffer attachment back to CPU as RGBA8. name is one of "depth" (RGBA8 linear depth), "normal" (world normal*0.5+0.5), "albedo". Valid only after a G-buffer or entity-ID offscreen pass filled it. Caller owns the returned ImageData*. Returns nullptr when unsupported.
在文件 Graphics2D.cpp 第 357 行定义.
◆ releaseMesh()
|
overridevirtual |
Eagerly releases a mesh created by this Graphics.
Mirrors releaseTexture: the returned handle is borrowed, a successful release frees the GPU buffers, detaches the handle (gpuHandle becomes null) and transfers the CPU facade to the caller for deletion.
- 参数
-
mesh Handle returned by a previous create call (may be null).
- 返回
- true when released; false for null, foreign or already-released handles.
在文件 GraphicsMesh.cpp 第 312 行定义.
◆ releaseShader()
|
overridevirtual |
Eagerly releases a shader created by this Graphics.
Mirrors releaseTexture: the returned handle is borrowed, a successful release destroys the GPU pipelines, detaches the handle (gpuHandle becomes null) and transfers the CPU facade to the caller for deletion. Only call this on shaders you created yourself; shaders owned by Graphics pipeline objects (AA / AO / GI / grass / ...) are still reachable through their owning objects and must not be released.
- 参数
-
shader Handle returned by a previous create call (may be null).
- 返回
- true when released; false for null, foreign or already-released handles.
在文件 Graphics2D.cpp 第 1161 行定义.
◆ releaseTexture()
|
overridevirtual |
Eagerly releases a texture created by this Graphics.
All newTexture* / newCubemap results are borrowed handles: the Graphics backend owns both the CPU facade and the GPU resource, and the handle must not be deleted directly. A successful release frees the GPU resource (after in-flight frames drain), detaches the handle (gpuHandle becomes null) and transfers the CPU facade to the caller, who may then delete it. Renderer-owned fallback textures (white / flat-normal / environment) and resources created by another Graphics are never released here.
- 参数
-
texture Handle returned by a previous create call (may be null).
- 返回
- true when released; false for null, foreign, internal or already-released handles.
在文件 Graphics2D.cpp 第 715 行定义.
引用了 device , 以及 eve::graphics::Texture::gpuHandle.
◆ reloadTextureFromFile()
|
overridevirtual |
Reload a path-cached texture from disk in place (pointer stable). False if unbound.
在文件 Graphics2D.cpp 第 839 行定义.
引用了 data , 以及 eve::ref< T >::get().
◆ renderEntityIdMask()
|
override |
在文件 Graphics2D.cpp 第 246 行定义.
引用了 d, eve::graphics::Texture::gpuHandle, h, eve::graphics::Graphics::height, viewProj, w, eve::graphics::Graphics::width , 以及 x.
◆ replaceTexturePixels()
| bool eve::graphics::vulkan::Graphics::replaceTexturePixels | ( | Texture * | tex, |
| image::ImageData * | data | ||
| ) |
在文件 Graphics2D.cpp 第 754 行定义.
引用了 data, device, eve::graphics::TextureCreateInfo::generateMipmaps, eve::graphics::Texture::gpuHandle, h, eve::graphics::Texture::height, eve::graphics::Texture::mipmapCount, eve::graphics::mipmapCountForSize(), eve::graphics::Texture::pixelHeight, eve::graphics::Texture::pixelWidth, eve::graphics::Texture::sampler, eve::graphics::TextureCreateInfo::sampler, w , 以及 eve::graphics::Texture::width.
◆ requestSurfaceRecreate()
|
inlineoverridevirtual |
Request recreation of the platform render surface on the next frame (Android background/foreground destroys the native window). Safe to call from a non-render thread; the actual work happens on the render thread.
在文件 Graphics.h 第 179 行定义.
◆ setCanvas()
|
overridevirtual |
nullptr or this → screen. Switching flushes pending draws to the previous target.
在文件 Graphics2D.cpp 第 411 行定义.
◆ setCloudShadows()
|
overridevirtual |
Dynamic cloud shadows cast on the ground by the default PBR mesh path. strength 0 disables (no change to rendering). time advances wind drift. Packed into Mesh3DUBO.cloud / cloudWind and consumed by mesh3d shaders.
在文件 Graphics3D.cpp 第 684 行定义.
引用了 eve::graphics::vulkan::Mesh3DUBO::cloud , 以及 eve::graphics::vulkan::Mesh3DUBO::cloudWind.
◆ setLighting2D()
|
overridevirtual |
Upload per-frame / per-canvas 2D lighting constants for subsequent lit draws.
在文件 Graphics2D.cpp 第 926 行定义.
◆ setMesh3DCameraPos()
|
overridevirtual |
Camera eye used by mesh shaders that need view/rim (stored in Mesh3DUBO).
在文件 Graphics3D.cpp 第 256 行定义.
◆ setMesh3DClip()
|
overridevirtual |
Near/far used to pack linear depth into scene color A (SSGI).
在文件 Graphics3D.cpp 第 760 行定义.
引用了 eve::graphics::ClusteredLightingUpload::clipInfo, eve::graphics::vulkan::Mesh3DUBO::clipInfo, f , 以及 n.
◆ setMesh3DClusteredActive()
|
overridevirtual |
Cheap per-draw toggle for the already-uploaded clustered light table. Unlike setMesh3DClusteredLighting it never re-uploads SSBO data, so the per-frame clustered build happens exactly once per camera.
在文件 GraphicsPipeline.cpp 第 1156 行定义.
引用了 active.
◆ setMesh3DClusteredLighting()
|
overridevirtual |
Enable clustered forward path for subsequent default mesh draws (SSBO light lists). Pass upload.active=false (or empty) to disable and return to the ≤8 UBO path.
在文件 GraphicsPipeline.cpp 第 1150 行定义.
◆ setMesh3DEnv()
|
overridevirtual |
Specular IBL environment for subsequent default mesh draws. cube must be from newCubemap (or nullptr → black / intensity 0). intensity is packed into Mesh3DUBO lightColor.w.
在文件 Graphics3D.cpp 第 494 行定义.
◆ setMesh3DHeightTexture()
|
overridevirtual |
Optional height map for parallax (R channel; nullptr = flat / off).
在文件 Graphics3D.cpp 第 490 行定义.
◆ setMesh3DLight()
|
overridevirtual |
Directional light for subsequent drawMesh calls (world-space direction toward surface).
在文件 Graphics3D.cpp 第 248 行定义.
引用了 color, d, dir, eve::graphics::vulkan::Mesh3DUBO::lightColor , 以及 eve::graphics::vulkan::Mesh3DUBO::lightDir.
◆ setMesh3DLighting()
|
overridevirtual |
Per-frame ambient + up to 8 lights packed into Mesh3DUBO.
在文件 Graphics3D.cpp 第 658 行定义.
引用了 eve::graphics::Lighting3DPack::ambient, eve::graphics::vulkan::Mesh3DUBO::ambient, eve::graphics::Light3DGpu::color, eve::graphics::Lighting3DPack::count, d, eve::graphics::Lighting3DPack::kMaxLights, eve::graphics::vulkan::Mesh3DUBO::lightColor, eve::graphics::vulkan::Mesh3DUBO::lightDir, eve::graphics::Lighting3DPack::lights, n , 以及 eve::graphics::Light3DGpu::posRadius.
◆ setMesh3DMaterial()
|
overridevirtual |
Metallic (0..1) and roughness (0..1) for the next default mesh draw.
在文件 Graphics3D.cpp 第 632 行定义.
引用了 eve::graphics::vulkan::Mesh3DUBO::ambient, eve::graphics::vulkan::Mesh3DUBO::cameraPos, metallic , 以及 roughness.
◆ setMesh3DNormalTexture()
|
overridevirtual |
Optional normal map for the next drawMesh / drawMeshShader (nullptr = flat).
在文件 Graphics3D.cpp 第 488 行定义.
引用了 normal.
◆ setMesh3DParallax()
|
overridevirtual |
Parallax occlusion mapping for the next default mesh draw. scale: UV displacement strength (0=off). Typical 0.02..0.08. minLayers / maxLayers: adaptive POM ray-march steps (more when glancing).
在文件 Graphics3D.cpp 第 647 行定义.
◆ setMesh3DSceneDepth()
|
overridevirtual |
Optional scene hardware depth (G-buffer hwDepth, Vulkan NDC z) bound to mesh3d shader binding 7. X-ray mesh shaders sample it to discard visible (non-occluded) fragments. nullptr falls back to a placeholder.
在文件 Graphics3D.cpp 第 492 行定义.
引用了 depth.
◆ setMesh3DShadowReceive()
|
overridevirtual |
Per-draw: when false, shadow sampling is forced off for the next mesh draw.
在文件 Graphics3D.cpp 第 502 行定义.
◆ setMesh3DShadows()
|
overridevirtual |
Upload CSM constants for subsequent default mesh draws (active=false disables).
在文件 Graphics3D.cpp 第 500 行定义.
◆ setMesh3DTexCellBomb()
|
overridevirtual |
Texture cell bombing for the next default mesh draw (breaks tiling). cellScale: cells per UV unit (typical 2..16). strength: 0=off, 1=full. rotAmount: 0..1 per-cell rotation scale (default 1).
在文件 Graphics3D.cpp 第 639 行定义.
◆ setMesh3DView()
|
overridevirtual |
Camera view matrix for subsequent drawMesh (view-space depth / CSM select).
在文件 Graphics3D.cpp 第 756 行定义.
引用了 view , 以及 eve::graphics::vulkan::Mesh3DUBO::view.
◆ setMesh3DViewProj()
|
overridevirtual |
viewProj used by subsequent drawMesh (mvp = viewProj * model). Expect RH + ZO with Vulkan NDC Y (see perspectiveVulkanRH_ZO).
在文件 Graphics3D.cpp 第 752 行定义.
◆ setMsaaSamples()
|
inlineoverridevirtual |
Hardware MSAA sample count for the 3D scene color pass (0 disables, then 2/4/8 are used when the device supports them). 0 or 1 mean no MSAA. Takes effect on the next begin3DFrame.
在文件 Graphics.h 第 190 行定义.
引用了 eve::graphics::Graphics::msaaSamples , 以及 eve::graphics::Graphics::setMsaaSamples().
◆ setScreenReadbackEnabled()
|
inlineoverridevirtual |
When true, each present copies the swapchain to a CPU buffer for getPixel/newImageData. Default false — full-frame readback is expensive; enable only for tests / tools.
在文件 Graphics.h 第 181 行定义.
引用了 enabled , 以及 eve::graphics::Graphics::setScreenReadbackEnabled().
◆ setTextureSampler()
|
overridevirtual |
Recreate the sampler for an existing texture (keeps image / mip chain). No-op when texture is null or not owned by this Graphics.
在文件 Graphics2D.cpp 第 699 行定义.
引用了 device, eve::graphics::Texture::gpuHandle , 以及 eve::graphics::Texture::sampler.
◆ setViewportSize()
|
overridevirtual |
Sets the current graphics display viewport dimensions.
在文件 Graphics2D.cpp 第 430 行定义.
引用了 eve::graphics::Graphics::height, eve::graphics::Graphics::pixelHeight, eve::graphics::Graphics::pixelWidth , 以及 eve::graphics::Graphics::width.
被这些函数引用 initWithWindow().
◆ setVSync()
|
inlineoverridevirtual |
Prefer uncapped present (IMMEDIATE/MAILBOX) when false, vsync (MAILBOX/FIFO) when true. Takes effect on the next swapchain recreate.
在文件 Graphics.h 第 185 行定义.
引用了 enabled, eve::graphics::Graphics::setVSync() , 以及 eve::graphics::Graphics::vsyncEnabled.
◆ updateMeshVertices()
|
overridevirtual |
In-place update of a mesh's vertex/index data (CPU -> host-visible VBO). Mirrors bakeMeshMorph: the update synchronizes with in-flight GPU work, so prefer rebuilding only when content actually changes. The mesh's buffer is reused while it fits (stable GPU handle) and reallocated when the new size grows. Returns false when unsupported (WebGPU backend). posXYZ/nrmXYZ follow newMeshFromArrays layout (uvST may be null); indices/indexCount may be null/0 to keep the mesh's existing indices.
在文件 GraphicsMesh.cpp 第 280 行定义.
引用了 getDevice(), mesh, eve::graphics::vulkan::MeshVertex::pos, v , 以及 verts.
友元及相关函数文档
◆ OffscreenCanvas
|
friend |
在文件 Graphics.h 第 340 行定义.
该类的文档由以下文件生成:
- src/modules/graphics/vulkan/Graphics.h
- src/modules/graphics/vulkan/Graphics.cpp
- src/modules/graphics/vulkan/Graphics2D.cpp
- src/modules/graphics/vulkan/Graphics3D.cpp
- src/modules/graphics/vulkan/GraphicsMesh.cpp
- src/modules/graphics/vulkan/GraphicsPipeline.cpp
Public 成员函数 继承自