Example #1
0
// CreateShader creates one of the known shaders. This is expected to be used by
// eng.LoadShader when a shader is not already in the cache. Nil is returned for
// unrecognized shaders. This function contains the list of official shader names.
func CreateShader(shaderName string, sh *data.Shader) {
	sh.Name = shaderName
	switch shaderName {
	case "flat":
		flatShader(sh)
	case "flata":
		flataShader(sh)
	case "gouraud":
		gouraudShader(sh)
	case "phong":
		phongShader(sh)
	case "uv":
		uvShader(sh)
	case "uva":
		uvaShader(sh)
	case "uvra":
		uvraShader(sh)
	case "uvm":
		uvmShader(sh)
	case "wave":
		waveShader(sh)
	case "bb":
		bbShader(sh)
	case "bba":
		bbaShader(sh)
	case "bbra":
		bbraShader(sh)
	default:
		sh.Name = "" // couldn't find the shader.
	}
}