Renderers

class Renderer(camera, scene, params, threeRenderer)

Non-euclidean renderer. Takes as input the non-euclidean camera and scene and makes some magic. It should not be confused with the Three.js WebGLRenderer it relies on. Abstract class with the code common to all renderers.

Constructor.

Arguments:
  • camera (Camera) – the camera

  • scene (Scene) – the scene

  • params (Object) – parameters for the Thurston part of the render. For the moment includes

  • threeRenderer (WebGLRenderer|Object) – either a Three.js renderer or the parameters to build it - {boolean} postprocess - Gamma and Tone correction

Renderer.Renderer

Constructor.

Renderer.camera

type: Camera

Non-euclidean camera

Renderer.domElement

Shortcut to the DOM element of the underlying Three.js renderer. See Three.js doc.

Renderer.globalUniforms

type: Object

“Global” uniforms (i.e. values that will not depend on the objects in the scene) A uniform is encoded by an object with two properties type - a glsl type value - the JS value.

Renderer.scene

type: Scene

Non-euclidean scene

Renderer.set

Shortcut for the underlying teleportation set.

Renderer.shader1

The first part of the geometry dependent shader.

Renderer.shader2

The second part of the geometry dependent shader.

Renderer.threeRenderer

type: WebGLRenderer

The underlying Three.js renderer If the passed argument is already a WebGLRenderer, we directly use it, otherwise, we build a WebGLRenderer from the passed parameters.

Renderer.build()

Build the Three.js scene with the non-euclidean shader.

Renderer.render()

Render the non-euclidean scene. The method build should be called before.

Renderer.setAnimationLoop(callback)

Shortcut to set the animation loop of the underlying Three.js renderer. See Three.js doc.

Arguments:
  • callback (function) –

Renderer.setClearColor(color, alpha)

Shortcut to set the clear color of the underlying Three.js renderer. See Three.js doc.

Arguments:
  • color (Color) –

  • alpha (number) –

Renderer.setPixelRatio(value)

Shortcut to set the pixel ratio of the underlying Three.js renderer. See Three.js doc.

Arguments:
  • value (number) –

Renderer.setSize(width, height, updateStyle=true)

Shortcut to set the size of the underlying Three.js renderer. See Three.js doc.

Arguments:
  • width (number) –

  • height (number) –

  • updateStyle (boolean) –

class BasicRenderer(camera, scene, params, threeRenderer)

Non-euclidean renderer. Takes as input the non-euclidean camera and scene and makes some magic. It should not be confused with the Three.js WebGLRenderer it relies on.

This one is built with a spherical Three.js screen. It is more convenient for virtual reality (see VRRenderer) It should be used with a perspective Three.js camera

Constructor.

Arguments:
  • camera (Camera) – the camera

  • scene (Scene) – the scene

  • params (Object) – parameters for the Thurston part of the renderer

  • threeRenderer (WebGLRenderer|Object) – parameters for the underlying Three.js renderer

BasicRenderer.BasicRenderer

Constructor.

BasicRenderer._fragmentBuilder

type: ShaderBuilder

Builder for the fragment shader.

BasicRenderer.composer

type: EffectComposer

Effect composer for postprocessing

BasicRenderer.postProcess

type: Array.<PostProcess>

Add post-processing to the final output

BasicRenderer.buildFragmentShader()

Build the fragment shader

class VRRenderer(camera, scene, params, threeRenderer)

Renderer for virtual reality. Based on the tools provided by Three.js (which relies on WebXR). We place in distinct layer of the Three.js scene two horizon spheres. Each sphere will render the picture seen by one eye.

Constructor.

Arguments:
  • camera (VRCamera) – the camera

  • scene (Scene) – the scene

  • params (Object) – parameters for the underlying Three.js renderer

  • threeRenderer (WebGLRenderer|Object) – parameters for the underlying Three.js renderer

VRRenderer.VRRenderer

Constructor.

VRRenderer._fragmentBuilders

type: Array.<ShaderBuilder>

Builder for the fragment shader. The first one correspond to the left eye, the second one to the right eye

VRRenderer.xr

Shortcut to access the Three.js WebXRManager

class PathTracerRenderer(camera, scene, params, threeRenderer)

Constructor.

Arguments:
  • camera (PathTracerCamera) – the camera

  • scene (Scene) – the scene

  • params (Object) – parameters for the Thurston part of the renderer

  • threeRenderer (WebGLRenderer|Object) – parameters for the underlying Three.js renderer

class PostProcess()

A post process is a treatment apply to the picture obtained after rendering the geometry. A post process defines 3 elements : - its uniforms - a vertex shader - a fragment shader Most of the time the vertex shader will be the same. These data are packaged by the method fullShader

PostProcess.PostProcess
PostProcess.fragmentShader()
Returns:

string – - the fragment shader

PostProcess.fullShader()
Returns:

Object – - all the data needed by the Three.js addPass method.

PostProcess.uniforms()

Return the uniforms needed in the fragment shader. It is a good practice to extend the object return by the method of this abstract class. tDiffuse is the texture containing the rendered geometry.

Returns:

Object – - an object with all the uniforms of the post process

PostProcess.vertexShader()
Returns:

string – - the vertex shader