Exemple #1
0
void RiftAppSkeleton::ToggleShaderWorld()
{
    ShaderToy* pST = m_paneScene.GetFocusedShader();

    if (m_shaderToyScene.m_bDraw)
    {
        // Back into gallery
        ResetAllTransformations();
        m_headSize = 1.0f;
        m_shaderToyScene.m_bDraw = false;
        m_shaderToyScene.SetShaderToy(NULL);

#ifdef USE_ANTTWEAKBAR
        TwRemoveVar(m_pTweakbar, "title");
        TwRemoveVar(m_pTweakbar, "author");
        TwRemoveVar(m_pTweakbar, "gotourl");
#endif
    }
    else if (pST != NULL)
    {
        // Transitioning into shader world
        ///@todo Will we drop frames here? Clear to black if so.
        m_shaderToyScene.m_bDraw = true;
        m_shaderToyScene.SetShaderToy(pST);

        const glm::vec3 hp = pST->GetHeadPos();
        m_chassisPos.x = hp.x;
        m_chassisPos.y = hp.y;
        m_chassisPos.z = hp.z;
        m_headSize = pST->GetHeadSize();
        m_chassisYaw = static_cast<float>(M_PI);

#ifdef USE_ANTTWEAKBAR
        const std::string titleStr = "title: " + pST->GetSourceFile();
        const std::string authorStr = "author: " + pST->GetAuthor();

        std::stringstream ss;
        // Assemble a string to pass into help here
        ss << " label='"
           << titleStr
           << "' group=Shader ";
        TwAddButton(m_pTweakbar, "title", NULL, NULL, ss.str().c_str());

        ss.str("");
        ss << " label='"
           << authorStr
           << "' group=Shader ";
        TwAddButton(m_pTweakbar, "author", NULL, NULL, ss.str().c_str());

        TwAddButton(m_pTweakbar, "gotourl", GoToURLCB, this, " label='Go to URL'  group='Shader' ");
#endif
    }
}
void TW_CALL MaterialDialog::RemoveGradientLayer(void *clientData)
{
	AglGradientMaterial* layer = (AglGradientMaterial*)clientData;
	vector<AglGradient*> gradients = Scene::GetInstance()->GetGradients();
	for (unsigned int i = 0; i < gradients.size(); i++)
	{
		vector<AglGradientMaterial*> layers = gradients[i]->getLayers();
		for (unsigned int j = 0; j < layers.size(); j++)
		{
			if (layers[j] == layer)
			{
				MaterialDialog* dialog = SceneDialog::GetInstance()->GetMaterialDialog();
				for (unsigned int l = 0; l < layers.size(); l++)
				{
					//Remove layers here				
					string name = "Layer" + toString(l);
					TwRemoveVar(dialog->m_dialog, name.c_str());
				}
				gradients[i]->removeLayer(layer);
				layers = gradients[i]->getLayers();
				for (unsigned int l = 0; l < layers.size(); l++)
				{
					//Add remaining layers
					dialog->AddLayer(gradients[i], layers[l], l);
				}

				break;
			}
		}
	}
}
Exemple #3
0
void AimerDemo::on_close()
{
    m_cloth_ready = false;

    gl::delete_program(&m_cloth_program);
    gl::delete_program(&m_aimer_program);
    gl::delete_buffer(&m_cloth_vertices);
    gl::delete_buffer(&m_sample_vertices);
    gl::delete_buffer(&m_grid_vertices);

    TwRemoveVar(twbar(), "Iters");
    TwRemoveVar(twbar(), "s");
    TwRemoveVar(twbar(), "a");

    ConstrainedClothoidDemo::on_close();
}
void Toolbar::unregisterTweakBar(TwBar* tweakBar)
{
  TwBar* toolTweakBar = TwGetBarByName(toolbarTitle);

  if(toolTweakBar == nullptr)
    return;

  TwRemoveVar(toolTweakBar, TwGetBarName(tweakBar));
}
void SceneDialog::RemoveParticleSystem(AglParticleSystem* pParticleSystem)
{
	vector<ParticleSystem*> ps = Scene::GetInstance()->GetParticleSystems();
	for (unsigned int i = 0; i < ps.size(); i++)
	{
		string name = "Particle Effect" + toString(i);
		TwRemoveVar(m_dialog, name.c_str());
	}
	Scene::GetInstance()->RemoveParticleSystem(pParticleSystem);
	ps = Scene::GetInstance()->GetParticleSystems();
	for (unsigned int i = 0; i < ps.size(); i++)
	{
		AddPE(ps[i]->getParticleSystem(), i);
	}
}
void SceneDialog::RemoveMaterial(AglMaterial* pMaterial)
{
	vector<AglMaterial*> materials = Scene::GetInstance()->GetMaterials();
	for (unsigned int i = 0; i < materials.size(); i++)
	{
		string name = ("Material" + toString(materials[i]->id));
		TwRemoveVar(m_dialog, name.c_str());
	}
	Scene::GetInstance()->RemoveMaterial(pMaterial);
	materials = Scene::GetInstance()->GetMaterials();
	for (unsigned int i = 0; i < materials.size(); i++)
	{
		AddMaterial(materials[i]);
	}
}
Exemple #7
0
void InterfaceGl::removeParam( const std::string &name )
{
    TwRemoveVar( mBar.get(), name.c_str() );
}