public static MD5Mesh parse(List<String> meshBlock) { MD5Mesh mesh = new MD5Mesh(); List<MD5Vertex> vertices = mesh.getVertices(); List<MD5Triangle> triangles = mesh.getTriangles(); List<MD5Weight> weights = mesh.getWeights(); Matcher textureMatcher = PATTERN_SHADER.matcher(line); if (textureMatcher.matches()) { mesh.setTexture(textureMatcher.group(1));
private static void parseBlock(MD5Model model, String blockId, List<String> blockBody) throws Exception { switch (blockId) { case "joints": MD5JointInfo jointInfo = MD5JointInfo.parse(blockBody); model.setJointInfo(jointInfo); break; case "mesh": MD5Mesh md5Mesh = MD5Mesh.parse(blockBody); model.getMeshes().add(md5Mesh); break; default: break; } }
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());
private static void handleTexture(Mesh mesh, MD5Mesh md5Mesh, Vector4f defaultColour) throws Exception { String texturePath = md5Mesh.getTexture(); if (texturePath != null && texturePath.length() > 0) { Texture texture = new Texture(texturePath); Material material = new Material(texture); // Handle normal Maps; int pos = texturePath.lastIndexOf("."); if (pos > 0) { String basePath = texturePath.substring(0, pos); String extension = texturePath.substring(pos, texturePath.length()); String normalMapFileName = basePath + "_local" + extension; if (Utils.existsResourceFile(normalMapFileName)) { Texture normalMap = new Texture(normalMapFileName); material.setNormalMap(normalMap); } } mesh.setMaterial(material); } else { mesh.setMaterial(new Material(defaultColour, 1)); } } }
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> md5Vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());
private static void handleTexture(Mesh mesh, MD5Mesh md5Mesh, Vector4f defaultColour) throws Exception { String texturePath = md5Mesh.getTexture(); if (texturePath != null && texturePath.length() > 0) { Texture texture = new Texture(texturePath); Material material = new Material(texture); // Handle normal Maps; int pos = texturePath.lastIndexOf("."); if (pos > 0) { String basePath = texturePath.substring(0, pos); String extension = texturePath.substring(pos, texturePath.length()); String normalMapFileName = basePath + "_local" + extension; if (Utils.existsResourceFile(normalMapFileName)) { Texture normalMap = new Texture(normalMapFileName); material.setNormalMap(normalMap); } } mesh.setMaterial(material); } else { mesh.setMaterial(new Material(defaultColour, 1)); } } }
public static MD5Mesh parse(List<String> meshBlock) { MD5Mesh mesh = new MD5Mesh(); List<MD5Vertex> vertices = mesh.getVertices(); List<MD5Triangle> triangles = mesh.getTriangles(); List<MD5Weight> weights = mesh.getWeights(); Matcher textureMatcher = PATTERN_SHADER.matcher(line); if (textureMatcher.matches()) { mesh.setTexture(textureMatcher.group(1));
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> md5Vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());
private static void parseBlock(MD5Model model, String blockId, List<String> blockBody) throws Exception { switch (blockId) { case "joints": MD5JointInfo jointInfo = MD5JointInfo.parse(blockBody); model.setJointInfo(jointInfo); break; case "mesh": MD5Mesh md5Mesh = MD5Mesh.parse(blockBody); model.getMeshes().add(md5Mesh); break; default: break; } }
private static void handleTexture(Mesh mesh, MD5Mesh md5Mesh, Vector4f defaultColour) throws Exception { String texturePath = md5Mesh.getTexture(); if (texturePath != null && texturePath.length() > 0) { Texture texture = new Texture(texturePath); Material material = new Material(texture); // Handle normal Maps; int pos = texturePath.lastIndexOf("."); if (pos > 0) { String basePath = texturePath.substring(0, pos); String extension = texturePath.substring(pos, texturePath.length()); String normalMapFileName = basePath + "_local" + extension; if (Utils.existsResourceFile(normalMapFileName)) { Texture normalMap = new Texture(normalMapFileName); material.setNormalMap(normalMap); } } mesh.setMaterial(material); } else { mesh.setMaterial(new Material(defaultColour, 1)); } } }
public static MD5Mesh parse(List<String> meshBlock) { MD5Mesh mesh = new MD5Mesh(); List<MD5Vertex> vertices = mesh.getVertices(); List<MD5Triangle> triangles = mesh.getTriangles(); List<MD5Weight> weights = mesh.getWeights(); Matcher textureMatcher = PATTERN_SHADER.matcher(line); if (textureMatcher.matches()) { mesh.setTexture(textureMatcher.group(1));
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> md5Vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());
private static void parseBlock(MD5Model model, String blockId, List<String> blockBody) throws Exception { switch (blockId) { case "joints": MD5JointInfo jointInfo = MD5JointInfo.parse(blockBody); model.setJointInfo(jointInfo); break; case "mesh": MD5Mesh md5Mesh = MD5Mesh.parse(blockBody); model.getMeshes().add(md5Mesh); break; default: break; } }
private static void handleTexture(Mesh mesh, MD5Mesh md5Mesh, Vector4f defaultColour) throws Exception { String texturePath = md5Mesh.getTexture(); if (texturePath != null && texturePath.length() > 0) { Texture texture = new Texture(texturePath); Material material = new Material(texture); // Handle normal Maps; int pos = texturePath.lastIndexOf("."); if (pos > 0) { String basePath = texturePath.substring(0, pos); String extension = texturePath.substring(pos, texturePath.length()); String normalMapFileName = basePath + "_local" + extension; if (Utils.existsResourceFile(normalMapFileName)) { Texture normalMap = new Texture(normalMapFileName); material.setNormalMap(normalMap); } } mesh.setMaterial(material); } else { mesh.setMaterial(new Material(defaultColour, 1)); } } }
public static MD5Mesh parse(List<String> meshBlock) { MD5Mesh mesh = new MD5Mesh(); List<MD5Vertex> vertices = mesh.getVertices(); List<MD5Triangle> triangles = mesh.getTriangles(); List<MD5Weight> weights = mesh.getWeights(); Matcher textureMatcher = PATTERN_SHADER.matcher(line); if (textureMatcher.matches()) { mesh.setTexture(textureMatcher.group(1));
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> md5Vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());
private static void parseBlock(MD5Model model, String blockId, List<String> blockBody) throws Exception { switch (blockId) { case "joints": MD5JointInfo jointInfo = MD5JointInfo.parse(blockBody); model.setJointInfo(jointInfo); break; case "mesh": MD5Mesh md5Mesh = MD5Mesh.parse(blockBody); model.getMeshes().add(md5Mesh); break; default: break; } }
private static void handleTexture(Mesh mesh, MD5Mesh md5Mesh, Vector4f defaultColour) throws Exception { String texturePath = md5Mesh.getTexture(); if (texturePath != null && texturePath.length() > 0) { Texture texture = new Texture(texturePath); Material material = new Material(texture); // Handle normal Maps; int pos = texturePath.lastIndexOf("."); if (pos > 0) { String basePath = texturePath.substring(0, pos); String extension = texturePath.substring(pos, texturePath.length()); String normalMapFileName = basePath + "_local" + extension; if (Utils.existsResourceFile(normalMapFileName)) { Texture normalMap = new Texture(normalMapFileName); material.setNormalMap(normalMap); } } mesh.setMaterial(material); } else { mesh.setMaterial(new Material(defaultColour, 1)); } } }
public static MD5Mesh parse(List<String> meshBlock) { MD5Mesh mesh = new MD5Mesh(); List<MD5Vertex> vertices = mesh.getVertices(); List<MD5Triangle> triangles = mesh.getTriangles(); List<MD5Weight> weights = mesh.getWeights(); Matcher textureMatcher = PATTERN_SHADER.matcher(line); if (textureMatcher.matches()) { mesh.setTexture(textureMatcher.group(1));
List<Integer> indices = new ArrayList<>(); List<MD5Mesh.MD5Vertex> md5Vertices = md5Mesh.getVertices(); List<MD5Mesh.MD5Weight> weights = md5Mesh.getWeights(); List<MD5JointInfo.MD5JointData> joints = md5Model.getJointInfo().getJoints(); for (MD5Mesh.MD5Triangle tri : md5Mesh.getTriangles()) { indices.add(tri.getVertex0()); indices.add(tri.getVertex1());