public ShaderAttribute(ShaderAttributeName nameParam, ShaderDataType dataTypeParam, int locationParam, int elementSizeParam) { name = nameParam; dataType = dataTypeParam; location = locationParam; elementSize = elementSizeParam; }
public ShaderAttribute(ShaderAttributeName nameParam, ShaderDataType dataTypeParam) { name = nameParam; dataType = dataTypeParam; location = -1; elementSize = -1; }
public static int getAttributeSizeElements(ShaderAttributeName name) { switch (name) { case ShaderAttributeName.Position: return(MeshData.getElementsInPosition()); case ShaderAttributeName.Normal: return(MeshData.getElementsInNormal()); case ShaderAttributeName.TexCoord: return(MeshData.getElementsInTexCoord()); default: return(0); } }
public static int getAttributeSizeBytes(ShaderAttributeName name) { switch (name) { case ShaderAttributeName.Position: return(MeshData.getPositionSizeBytes()); case ShaderAttributeName.Normal: return(MeshData.getNormalSizeBytes()); case ShaderAttributeName.TexCoord: return(MeshData.getTexCoordSizeBytes()); default: return(0); } }
public static ShaderAttribute getAttribute(ShaderAttributeName name, ShaderProgram shaderProgram) { foreach (ShaderAttribute attr in shaderProgram.attributes) { if (attr.name == name) { return(attr); } } Logger.LogError(Logger.ErrorState.Critical, "Did not get attribute " + ShaderUniformManager.GetSingleton().GetAttributeName(name)); ShaderAttribute invalid = new ShaderAttribute(ShaderAttributeName.InvalidAttributeName, ShaderDataType.InvalidType); return(invalid); }
public int GetAttributeLocation(ShaderAttributeName attribName) { foreach (ShaderAttribute a in attributes) { if (a.name == attribName) { return(a.location); } } ShaderUniformManager uniMan = ShaderUniformManager.GetSingleton(); Logger.LogError(Logger.ErrorState.Limited, "Attribute " + uniMan.GetAttributeName(attribName) + " location not found"); return(-1); }
public string GetAttributeName(ShaderAttributeName name) { switch (name) { case ShaderAttributeName.Position: return("aPosition"); case ShaderAttributeName.Normal: return("aNormal"); case ShaderAttributeName.TexCoord: return("aTexCoord"); case ShaderAttributeName.DiffuseColor: return("aDiffuseColor"); default: return(string.Empty); } }
private ShaderAttribute getAttribute(ShaderAttributeName name, List <ShaderAttribute> attributes) { ShaderAttribute result = new ShaderAttribute(); result.location = -1; foreach (ShaderAttribute a in attributes) { if (a.name.Equals(name)) { if (checkAttribute(a)) { result = a; } } } if (result.location == -1) { Logger.LogError(Logger.ErrorState.Limited, "Did not get attribute "); } return(result); }
private void AddSupportedAttribute(ShaderAttributeName name, ShaderDataType type) { supportedAttributes.Add(GetAttributeName(name), new ShaderAttribute(name, type)); }