//import processing.opengl.*; // .OBJ Loader // by SAITO // Placing a virtual structure represented as mathematically // three-dimensional object. // SModel.load() reads structure data of the object stored // as numerical data. // SModel.draw() gives a visual form to the structure data. // processing standard drawing functions can be used to manipulate // the visual form to create deep visual experiences. // Created 20 April 2005 import saito.objloader.*; OBJModel model; float rotX; float rotY; float changeSize = 30; void setup() { size(800, 600, P3D); frameRate(30); model = new OBJModel(this); model.debugMode(); model.load("hand.obj"); } void draw() { background(255); lights(); pushMatrix(); translate(mouseX, mouseY); rotateX(rotY); rotateY(rotX); scale(changeSize); model.draw(); popMatrix(); } boolean bTexture = true; boolean bStroke = true; void keyPressed(){ if(key == 't'){ changeSize++; } if(key == 's'){ changeSize--; } else if(key=='1') model.drawMode(POINTS); else if(key=='2') model.drawMode(TRIANGLES); else if(key=='4') model.drawMode(POLYGON); } void mouseDragged() { rotX += (mouseX - pmouseX) * 0.01; rotY -= (mouseY - pmouseY) * 0.01; }