sgsrules
Full Member
Offline
Posts: 108
Texas
Re: OCD Updated
Reply #11 - Mar 23rd , 2008, 2:31am
I ran into the same problem, it's because there's no constructor that takes those arguments. It's an error in the documentation. I had to look at the source code to find a list of suitable constructors. I went ahead and copied it here. it's pretty well documented, Kristian, maybe you should include it in the online documentation. I take it this doesn't work with the opengl camera, but it shouldn't be to hard to port. Thanks for the great work!! //--- Constructors -------- // Create a camera that sits on the z axis public Camera(PApplet aParent) { this(aParent, aParent.height * 0.5f / tan(DEFAULT_FOV * 0.5f)); } // Create a camera that sits on the z axis with a specified shot length public Camera(PApplet aParent, float aShotLength) { this(aParent, 0, 0, aShotLength); } // Create a camera at the specified location looking at the world origin public Camera(PApplet aParent, float aCameraX, float aCameraY, float aCameraZ) { this(aParent, aCameraX, aCameraY, aCameraZ, 0, 0, 0); } // Create a camera at the specified location with the specified target public Camera(PApplet aParent, float aCameraX, float aCameraY, float aCameraZ, float aTargetX, float aTargetY, float aTargetZ) { this(aParent, aCameraX, aCameraY, aCameraZ, aTargetX, aTargetY, aTargetZ, 0, 1, 0, DEFAULT_FOV, (float)(1f * aParent.width / aParent.height), 0, 0); theNearClip = theShotLength * 0.1f; theFarClip = theShotLength * 10f; } // Specify all parameters for camera creation public Camera(PApplet aParent, float aCameraX, float aCameraY, float aCameraZ, float aTargetX, float aTargetY, float aTargetZ, float anUpX, float anUpY, float anUpZ, float anFoV, float anAspect, float aNearClip, float aFarClip) { theParent = aParent; theCameraX = aCameraX; theCameraY = aCameraY; theCameraZ = aCameraZ; theTargetX = aTargetX; theTargetY = aTargetY; theTargetZ = aTargetZ; theUpX = anUpX; theUpY = anUpY; theUpZ = anUpZ; theFoV = anFoV; theAspect = anAspect; theNearClip = aNearClip; theFarClip = aFarClip; theDeltaX = theCameraX - theTargetX; theDeltaY = theCameraY - theTargetY; theDeltaZ = theCameraZ - theTargetZ; theShotLength = magnitude(theDeltaX, theDeltaY, theDeltaZ); theAzimuth = atan2(theDeltaX, theDeltaZ); theElevation = atan2(theDeltaY, sqrt(theDeltaZ * theDeltaZ + theDeltaX * theDeltaX)); if (theElevation > HALF_PI - TOL) { theUpY = 0; theUpZ = -1; } if (theElevation < TOL - HALF_PI) { theUpY = 0; theUpZ = 1; } updateUp(); }