API Docs for: 0.5.5
Show:

kick.importer.ColladaImporter Class

Imports a Collada meshes into a scene

Methods

addVertexAttributes

(
  • index
  • outVertexAttributes
  • outTriangleIndices
)
private

This method adds vertex attributes to the result index and

Parameters:

  • index Number

    Source index in vertex array (the p element)

  • outVertexAttributes Object

    Destination vertex index array

  • outTriangleIndices Array_Number

    Destination vertex index array

BuildDataAccessor

(
  • elementChild
)
private

Create accessor object for data

Parameters:

  • elementChild XML

Returns:

function of type function(index,paramOffset)

buildFromPolyList

(
  • polylist
  • destMeshData
)
private

Parameters:

buildMeshData

()

Builds meshdata component (based on a <mesh> node)

getArrayElementById

(
  • id
)
Array_Number private

Get data element by id
Note that the array is cached by id - this is done to speed up performance in case of interleaved data

Parameters:

  • id String

Returns:

Array_Number:

data

glFunctionArgsToString

(
  • functionName
  • args
)
String

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:806

Converts the arguments of a WebGL function to a string. Attempts to convert enum arguments to strings.

Parameters:

  • functionName String

    the name of the WebGL function.

  • args Number

    The arguments.

Returns:

String:

The arguments as a string.

glFunctionArgToString

(
  • value
)
String

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:775

Gets an string version of an WebGL enum.

Parameters:

  • value Number

    Value to return an enum for

Returns:

String:

The string version of the enum.

Example:

WebGLDebugUtil.init(ctx);
var str = WebGLDebugUtil.glEnumToString(ctx.getError());

glFunctionArgToString

(
  • functionName
  • argumentIndx
  • value
)
String

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:788

Converts the argument of a WebGL function to a string. Attempts to convert enum arguments to strings.

Parameters:

  • functionName String

    the name of the WebGL function.

  • argumentIndx Number

    the index of the argument.

  • value

    The value of the argument.

Returns:

String:

The value as a string.

Example:

WebGLDebugUtil.init(ctx);
var str = WebGLDebugUtil.glFunctionArgToString('bindTexture', 0, gl.TEXTURE_2D);

would return 'TEXTURE_2D'

import

(
  • colladaDOM
  • [scene=engine.activeScene]
  • rotate90x
)
Object static

Parameters:

  • colladaDOM XMLDom | String
  • [scene=engine.activeScene] kick.scene.Scene optional

    If not specified the active scene (from the engine) is used

  • rotate90x Boolean

    rotate -90 degrees around x axis

Returns:

Object:

returns container object with the properties(mesh:[], gameObjects:[], materials:[])

init

(
  • ctx
)

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:756

Initializes this module. Safe to call more than once.

Parameters:

  • ctx !WebGLRenderingContext

    A WebGL context. If you have more than one context it doesn't matter which one you pass in, it is only used to pull out constants.

makeDebugContext

(
  • ctx
  • opt_onErrorFunc
  • opt_onFunc
)

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:817

Given a WebGL context returns a wrapped context that calls gl.getError after every command and calls a function if the result is not NO_ERROR.

You can supply your own function if you want. For example, if you'd like an exception thrown on any GL error you could do this

Parameters:

  • ctx !WebGLRenderingContext

    The webgl context to wrap.

  • opt_onErrorFunc !function(err, funcName, args): void

    The function to call when gl.getError returns an error. If not specified the default function calls console.log with a message.

  • opt_onFunc !function(funcName, args): void

    The function to call when each webgl function is called. You can use this to log all calls for example.

Example:

 function throwOnGLError(err, funcName, args) {
   throw WebGLDebugUtils.glEnumToString(err) +
         " was caused by call to " + funcName;
 };
 ctx = WebGLDebugUtils.makeDebugContext(
     canvas.getContext("webgl"), throwOnGLError);

makeLostContextSimulatingCanvas

(
  • canvas
)

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:844

Given a canvas element returns a wrapped canvas element that will simulate lost context. The canvas returned adds the following functions.

loseContext: simulates a lost context event.

restoreContext: simulates the context being restored.

lostContextInNCalls: loses the context after N gl calls.

getNumCalls: tells you how many gl calls there have been so far.

setRestoreTimeout: sets the number of milliseconds until the context is restored after it has been lost. Defaults to 0. Pass -1 to prevent automatic restoring.

Parameters:

  • canvas !Canvas

    The canvas element to wrap.

mightBeEnum

(
  • value
)
Boolean

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:766

Returns true or false if value matches any WebGL enum

Parameters:

  • value

    Value to check if it might be an enum.

Returns:

Boolean:

True if value matches one of the WebGL defined enums

resetToInitialState

(
  • ctx
)

Provided by the kick.core module.

Defined in kick/core/WebGLDebugUtils.js:870

Resets a context to the initial state.

Parameters:

  • ctx !WebGLRenderingContext

    The webgl context to reset.

stringToArray

(
  • numberString
  • [type=[]]
)
private

Converts a string to an array

Parameters:

  • numberString String
  • [type=[]] Object optional

    valid types are Array (default), and typed arrays classes