1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-30 21:38:22 +01:00
Diya-API/Diya/TotoShader.class.st

39 lines
789 B
Smalltalk
Raw Normal View History

2022-03-03 19:19:40 +01:00
Class {
#name : #TotoShader,
#superclass : #OpenGLSL,
#category : #'Diya-Shaders'
}
{ #category : #'as yet unclassified' }
TotoShader class >> fragmentShader [
^'
2022-03-03 23:23:43 +01:00
#ifdef GL_ES
precision highp float;
#endif
2022-03-03 19:19:40 +01:00
2022-03-03 23:23:43 +01:00
varying vec2 texcoord;
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main(void) {
2022-03-04 20:28:38 +01:00
gl_FragColor = vec4(1, 1, 1, texture2D(u_texture, texcoord).a) * vec4(1,1,1,1);
}'
2022-03-03 19:19:40 +01:00
]
{ #category : #'as yet unclassified' }
TotoShader class >> vertexShader [
^'
2022-03-03 23:23:43 +01:00
varying vec2 texcoord;
2022-03-03 19:19:40 +01:00
uniform mat4 u_projection;
2022-03-03 23:23:43 +01:00
void main(void) {
gl_Position = u_projection * vec4(gl_Vertex.xy, 0, 1);
texcoord = gl_Vertex.zw;
}'
]
2022-03-03 19:19:40 +01:00
2022-03-03 23:23:43 +01:00
{ #category : #initialization }
TotoShader >> setUpUniforms [
self addUniform: #u_texture of: Uniform1i.
2022-03-03 19:19:40 +01:00
]