import saito.objloader.*; import processing.opengl.*; OBJModel model; // set position scale and rotation //rotations// float rotX= -0.080000035; float rotY= 1.5807964; float rotZ= 0.010000268; //positions// float posX= -22.800087; float posY= 175.90176; float posZ= -2.2999923; //scalings// float scalerW= 12.500106; float scalerD= 107.000145; float scalerH= 113.000336; //camera lens// float fov= 1.4407967; // swapToMe = loadImage("UVSwap.jpg"); void setup() { size(1024, 768, OPENGL); model = new OBJModel(this, "crystaphyll.obj"); model.drawMode(TRIANGLES); model.disableTexture(); } void draw() { background(0); //noStroke(); lights(); specular(0,0,0); emissive(0, 0, 0); shininess(0.0); ambientLight(0,0,0); ambient(0,0,0); // float cameraZ = (height/2.0) / tan(fov/2.0); perspective(fov, float(width)/float(height), cameraZ/10.0, cameraZ*10.0); // pushMatrix(); translate(width/2+posX, height/2+posY, posZ); pointLight(255, 128, 0, 222, -222, 100); rotateZ(rotZ); rotateX(rotX); rotateY(rotY); scale(scalerW, scalerD, scalerH); fill(0,0,0); stroke(255); strokeWeight(2); model.draw(); popMatrix(); printTransfomrations(); } void mouseDragged() { if(keyPressed) { if(key == 'd') { scalerD += (mouseX - pmouseX)*.1; } if(key == 'w') { scalerW += (mouseX - pmouseX)*.1; } if(key == 'h') { scalerH += (mouseY - pmouseY)*.1; } // if(key == 'X') { rotX += (mouseY - pmouseY) * 0.01; } if(key == 'Y') { rotY -= (mouseX - pmouseX) * 0.01; } if(key == 'Z') { rotZ += (mouseY - pmouseY) * 0.01; } // if(key == 'x') { posX += (mouseX - pmouseX) * 0.1; } if(key == 'y') { posY -= (mouseY - pmouseY) * 0.1; } if(key == 'z') { posZ += (mouseY - pmouseY) * 0.1; } // if(key == 'l') { fov += (mouseX - pmouseX) * 0.01; } } } void printTransfomrations() { println("//rotations//"); println(" float rotX= "+rotX+"; "); println(" float rotY= "+rotY+"; "); println(" float rotZ= "+rotZ+"; "); println("//positions//"); println(" float posX= "+posX+"; "); println(" float posY= "+posY+"; "); println(" float posZ= "+posZ+"; "); println("//scalings//"); println(" float scalerW= "+scalerW+"; "); println(" float scalerD= "+scalerD+"; "); println(" float scalerH= "+scalerH+"; "); println("//camera lens//"); println(" float fov= "+fov+"; "); println("\r\r"); }