package speiger.src.coreengine.rendering.tesselation.commands;

import java.nio.ByteBuffer;

public class DrawArraysIndirectCommand implements IndirectCommand {
    int count;
    int primCount;
    int first;
    int baseInstance;
    
    public DrawArraysIndirectCommand() {}
    
	public DrawArraysIndirectCommand(int count, int primCount, int first, int baseInstance) {
		set(count, primCount, first, baseInstance);
	}
	
	@Override
	public DrawArraysIndirectCommand write(ByteBuffer buffer) {
		buffer.putInt(count).putInt(primCount).putInt(first).putInt(baseInstance);
		return this;
	}
	
	@Override
	public DrawArraysIndirectCommand read(ByteBuffer buffer) {
		count = buffer.getInt();
		primCount = buffer.getInt();
		first = buffer.getInt();
		baseInstance = buffer.getInt();
		return this;
	}

	public int getCount() { return count; }
	public int getPrimCount() { return primCount; }
	public int getFirst() { return first; }
	public int getBaseInstance() { return baseInstance; }
	
	public DrawArraysIndirectCommand set(int count, int primCount, int first, int baseInstance) {
		this.count = count;
		this.primCount = primCount;
		this.first = first;
		this.baseInstance = baseInstance;
		return this;
	}
	
	public DrawArraysIndirectCommand setCount(int count) {
		this.count = count; 
		return this;
	}

	public DrawArraysIndirectCommand setPrimCount(int primCount) {
		this.primCount = primCount;
		return this;
	}

	public DrawArraysIndirectCommand setFirst(int first) {
		this.first = first; 
		return this;
	}

	public DrawArraysIndirectCommand setBaseInstance(int baseInstance) {
		this.baseInstance = baseInstance;
		return this;
	}
	
}
