Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #pragma once
00027
00028 #include "cinder/gl/gl.h"
00029 #include "cinder/gl/Fbo.h"
00030
00031
00032 namespace cinder {
00033 class Camera; class CameraPersp; class CameraStereo;
00034 }
00035
00036 namespace cinder { namespace gl {
00037
00038 class StereoAutoFocuser {
00039 public:
00040 StereoAutoFocuser()
00041 : mSpeed(1.0f), mDepth(1.0f) {}
00042
00048 void autoFocus( CameraStereo *cam, const Area &area = gl::getViewport() ) { autoFocus( cam, area, GL_NONE ); }
00054 void autoFocus( CameraStereo *cam, const gl::Fbo &buffer ) { autoFocus( cam, buffer.getBounds(), buffer.getId() ); }
00056 float getSpeed() const { return mSpeed; }
00060 void setSpeed( float factor ) { mSpeed = math<float>::clamp( factor, 0.01f, 1.0f); }
00062 float getDepth() const { return mDepth; }
00067 void setDepth( float factor ) { mDepth = math<float>::max( factor, 0.01f); }
00068
00070 void draw();
00071 private:
00072 void createBuffers( const Area &area );
00073
00075 void autoFocus( CameraStereo *cam, const Area &area, GLuint buffer );
00076 public:
00078 static const int AF_WIDTH = 64;
00079 static const int AF_HEIGHT = 64;
00080 private:
00081 float mSpeed;
00082 float mDepth;
00083
00084 Area mArea;
00085
00086 Fbo mFboSmall;
00087 Fbo mFboLarge;
00088 std::vector<GLfloat> mBuffer;
00089
00091 Vec3f mNearest;
00092 };
00093
00094 } }