@Override public void initialize() { super.initialize(); muEmissionTexture = (RSampler2D) addUniform(U_EMISSION_TEXTURE, DataType.SAMPLER2D); }
/** * 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 var A global shader variable * @return */ protected ShaderVar addAttribute(IGlobalShaderVar var) { return addAttribute(var.getVarString(), var.getDataType()); }
/** * Add a constant * * @param name * @param value * @return */ protected ShaderVar addConst(String name, double value) { return addConst(name, (float)value); }
@Test public void testGetShaderString() { AShader s = new AShader() { @Override public void main() { } }; s.initialize(); s.buildShader(); assertEquals("\n" + "void main() {\n" + "}\n", s.getShaderString()); }
@Override public void applyParams() { super.applyParams(); GLES20.glUniform1f(muColorInfluenceHandle, mColorInfluence); }
/** * 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 var A global shader variable * @param index The index for the shader variable. This number will appear suffixed in the final shader string. * @return */ protected ShaderVar addUniform(IGlobalShaderVar var, int index) { return addUniform(var.getVarString() + Integer.toString(index), var.getDataType()); }
/** * Adds a global variable * * @param var A global shader variable * @param index The index for the shader variable. This number will appear suffixed in the final shader string. * @return */ protected ShaderVar addGlobal(IGlobalShaderVar var, int index) { return addGlobal(var.getVarString() + Integer.toString(index), var.getDataType()); }
/** * 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 var A global shader variable * @param index The index for the shader variable. This number will appear suffixed in the final shader string. * @return */ protected ShaderVar addVarying(IGlobalShaderVar var, int index) { return addVarying(var.getVarString() + Integer.toString(index), var.getDataType()); }
public ShaderVar castInt(float value) { return castInt(Float.toString(value)); }
public ShaderVar castMat3(float value) { return castMat3(new RFloat(value)); }
public ShaderVar castMat4(float value) { return castMat4(new RFloat(Float.toString(value))); }
s.initialize(); s.buildShader(); assertEquals("\n" + "void main() {\n" + "v.y = 0.0;\n" + "v.y = (0+0);\n" + "}\n", s.getShaderString());
@Override public void applyParams() { super.applyParams(); GLES20.glUniform1f(muFarPlaneHandle, mFarPlane); }
/** * 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 var A global shader variable. * @return */ protected ShaderVar addUniform(IGlobalShaderVar var) { return addUniform(var.getVarString(), var.getDataType()); }
/** * Adds a global variable * * @param var A global shader variable * @return */ protected ShaderVar addGlobal(IGlobalShaderVar var) { return addGlobal(var.getVarString(), var.getDataType()); }
/** * 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 var * @return */ protected ShaderVar addVarying(IGlobalShaderVar var) { return addVarying(var.getVarString(), var.getDataType()); }
public ShaderVar castInt(ShaderVar value) { return castInt(value.getVarName()); }
public ShaderVar castMat3(float value) { return castMat3(new RFloat(value)); }
public ShaderVar castMat4(float value) { return castMat4(new RFloat(Float.toString(value))); }
@Override public void initialize() { super.initialize(); muAlpha = (RFloat) addUniform(U_ALPHA, DataType.FLOAT); }