static protected PShape loadShapeImpl(PGraphics pg, String filename, String extension) { PShapeOBJ obj = null; if (extension.equals("obj")) { obj = new PShapeOBJ(pg.parent, filename); int prevTextureMode = pg.textureMode; pg.textureMode = NORMAL; PShapeOpenGL p3d = PShapeOpenGL.createShape((PGraphicsOpenGL)pg, obj); pg.textureMode = prevTextureMode; return p3d; } return null; }
static protected PShape loadShapeImpl(PGraphics pg, String filename, String extension) { PShapeOBJ obj = null; if (extension.equals("obj")) { obj = new PShapeOBJ(pg.parent, filename); int prevTextureMode = pg.textureMode; pg.textureMode = NORMAL; PShapeOpenGL p3d = PShapeOpenGL.createShape((PGraphicsOpenGL)pg, obj); pg.textureMode = prevTextureMode; return p3d; } return null; }
protected void addChildren(ArrayList<OBJFace> faces, ArrayList<OBJMaterial> materials, ArrayList<PVector> coords, ArrayList<PVector> normals, ArrayList<PVector> texcoords) { int mtlIdxCur = -1; OBJMaterial mtl = null; for (int i = 0; i < faces.size(); i++) { OBJFace face = faces.get(i); // Getting current material. if (mtlIdxCur != face.matIdx || face.matIdx == -1) { // To make sure that at least we get the default material mtlIdxCur = PApplet.max(0, face.matIdx); mtl = materials.get(mtlIdxCur); } // Creating child shape for current face. PShape child = new PShapeOBJ(face, mtl, coords, normals, texcoords); addChild(child); } }
protected void addChildren(ArrayList<OBJFace> faces, ArrayList<OBJMaterial> materials, ArrayList<PVector> coords, ArrayList<PVector> normals, ArrayList<PVector> texcoords) { int mtlIdxCur = -1; OBJMaterial mtl = null; for (int i = 0; i < faces.size(); i++) { OBJFace face = faces.get(i); // Getting current material. if (mtlIdxCur != face.matIdx || face.matIdx == -1) { // To make sure that at least we get the default material mtlIdxCur = PApplet.max(0, face.matIdx); mtl = materials.get(mtlIdxCur); } // Creating child shape for current face. PShape child = new PShapeOBJ(face, mtl, coords, normals, texcoords); addChild(child); } }