Class: Axis

Axis(windowHandle)

new Axis(windowHandle)

Creates and initializes an instance of the Axis engine
Parameters:
Name Type Description
windowHandle Canvas A canvas object onto which to render
Source:

Methods

AcquireResourceName(resourceName, resourceType) → {AxString}

Creates a unique name for the given type of resource If the given resourceName is already unique, then it gets returned unaltered
Parameters:
Name Type Description
resourceName AxString Original name to use for generating the unique name
resourceType AxResourceType Type of the resource for which to acquire the name
Source:
Returns:
A name, which is unique for the given type of resources
Type
AxString

AcquireTexture(fileName, callbackContext, callback)

Acquires a texture from the given file name and returns the texture object If the texture is not already in the loaded resources, it gets loaded.
Parameters:
Name Type Description
fileName AxString Name of the file containing the image to used as a texture
callbackContext * An object which is to be passed to the callback. It can be used to serve as a context for the callback or just to pass any relevant data
callback AxisObjectLoadedCallback A callback method which is to be called when acquiring has finished
Source:

AddResource(resource) → {AxResource}

Adds a resource to the resources set
Parameters:
Name Type Description
resource AxResource The resource to add
Source:
Returns:
The added resource. Provided for syntax ease
Type
AxResource

Attach(sourceParentSet, sourceIndex, destinationParentSet, destinationIndex, parentTransform)

Attaches an entity to an entity set by moving it from its original 'source' set into another and, when applicable, performs transformations, so that it retains its situation in the scene
Parameters:
Name Type Description
sourceParentSet AxEntitySet The entity set, which contains the entity to be moved / attached
sourceIndex Integer Index of the entity in the references of the source parent set.
destinationParentSet AxEntitySet The destination entity set, where the entity is to be placed / attached to. If omitted or null is passed, the root of the scene is assumed.
destinationIndex Integer The index at which the entity is to placed in the references of te destination parent set. If omitted or -1 is passed, an index at the end of the parent set is assumed.
parentTransform AxTransform The transform, which is to be used as a parent transform of the entity. If omitted or null is passed, an identity transform is assumed
Source:

CalculateNearestActiveLights(maxCount, position)

Fills the nearestActiveLights collection with up to maxCount lights, which are nearest to a given location
Parameters:
Name Type Description
maxCount Integer Maximum number of lights to fill. If the whole scene has less lights than this number, all the lights will be included
position AxVector3 The position in relation to which to pick nearest lights
Source:

CreateEntity(typeId) → {AxEntity}

Creates an entity by its typeId, using the registered entity dispatchers
Parameters:
Name Type Description
typeId Integer The identifier for the type of entity, which is to be created
Source:
Returns:
The newly created entity. If the entity couldn't be created, for example because the typeId was invalid or was not supported by the registered entity dispatchers, the return value is null
Type
AxEntity

DeserializeResource(source) → {AxResource}

Deserializes a resource from a stream
Parameters:
Name Type Description
source AxStream Source stream, from which the resource's serialized data will be read
Source:
Returns:
The resource, deserialized from the stream. If deserialization was not successfull, returns null
Type
AxResource

Detach(sourceParentSet, sourceIndex)

Detaches an entity its original entity set and, when applicable, performs transformations, so that it retains its situation in the scene Effectively, attaches the entity to the root entity set
Parameters:
Name Type Description
sourceParentSet AxEntitySet The entity set, which contains the entity to be moved / attached
sourceIndex Integer Index of the entity in the references of the source parent set.
Source:

FindResource(resourceIdentifier, resourceType) → {AxResource}

Searches for a resource with a given name and of specific type and returns the result If no such resource is found, returns null Can search either by resource id or by resource name This method combines methods FindResource_1 and FindResource_2
Parameters:
Name Type Description
resourceIdentifier String | AxString | Integer In case of searching by id, it is the id of the searched resource. In case of searching by name, it is the name of the resources.
resourceType AxResourceType In case of searching by name, it is the type of the resource to search for.
Source:
Returns:
The resource with the given name and of the given type. If none such was found, returns null
Type
AxResource

FindResource_1(id) → {AxResource}

Searches for a resource with a given id If no such resource is found, returns null
Parameters:
Name Type Description
id Integer Id of the resource to search for
Source:
Returns:
The resource with the given id. If none such was found, returns null
Type
AxResource

FindResource_2(resourceName, resourceType) → {AxResource}

Searches for a resource with a given name and of specific type and returns the result If no such resource is found, returns null
Parameters:
Name Type Description
resourceName String | AxString Name of the resource to search for
resourceType AxResourceType Type of the resource to search for
Source:
Returns:
The resource with the given name and of the given type. If none such was found, returns null
Type
AxResource

GetFullFileName(fileName) → {AxString}

Gets the full file name with its absolute path
Parameters:
Name Type Description
fileName AxString File name to get absolute file name for. If the file name is already an absolute one, it is returned unaltered
Source:
Returns:
The full file name with its absolute path
Type
AxString

GetRenderingWindow() → {*}

Returns the id of the canvas used for rendering
Source:
Returns:
The id of the canvas used for rendering
Type
*

ImportScene(source, callback)

Imports a scene from a file or a stream The scene can be in any of the registered scene media formats This method combines methods ImportScene_1() and ImportScene_2()
Parameters:
Name Type Description
source String | AxString | AxStream In case of importing from a file, it is the file name. In case of importing from a stream, it is the stream
callback * In case of importing from a file, it is a callback method, called when importing the scene has finished. In case of importing from a stream, this argument is not used.
Source:

ImportScene_1(stream, callback) → {Boolean}

Imports a scene from a stream The scene can be in any of the registered scene media formats
Parameters:
Name Type Description
stream AxStream The stream, which contains the scene serialized data
callback * Callback method, called when importing the scene has finished
Source:
Returns:
True if the scene was imported successfully
Type
Boolean

ImportScene_2(fileName, callback)

Imports a scene from a file The scene can be in any of the registered scene media formats
Parameters:
Name Type Description
fileName String | AxString Name of the file, which contains the scene serialized data
callback * Callback method, called when importing the scene has finished
Source:

LoadImage(stream, callbackContext, callback)

Creates an image by loading it from the given stream, using the registered image dispatchers If none of the registered dispatchers is able to load an image from the stream, null is returned and the stream remains at the original position.
Parameters:
Name Type Description
stream AxStream Stream which contains the image data
callbackContext * An object which is to be passed to the callback. It can be used to serve as a context for the callback or just to pass any relevant data
callback AxisObjectLoadedCallback A callback method which is to be called when loading has finished
Source:

LoadImage_2(fileName, callbackContext, callback)

Creates an image by loading it from the given file name, using the registered file systems to access the file and the registered image to decode the image If none of the registered file systems can access the file or none of the registered image dispatchers is able to load an image from the file, null is returned
Parameters:
Name Type Description
fileName AxString Name of the file containing the image to be loaded
callbackContext * An object which is to be passed to the callback. It can be used to serve as a context for the callback or just to pass any relevant data
callback AxisObjectLoadedCallback A callback method which is to be called when loading has finished
Source:

PickByPixelSpaceCoords(screenPixelCoords, intersectionInfo, entityInfo, screenPixelSizenon-null) → {Boolean}

Picks a scene object, which is located at the given 2D coordinates on the screen. The coordinates are measured in screen pixels, the X coordinate ranging in the interval [0, viewportWidth] from left to right and the Y coordinate ranging in the interval [0, viewportHeight] from top to bottom
Parameters:
Name Type Description
screenPixelCoords AxVector2 The coordinates, in pixels, of the picking point on the screen
intersectionInfo AxIntersectionInfo After the picking is performed, provides information about the intersection. Must be a valid AxIntersectionInfo object
entityInfo AxTraceParameters After the picking is performed, provides information about the intersected object. Must be a valid AxTraceParameters object
screenPixelSize AxVector2 The size in pixels of the screen. If omitted, the current viewport size is assumed
Source:
Returns:
True if an object was picked
Type
Boolean

PickByRayPointAndOrientation(rayInitialPoint, rayOrientation, intersectionInfo, entityInfo) → {Boolean}

Provides information about the intersection of a given ray and the objects on the scene The ray is defined by an initial point and orientation The returned info is for the closest intersected object
Parameters:
Name Type Description
rayInitialPoint AxVector3 The initial (starting) point of the ray
rayOrientation AxVector3 The orientation vector of the ray
intersectionInfo AxIntersectionInfo After the picking is performed, provides information about the intersection. Must be a valid AxIntersectionInfo object
entityInfo AxTraceParameters After the picking is performed, provides information about the intersected object. Must be a valid AxTraceParameters object
Source:
Returns:
True if the ray has intersected with an object
Type
Boolean

PickByRayTwoPoints(rayInitialPoint, raySecondPoint, intersectionInfo, entityInfo) → {Boolean}

Provides information about the intersection of a given ray and the objects on the scene The ray is defined by two points The returned info is for the closest intersected object
Parameters:
Name Type Description
rayInitialPoint AxVector3 The initial (starting) point of the ray
raySecondPoint AxVector3 The second point along the ray
intersectionInfo AxIntersectionInfo After the picking is performed, provides information about the intersection. Must be a valid AxIntersectionInfo object
entityInfo AxTraceParameters After the picking is performed, provides information about the intersected object. Must be a valid AxTraceParameters object
Source:
Returns:
True if the ray has intersected with an object
Type
Boolean

PickByScreenSpaceCoords(screenUnitCoords, intersectionInfo, entityInfo) → {Boolean}

Picks a scene object, which is located at the given 2D coordinates on the screen. The coordinates are measured in unit coordinates, the X coordinate ranging in the interval [-1, 1] from left to right and the Y coordinate ranging in the interval [-1, 1] bottom to top
Parameters:
Name Type Description
screenUnitCoords AxVector2 The coordinates, in unit space, of the picking point on the screen
intersectionInfo AxIntersectionInfo After the picking is performed, provides information about the intersection. Must be a valid AxIntersectionInfo object
entityInfo AxTraceParameters After the picking is performed, provides information about the intersected object. Must be a valid AxTraceParameters object
Source:
Returns:
True if an object was picked
Type
Boolean

PixelToScreenSpace(pixelCoords, screenPixelSizenon-null) → {AxVector2}

Returns a set of 2D coordinates of unit size for the given coordinates of a pixel on the screen The input pixel coordinates are in the range [0, width - 1] horizontally from left to right and [height - 1, 0] vertically from bottom to top. The returned unit coordinates are in the range [-1, 1] horizontally from left to right and [-1, 1] vertically from bottom to top
Parameters:
Name Type Description
pixelCoords AxVector2 The pixel coordinates, which are to be converted to unit size
screenPixelSize AxVector2 The size of the screen in pixels. If omitted, the size of the viewport is assumed.
Source:
Returns:
The coordinates in unit size
Type
AxVector2

PresentOnScreen()

Presents the rendered sceen on the screen
Source:

ProcessEntity(entity, parameters)

Processes a given entity recursively. If the entity is an entity set, all the references in the set get processed recursively The way processing is done is influenced by the current traceEvents
Parameters:
Name Type Description
entity AxResource The entity which is to be processed
parameters AxTraceParameters The tracing parameters, relevant to the tracing
Source:

ProcessInput()

Performs the input models routines and the input devices routines
Source:

ProcessScene(traceEvents)

Traces the scene using the given trace events
Parameters:
Name Type Description
traceEvents AxTraceEvents The trace events to use while traversing the scene
Source:

RenderScene(presentOnScreen)

Renders the whole scene
Parameters:
Name Type Description
presentOnScreen Boolean Determines whether the scene should be presented on screen after rendered. If omitted, a value of true is assumed
Source:

ScreenToPixelSpace(screenCoords, screenPixelSizenon-null) → {AxVector2}

Returns a set of 2D coordinates of pixel size for the given coordinates of a pixel on the screen The input unit coordinates are in the range [-1, 1] horizontally from left to right and [-1, 1] vertically from bottom to top The returned pixel coordinates are in the range [0, width - 1] horizontally from left to right and [height - 1, 0] vertically from bottom to top.
Parameters:
Name Type Description
screenCoords AxVector2 The unit coordinates, which are to be converted to pixel size
screenPixelSize AxVector2 The size of the screen in pixels. If omitted, the size of the viewport is assumed.
Source:
Returns:
The coordinates in unit size
Type
AxVector2

SerializeResource(destination, resource)

Serializes a resource into a stream
Parameters:
Name Type Description
destination AxStream Destination stream in which the resource's serialized data will be written
resource AxResource The resource to serialize
Source:

SwapLightsLists()

Swaps the list of light which was collected during the last traversing of the world, with the list of lights which is used for lighting by the shaders
Source:

Documentation generated by JSDoc 3.5.3 on Mon Feb 19 2018 20:39:26 GMT+0200 (FLE Standard Time)