[cgkit-commits] cgkit2 viewer.py,1.7,1.8 From: Matthias Baas - 2005-05-12 12:59 ```Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22691 Modified Files: viewer.py Log Message: Removed the calcNearFar() function. This is now part of the camera classes. Index: viewer.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/viewer.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** viewer.py 28 Feb 2005 16:50:03 -0000 1.7 --- viewer.py 12 May 2005 12:59:18 -0000 1.8 *************** *** 58,110 **** - # calcNearFar - def calcNearFar(cam): - """Near und far clipping plane berechnen. - - Near und far clipping plane anhand der Bounding-Box der - Szene (+EditMode) bestimmen. Aus der Bounding-Box wird eine - Bounding-Kugel gemacht und die Clipping Planes jeweils tangential - daran gelegt. - - Die Clipping Planes beziehen sich auf die aktuell gesetzte Kamera. - - \return Tupel (Near, Far), jeweils als Float. - """ - - scene = getScene() - - # Bounding-Box der Szene - bbox = scene.boundingBox() - - # Bounding-Kugel bestimmen - bmin,bmax = bbox.getBounds() - if bmin!=None and bmin!=bmax: - # Mittelpunkt der Box (bzw. der Bounding Sphere) - c = 0.5*(bmin+bmax) - # Radius der Bounding Sphere - r = (bmax-c).length() - else: - c = vec3(0,0,0) - r = 10 - - # Transformation Welt->Kamera - VT = cam.viewTransformation() - - # minnear = 0.1 - # minfar = 0.2 - minnear = (bmax-bmin).length()/1000 - minfar = minnear+1 - - # cz: Tiefe des Mittelpunkts - cz = (VT*c).z - near = max(cz-r, minnear) - far = max(cz+r, minfar) - - if (far-near)<0.01: - far+=1 - - return (near,far) - - # Viewer class Viewer(Tool): --- 58,61 ---- *************** *** 653,657 **** # Set projection matrix ! near, far = calcNearFar(cam) P = cam.projection(width,height,near,far) renderer.setProjection(P) --- 604,608 ---- # Set projection matrix ! near, far = cam.getNearFar() P = cam.projection(width,height,near,far) renderer.setProjection(P) ```