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
| //PROTOTYPE PROTOTYPE PROTOTYPE PROTOTYPE PROTOTYPE | |
| function ShaderManager() { | |
| const state = { | |
| gl: canvas.getContext("webgl2"), | |
| mode: null, | |
| program: null, | |
| arrayBuffer: null, | |
| indexBuffer: null, | |
| vertexArray: null, |
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
| func QueryOpenGL(){ | |
| var currentQuery int32 | |
| gl.GetIntegerv(gl.MAX_3D_TEXTURE_SIZE, ¤tQuery) | |
| fmt.Print("\nMAX_3D_TEXTURE_SIZE : ", int(currentQuery)) | |
| gl.GetIntegerv(gl.MAX_ARRAY_TEXTURE_LAYERS, ¤tQuery) | |
| fmt.Print("\nMAX_ARRAY_TEXTURE_LAYERS : ", int(currentQuery)) | |
| gl.GetIntegerv(gl.MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, ¤tQuery) | |
| fmt.Print("\nMAX_ATOMIC_COUNTER_BUFFER_BINDINGS : ", int(currentQuery)) | |
| gl.GetIntegerv(gl.MAX_ATOMIC_COUNTER_BUFFER_SIZE, ¤tQuery) | |
| fmt.Print("\nMAX_ATOMIC_COUNTER_BUFFER_SIZE : ", int(currentQuery)) |
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
| package shader | |
| import ( | |
| "fmt" | |
| "strings" | |
| "io/ioutil" | |
| "github.com/go-gl/gl/v3.3-core/gl" | |
| ) | |
| type Shader struct { |
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
| package glutils | |
| import ( | |
| "fmt" | |
| "unsafe" | |
| "shader" | |
| "github.com/go-gl/gl/v3.3-core/gl" | |
| "github.com/go-gl/glfw/v3.2/glfw" | |
| ) |
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
| const rangeIntersect = (min0, max0, min1, max1) => | |
| Math.max(min0, max0) >= Math.min(min1, max1) && Math.min(min0, max0) <= Math.max(min1, max1) | |
| const elementsIntersect = (element1, element2) => { | |
| const r0 = element1.getBoundingClientRect() | |
| const r1 = element2.getBoundingClientRect() | |
| return rangeIntersect(r0.left, r0.right, r1.left, r1.right) && rangeIntersect(r0.top, r0.bottom, r1.top, r1.bottom) | |
| } | |
| const testColision = (selector1, selector2, callback) => |
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
| const playFromSoundCloud = async function (url) { | |
| const uri = encodeURIComponent(url) | |
| const link = `https://api.soundcloud.com/resolve.json?url=${uri}&client_id=17a992358db64d99e492326797fff3e8` | |
| const response = await fetch(link).then(res => res.json()).then(json => json) | |
| const audio = document.createElement('audio') | |
| audio.crossOrigin = "anonymous" | |
| audio.src = `http://api.soundcloud.com/tracks/${response.id}/stream?client_id=17a992358db64d99e492326797fff3e8` | |
| audio.play() | |
| return audio |
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
| document.querySelectorAll('img').forEach(e => { | |
| let url = e.src | |
| let name = url.slice(-20) | |
| let a = document.createElement("a") | |
| a.download = `${name}.png` | |
| a.href = url | |
| document.body.appendChild(a); | |
| a.click() | |
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
| const Colliders = (e => { | |
| const abs = (num) => Math.abs(num) | |
| class BaseSprite { | |
| constructor(x, y, w, h) { | |
| this.x = x | |
| this.y = y | |
| this.width = w | |
| this.height = h |
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
| const C$ = (str = 'html', all = false) => !all ? document.querySelector(str) : document.querySelectorAll(str); | |
| const sin = Math.sin | |
| const cos = Math.cos | |
| const abs = Math.abs | |
| const int = Number.parseInt | |
| const float = Number.parseFloat | |
| const rand = Math.random | |
| const u = (_ => { |
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
| (()=>{ | |
| const timeout = window.setTimeout, interval = window.setInterval | |
| let intervals = [], timeouts = [] | |
| window.setTimeout = (cb, tm, rv) => (timeouts.push(rv = timeout(cb, tm)), rv) | |
| window.setInterval = (cb, tm, rv) => (intervals.push(rv = interval(cb, tm)), rv) | |
| window.clearAllTimeouts = () => {timeouts.map(e => clearTimeout(e)); timeouts = []} | |
| window.clearAllIntervals = () => {intervals.map(e => clearInterval(e)); intervals = []} | |
| })() |