Class camera
Extends
entity.
camera
Defined in: camera.js.
Constructor Attributes | Constructor Name and Description |
---|---|
camera()
A rendering target and manipulation object.
|
Field Attributes | Field Name and Description |
---|---|
Whether the engine should handle clearing the framebuffer for you when
using this camer as a render target.
|
|
Height of the camera's output framebuffer
|
|
Type of the camera.
|
|
Width of the camera's output framebuffer
|
Method Attributes | Method Name and Description |
---|---|
Copies the current back visual of the camera as an image asset.
|
|
Copies the current front visual of the camera as an image asset.
|
|
refresh()
Forces clearing of the results of drawing stored within the Camera.
|
|
setRenderResolution(width, height)
Sets the width and height of the camer'as internal framebuffer.
|
|
setTarget(pos)
Sets the camera's facing target.
|
|
transformScreenToWorld(pointScreen, disance)
Converts a point representing a pixel on a display to
a point in world space.
|
|
transformWorldToScreen(point)
Converts a point in transformed space to a pixel position on the camera's framebuffer.
|
- Methods borrowed from class entity:
- addComponent, attach, contains, createChild, detach, draw, drawDuration, findChildByName, getAllSubEntities, getChildren, getComponents, getNumChildren, getParent, getPriority, hasParent, queryComponent, remove, removeComponent, setPriority, setPriorityFirst, setPriorityLast, step, stepDuration, valid
Class Detail
camera()
A rendering target and manipulation object.
The camera is the symbolic viewing port for sandboxe.
It acts as the bridge between the rendered scene and the viewer.
Any number of cameras can be maintained, but only one may be used at a time.
See sandboxe.graphics.setCamera2d
,sandboxe.graphics.setCamera3d
,sandboxe.graphics.setRenderCamera
Field Detail
autoRefresh
Whether the engine should handle clearing the framebuffer for you when
using this camer as a render target. Unless you're doing something very special,
the default of 'true' is good.
height
Height of the camera's output framebuffer
type
Type of the camera. See sandboxe.camera.type.
width
Width of the camera's output framebuffer
Method Detail
{asset}
copyBackVisual()
Copies the current back visual of the camera as an image asset.
In a double-buffered environment, the back buffer is usually the previous complete
frame that is currently visible on the screen.
Note that when done, the asset should be removed. See sandboxe.assets
- Returns:
- {asset} The image asset of the back visual.
{asset}
copyFrontVisual()
Copies the current front visual of the camera as an image asset.
In a double-buffered environment, the front buffer is usually the currently incomplete
frame that is painted to as the scene is drawn.
Note that when done, the asset should be removed. See sandboxe.assets
- Returns:
- {asset} The image asset of the front visual.
refresh()
Forces clearing of the results of drawing stored within the Camera.
setRenderResolution(width, height)
Sets the width and height of the camer'as internal framebuffer. The frameuffer
is effectively the image representing the results of drawing operations.
- Parameters:
- {Number} width
- The new width in device units.
- {Number} height
- The new height in device units.
setTarget(pos)
Sets the camera's facing target. When called, the camera will orient itseld
so that the center of its view "looks" at the given position.
- Parameters:
- {vector} pos
- Position to look at
transformScreenToWorld(pointScreen, disance)
Converts a point representing a pixel on a display to
a point in world space..
- Parameters:
- {vector} pointScreen
- The point to convert.
- {Number} disance
- The distance to project the Vector to. In the case of a 3D perspective camera: Since the source is 2D, the Z value is ignored. However, when projecting, since there is no source Z value, The actual depth from the Camera's point of view is undefined when projecting, so a distance from the viewpoint is needed.
transformWorldToScreen(point)
Converts a point in transformed space to a pixel position on the camera's framebuffer.
- Parameters:
- {vector} point
- The source point to project onto the camera.