示例#1
0
////////////////////////////////////////////////////////////////////////////////
//
//  Method: SkinningApp::initUI()
//
//    Sets up the user interface
//
////////////////////////////////////////////////////////////////////////////////
void SkinningApp::initUI() {
    if (mTweakBar) {
        NvTweakVarBase *var;
        // expose the rendering modes
        NvTweakEnum<uint32_t> renderModes[] = {
            {"Color", 0},
            {"Normals", 1},
            {"Weights", 2}
        };
        var = mTweakBar->addEnum("Render Mode", m_renderMode, renderModes, TWEAKENUM_ARRAYSIZE(renderModes));
        addTweakKeyBind(var, NvKey::K_M);
        addTweakButtonBind(var, NvGamepad::BUTTON_Y);

        mTweakBar->addPadding();
        var = mTweakBar->addValue("Single Bone Skinning", m_singleBoneSkinning);
        addTweakKeyBind(var, NvKey::K_B);
        addTweakButtonBind(var, NvGamepad::BUTTON_X);

        mTweakBar->addPadding();
        m_timeScalar = 1.0f;
        var = mTweakBar->addValue("Animation Speed", m_timeScalar, 0, 5.0, 0.1f);
        addTweakKeyBind(var, NvKey::K_RBRACKET, NvKey::K_LBRACKET);
        addTweakButtonBind(var, NvGamepad::BUTTON_RIGHT_SHOULDER, NvGamepad::BUTTON_LEFT_SHOULDER);
    }

    // Change the filtering for the framerate
    mFramerate->setMaxReportRate(.2f);
    mFramerate->setReportFrames(20);

    // Disable wait for vsync
    getGLContext()->setSwapInterval(0);  
}
示例#2
0
void SkinningAppVk::initUI(void) {
	if (mTweakBar) {
		NvTweakVarBase *var;
		// expose the rendering modes
		NvTweakEnum<uint32_t> renderModes[] = {
			{ "Color", 0 },
			{ "Normals", 1 },
			{ "Weights", 2 }
		};
		var = mTweakBar->addEnum("Render Mode", mRenderMode, renderModes, TWEAKENUM_ARRAYSIZE(renderModes));
		addTweakKeyBind(var, NvKey::K_M);
		addTweakButtonBind(var, NvGamepad::BUTTON_Y);

		mTweakBar->addPadding();
		var = mTweakBar->addValue("Single Bone Skinning", mSingleBoneSkinning);
		addTweakKeyBind(var, NvKey::K_B);
		addTweakButtonBind(var, NvGamepad::BUTTON_X);

		mTweakBar->addPadding();
		mTimeScalar = 1.0f;
		var = mTweakBar->addValue("Animation Speed", mTimeScalar, 0, 5.0, 0.1f);
		addTweakKeyBind(var, NvKey::K_RBRACKET, NvKey::K_LBRACKET);
		addTweakButtonBind(var, NvGamepad::BUTTON_RIGHT_SHOULDER, NvGamepad::BUTTON_LEFT_SHOULDER);
	}
}
void ParticleUpsampling::initUI(void)
{
    if (mTweakBar)
    {
        NvTweakVarBase *var;

        var = mTweakBar->addValue("Shadow Render", m_sceneRenderer->getParticleParams()->renderShadows);
        addTweakKeyBind(var, NvKey::K_S);
        addTweakButtonBind(var, NvGamepad::BUTTON_X);
        var = mTweakBar->addValue("Model Render", m_sceneRenderer->getSceneParams()->drawModel);
        addTweakKeyBind(var, NvKey::K_M);
        addTweakButtonBind(var, NvGamepad::BUTTON_X);
        var = mTweakBar->addValue("Use Depth Prepass", m_sceneRenderer->getSceneParams()->useDepthPrepass);
        addTweakKeyBind(var, NvKey::K_U);

        mTweakBar->addPadding();
        NvTweakEnum<uint32_t> shadowSliceModes[] = {
            {"16",  16},
            {"32",  32},
            {"64",  64}
        };
        var = mTweakBar->addEnum("Num Shadow Slices", m_sceneRenderer->getParticleParams()->numSlices, shadowSliceModes, TWEAKENUM_ARRAYSIZE(shadowSliceModes));
        addTweakKeyBind(var, NvKey::K_N);

        mTweakBar->addPadding();
        NvTweakEnum<uint32_t> particleDownsampleModes[] = {
            {"Full-Res",    1},
            {"Half-Res",    2},
            {"Quarter-Res", 4}
        };
        var = mTweakBar->addEnum("Particle Downsample Mode", m_sceneRenderer->getSceneFBOParams()->particleDownsample, particleDownsampleModes, TWEAKENUM_ARRAYSIZE(particleDownsampleModes), REACT_UPDATE_SCREEN_BUFFERS);
        addTweakKeyBind(var, NvKey::K_P);
        addTweakButtonBind(var, NvGamepad::BUTTON_RIGHT_SHOULDER);

        NvTweakEnum<uint32_t> lightBufferSizeModes[] = {
            {"64x64",   64},
            {"128x128",  128},
            {"256x256",  256}
        };
        var = mTweakBar->addEnum("Light Buffer Size", m_sceneRenderer->getSceneFBOParams()->lightBufferSize, lightBufferSizeModes, TWEAKENUM_ARRAYSIZE(lightBufferSizeModes), REACT_UPDATE_LIGHT_BUFFERS);
        addTweakKeyBind(var, NvKey::K_L);
    }
}