void ImageRetargetingApp::initGUI()
{
    linearScalingParams->addButton( "Reset Image", std::bind( &ImageRetargetingApp::linearResizeResetButtonClick, this ) );
    linearScalingParams->addSeparator();
    linearScalingParams->addParam("Original Width: ", &originalWidth, true);
    linearScalingParams->addParam("Original Height: ", &originalHeight, true);
    linearScalingParams->addParam( "Resize Width", &linearScaleWidth ).min( 1 ).max( 1200 ).step( 1 );
    linearScalingParams->addParam( "Resize Height", &linearScaleHeight ).min( 1 ).max( 750 ).step( 1 );
    linearScalingParams->addButton( "Resize", std::bind( &ImageRetargetingApp::linearResizeButtonClick, this ) );
    linearScalingParams->addSeparator();
    
    meshWarpingParams->addButton( "Reset Mesh", std::bind( &ImageRetargetingApp::meshWarperResetButtonClick, this ) );
    meshWarpingParams->addParam( "Quad Size", &(meshWarpRetargetter->quadSize) ).min( 5 ).max( 100 ).step( 1 );
    meshWarpingParams->addButton( "Toggle Wire Frame", std::bind( &ImageRetargetingApp::toggleWireFrameButtonClick, this ) );
    meshWarpingParams->addSeparator();
    meshWarpingParams->addText("Segmentation");
    meshWarpingParams->addParam( "Blur", &saliencySegmentor->segBlurDeviation ).min( 0.01f ).max( 1.00f ).step( 0.01f );
    meshWarpingParams->addParam( "K",&saliencySegmentor->segNeighborThreshold ).min( 0.0f ).max( 1500.0f ).step( 10.f );
    meshWarpingParams->addParam( "Min Size", &saliencySegmentor->segMinSize).min( 0 ).max( 1500 ).step( 10 );
    meshWarpingParams->addButton( "Segment Random", std::bind( &ImageRetargetingApp::segmentRandomButtonClick, this ) );
    meshWarpingParams->addButton( "Segment Color", std::bind( &ImageRetargetingApp::segmentColorButtonClick, this ) );
    meshWarpingParams->addSeparator();
    meshWarpingParams->addText("Saliency");
    meshWarpingParams->addParam( "Scale", &(saliencySegmentor->scale) ).min( 1 ).max( 10 ).step( 1 );
    meshWarpingParams->addButton( "Sobel Saliency", std::bind( &ImageRetargetingApp::sobelSaliencyButtonClick, this ) );
    meshWarpingParams->addButton( "Segment Saliency", std::bind( &ImageRetargetingApp::segmentSaliencyButtonClick, this ) );
    meshWarpingParams->addButton( "Edge Saliency", std::bind( &ImageRetargetingApp::getPatchEdgeClick, this ) );
    meshWarpingParams->addSeparator();
    meshWarpingParams->addText("Quad Warping");
    meshWarpingParams->addParam( "Resize Width", &(meshWarpRetargetter->resizeWidth) ).min( 1 ).max( 1200 ).step( 1 );
    meshWarpingParams->addParam( "Resize Height", &(meshWarpRetargetter->resizeHeight) ).min( 1 ).max( 750 ).step( 1 );
    meshWarpingParams->addParam( "Linear Weight", &(meshWarpRetargetter->transformationWeight) ).min( 0.f ).max( 1.f ).step( 0.1f );
    meshWarpingParams->addButton( "Resize Rect", std::bind( &ImageRetargetingApp::resizeMeshRect, this ) );
    meshWarpingParams->addButton( "Resize Ellipse", std::bind( &ImageRetargetingApp::resizeMeshEllipse, this ) );
    meshWarpingParams->addParam("Resize Time: ", &(meshWarpRetargetter->resizeTime), true);
    meshWarpingParams->addSeparator();
    
    seamCarvingParams->addButton( "Reset Image", std::bind( &ImageRetargetingApp::seamCarveResetButtonClick, this ) );
    seamCarvingParams->addSeparator();
    seamCarvingParams->addParam( "Scale", &(seamCarver->scale) ).min( 1 ).max( 20 ).step( 1 );
    seamCarvingParams->addButton( "Sobel Gradient", std::bind( &ImageRetargetingApp::sobelGradientButtonClick, this ) );
    seamCarvingParams->addSeparator();
    seamCarvingParams->addButton( "Show Vertical Seam", std::bind( &ImageRetargetingApp::verticalSeamGradientButtonClick, this ) );
    seamCarvingParams->addButton( "Show Horizontal Seam", std::bind( &ImageRetargetingApp::horizontalSeamGradientButtonClick, this ) );
    seamCarvingParams->addSeparator();
    seamCarvingParams->addButton( "Get Gradient", std::bind( &ImageRetargetingApp::sobelGradientButtonClick, this ) );
    seamCarvingParams->addButton( "Get Seam", std::bind( &ImageRetargetingApp::verticalSeamGradientButtonClick, this ) );
    seamCarvingParams->addButton( "Delete Seam", std::bind( &ImageRetargetingApp::deleteCurrentSeamButtonClick, this ) );
    //seamCarvingParams->addButton( "Add Seam", std::bind( &ImageRetargetingApp::addCurrentSeamButtonClick, this ) );
    seamCarvingParams->addSeparator();
    seamCarvingParams->addParam( "Resize Width", &(seamCarver->newWidth) ).min( 1 ).max( 1200 ).step( 1 );
    seamCarvingParams->addParam( "Resize Height", &(seamCarver->newHeight) ).min( 1 ).max( 750 ).step( 1 );
    seamCarvingParams->addButton( "Resize", std::bind( &ImageRetargetingApp::resizeSeamButtonClick, this ) );
    seamCarvingParams->addParam("Resize Time: ", &(seamCarver->carveTime), true);
    seamCarvingParams->addSeparator();
}
void TweakBarApp::setup()
{
	mObjSize = 4;
	mLightDirection = vec3( 0, 0, -1 );
	mColor = ColorA( 0.25f, 0.5f, 1, 1 );
	mSomeValue = 2;

	// Setup our default camera, looking down the z-axis
	mCam.lookAt( vec3( -20, 0, 0 ), vec3( 0 ) );

	// Create the interface and give it a name.
	mParams = params::InterfaceGl::create( getWindow(), "App parameters", toPixels( ivec2( 200, 400 ) ) );

	// Setup the parameters
	mParams->addParam( "Cube Size", &mObjSize ).min( 0.1f ).max( 20.5f ).keyIncr( "z" ).keyDecr( "Z" ).precision( 2 ).step( 0.02f );
	mParams->addParam( "Cube Rotation", &mObjOrientation );
	mParams->addParam( "Cube Color", &mColor );
	mParams->addParam( "String ", &mString );

	mParams->addSeparator();

	// Attach a callback that is fired after a target is updated.
	mParams->addParam( "some value", &mSomeValue ).updateFn( [this] { console() << "new value: " << mSomeValue << std::endl; } );

	// Add a param with no target, but instead provide setter and getter functions.
	std::function<void( vec3 )> setter	= std::bind( &TweakBarApp::setLightDirection, this, std::placeholders::_1 );
	std::function<vec3 ()> getter		= std::bind( &TweakBarApp::getLightDirection, this );
	mParams->addParam( "Light Direction", setter, getter );

	// Other types of controls that can be added to the interface
	mParams->addButton( "Button!", std::bind( &TweakBarApp::button, this ) );
	mParams->addText( "text", "label=`This is a label without a parameter.`" );
}
Beispiel #3
0
void MeshViewApp::setup()
{
	loadConfig("configs/gaztank.ini");

	setupCamera();

	// Create lights
	m_light1 = new gl::Light(gl::Light::DIRECTIONAL, 0);
	m_light1->setDirection(Vec3f(0, 0, 1).normalized());
	m_light1->setAmbient(Color(0.0f, 0.0f, 0.1f));
	m_light1->setDiffuse(Color(0.9f, 0.6f, 0.3f));
	m_light1->setSpecular(Color(0.9f, 0.6f, 0.3f));

	m_light2 = new gl::Light(gl::Light::DIRECTIONAL, 1);
	m_light2->setDirection(Vec3f(0, 0, -1).normalized());
	m_light2->setAmbient(Color(0.0f, 0.0f, 0.0f));
	m_light2->setDiffuse(Color(0.2f, 0.6f, 1.0f));
	m_light2->setSpecular(Color(0.2f, 0.2f, 0.2f));

	// Setup matrix
	m_matrix.setToIdentity();
	m_matrix.translate(Vec3f::zero());
	m_matrix.rotate(Vec3f::zero());
	m_matrix.scale(Vec3f::one());

	m_rotateMesh = false;

	// Create a parameter window
	m_params = params::InterfaceGl::create(getWindow(), "Properties", Vec2i(180, 240));
	m_params->addText("LMB + drag - rotate");
	m_params->addText("RMB + drag - zoom");
	m_params->addSeparator();
	m_params->addButton("Full screen", [&] { setFullScreen(!isFullScreen()); });
	m_params->addParam("Auto rotate", &m_rotateMesh);
	m_params->addSeparator();
	m_params->addParam("Diffuse", &m_diffuseEnabled);
	m_params->addParam("Normal", &m_normalEnabled);
	m_params->addParam("Specular", &m_specularEnabled);
	m_params->addParam("AO", &m_aoEnabled);
	m_params->addParam("Emissive", &m_emissiveEnabled);
	m_params->addSeparator();
	m_params->addParam("Gamma", &m_gamma, "min=0.0 max=10.0 step=0.1");

	m_time = (float)getElapsedSeconds();
}
void PhysicallyBasedShadingApp::setupParams()
{
	mParams = params::InterfaceGl::create( "PBR", ivec2( 300, 400 ) );
	mParams->minimize();
	
	mParams->addText( "Material" );
	mParams->addParam( "Roughness", &mRoughness ).min( 0.0f ).max( 1.0f ).step( 0.01f );
	mParams->addParam( "Metallic", &mMetallic ).min( 0.0f ).max( 1.0f ).step( 0.01f );
	mParams->addParam( "Specular", &mSpecular ).min( 0.0f ).max( 1.0f ).step( 0.01f );
	mParams->addParam( "Base Color", &mBaseColor );
	
	mParams->addSeparator();
	mParams->addText( "Light" );
	mParams->addParam( "Animation", &mAnimateLight );
	mParams->addParam( "Radius", &mLightRadius ).min( 0.0f ).max( 20.0f ).step( 0.1f );
	mParams->addParam( "Color", &mLightColor );
	
	mParams->addSeparator();
	mParams->addText( "Camera" );
	mParams->addParam( "Focal Length", &mFocalLength ).min( 0.0f ).step( 1.0f ).updateFn( [this]() {
		if( mFocalLength != sFocalPresetsValues[mFocalLengthPreset] ){
			mFocalLengthPreset = 0;
		}
	} );
	mParams->addParam( "Lense", sFocalPresets, &mFocalLengthPreset );
	mParams->addParam( "Sensor Size", &mSensorSize ).min( 0.0f ).step( 1.0f ).updateFn( [this]() {
		if( mSensorSize != sSensorPresetsValues[mSensorSizePreset] ){
			mSensorSizePreset = 0;
		}
	} );
	mParams->addParam( "Film Gate", sSensorPresets, &mSensorSizePreset );
	mParams->addParam( "F-Stop", &mFStop ).min( 0.25f ).max( 8.0f ).step( 0.25f ).updateFn( [this]() {
		if( mFStop != sFStopPresetsValues[mFStopPreset] ){
			mFStopPreset = 0;
		}
	} );
	mParams->addParam( "F-Stop Preset", sFStopPresets, &mFStopPreset );
}
Beispiel #5
0
void VectorBlur::setParams(params::InterfaceGlRef params)
{
	if (params == nullptr) {
		printf("hbVectorBlur get no params\n");
		return;
	}
	params->addSeparator();
	params->addText("Vector Blur Filter Settings");
	params->addParam("Vector Map Kernel", &mVectorMapKernel).min(1).max(5).step(1);
	params->addParam("Vector Map Theta", &mTheta).min(0.f).max(360.f).step(0.1f);
	params->addParam("Blur Map Kernel", &mSize).min(0).max((float)mSizeMax).step(1);
	params->addParam("Blur Map Amplifier", &mAmplifier).min(1.f).max(10.f).step(0.1f);
	params->addParam("Vector Blur Kernel", &mVectorBlurKernel).min(0).max(30).step(1);
	params->addSeparator();
}
void WaterSimulationApp::setup(){

	boxDimension=Vec3f(30.0f,30.0f,30.0f);
	boxCenter=Vec3f(boxDimension)/2.0f;

	//Fluid System setup
	fluidsys=&stamfluid;
	fluidsys->reset(boxDimension);

	randomForce=Vec3f(2,3,-1);
	randomForceX=boxCenter;

	//// setup our default camera, looking down the z-axis
	CameraPersp	cam;
	cam.setEyePoint(Vec3f(200, 50, 50));
	cam.setCenterOfInterestPoint(boxCenter);
	cam.setPerspective(60.0, getWindowAspectRatio(), 1.0, 1000.0);
	mMayaCam.setCurrentCam(cam);

	Matrix44f mvM=mMayaCam.getCamera().getModelViewMatrix();
	gravity = Vec3f(mvM.m10,mvM.m11,mvM.m12);//col4:camera center, row: right,up,back
	gravity*= 9.8f;
	// Setup the parameters
	mDrawGravity=false;
	mAddNewForce=false;
	mAnimate	=false;
	mDrawBox	=true;


	mParams = params::InterfaceGl::create( getWindow(), "Water Simulation Parameters", toPixels( Vec2i( 250,300  ) ) );
	mParams->addParam("Draw Box", &mDrawBox);
	mParams->addParam("Draw Grid",&mDrawGrid);
	mParams->addParam("Draw Random Force",&mDrawForce);
	mParams->addSeparator();
	mParams->addParam("External Force Position",&randomForceX);
	mParams->addParam("External Force Dir",&randomForce);
	mParams->addParam("Draw Gravity",&mDrawGravity);
	mParams->addParam("Draw Velocity", &(fluidsys->mDrawVelocity));
	mParams->addSeparator();
	mParams->addParam("Animate",&mAnimate);
	mParams->addText("status","label=` `");
	mParams->addParam("Time Elapsed",&(fluidsys->elapsed),"",true);
	mParams->addSeparator();
	mParams->addParam("Viscosity", &fluidsys->viscosity);
	mParams->addParam("Diffusion Rate", &fluidsys->diffusion);
	mParams->addParam("Buoyancy Rate",&fluidsys->buoyancy);
}
Beispiel #7
0
void ParamsBasicApp::setup()
{
    
    ObjLoader loader( (DataSourceRef)loadResource( "Final_sculpture3.obj" ) );
	loader.load( &mMesh );
    a = 1;
    e = 1;
    c = 1;
	mVBO = gl::VboMesh( mMesh );
    mMesh.recalculateNormals();
        mCameraDistance = 25;
    receiver.setup(3000);
	mObjSize = 4;
    mEye = Vec3f(-1,0.8f,1);
	mLightDirection = Vec3f( -0.54f, -0.27f, -1.07f );
	mColor = ColorA( 0.25f, 0.5f, 1.0f, 1.0f );
    mCam.setPerspective( 60.0f, getWindowAspectRatio(), 0.1f, 30000.0f );
	// setup our default camera, looking down the z-axis
	mCam.lookAt( mEye, Vec3f(0,0,0) );
    
	// Setup the parameters
	mParams = params::InterfaceGl::create( getWindow(), "App parameters", toPixels( Vec2i( 200, 400 ) ) );
	mParams->addParam( "Cube Size", &mObjSize, "min=0.1 max=20.5 step=0.5 keyIncr=z keyDecr=Z" );
	mParams->addParam( "Cube Rotation", &mObjOrientation );
	//mParams->addParam( "Cube Color", &mColor, "" );
	mParams->addSeparator();
	mParams->addParam( "Light Direction", &mLightDirection, "" );
	mParams->addButton( "Button!", std::bind( &ParamsBasicApp::button, this ) );
	mParams->addText( "text", "label=`This is a label without a parameter.`" );
	mParams->addParam( "String ", &mString, "" );
    mParams->addParam( "Eye Distance", &mCameraDistance, "min=1.0 max=100.0 step=1.0 keyIncr=s keyDecr=w" );
    
    
    
    
}
// assumes that prevPv and curPv are not equal
void GeoDeVisualizerApp::changeParameterWindow()
{
    switch (mPrevParams.displayMode) {
    case Geography:
            break;
    case Colonies:
        {
            mParams->removeParam("colony");
            mParams->removeParam("information");
            break;
        }
    case Attributes:
        {
            mParams->removeParam("attributes");
            const vector<string>& names = mWorld.attributeNames();
            for (vector<string>::const_iterator nameRef = names.begin(); nameRef != names.end(); ++nameRef) {
                mParams->removeParam(*nameRef);
            }
            break;
        }
    case Resources:
        {
            mParams->removeParam("resources");
            const vector<string>& names = mWorld.resourceNames();
            for (vector<string>::const_iterator nameRef = names.begin(); nameRef != names.end(); ++nameRef) {
                mParams->removeParam(*nameRef);
            }
            break;
        }
    }
    switch (mCurParams.displayMode) {
    case Geography:
            break;
    case Colonies:
        {
            mParams->addParam("colony", mColonyDisplay, &mCurParams.displayColony);
            Colony& colRef = mWorld.mColonies[mCurParams.displayColony];
            colRef.updateInfo();
            mParams->addParam("information",&colRef.getInfo());
            break;
        }
    case Attributes:
        {
            mParams->addText("attributes");
            const vector<string>& names = mWorld.attributeNames();
            string attrKey = "1";
            for (u32 i = 0; i < names.size(); i++) {
                mParams->addParam(names[i], &(mCurParams.showAttributes[i]), "keyIncr="+attrKey);
                attrKey[0]++;
            }
            break;
        }
    case Resources:
        {
            mParams->addText("resources");
            const vector<string>& names = mWorld.resourceNames();
            string resKey = "a";
            for (u32 i = 0; i < names.size(); i++) {
                mParams->addParam(names[i], &(mCurParams.showResources[i]), "keyIncr="+resKey);
                resKey[0]++;
            }
            break;
        }
    }
}
Beispiel #9
0
void cApp::makeGui(){
    gui = params::InterfaceGl::create( getWindow(), "Ramses", vec2(300, getWindowHeight()) );
    gui->setOptions( "", "position=`0 0` valueswidth=100" );
    
    function<void(void)> update = [&](){
        for( int i=0; i<rms.size(); i++){
            rms[i].updateVbo(eye);
        }
    };
    
    
    function<void(void)> sx = [this](){
        saveXml();
    };
    
    function<void(void)> ld = [this](){
        loadXml();
        for( int i=0; i<rms.size(); i++){
            rms[i].eSimType = simType;
            rms[i].loadSimData(frame);
            rms[i].updateVbo(eye);
        }
    };

    function<void(void)> ren = [this](){
        bStart = true;
        mExp.startRender();
    };
    
    gui->addText( "main" );
    gui->addParam("start", &bStart );
    gui->addParam("frame", &frame ).updateFn(update);
    gui->addParam("ortho", &bOrtho );
    gui->addParam("xyz global scale", &Ramses::globalScale ).step(0.01).updateFn(update);
    //gui->addParam("r(x) resolution", &Ramses::boxelx, true );
    //gui->addParam("theta(y) resolution", &Ramses::boxely, true );
    gui->addButton("save XML", sx );
    gui->addButton("load XML", ld );
    gui->addButton("start Render", ren );

    gui->addSeparator();
    
    for( int i=0; i<6; i++){
        string p = to_string(simType) + "_"+  Ramses::prm[i];
        
        function<void(void)> up = [i, this](){
            rms[i].updateVbo(eye);
        };
        
        function<void(void)> up2 = [i, this](){
            rms[i].loadSimData(this->frame);
            rms[i].updateVbo(eye);
        };
        
        gui->addParam(p+" show", &rms[i].bShow ).group(p).updateFn(up2);
        //gui->addParam(p+" polar coordinate", &rms[i].bPolar ).group(p).updateFn(up2);
        
        gui->addParam(p+" Auto Min Max", &rms[i].bAutoMinMax ).group(p).updateFn(up);
        gui->addParam(p+" in min", &rms[i].in_min).step(0.05f).group(p).updateFn(up);
        gui->addParam(p+" in max", &rms[i].in_max).step(0.05f).group(p).updateFn(up);
        
        gui->addParam(p+" z extrude", &rms[i].extrude).step(1.0f).group(p).updateFn(up);
        //gui->addParam(p+" x offset", &rms[i].xoffset).step(1.0f).group(p).updateFn(up);
        //gui->addParam(p+" y offset", &rms[i].yoffset).step(1.0f).group(p).updateFn(up);
        //gui->addParam(p+" z offset", &rms[i].zoffset).step(1.0f).group(p).updateFn(up);
        
        gui->addParam(p+" xy scale", &rms[i].scale).step(1.0f).group(p).updateFn(up);
        //gui->addParam(p+" visible thresh", &rms[i].visible_thresh).step(0.005f).min(0.0f).max(1.0f).group(p).updateFn(up);
        gui->addParam(p+" log", &rms[i].eStretch).step(1).min(0).max(1).group(p).updateFn(up2);
        
        // read only
        //gui->addParam(p+" r(x) resolution", &rms[eSimType][i].boxelx, true );
        //gui->addParam(p+" theta(y) resolution", &rms[eSimType][i].boxely, true );
        
        //gui->addParam(p+" visible rate(%)", &rms[i].visible_rate, true ).group(p);
        //gui->addParam(p+" num particle", &rms[i].nParticle, true).group(p);
        
        gui->addSeparator();
        
    }
}
Beispiel #10
0
void cApp::makeGui(){
    gui = params::InterfaceGl::create( getWindow(), Ramses::simType[eSimType], vec2(300, getWindowHeight()) );
    gui->setOptions( "", "position=`0 0` valueswidth=100" );
    
    function<void(void)> update = [&](){
        for( int i=0; i<rms.size(); i++){ rms[i].updateVbo(resolution); }
    };
    
    function<void(void)> changeSym = [this](){
        for( int i=0; i<rms.size(); i++){
            rms[i].eSimType = eSimType;
            rms[i].loadSimData(frame);
            rms[i].updateVbo(resolution);
        }
    };
    
    function<void(void)> sx = [this](){
        saveXml();
    };
    
    function<void(void)> ld = [this](){
        loadXml();
        for( int i=0; i<rms.size(); i++){
            rms[i].eSimType = eSimType;
            rms[i].loadSimData(frame);
            rms[i].updateVbo(resolution);
        }
    };
    
    function<void(void)> ren = [this](){
        bStart = true;
        mExp.startRender();
    };
    
    function<void(void)> norm = [this](){

        norms.resetCol();
        norms.resetPos();
        norms.resetVbo();
        
        for( int i=0; i<rms.size(); i++){
            if(rms[i].bShow){
                feature3d( rms[i].pos );
            }
        }
        norms.init(GL_LINES);
    };
    
    gui->addText( "main" );
    gui->addParam("simType", &eSimType ).min(0).max(4).updateFn( changeSym );
    gui->addParam("start", &bStart );
    gui->addParam("frame", &frame ).updateFn(update);
    gui->addParam("ortho", &bOrtho );
    gui->addButton("Compute Norm", norm );

    gui->addParam("xyz global scale", &Ramses::globalScale ).step(0.01).updateFn(update);
    gui->addParam("r(x) resolution", &Ramses::boxelx, true );
    gui->addParam("theta(y) resolution", &Ramses::boxely, true );
    gui->addButton("save XML", sx );
    gui->addButton("load XML", ld );
    gui->addButton("start render", ren );
    
    gui->addSeparator();
    
    for( int i=0; i<6; i++){
        string p = Ramses::prm[i];
        //gui->addText( p );
        
        //function<void(void)> up = bind(&Ramses::updateVbo, &rms[i]);
        function<void(void)> up = [i, this](){
            rms[i].updateVbo(resolution);
        };
        
        function<void(void)> up2 = [i, this](){
            rms[i].loadSimData(this->frame);
            rms[i].updateVbo(resolution);
        };
        
        gui->addParam(p+" show", &rms[i].bShow ).group(p).updateFn(up2);
        gui->addParam(p+" polar coordinate", &rms[i].bPolar ).group(p).updateFn(up2);
        gui->addParam(p+" Auto Min Max", &rms[i].bAutoMinMax ).group(p).updateFn(up);
        gui->addParam(p+" in min", &rms[i].in_min).step(0.05f).group(p).updateFn(up);
        gui->addParam(p+" in max", &rms[i].in_max).step(0.05f).group(p).updateFn(up);
        
        gui->addParam(p+" z extrude", &rms[i].extrude).step(1.0f).group(p).updateFn(up);
        gui->addParam(p+" x offset", &rms[i].xoffset).step(1.0f).group(p).updateFn(up);
        gui->addParam(p+" y offset", &rms[i].yoffset).step(1.0f).group(p).updateFn(up);
        gui->addParam(p+" z offset", &rms[i].zoffset).step(1.0f).group(p).updateFn(up);
        
        gui->addParam(p+" xy scale", &rms[i].scale).step(1.0f).group(p).updateFn(up);
        //gui->addParam(p+" visible thresh", &rms[i].visible_thresh).step(0.005f).min(0.0f).max(1.0f).group(p).updateFn(up);
        gui->addParam(p+" log", &rms[i].eStretch).step(1).min(0).max(1).group(p).updateFn(up2);
        gui->addParam(p+" inAngle", &rms[i].inAngle).step(1).min(-180).max(180).group(p).updateFn(up);
        gui->addParam(p+" outAngle", &rms[i].outAngle).step(1).min(-180).max(180).group(p).updateFn(up);
        gui->addParam(p+" offsetRotateAngle", &rms[i].offsetRotateAngle).step(0.01).group(p).updateFn(up);
        gui->addParam(p+" rotateSpeed", &rms[i].rotateSpeed).step(0.01).group(p).updateFn(up);
        
        // read only
        //gui->addParam(p+" visible rate(%)", &rms[i].visible_rate, true ).group(p);
        //gui->addParam(p+" num particle", &rms[i].nParticle, true).group(p);
        
        gui->addSeparator();
    }
}
Beispiel #11
0
void hidTestApp::setup()
{
	mJsonManager				= heartbeat::JsonManager::create("test.json");
    mSvgManager                 = heartbeat::SvgManager::create();
    mSvgManager->initialize();
	mEventManager				= heartbeat::EventManager::create( "global", true );
	mInteractionZones			= heartbeat::InteractionZones::create();
	mInteractionZonesDebug		= heartbeat::InteractionDebugRenderable::create( mInteractionZones );
	mKioskManager				= heartbeat::KioskManager::create();
	mKioskManager->initialize();
	
	mInteractionZones->initialize();
	mInteractionZonesDebug->initialize();
	
	mInteractionZonesDebug->enableDistance();
	mInteractionZonesDebug->enableZone();
	
	using namespace heartbeat;
	
	mFar = mInteractionZones->getZoneScalar( InteractionZones::Zone::FAR );
	mApproach = mInteractionZones->getZoneScalar( InteractionZones::Zone::APPROACH );
	mDead = mInteractionZones->getZoneScalar( InteractionZones::Zone::DEAD );
	mTable = mInteractionZones->getZoneScalar( InteractionZones::Zone::TABLE );
	
	mParams = params::InterfaceGl::create( "Interaction Zone Debug", ivec2( 300, 400 ) );
	
	// Unsafe but needed.
	mParams->addButton( "Capture Table Barrier", [&]() {
		mInteractionZones->captureBarrier();
		mInteractionZonesDebug->enableZone();
	});
	mParams->addButton( "Write Table Barrier", [&]() {
		mInteractionZones->writeInteractionZone();
	});
	
	mParams->addButton( "Toggle Live Distance", [&](){
		mInteractionZonesDebug->enableDistance( ! mInteractionZonesDebug->isDistanceEnabled() );
	});
	mParams->addButton( "Toggle Table Barrier", [&](){
		mInteractionZonesDebug->enableZone( ! mInteractionZonesDebug->isZoneEnabled() );
	});
	mParams->addSeparator();
	mParams->addButton( "Query/Store Ignore Indices(Poles)", std::bind( &InteractionZones::queryIgnoreIndices, mInteractionZones ) );
	mParams->addButton( "Print Current Ignore Indices(Poles)", [&](){
		std::cout << "Printing ignore indices: ";
		auto ignoreIndices = mInteractionZones->getIgnoreIndices();
		int last = 0;
		for( auto & indice : ignoreIndices ) {
			if( last == 0 ) {
				last = indice;
			}
			if( last != indice-1 ) {
				cout << endl << "  New Ignore Zone: ";
			}
			cout << indice << ", ";
			last = indice;
		}
		std::cout << std::endl;
	});
	mParams->addButton( "Clear Current Ignore Indices(Poles)", [&](){
		const_cast<std::vector<uint32_t>&>(mInteractionZones->getIgnoreIndices()).clear();
	});
	mParams->addSeparator();
	mParams->addText("Zone Scalars (No Overlapping)");
	mParams->addParam("Set Far Zone", &mFar).updateFn( std::bind( &hidTestApp::updateFar, this ) );
	mParams->addParam("Set Approach Zone", &mApproach).updateFn( std::bind( &hidTestApp::updateApproach, this ) );
	mParams->addParam("Set Dead Zone", &mDead).updateFn( std::bind( &hidTestApp::updateDead, this ) );
	mParams->addParam("Set Table Zone", &mTable).updateFn( std::bind( &hidTestApp::updateTable, this ) );
	mParams->addButton("Submit Zone Changes", std::bind( &hidTestApp::updateZones, this ) );
	mParams->addSeparator();
	mParams->addText("Teensy Settings");
	mParams->addButton("Send Top Teensy Approach", [&](){
		mEventManager->queueEvent( EventDataRef( new ApproachEvent( KioskId::TOP_KIOSK ) ) );
	});
	mParams->addButton("Send Top Teensy Depart", [&](){
		mEventManager->queueEvent( EventDataRef( new DepartEvent( KioskId::TOP_KIOSK ) ) );
	});
	mParams->addButton("Send Middle Teensy Approach", [&](){
		mEventManager->queueEvent( EventDataRef( new ApproachEvent( KioskId::MIDDLE_KIOSK ) ) );
	});
	mParams->addButton("Send Middle Teensy Depart", [&](){
		mEventManager->queueEvent( EventDataRef( new DepartEvent( KioskId::MIDDLE_KIOSK ) ) );
	});
	mParams->addButton("Send Bottom Teensy Approach", [&](){
		mEventManager->queueEvent( EventDataRef( new ApproachEvent( KioskId::BOTTOM_KIOSK ) ) );
	});
	mParams->addButton("Send Bottom Teensy Depart", [&](){
		mEventManager->queueEvent( EventDataRef( new DepartEvent( KioskId::BOTTOM_KIOSK ) ) );
	});
	
//	mParams->addButton("Set Teensy TOP", );
}