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
| varying vec2 v_vTexcoord; | |
| varying vec4 v_vColour; | |
| #pragma include("lighting.f.xsh") | |
| /// https://github.com/GameMakerDiscord/Xpanda | |
| uniform float lightBuckets; | |
| varying vec4 v_lightColour; |
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
| /// @param xx | |
| /// @param yy | |
| /// @param zz | |
| /// @param view_mat | |
| /// @param proj_mat | |
| /* | |
| Transforms a 3D world-space coordinate to a 2D window-space coordinate. Returns an array of the following format: | |
| [xx, yy] | |
| Returns [-1, -1] if the 3D point is not in view | |
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
| /// @description convert_2d_to_3d(x, y, view_mat, proj_mat) | |
| /// @param x | |
| /// @param y | |
| /// @param view_mat | |
| /// @param proj_mat | |
| /* | |
| Transforms a 2D coordinate (in window space) to a 3D vector. | |
| Returns an array of the following format: | |
| [dx, dy, dz, ox, oy, oz] | |
| where [dx, dy, dz] is the direction vector and [ox, oy, oz] is the origin of the ray. |
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
| // I haven't used this in anything yet, but TheSnidr on the GameMaker discord posted | |
| // this in response to a question about camera roll. He's usually pretty good at 3D | |
| // math so I'm going to assume it works. "roll" is the angle around the direction the | |
| // camera is looking at. Use for the view matrix. | |
| var c = dcos(roll); | |
| var s = dsin(roll) / max(math_get_epsilon(), sqrt(sqr(xdir) + sqr(ydir))); | |
| matrix_build_lookat(x, y, z, x + xdir, y + ydir, z + zdir, ydir * s, -xdir * s, c); |
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 triangle_normal(x1, y1, z1, x2, y2, z2, x3, y3, z3) { | |
| gml_pragma("forceinline"); | |
| var v1x = x2 - x1; | |
| var v1y = y2 - y1; | |
| var v1z = z2 - z1; | |
| var v2x = x3 - x1; | |
| var v2y = y3 - y1; | |
| var v2z = z3 - z1; | |
| var cx = v1y * v2z - v1z * v2y; | |
| var cy = -v1x * v2z + v1z * v2x; |
NewerOlder