Namespace: Primitives

SQR.Primitives

A collection of classes & functions and utilities to create geometries

Source:

Methods

(static) createCube(w, h, d) → {SQR.Buffer}

Creates a simple cube geometry, 1 quad per side, with UVs, non-indexed

Parameters:
Name Type Description
w Number

width of the cube

h Number

height of the cube

d Number

depth of the cube

Source:
Returns:
Type
SQR.Buffer

(static) createCylinder(height, radius, segments, options) → {SQR.Buffer}

Creates a cylinder with UVs, non-indexed

Parameters:
Name Type Description
height Number

height of the cylinder

radius Number

radius of the cylinder

segments Number

number of segments along the cylinder

options Object

additional options

Source:
To Do:
  • document the options
Returns:
Type
SQR.Buffer

(static) createPlane(w, h, wd, hd, wo, ho, options) → {SQR.Buffer}

Creates a plane, by default on the X/Y plane

Parameters:
Name Type Description
w Number

width of the plane

h Number

height of the plane

wd Number

number of segments along the width

hd Number

number of segments along the height

wo Number

horizontal offset

ho Number

vertical offset

options Object

options for the plan construction

Source:
Returns:
Type
SQR.Buffer

(static) createPostEffect(shaderSource, shaderOptionsopt) → {SQR.Transform}

Creates a post-processing effect (such as SAO or depth-of-field). It creates an instance of SQR.Transform with a full screen quad buffer and the shader build from the provided source. Please read the post-effects tutorial to see how it works.

Parameters:
Name Type Attributes Description
shaderSource string

the source of the shader for this post effect

shaderOptions Object <optional>

options for the shader. Same as in the SQR.Shader constructor

Source:
Returns:

a transform representing this post effect

Type
SQR.Transform

(static) createSphere(radius, swopt, shopt, optionsopt) → {SQR.Buffer}

Creates a simple cube geometry, 1 quad per side, with UVs, non-indexed

Parameters:
Name Type Attributes Default Description
radius Number

radius of the sphere

sw Number <optional>
8

width (longitude) segments. Minimum 3.

sh Number <optional>
6

width (latitude) segments. Minimum 3.

options Object <optional>

additional settings

Source:
Returns:
Type
SQR.Buffer