Search in sources :

Example 6 with ATexture

use of org.rajawali3d.materials.textures.ATexture in project Rajawali by Rajawali.

the class DiffuseTextureFragmentShaderFragment method main.

@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);
    }
}
Also used : ATexture(org.rajawali3d.materials.textures.ATexture)

Aggregations

ATexture (org.rajawali3d.materials.textures.ATexture)6 ArrayList (java.util.ArrayList)1 IMaterialPlugin (org.rajawali3d.materials.plugins.IMaterialPlugin)1 FragmentShader (org.rajawali3d.materials.shaders.FragmentShader)1 IShaderFragment (org.rajawali3d.materials.shaders.IShaderFragment)1 VertexShader (org.rajawali3d.materials.shaders.VertexShader)1 LightsFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.LightsFragmentShaderFragment)1 LightsVertexShaderFragment (org.rajawali3d.materials.shaders.fragments.LightsVertexShaderFragment)1 AlphaMapFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.texture.AlphaMapFragmentShaderFragment)1 DiffuseTextureFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.texture.DiffuseTextureFragmentShaderFragment)1 EnvironmentMapFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.texture.EnvironmentMapFragmentShaderFragment)1 NormalMapFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.texture.NormalMapFragmentShaderFragment)1 SkyTextureFragmentShaderFragment (org.rajawali3d.materials.shaders.fragments.texture.SkyTextureFragmentShaderFragment)1 CubeMapTexture (org.rajawali3d.materials.textures.CubeMapTexture)1