Shader Varying Descriptors

From GiderosMobile
Revision as of 09:20, 15 November 2024 by Hgy29 (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2015.06.30<br/> '''Class:''' Shader<br/> === Description === Each varying entry is a lua table with the following fields: * '''n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2015.06.30
Class: Shader

Description

Each varying entry is a lua table with the following fields:

  • name: name of the varying . Must match the name used in GLSL program
  • type: type of data this varying holds. Must be one of Shader.CFLOAT,Shader.CFLOAT2, Shader.CFLOAT3,Shader.CFLOAT4, Shader.CINT

A varying is a variable passed between a vertex shader and a fragment shader.

Examples

local shadergrey=Shader.new("openglshader/vShaderGrey","openglshader/fShaderGrey", 0,
	{
	{name="vMatrix", type=Shader.CMATRIX, sys=Shader.SYS_WVP, vertex=true},
	{name="fColor", type=Shader.CFLOAT4, sys=Shader.SYS_COLOR, vertex=false},
	{name="fTexture", type=Shader.CTEXTURE, vertex=false},
	},
	{
	{name="vVertex", type=Shader.DFLOAT, mult=3, slot=0, offset=0},
	{name="vColor", type=Shader.DUBYTE, mult=4, slot=1, offset=0},
	{name="vTexCoord", type=Shader.DFLOAT, mult=2, slot=2, offset=0},
	},
	{
	{name="fTexCoord", type=Shader.CFLOAT2},
	}
)
local shaderwave=Shader.new("openglshader/vShaderWave","openglshader/fShaderWave", 0,
{
	{name="g_MVPMatrix", type=Shader.CMATRIX, sys=Shader.SYS_WVP, vertex=true},
	{name="g_Color", type=Shader.CFLOAT4, mult=1, sys=Shader.SYS_COLOR},
	{name="g_Texture", type=Shader.CTEXTURE, mult=1, vertex=false},
	{name="time", type=Shader.CFLOAT, mult=1, vertex=false}
	},
	{
	{name="POSITION0", type=Shader.DFLOAT, mult=3, slot=0, offset=0},
	{name="vColor", type=Shader.DUBYTE, mult=0, slot=1, offset=0},
	{name="TEXCOORD0", type=Shader.DFLOAT, mult=2, slot=2, offset=0}
	},
	{
	{name="fTexCoord", type=Shader.CFLOAT2},
	}
)