Difference between revisions of "JavascriptGraphicsAPI"

From Sirikata Wiki
Jump to navigation Jump to search
Line 4: Line 4:
  
  
 
+
==Object Management==
==Creating a new graphics object==
+
===Creating a new graphics object===
  
 
  {
 
  {
Line 18: Line 18:
 
  }
 
  }
  
==Moving a  graphics object==
+
===Moving a  graphics object===
 
//should we define that the graphics system has some sort of interp--otherwise velocity may be useless?
 
//should we define that the graphics system has some sort of interp--otherwise velocity may be useless?
  
Line 32: Line 32:
 
  }
 
  }
 
   
 
   
==Adding/changing mesh property for an object==
+
===Destroying a graphics object===
 +
 
 +
{
 +
    msg:"Destroy"
 +
    id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
 +
}
 +
 
 +
 
 +
==Managing object appearance properties==
 +
===Adding/changing mesh property for an object===
 
  {
 
  {
 
   msg:"Mesh",
 
   msg:"Mesh",
Line 39: Line 48:
 
  }
 
  }
 
   
 
   
==Removing mesh property for an  object==
+
===Removing mesh property for an  object===
 
  {
 
  {
 
     msg:"DestroyMesh",
 
     msg:"DestroyMesh",
Line 45: Line 54:
 
  }
 
  }
  
==Adding/changing light property for an object==
+
===Adding/changing light property for an object===
  
 
  {
 
  {
Line 65: Line 74:
 
  }
 
  }
  
==Removing light property for an object==
+
===Removing light property for an object===
 
  {
 
  {
 
     msg:"DestroyLight"
 
     msg:"DestroyLight"
Line 71: Line 80:
 
  }
 
  }
  
==Destroying a graphics object==
+
==Camera Management==
  
{
+
===Attaching a camera to an object===
    msg:"Destroy"
 
    id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
 
}
 
 
 
==Attaching a camera to an object==
 
 
  {
 
  {
 
     msg:"Camera"
 
     msg:"Camera"
Line 85: Line 89:
 
  }
 
  }
  
==Detaching a  camera from an object==
+
===Detaching a  camera from an object===
 
  {
 
  {
 
     msg:"DestroyCamera"
 
     msg:"DestroyCamera"
Line 91: Line 95:
 
  }
 
  }
  
==Attach a camera to an object's texture"==
+
===Attach a camera to an object's texture"===
 
  {
 
  {
 
   msg:AttachCamera",
 
   msg:AttachCamera",
Line 98: Line 102:
 
   texname:"example.png"//overwrites this texture
 
   texname:"example.png"//overwrites this texture
 
  }
 
  }
 +
 +
==Skeleton Management==

Revision as of 00:13, 7 February 2010

Cross thread communication from Physics and Networking to graphics

Objects are sent across the thread barrier to alter the current scene graph being displayed


Object Management

Creating a new graphics object

{
 msg:"Create"
 id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
 pos:[1,2,3],
 vel:[.25,0,0],
 orient:[.5,0,0,.5]
 rotaxis:[0,0,1]
 rotvel:.25,
 parent:"c46ac00b-58cc-4372-a567-0e02b2c3d479"//<-- optional
}

Moving a graphics object

//should we define that the graphics system has some sort of interp--otherwise velocity may be useless?

{
  msg:"Move"
  id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
  pos:[1,2,3],
  vel:[.25,0,0],
  orient:[.5,0,0,.5]
  rotaxis:[0,0,1]
  rotvel:.25,
  parent:"c46ac00b-58cc-4372-a567-0e02b2c3d479"//<-- optional
}

Destroying a graphics object

{
   msg:"Destroy"
   id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
}


Managing object appearance properties

Adding/changing mesh property for an object

{
  msg:"Mesh",
  id:"f47ac10b-58cc-4372-a567-0e02b2c3d479",
  mesh:"http://example.com/test.dae"
}

Removing mesh property for an object

{
   msg:"DestroyMesh",
   id:"f47ac10b-58cc-4372-a567-0e02b2c3d479",
}

Adding/changing light property for an object

{
  msg:"Light"
  id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
  diffuse_color:[.25,.5,1],
  specular_color: [.2,1,.5],
  power=1.0: //exponent on the light
  ambient_color: [0,0,0],
  light_range: 1.0e5
  constant_falloff: 0.5,
  linear_falloff: 0.2,
  quadratic_falloff: 0.1,
  cone_inner_radians: 0,
  cone_outer_radians: 0,
  cone_falloff: 0.5,
  type: "POINT",//options include "SPOTLIGHT" or "DIRECTIONAL"
  casts_shadow: true
}

Removing light property for an object

{
    msg:"DestroyLight"
    id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

Camera Management

Attaching a camera to an object

{
   msg:"Camera"
   id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
   primary:true//whether the camera should be attached to the canvas rendering surface (may be overridden with future calls to Camera)
}

Detaching a camera from an object

{
   msg:"DestroyCamera"
   id:"f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

Attach a camera to an object's texture"

{
  msg:AttachCamera",
  id:"f47ac10b-58cc-4372-a567-0e02b2c3d479",
  camid:"f47ac10b-58cc-4372-a567-0e02b2c3d479",
  texname:"example.png"//overwrites this texture
}

Skeleton Management