示例#1
0
void Toolbar::unregisterTweakBar(TwBar* tweakBar)
{
  TwBar* toolTweakBar = TwGetBarByName(toolbarTitle);

  if(toolTweakBar == nullptr)
    return;

  TwRemoveVar(toolTweakBar, TwGetBarName(tweakBar));
}
示例#2
0
void Toolbar::registerTweakBar(TwBar *tweakBar)
{
  TwBar* toolTweakBar = TwGetBarByName(toolbarTitle);

  Q_ASSERT(toolTweakBar != nullptr);

  if(toolTweakBar == nullptr)
    return;

  TwAddVarCB(toolTweakBar,
             TwGetBarName(tweakBar),
             TW_TYPE_BOOLCPP,
             reinterpret_cast<TwSetVarCallback>(setBarVisibility),
             reinterpret_cast<TwGetVarCallback>(getBarVisibility),
             tweakBar,
             "");
}
示例#3
0
/*
 * @brief Displays the TwBar specified by name in data, hiding all others.
 */
void TW_CALL Ui_ShowBar(void *data) {
	const char *name = (const char *) data;
	int32_t hidden = 0, visible = 1;

	Com_Debug("%s\n", name);

	if (ui.top) {
		TwSetParam(ui.top, NULL, "visible", TW_PARAM_INT32, 1, &hidden);
	}

	ui.top = TwGetBarByName(name);

	if (ui.top) {
		TwSetParam(ui.top, NULL, "visible", TW_PARAM_INT32, 1, &visible);
	}

	// then center the visible bar
	Ui_CenterBar((void *) name);
}
void AtmosphereSample::UpdateGUI()
{
    auto bar = TwGetBarByName( "Settings" );

    {
        int32_t IsVisible = m_bEnableLightScattering ? 1 : 0;
        TwSetParam( bar, "Scattering", "visible", TW_PARAM_INT32, 1, &IsVisible );
        TwSetParam( bar, "ToneMapping", "visible", TW_PARAM_INT32, 1, &IsVisible );
    }

    bool bIsEpipolarSampling = m_PPAttribs.m_uiLightSctrTechnique == LIGHT_SCTR_TECHNIQUE_EPIPOLAR_SAMPLING;
    TwSetEnabled( bar, "NumSlices", bIsEpipolarSampling );
    TwSetEnabled( bar, "MaxSamples", bIsEpipolarSampling );
    TwSetEnabled( bar, "IntialStep", bIsEpipolarSampling );
    TwSetEnabled( bar, "EpipoleSamplingDensity", bIsEpipolarSampling );
    TwSetEnabled( bar, "RefinementThreshold", bIsEpipolarSampling );
    TwSetEnabled( bar, "1DMinMaxOptimization", bIsEpipolarSampling );
    TwSetEnabled( bar, "OptimizeSampleLocations", bIsEpipolarSampling );
    TwSetEnabled( bar, "ShowSampling", bIsEpipolarSampling );
    TwSetEnabled( bar, "CorrectScattering", bIsEpipolarSampling );
    TwSetEnabled( bar, "ShowDepthBreaks", bIsEpipolarSampling && m_PPAttribs.m_bCorrectScatteringAtDepthBreaks != 0);
    TwSetEnabled( bar, "NumIntegrationSteps", !m_PPAttribs.m_bEnableLightShafts && m_PPAttribs.m_uiSingleScatteringMode == SINGLE_SCTR_MODE_INTEGRATION );

    {
        int32_t IsVisible = m_PPAttribs.m_bUseCustomSctrCoeffs ? 1 : 0;
        TwSetParam( bar, "RayleighColor", "visible", TW_PARAM_INT32, 1, &IsVisible );
        TwSetParam( bar, "MieColor", "visible", TW_PARAM_INT32, 1, &IsVisible );
        TwSetParam( bar, "UpdateCoeffsBtn", "visible", TW_PARAM_INT32, 1, &IsVisible );
    }

    TwSetEnabled( bar, "WhitePoint", m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_MODE_REINHARD_MOD ||
                                     m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_MODE_UNCHARTED2 ||
                                     m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_LOGARITHMIC ||
                                     m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_ADAPTIVE_LOG );

    TwSetEnabled( bar, "LumSaturation", m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_MODE_EXP ||
                                        m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_MODE_REINHARD ||
                                        m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_MODE_REINHARD_MOD ||
                                        m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_LOGARITHMIC ||
                                        m_PPAttribs.m_uiToneMappingMode == TONE_MAPPING_ADAPTIVE_LOG );
    TwSetEnabled( bar, "LightAdaptation", m_PPAttribs.m_bAutoExposure ? true : false );
}
示例#5
0
/*
 * @brief Centers the TwBar by the specified name.
 */
void TW_CALL Ui_CenterBar(void *data) {
	const char *name = (const char *) data;
	TwBar *bar = TwGetBarByName(name);

	if (bar) {
		double size[2], position[2];
		TwGetParam(bar, NULL, "size", TW_PARAM_DOUBLE, 2, size);

		position[0] = (r_context.width - size[0]) / 2.0;
		position[1] = (r_context.height - size[1]) / 2.0;

		if (position[0] < (r_pixel_t) 0)
			position[0] = (r_pixel_t) 0;
		if (position[1] < (r_pixel_t) 0)
			position[1] = (r_pixel_t) 0;
		position[0] = (r_pixel_t) position[0];
		position[1] = (r_pixel_t) position[1];

		// Com_Debug("%s: %4f, %4f\n", name, position[0], position[1]);

		TwSetParam(bar, NULL, "position", TW_PARAM_DOUBLE, 2, position);
	}
}