VERSIÓ 1.3
- [NEW] shader.init(), shader.enable i shader.disable - [NEW] Deixe els shaders de Lynx i GBC de exemple. - [NEW] file_getfilebuffer() ara soporta un tercer paràmetre opcional, per a 'zeroterminar' el buffer per si es un arxiu de text.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
varying vec2 TEX0;
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
void main()
|
||||
{
|
||||
TEX0 = vec2(gl_MultiTexCoord0.x, 1.0-gl_MultiTexCoord0.y)*1.0001;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
uniform sampler2D Texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 winsize = vec2(640.0,480.0);
|
||||
vec2 pixpos = TEX0 * winsize;
|
||||
float y = floor(pixpos.y);
|
||||
if (mod(y,4.0) == 0.0)
|
||||
{
|
||||
vec4 color = texture2D(Texture, TEX0);
|
||||
vec4 blend = vec4(0.8, 0.8, 0.8, 1.0);
|
||||
gl_FragColor = color * blend;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_FragColor = texture2D(Texture, TEX0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
title=HOLA MINI
|
||||
config=minitest
|
||||
title=PAKU SIMBEL PROFANATION
|
||||
config=paku
|
||||
width=160
|
||||
height=120
|
||||
zoom=3
|
||||
height=144
|
||||
zoom=4
|
||||
|
||||
38
data/gbc.glsl
Normal file
38
data/gbc.glsl
Normal file
@@ -0,0 +1,38 @@
|
||||
varying vec2 tex_coord;
|
||||
varying vec2 pix_coord;
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
void main()
|
||||
{
|
||||
pix_coord = vec2(gl_MultiTexCoord0.x, 1.0-gl_MultiTexCoord0.y)*1.0001;
|
||||
tex_coord = vec2((gl_Vertex.x+1.0)*0.5, (-gl_Vertex.y+1.0)*0.5);
|
||||
vec4 pos = vec4(gl_Vertex.x * 2.0, gl_Vertex.y * 2.0, gl_Vertex.z, gl_Vertex.w);
|
||||
gl_Position = gl_Vertex; //(gl_Vertex*2)-vec3(1.0, 1.0, 1.0);//gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
uniform sampler2D Texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
float x = sign(pix_coord.x)*floor(abs(pix_coord.x)+0.5);
|
||||
float y = sign(pix_coord.y)*floor(abs(pix_coord.y)+0.5);
|
||||
float column = mod(x,4.0);
|
||||
float row = mod(y,4.0);
|
||||
vec4 color = texture2D(Texture, tex_coord);
|
||||
vec4 newcolor;
|
||||
if ((column == 0.0) || (row == 0.0) ) {
|
||||
newcolor = color * vec4(0.4, 0.4, 0.4, 1.0);
|
||||
} else if ((column == 1.0) || (row == 1.0) ) {
|
||||
newcolor = color * vec4(0.6, 0.7, 0.8, 1.0);
|
||||
} else if ((column == 3.0) || (row == 3.0) ) {
|
||||
newcolor = color * vec4(0.8, 0.7, 0.6, 1.0);
|
||||
} else {
|
||||
newcolor = color;
|
||||
}
|
||||
gl_FragColor = newcolor;
|
||||
}
|
||||
|
||||
#endif
|
||||
BIN
data/logo.gif
Normal file
BIN
data/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
37
data/lynx.glsl
Normal file
37
data/lynx.glsl
Normal file
@@ -0,0 +1,37 @@
|
||||
varying vec2 tex_coord;
|
||||
varying vec2 pix_coord;
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
void main()
|
||||
{
|
||||
pix_coord = vec2(gl_MultiTexCoord0.x, 1.0-gl_MultiTexCoord0.y)*1.0001;
|
||||
tex_coord = vec2((gl_Vertex.x+1.0)*0.5, (-gl_Vertex.y+1.0)*0.5);
|
||||
vec4 pos = vec4(gl_Vertex.x * 2.0, gl_Vertex.y * 2.0, gl_Vertex.z, gl_Vertex.w);
|
||||
gl_Position = gl_Vertex; //(gl_Vertex*2)-vec3(1.0, 1.0, 1.0);//gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
uniform sampler2D Texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
float x = sign(pix_coord.x)*floor(abs(pix_coord.x)+0.5);
|
||||
float column = mod(x,4.0);
|
||||
vec4 color = texture2D(Texture, tex_coord);
|
||||
color = color + vec4(0.5, 0.5, 0.5, 0.0) * (1.0-tex_coord.t);
|
||||
vec4 newcolor;
|
||||
if (column == 0.0) {
|
||||
newcolor = color * vec4(1.0, 0.4, 0.6, 1.0);
|
||||
} else if (column == 1.0) {
|
||||
newcolor = color * vec4(0.4, 1.0, 0.4, 1.0);
|
||||
} else if (column == 2.0) {
|
||||
newcolor = color * vec4(0.6, 0.4, 1.0, 1.0);
|
||||
} else {
|
||||
newcolor = color * vec4(0.2, 0.2, 0.2, 1.0);
|
||||
}
|
||||
gl_FragColor = newcolor;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,16 +3,30 @@ other = require "other"
|
||||
x=0
|
||||
|
||||
function mini.init()
|
||||
s = surf.load("tiles01.gif")
|
||||
s = surf.load("logo.gif")
|
||||
surf.source(s)
|
||||
p = pal.load("tiles01.gif")
|
||||
p = pal.load("logo.gif")
|
||||
pal.set(p)
|
||||
pal.trans(255)
|
||||
end
|
||||
|
||||
function mini.update()
|
||||
surf.cls(1)
|
||||
draw.surf(0, 0, 64, 64, 10, 10)
|
||||
if key.down(key.ESCAPE) then sys.quit() end
|
||||
draw.text(sys.fps(), 0, 0, 4)
|
||||
surf.cls(0)
|
||||
draw.surf(0, 0, 160, 144, 0, 0)
|
||||
|
||||
draw.text("PRESS START", 60, 110, 28)
|
||||
if key.press(key.ESCAPE) then sys.quit() end
|
||||
draw.text(sys.fps(), 1, 1, 28)
|
||||
|
||||
if key.press(key.N1) then
|
||||
shader.init("lynx.glsl")
|
||||
shader.enable()
|
||||
end
|
||||
if key.press(key.N2) then
|
||||
shader.init("gbc.glsl")
|
||||
shader.enable()
|
||||
end
|
||||
if key.press(key.N3) then
|
||||
shader.disable()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user