Docs for Version: 1.0a
Show:
Extends Aex
Module: camera

Camera class

Constructor

Camera

(
  • [near]
  • [far]
  • [angle]
)

Parameters:

  • [near] Float optional

    near Plane

  • [far] Float optional

    far Plane

  • [angle] Float optional

    angle of perspective camera

Example:

world = new Scene()
                                camera = new Camera()
                                camera.position = new Vector(0.1, -1, -10);

Methods

addChilds

(
  • mobject
)

Inherited from MObject:

Sets parent on MObject and unbinds current parent in RenderTree

Parameters:

  • mobject MObject

    mobject object to add as a child to RenderTree

centerPivot

()

Inherited from Aex:

Centers pivot of an Aex to parent Mesh

draw

()

Inherited from Aex:

Draw the Aex inside draw function of your Scene

forward

(
  • f
)

Move camera forward & backward

Parameters:

  • f Float

    distance to move

lookAt

(
  • e
  • c
  • u
)
Matrix

put the camera at the eye point looking e toward the center point c with an up direction of u.

Parameters:

Returns:

Matrix:

Result matrix

move

(
  • x
  • y
  • z
  • r
)

Inherited from Aex:

Move object

Parameters:

  • x Object
    • x axis
  • y Object
    • y axis
  • z Object
    • z axis
  • r Object
    • relative transform

Example:

 var aex = new Aex()
                                             aex.move(0,1,2)

on

()

Turn on standard camera mouse and WSAD operating

on

(
  • factor
)

DEPRECATED use setters instead Turn on standard camera mouse and WSAD operating

Parameters:

  • factor Float

    sensitivity of camera

pitch

(
  • change
)

Rotate on local x axis

Parameters:

  • change Float

    rotation

pitch

(
  • change
)

DEPRECATED use setters instead Rotate on local y axis

Parameters:

  • change Float

    rotation

pitch

(
  • change
)

Rotate on local y axis

Parameters:

  • change Float

    rotation

pitch

(
  • change
)

DEPRECATED use setters instead Rotate on local x axis

Parameters:

  • change Float

    rotation

remove

()

Inherited from MObject:

Removes MObject from RenderTree

roll

(
  • change
)

Rotate on local z axis

Parameters:

  • change Float

    rotation

roll

(
  • change
)

DEPRECATED use setters instead Rotate on local z axis

Parameters:

  • change Float

    rotation

rotate

(
  • x
  • y
  • z
  • r
)

Inherited from Aex:

Rotate object

Parameters:

  • x Object
    • angle around x axis
  • y Object
    • angle around y axis
  • z Object
    • angle around z axis
  • r Object
    • relative transform

Example:

 var aex = new Aex()
                                             aex.rotate(0,1,2)

rotateAroundPoint

(
  • center
  • angle
  • x
  • y
  • z
)

Inherited from Aex:

Rotate object around point

Parameters:

  • center Vector

    pivot point location

  • angle Object
    • rotation in degrees
  • x Object
    • usage of x axis
  • y Object
    • usage of y axis
  • z Object
    • usage of z axis

Example:

 var aex = new Aex()
                                             aex.rotateAroundPoint(new Vector(0,1,1),90,0,1,0)

scale

(
  • x
  • y
  • z
  • r
)

Inherited from Aex:

Scale object

Parameters:

  • x Object
    • x axis
  • y Object
    • y axis
  • z Object
    • z axis
  • r Object
    • relative transform

Example:

 var aex = new Aex()
                                             aex.scale(0,1,2)

setCameraPosition

()

Set camera position

setCameraPosition

()

Set camera position

setDisplay

()

Set table with screen dimensions and coordinates for 2D games

setDisplay

()

Set table with screen dimensions and coordinates for 2D games

setModelView

()

Inherited from Aex:

Sets aex modelview and Normal matrix. Internal function done after transformations as move, rotate etc..

setOrthoPerspective

()

set orthographic projection for camera

setParent

(
  • parent
)

Inherited from MObject:

Sets parent on MObject and unbinds current parent in RenderTree. Usually this is done inside GameObject, but you have also possibility to construct RenderTree by yourself.

Parameters:

Example:

world = new Scene() gshader = new basicShader() someMaterial = new Material({}) gshader.setParent(world) someMaterial.setParent(world)

setPerspective

()

set perspective projection for camera

setUniforms

()

Inherited from Aex:

Force set shader uniforms

Example:

 var aex = new Aex()
                                             aex.setUniforms()

side

(
  • f
)

DEPRECATED use setters instead Move camera left & right

Parameters:

  • f Float

    distance to move

side

(
  • f
)

Move camera left & right

Parameters:

  • f Float

    distance to move

transforms

()

this method is called as the first method in scene draw call transforming the gl.projectionMatrix

updown

(
  • f
)

Move camera up & down

Parameters:

  • f Float

    distance to move

updown

(
  • f
)

DEPRECATED use setters instead Move camera up & down

Parameters:

  • f Float

    distance to move

Properties

position

Vector

Inherited from Aex but overwritten in

Position of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.position = new Vector(1.0,2.0,3.0)

rotation

Vector

Inherited from Aex but overwritten in

Rotation of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.rotation = new Vector(0.0,90.0,0.0)

rotX

Float

Inherited from Aex but overwritten in

x Rotation of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.rotX = 20.0

rotY

Float

Inherited from Aex but overwritten in

y Rotation of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.rotY = 20.0

rotZ

Float

Inherited from Aex but overwritten in

z Rotation of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.rotZ = 20.0

scaleX

Float

Inherited from Aex but overwritten in

x scale of object

Example:

world = new Scene()
                                            cam = new Aex()
                                            cam.scaleX = 2.0

scaleY

Float

Inherited from Aex but overwritten in

y scale of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.scaleY = 2.0

scaleZ

Float

Inherited from Aex but overwritten in

z scale of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.scaleZ = 2.0

x

Float

Inherited from Aex but overwritten in

x Position of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.x = 20.0

y

Float

Inherited from Aex but overwritten in

y Position of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.y = 20.0

z

Float

Inherited from Aex but overwritten in

z Position of object

Example:

world = new Scene()
                                            cam = new Camera(0.1,100,45)
                                            cam.z = 20.0