Package limn.render3d
Class Graphics3D
java.lang.Object
limn.render3d.Graphics3D
Facade + install-at-startup SPI for the 3D backend, the same inversion pattern
as
Images/Sounds: a neutral entry point here, the GL
implementation installed by the backend on startup. All calls must happen on
the UI thread inside a frame (the owning window's GL context must be
current), because they create/render GPU resources.
Nothing here has an asynchronous form, and nothing here can: the GL context is current on one
thread inside one frame, so an upload moved to a worker would have no context to upload into. The
work that can leave the frame is whatever produces the MeshData and
TextureData (reading the file, decoding the image, building the vertices), and that is
where an application should put a background job. By the time a call reaches this class, the
remaining cost is the driver's.
For this milestone the provider also ships one built-in demo scene (a
spinning, depth-tested cube) via renderDemoScene(limn.render3d.RenderTarget, double). Later phases add the
real mesh/material/pass API on top of the same RenderTarget seam.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBackend-supplied factory + renderer (installed at startup). -
Method Summary
Modifier and TypeMethodDescriptionstatic RenderTargetcreateTarget(int widthPx, int heightPx, int samples) Creates a target withsamples× MSAA (clamped to what the GPU supports).static voidinstall(Graphics3D.Provider newProvider) Installs the backend's 3D provider.static booleanWhether a backend provider is installed (false when running headless).static voidrender(RenderTarget target, Camera camera, Consumer<RenderPass> body) Renders intotargetwithcamera: binds the target (depth on), then invokesbodywith aRenderPassto clear and draw.static voidrenderDemoScene(RenderTarget target, double timeSeconds) Draws a built-in scene, so a backend can be verified without any application content.static voiduninstall(Graphics3D.Provider expected) Removes the provider if it is stillexpected, so a late teardown cannot clear a newer one.static GpuMeshUploads geometry to the GPU (call once; reuse the handle across frames).static GpuMeshUploads geometry that will be rewritten throughGpuMesh.update(limn.render3d.MeshData)(MeshUsage.DYNAMIC) or statically, asupload(MeshData).static GpuTextureuploadTexture(TextureData texture, Sampler sampler) Uploads a texture with the given sampler state (call once; reuse the handle).
-
Method Details
-
install
Installs the backend's 3D provider. Called once at startup, before any viewport renders. -
uninstall
Removes the provider if it is stillexpected, so a late teardown cannot clear a newer one. -
isAvailable
public static boolean isAvailable()Whether a backend provider is installed (false when running headless). -
createTarget
Creates a target withsamples× MSAA (clamped to what the GPU supports). -
upload
Uploads geometry to the GPU (call once; reuse the handle across frames). -
upload
Uploads geometry that will be rewritten throughGpuMesh.update(limn.render3d.MeshData)(MeshUsage.DYNAMIC) or statically, asupload(MeshData). -
uploadTexture
Uploads a texture with the given sampler state (call once; reuse the handle). -
render
Renders intotargetwithcamera: binds the target (depth on), then invokesbodywith aRenderPassto clear and draw. Resolves MSAA and restores GL state afterwards. Must run inside a frame (context current). -
renderDemoScene
Draws a built-in scene, so a backend can be verified without any application content.
-