/// <summary> /// Creates the in (with prefix "fu") and out parameters of the vertex shader, depending on the given ShaderEffectProps. /// </summary> /// <param name="effectProps">>The ShaderEffectProps.</param> /// <returns></returns> public static string InAndOutParams(ShaderEffectProps effectProps) { var vertProps = new List <string> { GLSL.CreateOut(GLSL.Type.Vec3, VaryingNameDeclarations.CameraPosition), GLSL.CreateOut(GLSL.Type.Vec4, VaryingNameDeclarations.Position) }; vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec3, UniformNameDeclarations.Vertex)); if (effectProps.MeshProbs.HasTangents && effectProps.MeshProbs.HasBiTangents) { vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec4, UniformNameDeclarations.TangentAttribName)); vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec3, UniformNameDeclarations.BitangentAttribName)); vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec4, VaryingNameDeclarations.Tangent)); vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec3, VaryingNameDeclarations.Bitangent)); } if (effectProps.MatProbs.HasSpecular) { vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec3, VaryingNameDeclarations.ViewDirection)); } if (effectProps.MeshProbs.HasWeightMap) { vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec4, UniformNameDeclarations.BoneIndex)); vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec4, UniformNameDeclarations.BoneWeight)); } if (effectProps.MeshProbs.HasNormals) { vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec3, UniformNameDeclarations.Normal)); vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec3, VaryingNameDeclarations.Normal)); } if (effectProps.MeshProbs.HasUVs) { vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec2, UniformNameDeclarations.TextureCoordinates)); vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec2, VaryingNameDeclarations.TextureCoordinates)); } if (effectProps.MeshProbs.HasColors) { vertProps.Add(GLSL.CreateIn(GLSL.Type.Vec4, UniformNameDeclarations.Color)); vertProps.Add(GLSL.CreateOut(GLSL.Type.Vec4, VaryingNameDeclarations.Color)); } return(string.Join("\n", vertProps)); }
/// <summary> /// Creates a single color (vec4) out parameter. /// </summary> public static string ColorOut() { return(GLSL.CreateOut(GLSL.Type.Vec4, OutColorName)); }