本文整理汇总了C++中params::InterfaceGlRef::addParam方法的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceGlRef::addParam方法的具体用法?C++ InterfaceGlRef::addParam怎么用?C++ InterfaceGlRef::addParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params::InterfaceGlRef
的用法示例。
在下文中一共展示了InterfaceGlRef::addParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void RDiffusionApp::setup()
{
mReactionU = 0.25f;
mReactionV = 0.04f;
mReactionK = 0.047f;
mReactionF = 0.1f;
mMousePressed = false;
// Setup the parameters
mParams = params::InterfaceGl::create( "Parameters", ivec2( 175, 100 ) );
mParams->addParam( "Reaction u", &mReactionU, "min=0.0 max=0.4 step=0.01 keyIncr=u keyDecr=U" );
mParams->addParam( "Reaction v", &mReactionV, "min=0.0 max=0.4 step=0.01 keyIncr=v keyDecr=V" );
mParams->addParam( "Reaction k", &mReactionK, "min=0.0 max=1.0 step=0.001 keyIncr=k keyDecr=K" );
mParams->addParam( "Reaction f", &mReactionF, "min=0.0 max=1.0 step=0.001 keyIncr=f keyDecr=F" );
mCurrentFBO = 0;
mOtherFBO = 1;
mFBOs[0] = gl::Fbo::create( FBO_WIDTH, FBO_HEIGHT, gl::Fbo::Format().colorTexture().disableDepth() );
mFBOs[1] = gl::Fbo::create( FBO_WIDTH, FBO_HEIGHT, gl::Fbo::Format().colorTexture().disableDepth() );
mRDShader = gl::GlslProg::create( loadResource( RES_PASS_THRU_VERT ), loadResource( RES_GSRD_FRAG ) );
mTexture = gl::Texture::create( loadImage( loadResource( RES_STARTER_IMAGE ) ),
gl::Texture::Format().wrap(GL_REPEAT).magFilter(GL_LINEAR).minFilter(GL_LINEAR) );
gl::getStockShader( gl::ShaderDef().texture() )->bind();
resetFBOs();
}
示例2: setup
void FlockingApp::setup()
{
mCentralGravity = true;
mFlatten = false;
mZoneRadius = 30.0f;
// SETUP CAMERA
mCameraDistance = 500.0f;
mEye = Vec3f( 0.0f, 0.0f, mCameraDistance );
mCenter = Vec3f::zero();
mUp = Vec3f::yAxis();
mCam.setPerspective( 75.0f, getWindowAspectRatio(), 5.0f, 2000.0f );
// SETUP PARAMS
mParams = params::InterfaceGl::create( "Flocking", Vec2i( 200, 220 ) );
mParams->addParam( "Scene Rotation", &mSceneRotation, "opened=1" );
mParams->addSeparator();
mParams->addParam( "Eye Distance", &mCameraDistance, "min=50.0 max=1500.0 step=50.0 keyIncr=s keyDecr=w" );
mParams->addParam( "Center Gravity", &mCentralGravity, "keyIncr=g" );
mParams->addParam( "Flatten", &mFlatten, "keyIncr=f" );
mParams->addSeparator();
mParams->addParam( "Zone Radius", &mZoneRadius, "min=10.0 max=100.0 step=1.0 keyIncr=z keyDecr=Z" );
// CREATE PARTICLE CONTROLLER
mParticleController.addParticles( NUM_INITIAL_PARTICLES );
}
示例3: setup
void MASOSApp::setup()
{
mShouldQuit = false;
reset();
mParams = params::InterfaceGl::create(getWindow(), "Parameters", toPixels(ivec2(250, 300)));
mParams->addParam("Initial Velocity [m/s]", &mInitialVelocity, "min=0");
mParams->addParam("Angle [']", &mAngle, "min=0, max=90");
mParams->addParam("Terminal Velocity [m/s]", &mTerminalVelocity, "min=1");
mParams->addParam("Current time [s]", &mCurrentTime, "min=0");
mParams->addParam("Delta time [ms]", &mDeltaTime, "step=25");
mParams->addParam("Start time [s]", &mStartTime, "min=0");
mParams->addParam("End time [s]", &mEndTime, "min=0");
mParams->addButton("Start", bind(&MASOSApp::buttonStart, this));
mParams->addButton("Pause", bind(&MASOSApp::buttonPause, this));
mParams->addButton("Reset", bind(&MASOSApp::buttonReset, this));
mParams->addParam("Scale", &scale);
mParams->addParam("Pos X", &currX);
mParams->addParam("Pos Y", &currY);
mIsPlaying = false;
mThreadPlay = shared_ptr<thread>(new thread(bind(&MASOSApp::playLoop, this)));
}
示例4: createParams
void GeometryApp::createParams()
{
#if ! defined( CINDER_GL_ES )
vector<string> primitives = { "Capsule", "Cone", "Cube", "Cylinder", "Helix", "Icosahedron", "Icosphere", "Sphere", "Teapot", "Torus", "Plane" };
vector<string> qualities = { "Low", "Default", "High" };
vector<string> viewModes = { "Shaded", "Wireframe" };
vector<string> texturingModes = { "None", "Procedural", "Sampler" };
mParams = params::InterfaceGl::create( getWindow(), "Geometry Demo", toPixels( ivec2( 300, 200 ) ) );
mParams->setOptions( "", "valueswidth=160 refresh=0.1" );
mParams->addParam( "Primitive", primitives, (int*) &mPrimitiveSelected );
mParams->addParam( "Quality", qualities, (int*) &mQualitySelected );
mParams->addParam( "Viewing Mode", viewModes, (int*) &mViewMode );
mParams->addParam( "Texturing Mode", texturingModes, (int*) &mTexturingMode );
mParams->addSeparator();
mParams->addParam( "Subdivision", &mSubdivision ).min( 1 ).max( 5 ).updateFn( [this] { createGeometry(); } );
mParams->addSeparator();
mParams->addParam( "Show Grid", &mShowGrid );
mParams->addParam( "Show Normals", &mShowNormals );
mParams->addParam( "Show Colors", &mShowColors ).updateFn( [this] { createGeometry(); } );
mParams->addParam( "Face Culling", &mEnableFaceFulling ).updateFn( [this] { gl::enableFaceCulling( mEnableFaceFulling ); } );
#endif
}
示例5: initGui
void AudioObjApp::initGui()
{
mParams = params::InterfaceGl::create( "Settings", Vec2f( 200, 250 ) );
mParams->addParam( "Obj color", &mObjColor );
mParams->addParam( "Wireframe", &mRenderWireframe );
mParams->addParam( "Data Gain", &mFeatureGain, "min=0.0 max=25.0 step=0.1" );
mParams->addParam( "Data Offset", &mFeatureOffset, "min=-1.0 max=1.0 step=0.01" );
mParams->addParam( "Data Damping", &mFeatureDamping, "min=0.0 max=0.99 step=0.01" );
mParams->addParam( "Spread", &mFeatureSpread, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Spread Offset", &mFeatureSpreadOffset, "min=0.0 max=1.0 step=0.01" );
}
示例6: initGui
void BasicReceiverApp::initGui()
{
mParams = params::InterfaceGl::create( "Settings", Vec2f( 220, 200 ) );
mParams->addParam( "Data Gain", &mDataGain, "min=0.0 max=100.0 step=0.1" );
mParams->addParam( "Data Offset", &mDataOffset, "min=-1.0 max=1.0 step=0.01" );
mParams->addParam( "Data Damping", &mDataDamping, "min=0.0 max=0.99 step=0.01" );
mParams->addParam( "Use log", &mDataIsLog );
mParams->addParam( "Spread", &mDataSpread, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Spread Offset", &mDataSpreadOffset, "min=0.0 max=1.0 step=0.01" );
mParams->addParam( "Feature", mAvailableFeatures, &mActiveFeature );
}
示例7: setupParams
void PinballWarpingApp::setupParams()
{
mParams = params::InterfaceGl::create("params", ivec2(300,300));
mParams->addParam("FPS", &mFps);
mParams->addSeparator();
mParams->addParam("Draw Image", &mDrawImage);
mParams->addParam("Debugging", &mPinball.mDebug);
mParams->addParam("Editing Locations", &mPinball.mIsInEditingMode).updateFn([this] {
if (!mPinball.mDebug)
mPinball.saveJson();
});
}
示例8: setParams
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();
}
示例9: devices
void PS3EyeSlowMoApp::setup()
{
currentFrame = 0;
mSkippedFrames = 1;
using namespace ps3eye;
mShouldQuit = false;
// list out the devices
std::vector<PS3EYECam::PS3EYERef> devices( PS3EYECam::getDevices() );
console() << "found " << devices.size() << " cameras" << std::endl;
mTimer = Timer(true);
mCamFrameCount = 0;
mCamFps = 0;
mCamFpsLastSampleFrame = 0;
mCamFpsLastSampleTime = 0;
if(devices.size())
{
eye = devices.at(0);
bool res = eye->init(640, 480, 60);
console() << "init eye result " << res << std::endl;
eye->start();
frame_bgra = new uint8_t[eye->getWidth()*eye->getHeight()*4];
mFrame = Surface(frame_bgra, eye->getWidth(), eye->getHeight(), eye->getWidth()*4, SurfaceChannelOrder::BGRA);
memset(frame_bgra, 0, eye->getWidth()*eye->getHeight()*4);
// create and launch the thread
mThread = thread( bind( &PS3EyeSlowMoApp::eyeUpdateThreadFn, this ) );
}
mParams = params::InterfaceGl::create( "PS3EYE", toPixels( ivec2( 180, 150 ) ) );
mParams->addParam( "Framerate", &mFrameRate, "", true );
mParams->addParam( "Queue", &mQueueSize, "", true);
mParams->addSeparator();
mParams->addParam( "Skip", &mSkippedFrames).min( 1 ).step( 1 );
mParams->addParam( "Auto gain", &isAutoGain );
mParams->addParam( "Auto WB", &isAutoWB );
//surfaceQueue = new ph::ConcurrentQueue<Surface*>();
mAccumFbo = gl::Fbo::create( getWindowWidth(), getWindowHeight(),
gl::Fbo::Format().colorTexture( gl::Texture::Format().internalFormat( GL_RGB16F ) ).disableDepth() );
}
示例10: setup
void TessellationShaderApp::setup()
{
mTessLevelInner = mTessLevelOuter = 4;
int maxPatchVertices = 0;
glGetIntegerv( GL_MAX_PATCH_VERTICES, &maxPatchVertices );
app::console() << "Max supported patch vertices " << maxPatchVertices << std::endl;
#if ! defined( CINDER_GL_ES )
fs::path glDir = "ogl";
mRadius = 200.0f;
mParams = params::InterfaceGl::create( "Settings", ivec2( 200, 200 ) );
mParams->addParam( "Radius", &mRadius, "step=1.0" );
mParams->addParam( "Tess level inner", &mTessLevelInner, "min=0" );
mParams->addParam( "Tess level outer", &mTessLevelOuter, "min=0" );
#else
fs::path glDir = "es31a";
mRadius = 400.0f;
#endif
try {
mGlsl = gl::GlslProg::create( gl::GlslProg::Format()
.vertex( loadAsset( glDir / "0_vert.glsl" ) )
.tessellationCtrl( loadAsset( glDir / "1_tess_ctrl.glsl" ) )
.tessellationEval( loadAsset( glDir / "2_tess_eval.glsl" ) )
#if defined( CINDER_GL_ES )
.geometry( loadAsset( glDir / "x_geom.glsl" ) )
#endif
.fragment( loadAsset( glDir / "3_frag.glsl" ) ) );
}
catch( const std::exception &ex ) {
console() << ex.what() << endl;
//quit();
}
mBatch = gl::VertBatch::create( GL_PATCHES );
mBatch->color( 1.0f, 0.0f, 0.0f );
mBatch->vertex( vec2( 1, -1 ) );
mBatch->color( 0.0f, 1.0f, 0.0f );
mBatch->vertex( vec2( 0 , 1 ) );
mBatch->color( 0.0f, 0.0f, 1.0f );
mBatch->vertex( vec2( -1, -1 ) );
gl::patchParameteri( GL_PATCH_VERTICES, 3 );
}
示例11: setup
void MotionBlurVelocityBufferApp::setup()
{
mBackground = gl::Texture::create( loadImage( loadAsset( "background.jpg" ) ) );
mGpuTimer = gl::QueryTimeSwapped::create();
gl::enableVerticalSync();
createGeometry();
createBuffers();
loadShaders();
#if ! defined( CINDER_ANDROID )
mParams = params::InterfaceGl::create( "Motion Blur Options", ivec2( 250, 300 ) );
mParams->addParam( "Average GPU Draw (ms)", &mAverageGpuTime );
mParams->addParam( "Average CPU Draw (ms)", &mAverageCpuTime );
mParams->addSeparator();
mParams->addParam( "Enable Blur", &mBlurEnabled );
mParams->addParam( "Show Velocity Buffers", &mDisplayVelocityBuffers );
mParams->addParam( "Pause Animation", &mPaused );
mParams->addParam( "Animation Speed", &mAnimationSpeed ).min( 0.05f ).step( 0.2f );
mParams->addParam( "Max Samples", &mSampleCount ).min( 1 ).step( 2 );
mParams->addParam( "Blur Noise", &mBlurNoise ).min( 0.0f ).step( 0.01f );
#endif
#if defined( CINDER_COCOA_TOUCH )
getSignalSupportedOrientations().connect( [] { return InterfaceOrientation::LandscapeAll; } );
#endif
}
示例12: setup
void SlingshotSmokeApp::setup()
{
mVolumeMult = 5.0;
mLastTime = 0;
getWindowIndex(0)->getSignalDraw().connect([=]() { drawRender(); });
mAudioSource = AudioSource();
mAudioSource.setup();
vec2 fluidResolution = vec2(512);
vec2 smokeResolution = app::getWindowSize();
mFluid = Fluid(fluidResolution);
mSmokers.reserve(2);
mSmokers.push_back(shared_ptr<FakeSmoker>(new FakeSmoker(fluidResolution, smokeResolution)));
mSmokers.push_back(shared_ptr<PositionSmoker>(new PositionSmoker(fluidResolution, smokeResolution)));
mSmokers.push_back(shared_ptr<TransitionSmoker>(new TransitionSmoker(fluidResolution, smokeResolution)));
mSmokers.push_back(shared_ptr<BottomSmoker>(new BottomSmoker(fluidResolution, smokeResolution)));
mCurrentSmoker = 0;
mSmokers[mCurrentSmoker]->light(vec2(0.5, 0.2), mParams);
gl::GlslProg::Format renderFormat;
renderFormat.vertex(app::loadAsset("passthru.vert"));
renderFormat.fragment(app::loadAsset("Smokers/smoke_draw.frag"));
mRenderProg = gl::GlslProg::create(renderFormat);
mRenderProg->uniform("i_resolution", smokeResolution);
gl::Texture2d::Format texFmt;
texFmt.setInternalFormat(GL_RGBA32F);
texFmt.setDataType(GL_FLOAT);
texFmt.setTarget(GL_TEXTURE_2D);
texFmt.setWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
gl::Fbo::Format fmt;
fmt.disableDepth()
.setColorTextureFormat(texFmt);
mSmokeField = PingPongFBO(fmt, smokeResolution, 4);
// Do params last so that all the FBOs are in the right context
vec2 paramsSize = vec2(255, 512);
auto format = Window::Format();
format.setSize(paramsSize + vec2(40, 20));
format.setPos(ivec2(100));
WindowRef paramsWindow = createWindow(format);
paramsWindow->getSignalDraw().connect([=]() { drawParams(); });
mParams = params::InterfaceGl::create(paramsWindow, "Options", paramsSize);
mParams->addParam("Volume", &mVolumeMult)
.max(10.0)
.min(0.0)
.step(0.1);
}
示例13: setup
void FlockingApp::setup()
{
Rand::randomize();
mCenter = vec3( getWindowWidth() * 0.5f, getWindowHeight() * 0.5f, 0.0f );
mCentralGravity = true;
mFlatten = false;
mSaveFrames = false;
mIsRenderingPrint = false;
mZoneRadius = 80.0f;
mLowerThresh = 0.5f;
mHigherThresh = 0.8f;
mAttractStrength = 0.004f;
mRepelStrength = 0.01f;
mOrientStrength = 0.01f;
// SETUP CAMERA
mCameraDistance = 350.0f;
mEye = vec3( 0.0f, 0.0f, mCameraDistance );
mCenter = vec3::zero();
mUp = vec3::yAxis();
mCam.setPerspective( 75.0f, getWindowAspectRatio(), 5.0f, 5000.0f );
// SETUP PARAMS
mParams = params::InterfaceGl::create( "Flocking", ivec2( 200, 310 ) );
mParams->addParam( "Scene Rotation", &mSceneRotation, "opened=1" );
mParams->addSeparator();
mParams->addParam( "Eye Distance", &mCameraDistance, "min=100.0 max=2000.0 step=50.0 keyIncr=s keyDecr=w" );
mParams->addParam( "Center Gravity", &mCentralGravity, "keyIncr=g" );
mParams->addParam( "Flatten", &mFlatten, "keyIncr=f" );
mParams->addSeparator();
mParams->addParam( "Zone Radius", &mZoneRadius, "min=10.0 max=100.0 step=1.0 keyIncr=z keyDecr=Z" );
mParams->addParam( "Lower Thresh", &mLowerThresh, "min=0.025 max=1.0 step=0.025 keyIncr=l keyDecr=L" );
mParams->addParam( "Higher Thresh", &mHigherThresh, "min=0.025 max=1.0 step=0.025 keyIncr=h keyDecr=H" );
mParams->addSeparator();
mParams->addParam( "Attract Strength", &mAttractStrength, "min=0.001 max=0.1 step=0.001 keyIncr=a keyDecr=A" );
mParams->addParam( "Repel Strength", &mRepelStrength, "min=0.001 max=0.1 step=0.001 keyIncr=r keyDecr=R" );
mParams->addParam( "Orient Strength", &mOrientStrength, "min=0.001 max=0.1 step=0.001 keyIncr=o keyDecr=O" );
// CREATE PARTICLE CONTROLLER
mParticleController.addParticles( NUM_INITIAL_PARTICLES );
mParticleController.addPredators( NUM_INITIAL_PREDATORS );
}
示例14: setup
void GeoDeVisualizerApp::setup()
{
// read the initial world
json initJSON;
if (!debug) {
string JSONBuff;
if (mServer.open(DEFAULT_PORT, "localhost")) {
while (!mServer.isReady(JSONBuff)) {};
}
initJSON = json::parse(JSONBuff);
} else {
ifstream inputFile( "../../../resources/test_data.json" );
assert( inputFile.good() );
string JSONBuff(( istreambuf_iterator<char>( inputFile )), ( istreambuf_iterator<char>() ));
initJSON = json::parse(JSONBuff);
}
if (!(isInitialJSON(initJSON) and validateInitialJSON(initJSON))) {
cerr << "Initial JSON was not valid" << endl;
exit(1);
}
// WRITE VERTICES AND FACES TO THE TRIMESH
writeMesh(initJSON);
mWorld.initialize(initJSON);
setupColoniesList();
resourceColors = ResourceColorPicker().getColors(mWorld.numResources());
// SETUP CAMERA
setupCamVars(mCamVars);
mCam.setPerspective(75.0f, getWindowAspectRatio(), 0.5f, 2000.0f );
// SETUP PARAMS
setupParamVars(mCurParams, mPrevParams, mWorld.numResources());
mParams = params::InterfaceGl::create("GeoDe", Vec2i(200, 400));
mParams->addParam("scene rotation", &mCamVars.sceneRotation, "opened=1");
mParams->addParam("eye distance", &mCamVars.cameraDistance, "min=1.0 max=1500.0 step=0.1 keyIncr=s keyDecr=k keyIncr=j");
mParams->addSeparator();
mParams->addParam("time", &mCurParams.timeStep);
mParams->addParam("state", mDisplayModes, &mCurParams.displayMode);
mParams->addSeparator();
}
示例15: setup
void SpawnObjectApp::setup()
{
mFixtures = Fixture::loadFixtures( getAssetPath("fixtures_001.csv") ); // load CSV fixtures file
mFixtureMesh = Fixture::loadObj( getAssetPath("sphere.obj") ); // load fixture mesh
mVenueMesh = Fixture::loadObj( getAssetPath("piano2.obj") ); // load venue mesh
mFadeIn = 0.5f;
mFadeOut = 0.1f;
mSpeed = 0.2f;
mRadius = 1.5f;
mPointsN = 8;
mDeg = 3;
mModule = SpawnModule::create(); // create module
mParams = params::InterfaceGl::create( "Params", Vec2i( 200, 240 ) ); // Gui
mParams->addParam( "Fade IN", &mFadeIn , "min=0.001 max=1.0 step=0.001" );
mParams->addParam( "Fade OUT", &mFadeOut , "min=0.001 max=1.0 step=0.001" );
mParams->addSeparator();
mParams->addParam( "Speed", &mSpeed , "min=0.001 max=10.0 step=0.001" );
mParams->addParam( "Radius", &mRadius , "min=0.1 max=15.0 step=0.1" );
mParams->addParam( "Points N", &mPointsN , "min=2 max=100 step=1" );
mParams->addParam( "Deg", &mDeg , "min=1 max=10 step=1" );
ci::CameraPersp initialCam; // Initialise camera
initialCam.setPerspective( 45.0f, ci::app::getWindowAspectRatio(), 0.1, 3000 );
mMayaCam = MayaCamUI( initialCam );
// Set up light
mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 );
mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() );
mLight->setAmbient( ColorAf::gray( 0.843f ) );
mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) );
mLight->enable();
// create a path
mModule->createPath( mPointsN, mDeg, mRadius );
}