material

package
v0.0.0-...-23544e4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = Material{
	Name: "default",
	VertexShader: `#version 100
	precision mediump float;
	
	//mesh & camera position/view matrix
	uniform mat4 u_ModelViewProjection;
	
	//mesh attributes
	attribute vec3 a_Position;
	
	void main() {          
		gl_Position = u_ModelViewProjection * vec4(a_Position,1);
	}`,

	FragmentShader: `#version 100
	precision mediump float;
	
	//material uniform
	uniform vec3 u_Color;
	
	void main() {
		gl_FragColor = vec4((u_Color).rgb, 1.0);
	}`}
View Source
var Textured = Material{
	Name: "textured",
	VertexShader: `#version 100
	//Camera/Model
	uniform mat4 u_ModelViewProjection;  
	//Mesh
	attribute vec3 a_Position;
	attribute vec2 a_UV;
	
	// varying
	varying vec2  v_UV;
			
	void main(){
		v_UV = a_UV;
		gl_Position = u_ModelViewProjection * vec4(a_Position,1);
	}`,

	FragmentShader: `#version 100
	precision mediump float;
	
	//material 
	uniform sampler2D u_Texture0;
	
	//mesh
	varying vec2 v_UV;
	
	void main() {
		gl_FragColor = texture2D(u_Texture0, v_UV); 
	}`}

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Material *Material

	Color    *color.Color     //u_Color
	Texture0 *texture.Texture //u_Texture0
}

func (*Instance) String

func (instance *Instance) String() string

type Material

type Material struct {
	Name           string      `json:"name"`
	VertexShader   string      `json:"vert"`
	FragmentShader string      `json:"frag"`
	Native         interface{} `json:"-"`
}

func (*Material) Instance

func (m *Material) Instance() *Instance

func (*Material) String

func (m *Material) String() string

Jump to

Keyboard shortcuts

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