Class
WebglRendererPlugin
View sourceExtendsPlugin
Provides the WebGL 2 rendering backend for an App.
Register this plugin to render mesh and material assets through the WebGL 2
context associated with the app’s main Window. The main window
must provide a canvas with a WebGL 2 context; this plugin does not create a
canvas.
The plugin includes a built-in 3D pipeline for BasicMaterial.
Register another WebglMaterialPlugin for a different material type
and matching shader pair. The built-in material configuration also requires
Transform3DPlugin.
Register DefaultPlugin or the required dependencies before app
startup. Dependencies are checked but are not installed automatically.
Examples
import { App } from '@wimaengine/app'
import { DefaultPlugin } from '@wimaengine/misc'
import { WebglRendererPlugin } from '@wimaengine/render-webgl'
new App()
.registerPlugin(new DefaultPlugin())
.registerPlugin(new WebglRendererPlugin())
.run()Constructor
Methods
register(app: App): void
View sourceStages the renderer resources and built-in material configuration in an
App.
The default world receives ProgramCache, MeshCache,
UBOCache, ClearColor, AttributeMap, and
WebglProgramCache. The attribute map starts with built-in
MeshAttribute descriptors for position, normal, tangent, UV, UVB,
and color data.
The built-in BasicMaterial configuration uses
WebglMaterialPlugin with the bundled 3D shaders. Register another
WebglMaterialPlugin when an app needs a different material and
shader pair. Rendering uses the canvas for the main Window in
Windows; the canvas must provide a WebGL 2 context.
requires(): TypeId[]
View sourceReturns this renderer’s direct plugin dependencies.
Register CorePlugin, ReflectPlugin,
RenderCorePlugin, and WindowPlugin before startup.
The nested WebglMaterialPlugin registered for
BasicMaterial separately requires Transform3DPlugin;
that dependency is not included in this return value. Dependencies are
checked but are not installed automatically.
