/** * Adds a global variable * * @param name The global name * @param dataType The global data type * @return */ protected ShaderVar addGlobal(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mGlobals.put(v.getName(), v); return v; }
/** * Varying variables provide the interface between the vertex shaders, the fragment shaders, and the fixed * functionality between them. Vertex shaders will compute values per vertex (such as color, texture * coordinates, etc.) and write them to variables declared with the varying qualifier. A vertex shader may * also read varying variables, getting back the same values it has written. Reading a varying variable in a * vertex shader returns undefined values if it is read before being written. * * @param name The varying name * @param dataType The varying data type * @return */ protected ShaderVar addVarying(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mVaryings.put(v.getName(), v); return v; }
/** * Add a uniform. The uniform qualifier is used to declare global variables whose values are the same across the entire * primitive being processed. All uniform variables are read-only and are initialized externally either at link * time or through the API. The link time initial value is either the value of the variable's initializer, if * present, or 0 if no initializer is present. Sampler types cannot have initializers. * * @param name The uniform name * @param dataType The uniform data type * @return */ protected ShaderVar addUniform(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mUniforms.put(v.getName(), v); return v; }
/** * The attribute qualifier is used to declare variables that are passed to a vertex shader from OpenGL on a * per-vertex basis. It is an error to declare an attribute variable in any type of shader other than a vertex * shader. Attribute variables are read-only as far as the vertex shader is concerned. Values for attribute * variables are passed to a vertex shader through the OpenGL vertex API or as part of a vertex array. They * convey vertex attributes to the vertex shader and are expected to change on every vertex shader run. The * attribute qualifier can be used only with float, floating-point vectors, and matrices. Attribute variables * cannot be declared as arrays or structures. * * @param name The attribute name * @param dataType The attribute data type * @return */ protected ShaderVar addAttribute(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mAttributes.put(v.getName(), v); return v; }
/** * Varying variables provide the interface between the vertex shaders, the fragment shaders, and the fixed * functionality between them. Vertex shaders will compute values per vertex (such as color, texture * coordinates, etc.) and write them to variables declared with the varying qualifier. A vertex shader may * also read varying variables, getting back the same values it has written. Reading a varying variable in a * vertex shader returns undefined values if it is read before being written. * * @param name The varying name * @param dataType The varying data type * @return */ protected ShaderVar addVarying(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mVaryings.put(v.getName(), v); return v; }
/** * Add a uniform. The uniform qualifier is used to declare global variables whose values are the same across the entire * primitive being processed. All uniform variables are read-only and are initialized externally either at link * time or through the API. The link time initial value is either the value of the variable's initializer, if * present, or 0 if no initializer is present. Sampler types cannot have initializers. * * @param name The uniform name * @param dataType The uniform data type * @return */ protected ShaderVar addUniform(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mUniforms.put(v.getName(), v); return v; }
/** * Adds a global variable * * @param name The global name * @param dataType The global data type * @return */ protected ShaderVar addGlobal(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mGlobals.put(v.getName(), v); return v; }
/** * Add a constant * * @param name * @param var * @return */ protected ShaderVar addConst(String name, ShaderVar var) { ShaderVar v = getInstanceForDataType(name, var.getDataType()); v.setValue(var.getValue()); v.isGlobal(true); mConstants.put(v.getName(), v); return v; }
/** * The attribute qualifier is used to declare variables that are passed to a vertex shader from OpenGL on a * per-vertex basis. It is an error to declare an attribute variable in any type of shader other than a vertex * shader. Attribute variables are read-only as far as the vertex shader is concerned. Values for attribute * variables are passed to a vertex shader through the OpenGL vertex API or as part of a vertex array. They * convey vertex attributes to the vertex shader and are expected to change on every vertex shader run. The * attribute qualifier can be used only with float, floating-point vectors, and matrices. Attribute variables * cannot be declared as arrays or structures. * * @param name The attribute name * @param dataType The attribute data type * @return */ protected ShaderVar addAttribute(String name, DataType dataType) { ShaderVar v = getInstanceForDataType(name, dataType); v.isGlobal(true); mAttributes.put(v.getName(), v); return v; }
/** * Add a constant * * @param name * @param var * @return */ protected ShaderVar addConst(String name, ShaderVar var) { ShaderVar v = getInstanceForDataType(name, var.getDataType()); v.setValue(var.getValue()); v.isGlobal(true); mConstants.put(v.getName(), v); return v; }