This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Basic FXAA implementation based on the code on geeks3d.com with the | |
| modification that the texture2DLod stuff was removed since it's | |
| unsupported by WebGL. | |
| GameMaker-ized by dragonitespam. | |
| -- | |
| From: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Feather disable all | |
| // @ignore | |
| /* | |
| function Drago3D_Internals() { | |
| static Vertex = function(vbuff, x, y, z, nx, ny, nz, u, v, c, a) { | |
| vertex_position_3d(vbuff, x, y, z); | |
| vertex_normal(vbuff, nx, ny, nz); | |
| vertex_colour(vbuff, c, a); | |
| vertex_texcoord(vbuff, u, v); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function tilemap_to_vertex_buffer(tilemap, format) { | |
| // vertex format: position, normal, texture | |
| var vbuff = vertex_create_buffer(); | |
| vertex_begin(vbuff, format); | |
| var ts_tileset = tilemap_get_tileset(tilemap); | |
| var ts_tex = tileset_get_texture(ts_tileset); | |
| var ts_uvs = tileset_get_uvs(ts_tileset); | |
| var ts_tex_width = texture_get_texel_width(ts_tex); | |
| var ts_tex_height = texture_get_texel_height(ts_tex); | |
| var ts_tile_width = tilemap_get_tile_width(tilemap); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function draw_ngon(x, y, n, length, rot) { | |
| draw_primitive_begin(pr_trianglefan); | |
| draw_vertex_colour(x, y, c_white, 1); | |
| for (var i = 0; i <= n; i++) { | |
| var angle = 2 * pi / n * i + rot; | |
| draw_vertex_colour(x + length * cos(angle), y - length * sin(angle), make_colour_hsv(255 / (n + 1) * i, 255, 255), 1); | |
| } | |
| draw_primitive_end(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum InputVerbs { | |
| A, B, X, Y, | |
| LEFT, RIGHT, UP, DOWN, | |
| LOOK_LEFT, LOOK_RIGHT, LOOK_UP, LOOK_DOWN, | |
| PAD_LEFT, PAD_RIGHT, PAD_UP, PAD_DOWN, | |
| PAUSE, UNPAUSE, RUN, | |
| FRIEND_ATTACK, | |
| FRIEND_DEFEND, | |
| SHOULDERR2, // unused | |
| SPELL_FIRE, SPELL_WATER, SPELL_THUNDER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ds_collection_create() { | |
| return [[undefined], 0, 0]; | |
| } | |
| function ds_collection_add(collection, value) { | |
| collection[@ 2]++; | |
| var arr = collection[@ 0]; | |
| if (array_length(arr) <= collection[@ 1]) { | |
| var new_arr = array_create(array_length(arr) * 2, undefined); | |
| array_copy(new_arr, 0, arr, 0, array_length(arr)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function string_hex(value, padding) { | |
| if (padding == undefined) padding = 0; | |
| var s = sign(value); | |
| var v = abs(value); | |
| var output = ""; | |
| while (v > 0) { | |
| var c = v & 0xf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hex(str) { | |
| var result = 0; | |
| // special unicode values | |
| static ZERO = ord("0"); | |
| static NINE = ord("9"); | |
| static A = ord("A"); | |
| static F = ord("F"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| attribute vec3 in_Position; // (x,y,z) | |
| //attribute vec3 in_Normal; // (x,y,z) unused in this shader. | |
| attribute vec4 in_Colour; // (r,g,b,a) | |
| attribute vec2 in_TextureCoord; // (u,v) | |
| varying vec2 v_vTexcoord; | |
| varying vec4 v_vColour; | |
| void main() { | |
| vec4 object_space_pos = vec4(in_Position, 1.); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function NVec2(_x, _y) { | |
| x = _x; | |
| y = _y; | |
| Add = function(_val) { | |
| return new NVec2(x + _val.x, y + _val.y); | |
| } | |
| Sub = function(_val) { | |
| return new NVec2(x - _val.x, y - _val.y); |
NewerOlder