Skip to content

@orillusion/core


Class: Object3DUtil

Defined in: src/util/Object3DUtil.ts:29

Helper factory for quickly creating common debug/sample Object3D primitives (cubes, spheres, planes, point lights), backed by a per-Context3D cache of shared geometries and materials.

Constructors

Constructor

new Object3DUtil(): Object3DUtil

Returns

Object3DUtil

Methods

CubeMesh()

static CubeMesh(ctx): BoxGeometry

Defined in: src/util/Object3DUtil.ts:49

Shared unit box geometry for the given context.

Parameters

ctx

Context3D

Returns

BoxGeometry


SphereMesh()

static SphereMesh(ctx): SphereGeometry

Defined in: src/util/Object3DUtil.ts:54

Shared unit sphere geometry for the given context.

Parameters

ctx

Context3D

Returns

SphereGeometry


GetCube()

static GetCube(ctx): Object3D

Defined in: src/util/Object3DUtil.ts:59

Create a cube Object3D using the shared box geometry and a cloned default material.

Parameters

ctx

Context3D

Returns

Object3D


GetMaterial()

static GetMaterial(ctx, tex): Material

Defined in: src/util/Object3DUtil.ts:70

Get (and cache per texture) a clone of a LitMaterial whose base map is the given texture.

Parameters

ctx

Context3D

tex

Texture

Returns

Material


GetPlane()

static GetPlane(ctx, tex): Object3D

Defined in: src/util/Object3DUtil.ts:82

Create a textured, additively-blended plane Object3D (no shadow/GI/reflection).

Parameters

ctx

Context3D

tex

Texture

Returns

Object3D


GetSingleCube()

static GetSingleCube(sizeX, sizeY, sizeZ, r, g, b): Object3D

Defined in: src/util/Object3DUtil.ts:97

Create a standalone cube with its own box geometry and a colored LitMaterial.

Parameters

sizeX

number

sizeY

number

sizeZ

number

r

number

g

number

b

number

Returns

Object3D


GetSingleSphere()

static GetSingleSphere(radius, r, g, b): Object3D

Defined in: src/util/Object3DUtil.ts:112

Create a standalone sphere with its own geometry and a colored LitMaterial.

Parameters

radius

number

r

number

g

number

b

number

Returns

Object3D


GetSingleCube2()

static GetSingleCube2(mat, size?): Object3D

Defined in: src/util/Object3DUtil.ts:125

Create a standalone cube with the given material and uniform size (no shadow).

Parameters

mat

Material

size?

number = 10

Returns

Object3D


GetPointLight()

static GetPointLight(pos, rotation, radius, r, g, b, intensity?, castShadow?): PointLight

Defined in: src/util/Object3DUtil.ts:135

Create a point light Object3D with a small visualizer sphere child.

Parameters

pos

Vector3

rotation

Vector3

radius

number

r

number

g

number

b

number

intensity?

number = 1

castShadow?

boolean = true

Returns

PointLight