Here is the first release of the library I was showing off in my last post ( Pro camera library ) https://github.com/matthewseal/JmeProCamera
Here is how to use the library:
// to create a lens definition
LensDef lensDef = new LensDef("Canon EF 24-70mm f/2.8L USM")
.setCanAutoFocus(true)
//.setFstop(2.8f, 22f, 4f, 32f); for a variable aperture lens
.setFstop(2.8f, 22f)
.setMaximumFocal(70f)
.setMinimumFocal(24f)
.setNearestFocus(0.38f)// in meters
.usableWith(Sensor.FULLFRAME, Sensor.CANON_APS_C);
// for usability with any sensor use, there will be no duplicate enumerations
lensDef.usableWith(Sensor.values());
// Then to create the actual lens
Lens lens = lensDef.create();
lens.setAutoFocus(true);// might want to set
// Finally initialize the CameraAppState
CameraAppState cameraState = new CameraAppState(Sensor.FULLFRAME, lens);// can also input a LensDef
cameraState.setDofEnabled(false);// use to disable the depth of field filter if not wanted
stateManager.attachState(cameraState);
I have also implemented the ability to interpolate on the focal length, fstop and focus distance(auto focus disabled) values of the lens through:
cameraState.setInterpolator(Lens.Value.FOCALLENGTH, /* start */ 17f, /* end */ 50f, /* velocity */ 1f);
// Note: these are reset upon lens changes.
To change the values of the lens:
lens.setFocalLength(35f);
lens.setFstop(2.8f);
lens.setFocusDistance(10f);// given that auto focus is disabled
If you want to see the library in action, I have created a demo that can be downloaded from the github repository.
Please tell me what you think and suggest any new features you want to see!