Java Code Examples for com.jme3.texture.Texture#WrapMode

The following examples show how to use com.jme3.texture.Texture#WrapMode . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GltfLoader.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public Texture2D readSampler(int samplerIndex, Texture2D texture) throws IOException {
    if (samplers == null) {
        throw new AssetLoadException("No samplers defined");
    }
    JsonObject sampler = samplers.get(samplerIndex).getAsJsonObject();
    Texture.MagFilter magFilter = getMagFilter(getAsInteger(sampler, "magFilter"));
    Texture.MinFilter minFilter = getMinFilter(getAsInteger(sampler, "minFilter"));
    Texture.WrapMode wrapS = getWrapMode(getAsInteger(sampler, "wrapS"));
    Texture.WrapMode wrapT = getWrapMode(getAsInteger(sampler, "wrapT"));

    if (magFilter != null) {
        texture.setMagFilter(magFilter);
    }
    if (minFilter != null) {
        texture.setMinFilter(minFilter);
    }
    texture.setWrap(Texture.WrapAxis.S, wrapS);
    texture.setWrap(Texture.WrapAxis.T, wrapT);

    texture = customContentManager.readExtensionAndExtras("texture.sampler", sampler, texture);

    return texture;
}
 
Example 2
Source File: GdxRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
        switch (mode) {
//            case BorderClamp:
//                return GLES20.GL_CLAMP_TO_BORDER;
//            case Clamp:
//                return GLES20.GL_CLAMP;
            case EdgeClamp:
                return GL20.GL_CLAMP_TO_EDGE;
            case Repeat:
                return GL20.GL_REPEAT;
            case MirroredRepeat:
                return GL20.GL_MIRRORED_REPEAT;
            default:
                throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
        }
    }
 
Example 3
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
    switch (mode) {
        case BorderClamp:
            return gl.GL_CLAMP_TO_BORDER;
        case Clamp:
            return gl.GL_CLAMP;
        case EdgeClamp:
            return gl.GL_CLAMP_TO_EDGE;
        case Repeat:
            return gl.GL_REPEAT;
        case MirroredRepeat:
            return gl.GL_MIRRORED_REPEAT;
        default:
            throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
    }
}
 
Example 4
Source File: OGLESShaderRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
        switch (mode) {
//            case BorderClamp:
//                return GLES20.GL_CLAMP_TO_BORDER;
//            case Clamp:
//                return GLES20.GL_CLAMP;
            case EdgeClamp:
                return GLES20.GL_CLAMP_TO_EDGE;
            case Repeat:
                return GLES20.GL_REPEAT;
            case MirroredRepeat:
                return GLES20.GL_MIRRORED_REPEAT;
            default:
                throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
        }
    }
 
Example 5
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
    switch (mode) {
        case BorderClamp:
            return GL2GL3.GL_CLAMP_TO_BORDER;
        case Clamp:
            return GL2.GL_CLAMP;
        case EdgeClamp:
            return GL.GL_CLAMP_TO_EDGE;
        case Repeat:
            return GL.GL_REPEAT;
        case MirroredRepeat:
            return GL.GL_MIRRORED_REPEAT;
        default:
            throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
    }
}
 
Example 6
Source File: LwjglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
    switch (mode) {
        case BorderClamp:
            return GL_CLAMP_TO_BORDER;
        case Clamp:
            return GL_CLAMP;
        case EdgeClamp:
            return GL_CLAMP_TO_EDGE;
        case Repeat:
            return GL_REPEAT;
        case MirroredRepeat:
            return GL_MIRRORED_REPEAT;
        default:
            throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
    }
}
 
Example 7
Source File: GltfUtils.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Texture.WrapMode getWrapMode(Integer value) {
    if (value == null) {
        return Texture.WrapMode.Repeat;
    }
    switch (value) {
        case 33071:
            return Texture.WrapMode.EdgeClamp;
        case 33648:
            return Texture.WrapMode.MirroredRepeat;
        default:
            return Texture.WrapMode.Repeat;
    }
}
 
Example 8
Source File: GLRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
    switch (mode) {
        case BorderClamp:
        case Clamp:
        case EdgeClamp:
            // Falldown intentional.
            return GL.GL_CLAMP_TO_EDGE;
        case Repeat:
            return GL.GL_REPEAT;
        case MirroredRepeat:
            return GL.GL_MIRRORED_REPEAT;
        default:
            throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
    }
}