Home Reference Source Repository
import Camera from 'dh3dlib/js/base/Camera.js'
public class | source

Camera

Camera class

Constructor Summary

Public Constructor
public

constructor

Member Summary

Public Members
public
public
public

bindXAngle: float

public

bindYAngle: float

public

distance: float

public
public
public

Method Summary

Public Methods
public

bind(dhObject: DH3DObject): void

bind camera to object

public

change coordination

public

frustum(left: float, right: float, bottom: float, top: float, nearVal: float, farVal: float): void

public

getAnimating(): bool

get animation state

public

getAnimationTime(): float

get animation time (sec)

public

getLoop(): bool

get loop state

public

get motion of object

public

get normal matrix

public

get position array for WebGL

public

get projection array for WebGL

public

get projection matrix

public

get screen position from world position

public

get view array for WebGL

public

identity(): void

reset camera position and matrix

public

lookat(eyeX: float, eyeY: float, eyeZ: float, centerX: float, centerY: float, centerZ: float, upX: float, upY: float, upZ: float): void

change camera matrix to look at the given point

public

ortho(left: float, right: float, bottom: float, top: float, nearVal: float, farVal: float): void

public

perspective(fovy: float, aspect: float, nearVal: float, farVal: float): void

public

rotate(angle: float, x: float, y: float, z: float): void

rotate camera

public

scale(x: float, y: float, z: float): void

scale view matrix: zoom up/down

public

scaleProjection(x: float, y: float, z: float): void

scale projection matrix

public

setAnimating(animating: bool): void

set animation

public

setAnimationTime(time: float): void

set animation time (sec)

public

setAnimator(animator: Animator): void

set animator to object

public

setBindOffset(x: float, y: float, z: float): void

set offset between camera and binded object

public

setLoop(loop: bool): void

set animation loop

public

setMotion(motion: Motion): void

set motion to object

public

setPosition(x: float, y: float, z: float): void

set camera position

public

show camera matrix for debug

public

translate(x: float, y: float, z: float): void

move camera position

public

unbind(): void

unbind object

public

update(elapsedTime: float): void

update camera position and matrix

Public Constructors

public constructor source

constructor

Public Members

public bindObj: DH3DObject source

public bindOffset: Vector3 source

public bindXAngle: float source

public bindYAngle: float source

public distance: float source

public position: Vector3 source

public projMat: Matrix source

public viewMat: Matrix source

Public Methods

public bind(dhObject: DH3DObject): void source

bind camera to object

Params:

NameTypeAttributeDescription
dhObject DH3DObject

Return:

void

public changeCoordination(): void source

change coordination

Return:

void

public frustum(left: float, right: float, bottom: float, top: float, nearVal: float, farVal: float): void source

Params:

NameTypeAttributeDescription
left float
right float
bottom float
top float
nearVal float
farVal float

Return:

void

public getAnimating(): bool source

get animation state

Return:

bool

true if it's animating

public getAnimationTime(): float source

get animation time (sec)

Return:

float

animation time

public getLoop(): bool source

get loop state

Return:

bool

true if loop is enabled

public getMotion(): Motion source

get motion of object

Return:

Motion

motion

public getNormalMatrix(): Float32Array source

get normal matrix

Return:

Float32Array

normal matrix

public getPosition(): Float32Array source

get position array for WebGL

Return:

Float32Array

position value

public getProjectionArray(): Float32Array source

get projection array for WebGL

Return:

Float32Array

projection matrix value

public getProjectionViewMatrix(): Float32Array source

get projection matrix

Return:

Float32Array

projection view matrix

public getScreenPosition(pos: Vector3): Vector3 source

get screen position from world position

Params:

NameTypeAttributeDescription
pos Vector3

world position

Return:

Vector3

screen position

public getViewArray(): Float32Array source

get view array for WebGL

Return:

Float32Array

view matrix value

public identity(): void source

reset camera position and matrix

Return:

void

public lookat(eyeX: float, eyeY: float, eyeZ: float, centerX: float, centerY: float, centerZ: float, upX: float, upY: float, upZ: float): void source

change camera matrix to look at the given point

Params:

NameTypeAttributeDescription
eyeX float
eyeY float
eyeZ float
centerX float
centerY float
centerZ float
upX float
upY float
upZ float

Return:

void

public ortho(left: float, right: float, bottom: float, top: float, nearVal: float, farVal: float): void source

Params:

NameTypeAttributeDescription
left float
right float
bottom float
top float
nearVal float
farVal float

Return:

void

public perspective(fovy: float, aspect: float, nearVal: float, farVal: float): void source

Params:

NameTypeAttributeDescription
fovy float
aspect float
nearVal float
farVal float

Return:

void

public rotate(angle: float, x: float, y: float, z: float): void source

rotate camera

Params:

NameTypeAttributeDescription
angle float

rotation angle in radian

x float

x value of axis of rotation

y float

y value of axis of rotation

z float

z value of axis of rotation

Return:

void

public scale(x: float, y: float, z: float): void source

scale view matrix: zoom up/down

Params:

NameTypeAttributeDescription
x float

x value of scale

y float

y value of scale

z float

z value of scale

Return:

void

public scaleProjection(x: float, y: float, z: float): void source

scale projection matrix

Params:

NameTypeAttributeDescription
x float

x value of scale

y float

y value of scale

z float

z value of scale

Return:

void

public setAnimating(animating: bool): void source

set animation

Params:

NameTypeAttributeDescription
animating bool

Return:

void

public setAnimationTime(time: float): void source

set animation time (sec)

Params:

NameTypeAttributeDescription
time float

animation time

Return:

void

public setAnimator(animator: Animator): void source

set animator to object

Params:

NameTypeAttributeDescription
animator Animator

Return:

void

public setBindOffset(x: float, y: float, z: float): void source

set offset between camera and binded object

Params:

NameTypeAttributeDescription
x float
y float
z float

Return:

void

public setLoop(loop: bool): void source

set animation loop

Params:

NameTypeAttributeDescription
loop bool

Return:

void

public setMotion(motion: Motion): void source

set motion to object

Params:

NameTypeAttributeDescription
motion Motion

Return:

void

public setPosition(x: float, y: float, z: float): void source

set camera position

Params:

NameTypeAttributeDescription
x float

x position of camera

y float

y position of camera

z float

z position of camera

Return:

void

public showCameraMatrix(): void source

show camera matrix for debug

Return:

void

public translate(x: float, y: float, z: float): void source

move camera position

Params:

NameTypeAttributeDescription
x float

x value of camera transition

y float

y value of camera transition

z float

z value of camera transition

Return:

void

public unbind(): void source

unbind object

Return:

void

public update(elapsedTime: float): void source

update camera position and matrix

Params:

NameTypeAttributeDescription
elapsedTime float

elapsedTime

Return:

void