public class WebGLRenderer extends AbstractRenderer implements HasEventBus
Scene
s using WebGL, if your device supports it.Modifier and Type | Field and Description |
---|---|
Frustum |
_frustum |
boolean |
_logarithmicDepthBuffer |
Shader.PRECISION |
_precision |
java.util.Map<java.lang.String,Shader> |
_programs |
Matrix4 |
_projScreenMatrix |
Matrix4 |
_projScreenMatrixPS |
Vector3 |
_vector3 |
java.util.Map<java.lang.String,java.util.List<WebGLObject>> |
_webglObjects |
java.util.List<WebGLObject> |
_webglObjectsImmediate |
double |
devicePixelRatio |
java.util.List<WebGLObject> |
opaqueObjects |
java.util.List<WebGLObject> |
transparentObjects |
EVENT_BUS
Constructor and Description |
---|
WebGLRenderer(WebGLRenderingContext gl,
int width,
int height)
The constructor will create renderer for the
Canvas3d widget. |
Modifier and Type | Method and Description |
---|---|
double |
_devicePixelRatio() |
void |
addPlugin(Plugin plugin) |
void |
clear() |
void |
clear(boolean color,
boolean depth,
boolean stencil)
Tells the renderer to clear its color, depth or stencil drawing buffer(s).
|
void |
clearColor() |
void |
clearDepth() |
void |
clearStencil() |
void |
clearTarget(RenderTargetTexture renderTarget,
boolean color,
boolean depth,
boolean stencil)
Clear
RenderTargetTexture and GL buffers. |
void |
deletePlugin(Plugin plugin) |
void |
enableScissorTest(boolean enable)
Enable the scissor test.
|
Material |
getBufferMaterial(GeometryObject object,
Geometry geometry) |
Material |
getBufferMaterial(GeometryObject object,
GeometryGroup geometryGroup) |
WebGLRenderingContext |
getGL()
Gets the WebGL context from the
Canvas3d widget. |
WebGlRendererInfo |
getInfo()
Gets
WebGlRendererInfo instance with debug information. |
int |
getMaxAnisotropy() |
Shader.PRECISION |
getPrecision() |
int |
getTextureUnit() |
void |
initGeometryGroups(Object3D scene,
Mesh object,
Geometry geometry) |
boolean |
isAutoClearColor()
Gets
setAutoClearColor(boolean) flag. |
boolean |
isAutoClearDepth()
Gets
setAutoClearDepth(boolean) flag. |
boolean |
isAutoClearStencil()
Gets
setAutoClearStencil(boolean) flag. |
boolean |
isAutoUpdateObjects()
Gets
setAutoUpdateObjects(boolean) flag. |
boolean |
isAutoUpdateScene()
Gets
setAutoUpdateScene(boolean) flag. |
boolean |
isGammaInput() |
boolean |
isGammaOutput() |
boolean |
isSortObjects()
Gets
setSortObjects(boolean) flag. |
java.util.List<GeometryGroup> |
makeGroups(Geometry geometry,
boolean usesFaceMaterial) |
void |
render(Scene scene,
Camera camera) |
void |
render(Scene scene,
Camera camera,
RenderTargetTexture renderTarget) |
void |
render(Scene scene,
Camera camera,
RenderTargetTexture renderTarget,
boolean forceClear)
Rendering.
|
void |
renderBuffer(Camera camera,
java.util.List<Light> lights,
AbstractFog fog,
Material material,
WebGLGeometry geometry,
GeometryObject object)
Buffer rendering.
|
void |
renderBufferDirect(Camera camera,
java.util.List<Light> lights,
AbstractFog fog,
Material material,
BufferGeometry geometry,
GeometryObject object) |
void |
renderBufferImmediate(GeometryObject object,
Shader program,
Material material) |
void |
renderImmediateObject(Camera camera,
java.util.List<Light> lights,
AbstractFog fog,
Material material,
GeometryObject object) |
void |
renderObjectsImmediate(java.util.List<WebGLObject> renderList,
java.lang.Boolean isTransparentMaterial,
Camera camera,
java.util.List<Light> lights,
AbstractFog fog,
boolean useBlending,
Material overrideMaterial) |
void |
resetGLState() |
void |
setAutoClearColor(boolean isAutoClearColor)
Defines whether the renderer should clear the color buffer.
|
void |
setAutoClearDepth(boolean isAutoClearDepth)
Defines whether the renderer should clear the depth buffer.
|
void |
setAutoClearStencil(boolean isAutoClearStencil)
Defines whether the renderer should clear the stencil buffer.
|
void |
setAutoUpdateObjects(boolean isAutoUpdateObjects)
Defines whether the renderer should auto update objects.
|
void |
setAutoUpdateScene(boolean isAutoUpdateScene)
Defines whether the renderer should auto update the scene.
|
void |
setBlending(Material.BLENDING blending) |
void |
setClearColor(Color color,
double alpha)
Sets the the background color, using
Color for the color and alpha for the opacity. |
void |
setDepthTest(boolean depthTest) |
void |
setDepthWrite(boolean depthWrite) |
void |
setGammaInput(boolean isGammaInput) |
void |
setGammaOutput(boolean isGammaOutput) |
void |
setMaterialFaces(Material material) |
void |
setRenderTarget(RenderTargetTexture renderTarget)
Setup render target
|
void |
setScissor(int x,
int y,
int width,
int height)
Sets the scissor area from (x, y) to (x + absoluteWidth, y + absoluteHeight).
|
void |
setSize(int width,
int height)
Sets the sizes and also sets
setViewport(int, int, int, int) size. |
void |
setSortObjects(boolean isSortObjects)
Defines whether the renderer should sort objects.
|
void |
setTexture(Texture texture,
int slot) |
void |
setViewport(int x,
int y,
int width,
int height)
Sets the viewport to render from (X, Y) to (X + absoluteWidth, Y + absoluteHeight).
|
boolean |
supportsBlendMinMax() |
boolean |
supportsCompressedTexturePVRTC() |
boolean |
supportsCompressedTextureS3TC() |
boolean |
supportsFloatTextures() |
boolean |
supportsStandardDerivatives() |
boolean |
supportsVertexTextures() |
void |
updateObject(GeometryObject object,
Object3D scene) |
getAbsoluteAspectRation, getAbsoluteHeight, getAbsoluteWidth, getClearAlpha, getClearColor, isAutoClear, setAutoClear, setClearColor, setClearColor, setClearColor
public java.util.Map<java.lang.String,java.util.List<WebGLObject>> _webglObjects
public java.util.List<WebGLObject> _webglObjectsImmediate
public java.util.List<WebGLObject> opaqueObjects
public java.util.List<WebGLObject> transparentObjects
public double devicePixelRatio
public boolean _logarithmicDepthBuffer
public Shader.PRECISION _precision
public java.util.Map<java.lang.String,Shader> _programs
public Frustum _frustum
public Matrix4 _projScreenMatrix
public Matrix4 _projScreenMatrixPS
public Vector3 _vector3
public WebGLRenderer(WebGLRenderingContext gl, int width, int height)
Canvas3d
widget.gl
- the WebGLRenderingContext
width
- the viewport widthheight
- the viewport heightpublic final double _devicePixelRatio()
public void addPlugin(Plugin plugin)
public void deletePlugin(Plugin plugin)
public boolean supportsVertexTextures()
public boolean supportsFloatTextures()
public boolean supportsStandardDerivatives()
public boolean supportsCompressedTextureS3TC()
public boolean supportsCompressedTexturePVRTC()
public boolean supportsBlendMinMax()
public int getMaxAnisotropy()
public Shader.PRECISION getPrecision()
public boolean isAutoClearColor()
setAutoClearColor(boolean)
flag.public void setAutoClearColor(boolean isAutoClearColor)
isAutoClearColor
- false or truepublic boolean isAutoClearDepth()
setAutoClearDepth(boolean)
flag.public void setAutoClearDepth(boolean isAutoClearDepth)
isAutoClearDepth
- false or truepublic boolean isAutoClearStencil()
setAutoClearStencil(boolean)
flag.public void setAutoClearStencil(boolean isAutoClearStencil)
isAutoClearStencil
- false or truepublic boolean isSortObjects()
setSortObjects(boolean)
flag.public void setSortObjects(boolean isSortObjects)
isSortObjects
- false or truepublic boolean isAutoUpdateObjects()
setAutoUpdateObjects(boolean)
flag.public void setAutoUpdateObjects(boolean isAutoUpdateObjects)
isAutoUpdateObjects
- false or truepublic boolean isAutoUpdateScene()
setAutoUpdateScene(boolean)
flag.public boolean isGammaInput()
public void setGammaInput(boolean isGammaInput)
public boolean isGammaOutput()
public void setGammaOutput(boolean isGammaOutput)
public void setAutoUpdateScene(boolean isAutoUpdateScene)
isAutoUpdateScene
- false or truepublic WebGlRendererInfo getInfo()
WebGlRendererInfo
instance with debug information.WebGlRendererInfo
instancepublic WebGLRenderingContext getGL()
Canvas3d
widget.Canvas3d
.public void setSize(int width, int height)
setViewport(int, int, int, int)
size.setSize
in class AbstractRenderer
width
- the Canvas3d
width.height
- the Canvas3d
height.public void setViewport(int x, int y, int width, int height)
public void setScissor(int x, int y, int width, int height)
public void enableScissorTest(boolean enable)
public void setClearColor(Color color, double alpha)
AbstractRenderer
Color
for the color and alpha for the opacity.setClearColor
in class AbstractRenderer
color
- the Color
instance.alpha
- the opacity of the scene's background color, range 0.0 (invisible) to 1.0 (opaque).public void clear()
clear
in class AbstractRenderer
public void clear(boolean color, boolean depth, boolean stencil)
color
- is it should clear colordepth
- is it should clear depthstencil
- is it should clear stencilpublic void clearColor()
public void clearDepth()
public void clearStencil()
public void clearTarget(RenderTargetTexture renderTarget, boolean color, boolean depth, boolean stencil)
RenderTargetTexture
and GL buffers.public void resetGLState()
public void renderBufferImmediate(GeometryObject object, Shader program, Material material)
public void renderBufferDirect(Camera camera, java.util.List<Light> lights, AbstractFog fog, Material material, BufferGeometry geometry, GeometryObject object)
public java.util.List<GeometryGroup> makeGroups(Geometry geometry, boolean usesFaceMaterial)
public Material getBufferMaterial(GeometryObject object, GeometryGroup geometryGroup)
public Material getBufferMaterial(GeometryObject object, Geometry geometry)
public void updateObject(GeometryObject object, Object3D scene)
public void render(Scene scene, Camera camera)
render
in class AbstractRenderer
public void render(Scene scene, Camera camera, RenderTargetTexture renderTarget)
public void render(Scene scene, Camera camera, RenderTargetTexture renderTarget, boolean forceClear)
scene
- the Scene
object.renderTarget
- optionalforceClear
- optionalpublic void renderObjectsImmediate(java.util.List<WebGLObject> renderList, java.lang.Boolean isTransparentMaterial, Camera camera, java.util.List<Light> lights, AbstractFog fog, boolean useBlending, Material overrideMaterial)
public void renderImmediateObject(Camera camera, java.util.List<Light> lights, AbstractFog fog, Material material, GeometryObject object)
public void renderBuffer(Camera camera, java.util.List<Light> lights, AbstractFog fog, Material material, WebGLGeometry geometry, GeometryObject object)
public int getTextureUnit()
public void setMaterialFaces(Material material)
public void setDepthTest(boolean depthTest)
public void setDepthWrite(boolean depthWrite)
public void setBlending(Material.BLENDING blending)
public void setTexture(Texture texture, int slot)
public void setRenderTarget(RenderTargetTexture renderTarget)
renderTarget
- the render target