package org.bimserver.plugins.renderengine;

import java.nio.ByteBuffer;

/******************************************************************************
 * Copyright (C) 2009-2019  BIMserver.org
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see {@literal<http://www.gnu.org/licenses/>}.
 *****************************************************************************/

public class RenderEngineGeometry {
	private final ByteBuffer indices;
	private final ByteBuffer vertices;
	private final ByteBuffer normals;
	private final ByteBuffer materials;
	private final ByteBuffer materialIndices;

	public RenderEngineGeometry(ByteBuffer indices, ByteBuffer vertices, ByteBuffer normals, ByteBuffer materials, ByteBuffer materialIndices) {
		this.indices = indices;
		this.vertices = vertices;
		this.normals = normals;
		this.materials = materials;
		this.materialIndices = materialIndices;
	}
	
	public int getIndex(int index) {
		return indices.get(index);
	}
	
	public double getVertex(int index) {
		return vertices.get(index);
	}
	
	public float getNormal(int index) {
		return normals.get(index);
	}

	public ByteBuffer getMaterials() {
		return materials;
	}
	
	public ByteBuffer getMaterialIndices() {
		return materialIndices;
	}
	
	public int getNrVertices() {
		return vertices.capacity();
	}

	public int getNrNormals() {
		return normals.capacity();
	}

	public int getNrIndices() {
		return indices.capacity();
	}

	public ByteBuffer getVertices() {
		return vertices;
	}
	
	public ByteBuffer getNormals() {
		return normals;
	}
	
	public ByteBuffer getIndices() {
		return indices;
	}

	public int getMaterialIndex(int index) {
		return materialIndices.get(index);
	}

	public float getMaterial(int index) {
		return materials.get(index);
	}

	public int getNrMaterialIndices() {
		return materialIndices.capacity();
	}
}
@@ -1888,24 +1888,41 @@
 rn vertices.
+asDoubleBuffer().
 capacity();%0D
@@ -1914,32 +1914,32 @@
 ().capacity();%0D%0A
-
 %09%7D%0D%0A%0D%0A%09public in
@@ -1975,16 +1975,32 @@
 normals.
+asFloatBuffer().
 capacity
@@ -2032,32 +2032,32 @@
 tNrIndices() %7B%0D%0A
-
 %09%09return indices
@@ -2053,24 +2053,38 @@
 urn indices.
+asIntBuffer().
 capacity();%0D
@@ -2479,16 +2479,30 @@
 Indices.
+asIntBuffer().
 capacity

Return the right sizes