Ejemplo n.º 1
0
void redEyeApp::setup() {
    
    //-settings
    mListener.setup(43334);  //osc input port
    
    //--defaults
    mHide= false;       //also keydown 'i'
    mError= "";
    mOsc= "";
    mMode= 5;
    mAmplitude= 0.0f;
    mNumSamples= 512;
    mDownSample= 0;
    mWidth= 1.0f;
    mColorBack= ColorA(0.0f, 0.0f, 0.0f, 1.0f);
    
    //mVisible0= mVisible1= true;
    mScale0= mScale1= Vec3f(1.0f, 1.0f, 1.0f);
    mTranslate0= mTranslate1= Vec3f::zero();
    mColor0= ColorA(1.0f, 0.0f, 0.0f, 1.0f);
    mColor1= ColorA(0.0f, 1.0f, 0.0f, 1.0f);
    
    //--audio
    mInput= audio::Input();     //use default input device
    mInput.start();             //start capturing
    
    //--shaders
    mPathFrag= getPathDirectory(app::getAppPath().string())+"data/_default_frag.glsl";
    mPathVert= getPathDirectory(app::getAppPath().string())+"data/_default_vert.glsl";
    //loadShader();
    
    //--parameter window
    mParams= params::InterfaceGl::create(getWindow(), "redEye", toPixels(Vec2i(200, 400)));
    //mParams->addText("text", ("label=`redEye`"));
    mParams->addParam("NumSamples", &mNumSamples, "min=1 max=2048 step=1");
    mParams->addParam("DownSample", &mDownSample, "min=0 max=2047 step=1");
    mParams->addParam("Width", &mWidth, "min=0 max=1000 step=1");
    mParams->addParam("Back color", &mColorBack, "");
    mParams->addSeparator();
    //mParams->addParam("Visible", &mVisible0);
    mParams->addParam("Scale", &mScale0);
    mParams->addParam("Rotate", &mRotate0);
    mParams->addParam("Translate", &mTranslate0);
    mParams->addParam("Color", &mColor0, "");
    /*mParams->addSeparator();
    mParams->addParam("Visible1", &mVisible1);
    mParams->addParam("Scale1", &mScale1);
    mParams->addParam("Rotate1", &mRotate1);
    mParams->addParam("Translate1", &mTranslate1);
    mParams->addParam("Color1", &mColor1, "");*/
    
    //mParams->addParam("Cube Size", &mObjSize, "min=0.1 max=20.5 step=0.5 keyIncr=z keyDecr=Z");
    mParams->addSeparator();
    mParams->addParam("String00", &mNameFrag, "label=`frag (f):`");
    mParams->addParam("String01", &mNameVert, "label=`vert (v):`");
    mParams->addParam("String02", &mError, "label=`error:`");
    mParams->addParam("String03", &mOsc, "label=`osc:`");
    mParams->addParam("String04", &mMode, "label=`mode (m):`");
    mParams->addParam("String05", &mFps, "label=`fps:`");
}
Ejemplo n.º 2
0
void MilluminApp::setup()
{
	listener.setup(5001);
	host = "127.0.0.1";
	port = 5000;
	sender.setup(host, port);
    
    
	mTex = gl::Texture(200, 100); //create our texture to publish
	mSurface = Surface8u(200, 100, false); //create a surface to manipulate
	randomizeSurface(&mSurface); //randomize our surface
	mTex.update(mSurface); //tell the texture about our changes
	
	archimedes.set(100.f, 0.6f); //set up and calculate our spiral
	archimedes.calc();
	mRot = 0.f;
	
	mScreenSyphon.setName("Cinder Screen"); // set a name for each item to be published
	mTextureSyphon.setName("Cinder Texture");
	
	mClientSyphon.setup();
    
	// in order for this to work, you must run simple server from the testapps directory
	// any other syphon item you create would work as well, just change the name
    mClientSyphon.setApplicationName("Simple Server");
    mClientSyphon.setServerName("");
	
	mClientSyphon.bind();
}
Ejemplo n.º 3
0
void osc_exampleApp::setup()
{
  mListener.setup(23232);
  for (auto& emg : mEMG) {
    emg.resize(1000);
    std::fill(emg.begin(), emg.end(), 0);
  }
}
Ejemplo n.º 4
0
void PxlFkr::setup()
{
	// Todo: enable resize from lua
	setWindowSize(1024, 768);
	
	listener.setup(PORT);
	luaBridge.setup();
}
Ejemplo n.º 5
0
void OSCListenerApp::setup()
{
	listener.setup( 3000 );
	positionX = 0;
}
void EpicMonsterApp::setup()
{
    mScreenSyphon.setName("Epic Monster Demo");
    
    mFallDirection = Vec3f(0.0,-1.0,0.0);
    listener.setup(7000);
    
    // Slows down particle pulses
    mTimerSlower = 0.05;
    
    // Number of iterations for particle drawing to texture
    n = Vec3f(128, 128, 0);
    
    // Where texture baking shader starts drawing (obsolete)
    mParTexOffset = Vec3f(-1.0, 1.0, 0.0);
    timer = cinder::Timer(true);
    mStep = true;
    try {
        // Multiple render targets shader updates the positions/velocities
        mParticlesShader = gl::GlslProg( ci::app::loadResource( PASSTHROUGH_VERT ), ci::app::loadResource( PARTICLES_FRAG ));
        // Vertex displacement shader
        mDisplacementShader = gl::GlslProg( ci::app::loadResource( VERTEXDISPLACEMENT_VERT ), ci::app::loadResource( VERTEXDISPLACEMENT_FRAG ));
        
        mBakeShader = gl::GlslProg( ci::app::loadResource( BAKE_VERT ), ci::app::loadResource( BAKE_FRAG ));
    }
    catch( ci::gl::GlslProgCompileExc &exc ) {
        std::cout << "Shader compile error: " << endl;
        std::cout << exc.what();
    }
    catch( const std::exception& ex ) {
        std::cout << "Unable to load shader" << endl;
    }
    
    setupPingPongFbo();
    // THE VBO HAS TO BE DRAWN AFTER FBO!
    setupVBO();
    
    // End of Particle setup
    
    try {
    mAssimpLoader = assimp::AssimpLoader( getAssetPath( "Monsu7b.dae" ) );
        
    }
    catch(const std::exception& ex ) {
        std::cout << "Model loading error: " << endl;
        std::cout << ex.what();
    }
    
    mNormalMap	= gl::Texture( loadImage( loadResource( RES_NORMAL ) ) );
	mAssimpLoader.enableSkinning();
    
	mNodeNames = mAssimpLoader.getNodeNames();
	if ( mNodeNames.empty () )
	{
		mNodeNames.push_back( "NO BONES!" );
		mNoBones = true;
	}
	else
	{
		mNoBones = false;
	}
    
	// query original node orientations from model
	mNodeOrientations.assign( mNodeNames.size(), Quatf() );
	if ( !mNoBones )
	{
		for ( size_t i = 0; i < mNodeOrientations.size(); ++i )
		{
			mNodeOrientations[ i ] = mAssimpLoader.getNodeOrientation( mNodeNames[ i ] );
		}
	}
    
    // query original node orientations from model
	mNodePositions.assign( mNodeNames.size(), Vec3f() );
	if ( !mNoBones )
	{
		for ( size_t i = 0; i < mNodePositions.size(); ++i )
		{
			mNodePositions[ i ] = mAssimpLoader.getNodePosition( mNodeNames[ i ] );
		}
	}
    
	mNodeIndex = 0;
    triangles = mAssimpLoader.totalTriangles();
	mEnableWireframe = false;
    mEnableDebugTexture = false;
    
	mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 300 ) );
    
	setupParams();
    
    CameraPersp cam;
	cam.setPerspective( 60, getWindowAspectRatio(), 0.1f, 1000.0f );
	cam.setEyePoint( Vec3f( 0, 1, 3 ) );
	cam.setCenterOfInterestPoint( Vec3f( 0, 0, 0 ) );
	mMayaCam.setCurrentCam( cam );
}