@Override public void main() { super.main(); RVec4 color = (RVec4) getGlobal(DefaultShaderVar.G_COLOR); RVec4 skyColor = new RVec4("skyColor"); RVec3 texCoord = (RVec3) getGlobal(DefaultShaderVar.V_CUBE_TEXTURE_COORD); int cubeMapCount = 0; for (int i = 0; i < mTextures.size(); ++i) { if(mTextures.get(i).getTextureType() == TextureType.CUBE_MAP) { skyColor.assign(textureCube(muCubeTextures[cubeMapCount++], texCoord)); } skyColor.assignMultiply(muInfluence[i]); color.assignAdd(skyColor); } }
@Override public void main() { super.main(); RVec4 color = (RVec4)getGlobal(DefaultShaderVar.G_COLOR); RVec2 textureCoord = (RVec2)getGlobal(DefaultShaderVar.G_TEXTURE_COORD); RVec4 texColor = new RVec4("texColor"); for(int i=0; i<mTextures.size(); i++) { ATexture texture = mTextures.get(i); if(texture.offsetEnabled()) textureCoord.assignAdd(getGlobal(DefaultShaderVar.U_OFFSET, i)); if(texture.getWrapType() == WrapType.REPEAT) textureCoord.assignMultiply(getGlobal(DefaultShaderVar.U_REPEAT, i)); if(texture.getTextureType() == TextureType.VIDEO_TEXTURE) texColor.assign(texture2D(muVideoTextures[videoTextureMap.indexOf(i)], textureCoord)); else texColor.assign(texture2D(muTextures[textureMap.indexOf(i)], textureCoord)); texColor.assignMultiply(muInfluence[i]); color.assignAdd(texColor); } }
specColor.assign(texture2D(muTextures[i], textureCoord)); specColor.assignMultiply(muInfluence[i]); specMapColor.assignAdd(specColor);
specColor.assign(texture2D(muTextures[i], textureCoord)); specColor.assignMultiply(muInfluence[i]); specMapColor.assignAdd(specColor);
color.assignAdd(cmColor);
@Override public void main() { super.main(); RVec4 color = (RVec4)getGlobal(DefaultShaderVar.G_COLOR); RVec2 textureCoord = (RVec2)getGlobal(DefaultShaderVar.G_TEXTURE_COORD); RVec4 texColor = new RVec4("texColor"); for(int i=0; i<mTextures.size(); i++) { ATexture texture = mTextures.get(i); if(texture.offsetEnabled()) textureCoord.assignAdd(getGlobal(DefaultShaderVar.U_OFFSET, i)); if(texture.getWrapType() == WrapType.REPEAT) textureCoord.assignMultiply(getGlobal(DefaultShaderVar.U_REPEAT, i)); if(texture.getTextureType() == TextureType.VIDEO_TEXTURE) texColor.assign(texture2D(muVideoTextures[i], textureCoord)); else texColor.assign(texture2D(muTextures[i], textureCoord)); texColor.assignMultiply(muInfluence[i]); color.assignAdd(texColor); } }
@Override public void main() { super.main(); RVec4 color = (RVec4) getGlobal(DefaultShaderVar.G_COLOR); RVec4 skyColor = new RVec4("skyColor"); RVec3 texCoord = (RVec3) getGlobal(DefaultShaderVar.V_CUBE_TEXTURE_COORD); int cubeMapCount = 0; for (int i = 0; i < mTextures.size(); ++i) { if(mTextures.get(i).getTextureType() == TextureType.CUBE_MAP) { skyColor.assign(textureCube(muCubeTextures[cubeMapCount++], texCoord)); } skyColor.assignMultiply(muInfluence[i]); color.assignAdd(skyColor); } }
color.assignAdd(cmColor);
horizEdge.assignSubtract(texture2D( uTexture, pos).multiply(1)); pos.assign("vec2( vTextureCoord.x + uSobel.x, vTextureCoord.y - uSobel.y )"); horizEdge.assignAdd(texture2D( uTexture, pos).multiply(1)); pos.assign("vec2( vTextureCoord.x + uSobel.x, vTextureCoord.y )"); horizEdge.assignAdd(texture2D( uTexture, pos).multiply(2)); pos.assign("vec2( vTextureCoord.x + uSobel.x, vTextureCoord.y + uSobel.y )"); horizEdge.assignAdd(texture2D( uTexture, pos).multiply(1)); vertEdge.assignSubtract(texture2D( uTexture, pos).multiply(1)); pos.assign("vec2( vTextureCoord.x - uSobel.x, vTextureCoord.y + uSobel.y )"); vertEdge.assignAdd(texture2D( uTexture, pos).multiply(1)); pos.assign("vec2( vTextureCoord.x , vTextureCoord.y + uSobel.y )"); vertEdge.assignAdd(texture2D( uTexture, pos).multiply(2)); pos.assign("vec2( vTextureCoord.x + uSobel.x, vTextureCoord.y + uSobel.y )"); vertEdge.assignAdd(texture2D( uTexture, pos).multiply(1));
@Override public void main() { RVec2 textureCoord = (RVec2)getGlobal(DefaultShaderVar.G_TEXTURE_COORD); RVec4 emissionCol = new RVec4("emissionCol"); emissionCol.assign(texture2D(muEmissionTexture, textureCoord)); RVec4 color = (RVec4) getGlobal(DefaultShaderVar.G_COLOR); color.assignAdd(emissionCol); } }