Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2016-0-4 21:22

Class enchant.gl.Sprite3D

Class Summary
Constructor Attributes Constructor Name and Description
 
Class with Sprite3D display function.
Field Summary
Field Attributes Field Name and Description
 
Object used in Sprite3D collision detection.
 
Array for child Sprite 3D element.
 
Sprite3D global x coordinates.
 
Sprite 3D global y coordinates.
 
Sprite3D global 3D coordinates.
 
Conversion line applied to Sprite3D.
 
 
Sprite3D name
 
Sprite3D parent element.
 
Sprite3D rotation line.
 
Sprite3D x axis direction expansion rate
 
Sprite3D y axis direction expansion rate
 
Sprite3D z axis direction expansion rate
 
The scene object currently added by this Sprite3D.
 
Determine whether to make Sprite3D touch compatible.
 
x
Sprite3D x coordinates.
 
y
Sprite3D y coordinates.
 
z
Sprite3D z coordinates.

Method Summary

Method Attributes Method Name and Description
 
addChild(sprite)
Add child Sprite3D.
 
altitude(speed)
Moves up Sprite3D.
 
Executes the reproduction of Sprite3D.
 
forward(speed)
Moves forward Sprite3D.
 
intersect(bounding)
Other object collison detection.
<static>  
enchant.gl.Sprite3D.loadCollada(url, onload, onload)
Create Sprite3D from Collada data.
 
removeChild(sprite)
Deletes designated child Sprite3D.
 
rotatePitch(radius)
Rotate Sprite3D in local X acxis.
 
rotateRoll(radius)
Rotate Sprite3D in local Z acxis.
 
rotateYaw(radius)
Rotate Sprite3D in local Y acxis.
 
Applies rotation line in rotation line received from quarterion.
 
Sets rotation line in rotation line received from quarterion.
 
scale(x, y, z)
Expand or contract Sprite3D.
 
set(sprite)
Sets condition of other Sprite3D.
 
sidestep(speed)
Moves side Sprite3D.
 
translate(x, y, z)
Parallel displacement of Sprite3D.
Methods borrowed from class enchant.EventTarget:
addEventListener
clearEventListener
dispatchEvent
on
removeEventListener

Class Detail

enchant.gl.Sprite3D()
Class with Sprite3D display function.

By adding enchant.gl.Scene3D instance, you can display atop an image. By changing enchant.gl.Sprite3D#vertices, enchant.gl.Sprite3D#indices, enchant.gl.Sprite3D#normals and others, you can freely draw Sprite3D, as well as pasting texture and more.

In addition, it is also possible to add Sprite3D as a child, and all child classes will be drawn with coordinates based on their parents.

  //Scene initialization
  var scene = new Scene3D();
  //Sprite3D initialization
  var sprite = new Sprite3D();
  //Add Sprite3D to scene
  scene.addChild(sprite);

Field Detail

{enchant.gl.Bounding | enchant.gl.BS | enchant.gl.AABB} bounding
Object used in Sprite3D collision detection.
{enchant.gl.Sprite3D[]} childNodes
Array for child Sprite 3D element. Can acquire list of Sprite3Ds added as child classes to this element. When adding or subtracting child classes, without directly operating this array, enchant.gl.Sprite3D#addChild or enchant.gl.Sprite3D#removeChild is used.
See:
enchant.gl.Sprite3D#addChild
enchant.gl.Sprite3D#removeChild
{Number} globalX
Sprite3D global x coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0
{Number} globalY
Sprite 3D global y coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0
{Number} globalZ
Sprite3D global 3D coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0
{Number[]} matrix
Conversion line applied to Sprite3D.
mesh
{String} name
Sprite3D name
Sprite3D parent element. When no parent exists this is null.
{Number[]} rotation
Sprite3D rotation line. Array is a one-dimensional array of length 16, interpreted as the 4x4 line destination.
  var sprite = new Sprite3D();
  //45 degree rotation along the x axis
  var rotX = Math.PI() / 4;
  sprite.rotation = [
      1, 0, 0, 0,
      0, Math.cos(rotX), -Math.sin(rotX), 0,
      0, Math.sin(rotX), Math.cos(rotX), 0,
      0, 0, 0, 1
  ];
{Number} scaleX
Sprite3D x axis direction expansion rate
See:
enchant.gl.Sprite3D#scale
Default Value:
1.0
{Number} scaleY
Sprite3D y axis direction expansion rate
See:
enchant.gl.Sprite3D#scale
Default Value:
1.0
{Number} scaleZ
Sprite3D z axis direction expansion rate
See:
enchant.gl.Sprite3D#scale
Default Value:
1.0
The scene object currently added by this Sprite3D. When no scene is added this is null.
See:
enchant.gl.Scene3D#addChild
{bool} touchable
Determine whether to make Sprite3D touch compatible. If set to false, will be ignored each time touch detection occurs.
{Number} x
Sprite3D x coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0
{Number} y
Sprite3D y coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0
{Number} z
Sprite3D z coordinates.
See:
enchant.gl.Sprite3D#translate
Default Value:
0

Method Detail

  • addChild(sprite)
    Add child Sprite3D. When it is added, an "added" event will be created for child Sprite3D. When a parent is already added to scene, it will be added to scene, and an "addedtoscene" event will be created. Child Sprite3D for adding @param {enchant.gl.Sprite3D} sprite.
      var parent = new Sprite3D();
      var child = new Sprite3D();
      //Add Sprite3D as child to another Sprite3D
      parent.addChild(child);
    Parameters:
    sprite
    See:
    enchant.gl.Sprite3D#removeChild
    enchant.gl.Sprite3D#childNodes
    enchant.gl.Sprite3D#parentNode
  • altitude(speed)
    Moves up Sprite3D.
    Parameters:
    {Number} speed
  • Executes the reproduction of Sprite3D. Position, rotation line, and others will be returned to a copied, new instance.
      var sp = new Sprite3D();
      sp.x = 15;
      var sp2 = sp.clone();
      //sp2.x = 15;
    Returns:
    {enchant.gl.Sprite3D}
  • forward(speed)
    Moves forward Sprite3D.
    Parameters:
    {Number} speed
  • {Boolean} intersect(bounding)
    Other object collison detection. Can detect collisions with collision detection objects with x, y, z properties.
    Parameters:
    {enchant.gl.Sprite3D} bounding
    Target object
    Returns:
    {Boolean}
  • <static> enchant.gl.Sprite3D.loadCollada(url, onload, onload)
    Create Sprite3D from Collada data. At present, data that has joint and animation is not supported. In addition, vertex attributes should be triangles.
    Defined in: collada.gl.enchant.js.
      var scene = new Scene3D();
      Sprite3D.loadCollada('hoge.dae', function(model){
          scene.addChild(model);
      });
    Parameters:
    {String} url
    Collada model URL,
    {Function} onload
    Callback when loading is complete.
    {Function} onload
    Callback when loading is fail.
  • removeChild(sprite)
    Deletes designated child Sprite3D. When deletion is complete, a "removed" event will be created for child Sprite3D. When added to scene, it will be deleted from that scene, and a "removedfromscene" event will be created. Child Sprite3D for deleting @param {enchant.gl.Sprite3D} sprite.
      var scene = new Scene3D();
      //Deletes scene's first child
      scene.removeChild(scene.childNodes[0]);
    Parameters:
    sprite
    See:
    enchant.gl.Sprite3D#addChild
    enchant.gl.Sprite3D#childNodes
    enchant.gl.Sprite3D#parentNode
  • rotatePitch(radius)
    Rotate Sprite3D in local X acxis.
    Parameters:
    {Number} radius
  • rotateRoll(radius)
    Rotate Sprite3D in local Z acxis.
    Parameters:
    {Number} radius
  • rotateYaw(radius)
    Rotate Sprite3D in local Y acxis.
    Parameters:
    {Number} radius
  • {quat} rotationApply(quat)
    Applies rotation line in rotation line received from quarterion.
    Parameters:
    quat
  • rotationSet(quat)
    Sets rotation line in rotation line received from quarterion.
    Parameters:
    {enchant.gl.Quat} quat
  • scale(x, y, z)
    Expand or contract Sprite3D. Expands each axis by a designated expansion rate.
      var sprite = new Sprite3D();
      //Expand x axis by 2.0 times, y axis by 3.0 times, and z axis by 0.5 times
      sprite.scale(2,0, 3.0, 0.5);
    Parameters:
    {Number} x
    x axis expansion rate
    {Number} y
    y axis expansion rate
    {Number} z
    z axis expansion rate
    See:
    enchant.gl.Sprite3D#scaleX
    enchant.gl.Sprite3D#scaleY
    enchant.gl.Sprite3D#scaleZ
    enchant.gl.Sprite3D#translate
  • set(sprite)
    Sets condition of other Sprite3D. Can be used corresponding Collada file's loaded assets.
      var sp = new Sprite3D();
      sp.set(core.assets['sample.dae']);
      //Becomes Sprite3D with sample.dae model information
    Parameters:
    sprite
  • sidestep(speed)
    Moves side Sprite3D.
    Parameters:
    {Number} speed
  • translate(x, y, z)
    Parallel displacement of Sprite3D. Displaces each coordinate a designated amount from its current location.
      var sprite = new Sprite3D();
      //Parallel displacement by 10 along the x axis, 3 along the y axis, and -20 along the z axis
      sprite.translate(10, 3, -20);
    Parameters:
    {Number} x
    Parallel displacement of x axis
    {Number} y
    Parallel displacement of y axis
    {Number} z
    Parallel displacement of z axis
    See:
    enchant.gl.Sprite3D#x
    enchant.gl.Sprite3D#y
    enchant.gl.Sprite3D#z
    enchant.gl.Sprite3D#scale