Java Code Examples for com.jme3.scene.VertexBuffer#Format

The following examples show how to use com.jme3.scene.VertexBuffer#Format . 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: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertVertexFormat(VertexBuffer.Format fmt) {
    switch (fmt) {
        case Byte:
            return gl.GL_BYTE;
        case Double:
            return gl.GL_DOUBLE;
        case Float:
            return gl.GL_FLOAT;
        case Half:
            return gl.GL_HALF_FLOAT_ARB;
        case Int:
            return gl.GL_INT;
        case Short:
            return gl.GL_SHORT;
        case UnsignedByte:
            return gl.GL_UNSIGNED_BYTE;
        case UnsignedInt:
            return gl.GL_UNSIGNED_INT;
        case UnsignedShort:
            return gl.GL_UNSIGNED_SHORT;
        default:
            throw new UnsupportedOperationException("Unrecognized vertex format: " + fmt);
    }
}
 
Example 2
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected int convertVertexFormat(VertexBuffer.Format fmt) {
    switch (fmt) {
        case Byte:
            return GL.GL_BYTE;
        case Double:
            return GL2GL3.GL_DOUBLE;
        case Float:
            return GL.GL_FLOAT;
        case Half:
            return GL.GL_HALF_FLOAT;
        case Int:
            return GL2ES2.GL_INT;
        case Short:
            return GL.GL_SHORT;
        case UnsignedByte:
            return GL.GL_UNSIGNED_BYTE;
        case UnsignedInt:
            return GL2ES2.GL_UNSIGNED_INT;
        case UnsignedShort:
            return GL.GL_UNSIGNED_SHORT;
        default:
            throw new UnsupportedOperationException("Unrecognized vertex format: " + fmt);
    }
}
 
Example 3
Source File: SilentTangentBinormalGenerator.java    From OpenRTS with MIT License 5 votes vote down vote up
private static void bulkPut(VertexBuffer.Format format, Buffer buf1, Buffer buf2) {
	switch (format) {
		case Byte:
		case Half:
		case UnsignedByte:
			((ByteBuffer) buf1).put((ByteBuffer) buf2);
			break;
		case Short:
		case UnsignedShort:

			((ShortBuffer) buf1).put((ShortBuffer) buf2);
			break;

		case Int:
		case UnsignedInt:
			((IntBuffer) buf1).put((IntBuffer) buf2);
			break;
		case Float:

			((FloatBuffer) buf1).put((FloatBuffer) buf2);
			break;
		case Double:
			((DoubleBuffer) buf1).put((DoubleBuffer) buf2);
			break;

		default:
			throw new UnsupportedOperationException("Unrecoginized buffer format: " + format);
	}
}
 
Example 4
Source File: SilentTangentBinormalGenerator.java    From OpenRTS with MIT License 5 votes vote down vote up
private static void putValue(VertexBuffer.Format format, Buffer buf1, Buffer buf2, int index) {
	switch (format) {
		case Byte:
		case Half:
		case UnsignedByte:
			byte b = ((ByteBuffer) buf2).get(index);
			((ByteBuffer) buf1).put(b);
			break;
		case Short:
		case UnsignedShort:
			short s = ((ShortBuffer) buf2).get(index);
			((ShortBuffer) buf1).put(s);
			break;

		case Int:
		case UnsignedInt:
			int i = ((IntBuffer) buf2).get(index);
			((IntBuffer) buf1).put(i);
			break;
		case Float:
			float f = ((FloatBuffer) buf2).get(index);
			((FloatBuffer) buf1).put(f);
			break;
		case Double:
			double d = ((DoubleBuffer) buf2).get(index);
			((DoubleBuffer) buf1).put(d);
			break;
		default:
			throw new UnsupportedOperationException("Unrecoginized buffer format: " + format);
	}
}
 
Example 5
Source File: AbstractRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License votes vote down vote up
protected abstract int convertVertexFormat(VertexBuffer.Format fmt);