Difference between revisions of "JavascriptGraphicsAPI"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
{ | { | ||
+ | msg:"Create" | ||
id:"f47ac10b-58cc-4372-a567-0e02b2c3d479" | 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== | + | ==Moving a graphics object== |
+ | { | ||
+ | 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 | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==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 | ||
+ | } | ||
+ | |||
+ | |||
+ | //This message is from a space to an object updating its position and orientation | ||
+ | //If sent in response to a LocRequest, the information must be valid. | ||
+ | { | ||
+ | timestamp: new Date().getTime(), // ????? Should we only use extrapolated positions | ||
+ | position: [1,2,3], | ||
+ | orientation: [.5,0,0,.867], | ||
+ | velocity: [1,1,1], | ||
+ | rotational_axis: [0,1,0], | ||
+ | angular_speed: 1.0, | ||
+ | forced_update: false, // if we do extrapolation | ||
+ | } | ||
==Destroying a graphics object== | ==Destroying a graphics object== | ||
+ | |||
+ | { | ||
+ | msg:"Destroy" | ||
+ | id:"f47ac10b-58cc-4372-a567-0e02b2c3d479" | ||
+ | } | ||
==Attaching a graphics object== | ==Attaching a graphics object== |
Revision as of 22:13, 6 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
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
{ 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 }
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 }
//This message is from a space to an object updating its position and orientation //If sent in response to a LocRequest, the information must be valid. { timestamp: new Date().getTime(), // ????? Should we only use extrapolated positions position: [1,2,3], orientation: [.5,0,0,.867], velocity: [1,1,1], rotational_axis: [0,1,0], angular_speed: 1.0, forced_update: false, // if we do extrapolation
}
Destroying a graphics object
{ msg:"Destroy" id:"f47ac10b-58cc-4372-a567-0e02b2c3d479" }