-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some shaders and frame loop going
- Loading branch information
Showing
21 changed files
with
319 additions
and
97 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"recommendations": ["danielgavin.ols", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] | ||
"recommendations": [ | ||
"danielgavin.ols", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"raczzalan.webgl-glsl-editor" | ||
] | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// fragment shaders don't have a default precision so we need | ||
// to pick one. mediump is a good default | ||
precision mediump float; | ||
|
||
// color varying received from vertex shader | ||
varying vec4 v_color; | ||
|
||
void main() { | ||
// gl_FragColor is a special variable a fragment shader is responsible for setting | ||
gl_FragColor = v_color; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// an attribute will receive data from a buffer | ||
attribute vec2 a_position; | ||
attribute vec4 a_color; | ||
uniform vec2 u_resolution; | ||
// color to pass to the fragment shader | ||
// value in fragment shader will be interpolated | ||
varying vec4 v_color; | ||
|
||
void main() { | ||
// from pixels to 0->1 then to 0->2 then to -1->+1 (clipspace) | ||
vec2 clip_space = (a_position / u_resolution) * 2.0 - 1.0; | ||
|
||
gl_Position = vec4(clip_space * vec2(1, -1), 0, 1); | ||
|
||
// Convert from clip space to color space. | ||
// Clip space goes -1.0 to +1.0 | ||
// Color space goes from 0.0 to 1.0 | ||
// v_color = 1.0 - (gl_Position * 0.5 + 0.5); | ||
v_color = a_color; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as wasm from "../wasm/runtime.js" | ||
|
||
export interface WasmExports extends wasm.OdinExports { | ||
frame: (time: number, ctx_ptr: number) => void | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {} |
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.