Roi Atalla avatar Roi Atalla committed c4b128b

Updated Mesh.

Comments (0)

Files changed (2)

 
 
 * **arcsynthesis:** Java ports of the excellent C++ tutorials from "Learning Modern 3d Graphics Programming"
-at [arcsynthesis.org](http://arcsynthesis.org/gltut)     (10/17 chapters ported)
+at [arcsynthesis.org](http://arcsynthesis.org/gltut) (10/17 chapters ported)
 
 
 * **redbook:** A collection of examples from the [OpenGL Programming Guide](http://www.glprogramming.com/red/) first edition

src/main/java/com/ra4king/opengl/util/Mesh.java

 	}
 	
 	private enum RenderCommandType {
-		UBYTE("ubyte",GL_UNSIGNED_BYTE,1), USHORT("ushort",GL_UNSIGNED_SHORT,2), UINT("uint",GL_UNSIGNED_INT,4);
+		UBYTE("ubyte",GL_UNSIGNED_BYTE,1) {
+			public void store(ByteBuffer b, String[] data) {
+				for(String s : data)
+					b.put(Byte.parseByte(s));
+			}
+		},
+		USHORT("ushort",GL_UNSIGNED_SHORT,2) {
+			public void store(ByteBuffer b, String[] data) {
+				for(String s : data)
+					b.putShort(Short.parseShort(s));
+			}
+		},
+		UINT("uint",GL_UNSIGNED_INT,4) {
+			public void store(ByteBuffer b, String[] data) {
+				for(String s : data)
+					b.putInt(Integer.parseInt(s));
+			}
+		};
 		
 		private String name;
 		private int dataType;
 			this.size = size;
 		}
 		
-		public void store(ByteBuffer b, String[] data) {
-			switch(dataType) {
-				case GL_UNSIGNED_BYTE:
-					for(String s : data)
-						b.put(Byte.parseByte(s));
-					break;
-				case GL_UNSIGNED_SHORT:
-					for(String s : data)
-						b.putShort(Short.parseShort(s));
-					break;
-				case GL_UNSIGNED_INT:
-					for(String s : data)
-						b.putInt(Integer.parseInt(s));
-					break;
-			}
-			
-			b.position(b.capacity());
-		}
+		public abstract void store(ByteBuffer b, String[] data);
 		
 		public static RenderCommandType getRenderType(String name) {
 			for(RenderCommandType rt : values()) {
 						b.put(Byte.parseByte(s));
 					break;
 			}
-			
-			b.position(b.capacity());
 		}
 		
 		public static AttributeType getAttributeType(String name) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.