void bordaiApp::update() { setFrameRate(mFrameRate); mWindowSize = getWindowSize(); mCamera.bufferCaptured(mHaarDetector, mStoryCardDetector); mScreenView.setAspectRatio(getWindowAspectRatio()); mScreenView.setOrtho(0., mCameraLensSize.x, mCameraLensSize.y, 0., 0., 1.); }
void cApp::setup(){ setWindowPos( 0, 0 ); setWindowSize( mW*0.5, mH*0.5 ); mExp.setup( mW*mScale, mH*mScale,0, 2999, GL_RGB, mt::getRenderPath() ); mPln.setOctaves(4); mPln.setSeed(1332); randSeed( mt::getSeed() ); int count = 0; for( int i=0; i<100; i++){ StrangeAgent sa; sa.setRandom(); mSAs.push_back( sa ); for(int j=0; j<sa.points.size(); j++){ mPlnPts.push_back( Vec3f(count*scale,0,0) ); count++; } } total = count; if( 1 ){ CameraPersp cam; cam.setNearClip(0.1); cam.setFarClip(1000000); cam.setFov(60); cam.setEyePoint( Vec3f(0,0,-30 ) ); cam.setCenterOfInterestPoint( Vec3f(0,0,0) ); cam.setAspectRatio( (float)mW/mH ); mCamUi.setCurrentCam(cam); }else{ ortho.setNearClip(0.1); ortho.setFarClip(1000000); ortho.setEyePoint( Vec3f(0,0,-7 ) ); ortho.setCenterOfInterestPoint( Vec3f(0,0,0) ); ortho.setAspectRatio( (float)mW/mH ); } #ifdef RENDER mExp.startRender(); #endif }
void ComponeApp::setup() { _zoom = 1.0; _w = getWindowHeight()/(2.0f * _zoom); _h = getWindowWidth()/(2.0f * _zoom); _pan = vec2(0,0); _cam = CameraOrtho(-_w, _w, -_h, _h, 0, 2); _cam.lookAt(vec3(0,0,1), vec3(0)); _widgets.push_back(shared_ptr<Widget>(new Widget)); _widgets.push_back(shared_ptr<Widget>(new Widget(vec2(100, 100), 0))); _widgets.push_back(shared_ptr<Widget>(new Widget(vec2(100, 200), glm::radians(-45.0)))); }
void Diver::debugDrawIndices(const CameraOrtho &camera){ static const float fontScale = 0.005f; Vec3f v; Vec3f w; Vec3f u; camera.getBillboardVectors(&w, &u); v = w.cross(u); const static Vec2f zero; const gl::TextureFontRef& sharedTextureFont = SharedTextureFont::Get(); float fontDescent = sharedTextureFont->getDescent(); Matrix44f mat; Matrix44f rot = Matrix44f::createRotationOnb(u,w,v); rot*= Matrix44f::createRotation(Vec3f::zAxis(), M_PI_2); rot*= Matrix44f::createScale(Vec3f(fontScale,fontScale,fontScale)); gl::enableAlphaTest(); gl::enableAlphaBlending(); glColor3f(1,1,1); int i = -1; while(++i < mPoints.size()){ mat.setToIdentity(); mat *= Matrix44f::createTranslation(mPoints[i]); mat *= rot; string stringTexCoord = toString(mTexcoords[i]); Vec2f stringSize = sharedTextureFont->measureString(stringTexCoord); glPushMatrix(); glMultMatrixf(&mat[0]); glColor4f(0,0,0,0.75f); gl::drawSolidRect(Rectf(0,fontDescent,stringSize.x, stringSize.y * -1+fontDescent)); glColor3f(1,1,1); sharedTextureFont->drawString(stringTexCoord, zero); glPopMatrix(); } gl::disableAlphaBlending(); gl::disableAlphaTest(); }
void ComponeApp::draw() { gl::clear(Color(0, 0, 0)); gl::color(Color::white()); gl::pushMatrices(); gl::setMatrices(_cam); // Draw world (0,0) crosshair gl::color(0.6, 0.4, 0.0); gl::drawLine(vec3(0, -_h, 0), vec3(0, _h, 0)); gl::drawLine(vec3(-_w, 0, 0), vec3(_w, 0, 0)); _widgetsMtx.lock(); int c = 1; for(auto w : _widgets) { gl::color(Color(ColorModel::CM_HSV, vec3(c*0.25, 1.0, 1.0))); gl::pushMatrices(); auto t = glm::translate(vec3(w->position(), 0.0)) * glm::rotate(w->angle(), vec3(0,0,1)); gl::setModelMatrix(t); w->draw(); gl::popMatrices(); c++; } _widgetsMtx.unlock(); gl::color(0,0.5,1); _touchesMtx.lock(); for(auto t : _touches) { // mat4 m = glm::translate(_cam.getPivotPoint()); vec2 p(_pan*(1.0f/_zoom)*2.0f - vec2(_w, -_h) + vec2(_cam.getViewMatrix() * vec4(vec2(1,-1)*t.second.getPos(), 1, 1))); gl::drawSolidCircle(p, 10.0); console() << p << endl; } _touchesMtx.unlock(); gl::popMatrices(); // Draw window crosshair gl::color(1.0, 1.0, 0.0); gl::drawLine(vec2(getWindowWidth()/2, 0), vec2(getWindowWidth()/2, getWindowHeight())); gl::drawLine(vec2(0, getWindowHeight()/2), vec2(getWindowWidth(), getWindowHeight()/2)); }
void VideoPanApp::setup() { Url url( "http://libcinder.org/media/tutorial/paris.jpg" ); myImage = gl::Texture( loadImage( loadUrl( url ) ) ); mCam.setOrtho(-1, 1, -1, 1, -1, 1); string moviePath = "/Volumes/SPEEDY/desert_right.mov"; if( ! moviePath.empty() ) loadMovieFile( moviePath ); maxParticles = 200; particleCount = 0; startFrame = 10000; mParticleWidth = 20; mPixelOffset = 0; mParams = params::InterfaceGl( "Particle Width", Vec2i( 225, 200 ) ); mParams.addParam( "Slice Width", &mParticleWidth, "min=1.0 max=100.0 step=.1 keyIncr=s keyDecr=w"); mParams.addParam( "Slice Offset", &mPixelOffset, "min=-400.0 max=400.0 step=1 keyIncr=x keyDecr=z"); mParticleController = ParticleController( myImage ); }
void ComponeApp::update() { _cam.lookAt(vec3(_pan, 1), vec3(_pan, 0)); _cam.setOrtho(-_w/_zoom, _w/_zoom, -_h/_zoom, _h/_zoom, 0, 2); }