mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Remove unneeded shaders
This commit is contained in:
parent
6673a39fa2
commit
ccef1b5e65
63
example/perspective2/main.go
Normal file
63
example/perspective2/main.go
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2014 Hajime Hoshi
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
"github.com/hajimehoshi/ebiten/ebitenutil"
|
||||
_ "image/jpeg"
|
||||
"log"
|
||||
)
|
||||
|
||||
const (
|
||||
screenWidth = 320
|
||||
screenHeight = 240
|
||||
)
|
||||
|
||||
type Game struct {
|
||||
gophersTexture *ebiten.Texture
|
||||
textRenderTarget *ebiten.RenderTarget
|
||||
}
|
||||
|
||||
func (g *Game) Update(gr ebiten.GraphicsContext) error {
|
||||
gr.PushRenderTarget(g.textRenderTarget)
|
||||
gr.Fill(0x80, 0x40, 0x40)
|
||||
ebitenutil.DebugPrint(gr, "Hello, World!")
|
||||
gr.PopRenderTarget()
|
||||
|
||||
gr.Fill(0x40, 0x40, 0x80)
|
||||
geo := ebiten.GeometryMatrixI()
|
||||
clr := ebiten.ColorMatrixI()
|
||||
ebiten.DrawWholeTexture(gr, g.textRenderTarget.Texture(), geo, clr)
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
g := new(Game)
|
||||
var err error
|
||||
g.gophersTexture, _, err = ebitenutil.NewTextureFromFile("images/gophers.jpg", ebiten.FilterNearest)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
g.textRenderTarget, err = ebiten.NewRenderTarget(screenWidth, screenHeight, ebiten.FilterNearest)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := ebiten.Run(g.Update, screenWidth, screenHeight, 2, "Perspective (Ebiten Demo)"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
@ -54,18 +54,6 @@ void main(void) {
|
||||
vertex_out_tex_coord1 = (modelview_matrix_n * vec4(tex_coord1, 0, 1)).xy;
|
||||
gl_Position = projection_matrix * modelview_matrix * vec4(vertex, 0, 1);
|
||||
}
|
||||
`,
|
||||
},
|
||||
// TODO: Now this shader is not used
|
||||
shaderFragment: {
|
||||
shaderType: gl.FRAGMENT_SHADER,
|
||||
source: `
|
||||
uniform sampler2D texture;
|
||||
varying vec2 vertex_out_tex_coord0;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(texture, vertex_out_tex_coord0);
|
||||
}
|
||||
`,
|
||||
},
|
||||
shaderColorMatrix: {
|
||||
@ -86,17 +74,6 @@ void main(void) {
|
||||
gl_FragColor.a = color0.a + color1.a - color0.a * color1.a;
|
||||
gl_FragColor.rgb = (color0.a * color0.rgb + (1.0 - color0.a) * color1.a * color1.rgb) / gl_FragColor.a;
|
||||
}
|
||||
`,
|
||||
},
|
||||
// TODO: Now this shader is not used
|
||||
shaderSolidColor: {
|
||||
shaderType: gl.FRAGMENT_SHADER,
|
||||
source: `
|
||||
uniform vec4 color;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = color;
|
||||
}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user