示例#1
0
void ciApp::setup()
{
	setWindowSize(1280, 720);
	setFrameRate(60.f);
	
	int maxVertUniformsVect;
	glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxVertUniformsVect);

	mSize = 0;
	mSizePrev = -1;
	mSizeMax = 17;
	mAmplifier = 1.f;

	mExposure = 1.f;
	mGamma = 2.2f;

	printf("max uniform: %i, %i\n", maxVertUniformsVect, mSizeMax);

	mParams = params::InterfaceGl::create(getWindow(), "App parameters", ivec2(250, 300));
	mParams->setPosition(ivec2(20, 250));

	mTexture = gl::Texture::create(loadImage(loadFile(data_path + "demo.png")));
	mFbo = gl::Fbo::create(mTexture->getWidth(), mTexture->getHeight(), gl::Fbo::Format().colorTexture());
	//mShader.setup("filterGaussianBlur");

	filter = hb::GlslFilter::create(mTexture->getSize());
	filter->setParams(mParams);

	vector_blur.setup(getWindowSize());
	vector_blur.setParams(mParams);

	spout_receiver = hb::Receiver::create("Spout DX11 Sender");
	//spout_receiver = hbSpoutReceiver::create("KidsLandSea");
	spout_sender = hb::Sender::create("cinder_spout", mFbo->getWidth(), mFbo->getHeight());

#if 0
	auto ctx = audio::Context::master();

	// The InputDeviceNode is platform-specific, so you create it using a special method on the Context:
	mInputDeviceNode = ctx->createInputDeviceNode();

	// By providing an FFT size double that of the window size, we 'zero-pad' the analysis data, which gives
	// an increase in resolution of the resulting spectrum data.
	auto monitorFormat = audio::MonitorSpectralNode::Format().fftSize(2048).windowSize(1024);
	mMonitorSpectralNode = ctx->makeNode(new audio::MonitorSpectralNode(monitorFormat));

	mInputDeviceNode >> mMonitorSpectralNode;

	// InputDeviceNode (and all InputNode subclasses) need to be enabled()'s to process audio. So does the Context:
	mInputDeviceNode->enable();
	ctx->enable();
#endif
}
示例#2
0
void MASOSApp::update()
{
    if (mAngle != oldAngle)
    {
        scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y);
    }
    oldAngle = mAngle;

    if (scale != oldScale)
    {
        scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y);
    }
    oldScale = scale;

    if (mTerminalVelocity != oldTerminalVelocity)
    {
        scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y);
    }
    oldTerminalVelocity = mTerminalVelocity;

    if (mInitialVelocity != oldInitialVelocity)
    {
        scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y);
    }
    oldInitialVelocity =mInitialVelocity;
    

    float tmp = mProjectileUnderTest.mPosition.y;
    mProjectileUnderTest.update(mInitialVelocity, mAngle, mCurrentTime, mTerminalVelocity);
    if (mProjectileUnderTest.mPosition.y > 0)
    {
        mProjectileUnderTest.mPosition.y = 0;
        mIsPlaying = false;
    }
    if (tmp >= 0 && mProjectileUnderTest.mPosition.y >= 0)
    {
        mProjectileUnderTest.mPosition.y = 0;
        mIsPlaying = false;
        mCurrentTime = oldTime;
    }

    if (mProjectileUnderTest.mPosition.x < 0)
    {
        mProjectileUnderTest.mPosition.x = 0.f;
    }

    oldTime = mCurrentTime;
    currX = mProjectileUnderTest.mPosition.x;
    currY = -(mProjectileUnderTest.mPosition.y);
    if (currY == -0) currY = 0;
    mParams->setPosition(ivec2(0,0));
}
void MPEBouncingBallApp::setup()
{
    mClient = MPEClient::Create(this, USE_THREADED);

    // 3D
    mClient->setIsRendering3D(true);
    mCamZ = -900.0f;
    mClient->set3DCameraZ(mCamZ);
    mFOV = mClient->get3DFieldOfView();
    mAspectRatio = mClient->get3DAspectRatio();
    
    mParams = params::InterfaceGl::create("Camera Params", vec2(getWindowSize()) * getWindowContentScale());
    mParams->setPosition(ivec2(0,0));
    mParams->addParam("Field of View", &mFOV).min(1.f).max(180.f).step(0.5);
    mParams->addParam("Camera Z", &mCamZ).min(-1500.f).max(0.f);
    mParams->addParam("Aspect Ratio", &mAspectRatio).min(0.f).max(2.f);
    mParams->addButton("Reset", [&](){ this->buttonResetClicked(); } );
    mParams->addButton("Render Mode (2D/3D)", [&](){ this->buttonRenderModeClicked(); } );

    mFont = Font( "Helvetica Bold", 12 );
    mTextureFont = gl::TextureFont::create( mFont );
}