iterami/Docs.htm/Tests/common/webgl.js
FunctionArgsExpectedResultTest
webgl_character_init()
{
  "id": "test_character_1",
  "level": 5
}
function(result){
    return webgl_characters.test_character_1.life > 0;
}
undefined
true
webgl_character_level()
undefined
-1
-1
true
webgl_character_level()
"fake_character"
-3
-3
true
webgl_character_level()
{
  "camera_rotate_x": 0,
  "camera_rotate_y": 0,
  "camera_rotate_z": 0,
  "camera_x": 0,
  "camera_y": 0,
  "camera_z": 0,
  "change_position_x": 0,
  "change_position_y": 0,
  "change_position_z": 0,
  "change_rotate_x": 0,
  "change_rotate_y": 0,
  "change_rotate_z": 0,
  "jump_allow": false,
  "keys": false,
  "locked": {},
  "pointer": false,
  "position_x": 23,
  "position_y": 0,
  "position_z": 0,
  "rotate_x": 0,
  "rotate_y": 0,
  "rotate_z": 0,
  "vehicle": false,
  "vehicle_stats": false,
  "id": "test_character_0",
  "level": 1,
  "spawn": {
    "position_x": 23
  },
  "automove": false,
  "camera_lock": true,
  "camera_zoom": 0,
  "collide_bottom": 3,
  "collide_top": 3,
  "collide_xz": 2,
  "collides": false,
  "controls": "",
  "gravity": 0,
  "jump_height": 1,
  "level_xp": 0,
  "life": 1,
  "life_max": 1,
  "lives": -1,
  "lock": {},
  "path_direction": 1,
  "path_end": "",
  "path_id": "",
  "path_point": 0,
  "scale_x": 1,
  "scale_y": 1,
  "scale_z": 1,
  "speed": 1,
  "turn_speed": 5
}
1
1
true
webgl_color_set()
{
  "blue": 0.3,
  "green": 0.2,
  "red": 0.1
}
function(result){
    const clearcolor = webgl.getParameter(webgl.COLOR_CLEAR_VALUE);
    return webgl_properties.clear_color[0] === .1
      && webgl_properties.clear_color[1] === .2
      && webgl_properties.clear_color[2] === .3
      && core_float_compare({
        'a': clearcolor[0],
        'b': .1,
        'precision': .001,
      })
      && core_float_compare({
        'a': clearcolor[1],
        'b': .2,
        'precision': .001,
      })
      && core_float_compare({
        'a': clearcolor[2],
        'b': .3,
        'precision': .001,
      });
}
undefined
true
webgl_get_position()
{
  "camera_rotate_x": 0,
  "camera_rotate_y": 0,
  "camera_rotate_z": 0,
  "camera_x": 0,
  "camera_y": 0,
  "camera_z": 0,
  "change_position_x": 0,
  "change_position_y": 0,
  "change_position_z": 0,
  "change_rotate_x": 0,
  "change_rotate_y": 0,
  "change_rotate_z": 0,
  "jump_allow": false,
  "keys": false,
  "locked": {},
  "pointer": false,
  "position_x": 23,
  "position_y": 0,
  "position_z": 0,
  "rotate_x": 0,
  "rotate_y": 0,
  "rotate_z": 0,
  "vehicle": false,
  "vehicle_stats": false,
  "id": "test_character_0",
  "level": 1,
  "spawn": {
    "position_x": 23
  },
  "automove": false,
  "camera_lock": true,
  "camera_zoom": 0,
  "collide_bottom": 3,
  "collide_top": 3,
  "collide_xz": 2,
  "collides": false,
  "controls": "",
  "gravity": 0,
  "jump_height": 1,
  "level_xp": 0,
  "life": 1,
  "life_max": 1,
  "lives": -1,
  "lock": {},
  "path_direction": 1,
  "path_end": "",
  "path_id": "",
  "path_point": 0,
  "scale_x": 1,
  "scale_y": 1,
  "scale_z": 1,
  "speed": 1,
  "turn_speed": 5
}
function(result){
    return result.x === 23;
}
{
  "x": 23,
  "y": 0,
  "z": 0
}
true
webgl_move_to()
{
  "move": {
    "camera_rotate_x": 0,
    "camera_rotate_y": 0,
    "camera_rotate_z": 0,
    "camera_x": 0,
    "camera_y": 0,
    "camera_z": 0,
    "change_position_x": 0,
    "change_position_y": 0,
    "change_position_z": 0,
    "change_rotate_x": 0,
    "change_rotate_y": 0,
    "change_rotate_z": 0,
    "jump_allow": false,
    "keys": false,
    "locked": {},
    "pointer": false,
    "position_x": 23,
    "position_y": 0,
    "position_z": 0,
    "rotate_x": 0,
    "rotate_y": 0,
    "rotate_z": 0,
    "vehicle": false,
    "vehicle_stats": false,
    "id": "test_character_0",
    "level": 1,
    "spawn": {
      "position_x": 23
    },
    "automove": false,
    "camera_lock": true,
    "camera_zoom": 0,
    "collide_bottom": 3,
    "collide_top": 3,
    "collide_xz": 2,
    "collides": false,
    "controls": "",
    "gravity": 0,
    "jump_height": 1,
    "level_xp": 0,
    "life": 1,
    "life_max": 1,
    "lives": -1,
    "lock": {},
    "path_direction": 1,
    "path_end": "",
    "path_id": "",
    "path_point": 0,
    "scale_x": 1,
    "scale_y": 1,
    "scale_z": 1,
    "speed": 1,
    "turn_speed": 5
  },
  "y": 23
}
function(result){
    return webgl_characters.test_character_0.position_y === 23;
}
undefined
true
webgl_normals()
{
  "rotate-x": 0,
  "rotate-y": 0,
  "rotate-z": 0,
  "vertices-length": 1
}
[
  0,
  1,
  0
]
[
  0,
  1,
  0
]
true
webgl_pick_color()
{
  "x": 0,
  "y": 0
}
[
  0,
  0,
  0,
  0
]
{
  "0": 0,
  "1": 0,
  "2": 0
}
true
webgl_stat_modify()
{
  "stat": "level",
  "target": {
    "camera_rotate_x": 0,
    "camera_rotate_y": 0,
    "camera_rotate_z": 0,
    "camera_x": 0,
    "camera_y": 0,
    "camera_z": 0,
    "change_position_x": 0,
    "change_position_y": 0,
    "change_position_z": 0,
    "change_rotate_x": 0,
    "change_rotate_y": 0,
    "change_rotate_z": 0,
    "jump_allow": false,
    "keys": false,
    "locked": {},
    "pointer": false,
    "position_x": 0,
    "position_y": 23,
    "position_z": 0,
    "rotate_x": 0,
    "rotate_y": 0,
    "rotate_z": 0,
    "vehicle": false,
    "vehicle_stats": false,
    "id": "test_character_0",
    "level": 1,
    "spawn": {
      "position_x": 23
    },
    "automove": false,
    "camera_lock": true,
    "camera_zoom": 0,
    "collide_bottom": 3,
    "collide_top": 3,
    "collide_xz": 2,
    "collides": false,
    "controls": "",
    "gravity": 0,
    "jump_height": 1,
    "level_xp": 0,
    "life": 1,
    "life_max": 1,
    "lives": -1,
    "lock": {},
    "path_direction": 1,
    "path_end": "",
    "path_id": "",
    "path_point": 0,
    "scale_x": 1,
    "scale_y": 1,
    "scale_z": 1,
    "speed": 1,
    "turn_speed": 5
  }
}
function(result){
    return webgl_characters.test_character_0.level === 2;
}
undefined
true
webgl_vertexcolorarray()
{
  "colors": [
    0,
    1,
    0,
    1
  ],
  "vertexcount": 2
}
[
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1
]
[
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1
]
true