Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a sphere in 3D space.

Hierarchy

  • Sphere

Implements

Index

Constructors

constructor

  • new Sphere(gl: WebGL2RenderingContext, colors?: Vector4[], radius?: number): Sphere
  • Parameters

    • gl: WebGL2RenderingContext
    • Default value colors: Vector4[] = ColorHelper.CreateColorArray(new Vector3(1, 0, 0), 2)
    • Default value radius: number = 1

    Returns Sphere

Properties

Private center

center: Vector4

Center of the Sphere should be in the origin of our space.

Private colorbuffer

colorbuffer: WebGLBuffer

The buffer containing the sphere's colors.

colors

colors: Vector4[]

Colors used to color the sphere.

Private elements

elements: number

The amount of indices.

Private gl

gl: WebGL2RenderingContext

Private indexbuffer

indexbuffer: WebGLBuffer

The indices describing which vertices form a triangle.

Private normalbuffer

normalbuffer: WebGLBuffer

The buffer containing the sphere's normals.

radius

radius: number

The radius of the sphere.

Readonly shader

shader: string = "pvmcolor"

Key of the corresponding Shader in the Shadermanager.

Private vertexbuffer

vertexbuffer: WebGLBuffer

The buffer containing the sphere's vertices.

Methods

intersect

  • Used for drawing with the raytracer.

    Parameters

    • ray: Ray

      Ray to intersect with.

    • transformation: Matrix4

      Transformation of the object into worldspace.

    Returns Intersection

render

  • render(shader: Shader): void
  • Method to used for drawing with rasterizer.

    Parameters

    • shader: Shader

      Shader used for rendering.

    Returns void

Generated using TypeDoc