pixelshader

package module
v0.0.0-...-fc3de36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 4 Imported by: 1

README

pixelShader

A pixel shader for engo

Pretty straightforward. Creates a pixel shader using the provided FragShader. Play with neat designs and such from places like Shader Toy right inside your engo games! The demo shows off how to use it in engo.

The fragment shader has access to three uniforms. If you think of more, submit a PR or create an issue and I can add it. The uniforms are the following:

uniform vec2 u_resolution;  // Canvas size (width,height)
uniform vec2 u_mouse;       // mouse position in screen pixels
uniform float u_time;       // Time in seconds since load
uniform sampler2D u_tex0;   // Drawable Tex0
uniform sampler2D u_tex1;   // Drawable Tex1
uniform sampler2D u_tex2;   // Drawable Tex2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PixelRegion

type PixelRegion struct {
	// Tex0, Tex1 and Tex2 are textures available to the shader
	// They're available as u_tex0, u_tex1, and u_tex2
	// Note: The position for the textures is opposite the frag coordinates
	// Due to OpenGL storing the textures flipped on the y-axis.
	// so if
	// vec2 p = gl_FragCoord.xy/u_resolution.xy;
	// the coordinate positions are
	// vec2 texPos = vec2(p.x, -p.y);
	Tex0, Tex1, Tex2 *common.Texture
}

PixelRegion is a drawable to use with the pixel shader!

func (PixelRegion) Close

func (p PixelRegion) Close()

func (PixelRegion) Height

func (p PixelRegion) Height() float32

func (PixelRegion) Texture

func (p PixelRegion) Texture() *gl.Texture

func (PixelRegion) View

func (p PixelRegion) View() (float32, float32, float32, float32)

func (PixelRegion) Width

func (p PixelRegion) Width() float32

type PixelShader

type PixelShader struct {
	FragShader string
	// contains filtered or unexported fields
}

func (*PixelShader) Draw

func (s *PixelShader) Draw(render *common.RenderComponent, space *common.SpaceComponent)

func (*PixelShader) Post

func (s *PixelShader) Post()

func (*PixelShader) Pre

func (s *PixelShader) Pre()

func (*PixelShader) SetCamera

func (s *PixelShader) SetCamera(c *common.CameraSystem)

func (*PixelShader) Setup

func (s *PixelShader) Setup(w *ecs.World) error

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL