Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a CPU-Raytracer to draw the scene.

Hierarchy

  • Raytracer

Implements

Index

Constructors

constructor

  • Parameters

    Returns Raytracer

Properties

Private camToWorld

camToWorld: Matrix4

Transformation of the current camera.

Private fov

fov: number

Field of view of the current camera.

Private gl

gl: WebGL2RenderingContext

Private intersections

intersections: Intersection[][]

Saves the intersections.

Private lightcolor

lightcolor: Vector4[]

Array to save the color of the LightSources.

Private lightpos

lightpos: Vector4[]

Array to save the positions of the LightSources.

Private mStack

mStack: MatrixStack

Local Matrixstack to help traversing the graph.

Private plane

plane: RayPlane

Plane to draw on.

Private rays

rays: Ray[][]

Holds the Rays only gets renewed at camerachange or if a animated camera is used.

Private sg

Private texture

texture: WebGLTexture

Private texture to render the intersection data.

Methods

camTraversal

  • Traverses the SceneGraph and sets up the Camera.

    Parameters

    Returns void

Private createRays

  • createRays(): void
  • Recreates the rays by using the selected Camera.

    Returns void

lightTraversal

  • lightTraversal(node: INode): void
  • Traverses the SceneGraph and sets up the LightSources.

    Parameters

    • node: INode

      Node to traverse

    Returns void

startDraw

  • startDraw(delta: number): void
  • Starts setting up and rendering the scene.

    Parameters

    • delta: number

      Time delta since the last draw.

    Returns void

visitGeometryNode

  • Visits a GeometryNode and intersects the corresponding geometry.

    Parameters

    Returns void

visitGroupNode

  • Vists a GroupNode.

    Parameters

    Returns void

visitNode

  • visitNode(node: INode): void
  • Determines which is visited and calls the appropriate method.

    Parameters

    • node: INode

      Node to visit.

    Returns void

visitRootNode

  • Sets up the draw call. Intersections are computed with raytracing by the CPU and then send to a texture and drawn by GPU to avoid a WebGL-Contextswitch.

    Parameters

    • node: RootNode

      Rootnode to start with.

    Returns void

Generated using TypeDoc