Ejemplo n.º 1
0
void 
DlgPass::updateMats(Pass *p)
{
	MaterialID mid;
	wxString mName,propName;

	std::map<std::string, nau::material::MaterialID> mm = p->getMaterialMap();

	std::map<std::string, nau::material::MaterialID>::iterator iterMM = mm.begin();

	for ( ; iterMM != mm.end() ; ++iterMM) {

		mid = iterMM->second;
		mName = wxString(mid.getLibName().c_str());
		mName.append(wxT("::"));
		mName.append(wxString(mid.getMaterialName().c_str()));
		propName = wxT("Material Maps.");
		propName.append(wxString(iterMM->first.c_str()));
		m_PG->SetPropertyValue(propName, mName);
	}
}
Ejemplo n.º 2
0
void DlgPass::updateProperties(Pass *p) {

	//
	m_PG->SetPropertyValue(wxT("Class"), wxString(p->getClassName().c_str()));

	// CAMERA
	if (p->getClassName() == "quad")
		m_PG->DisableProperty(wxT("Camera"));
	else
		m_PG->EnableProperty(wxT("Camera"));

	m_PG->SetPropertyValue(wxT("Camera"), wxString(p->getCameraName().c_str()));

	// VIEWPORT
	nau::render::Viewport *v = p->getViewport();

	if (p->hasRenderTarget() && p->isRenderTargetEnabled()) {
		m_PG->SetPropertyValue(wxT("Viewport"), wxT("From Render Target"));
		m_PG->DisableProperty(wxT("Viewport"));
	}
	else if (v == NULL) {
		m_PG->EnableProperty(wxT("Viewport"));
		m_PG->SetPropertyValue(wxT("Viewport"), wxT("From Camera"));
	}
	else {
		m_PG->EnableProperty(wxT("Viewport"));
		m_PG->SetPropertyValue(wxT("Viewport"), wxString(v->getName().c_str()));
	}

	// RENDER TARGET
	if (RESOURCEMANAGER->getNumRenderTargets()) {
		m_PG->EnableProperty(wxT("Render Target"));
		m_PG->EnableProperty(wxT("Use Render Target"));
	}
	else {
		m_PG->DisableProperty(wxT("Render Target"));
		m_PG->DisableProperty(wxT("Use Render Target"));
	}

	if (p->hasRenderTarget())
		m_PG->SetPropertyValue(wxT("Render Target"), wxString(p->getRenderTarget()->getName().c_str()));
	else
		m_PG->SetPropertyValue(wxT("Render Target"), wxT("None"));
		
	m_PG->SetPropertyValue(wxT("Use Render Target"),p->isRenderTargetEnabled());

	// SCENES
	std::vector<std::string> *names = RENDERMANAGER->getAllSceneNames();
	std::vector<std::string>::iterator iter;
	bool b;

	for (iter = names->begin(); iter != names->end(); ++iter) {

		if (p->hasScene(*iter))
			b = true;
		else
			b = false;
		wxString str(wxT("Scenes."));
		str.Append(wxString(*iter).c_str());
		m_PG->SetPropertyValue(str, b);
	}
	delete names;

	// LIGHTS
	names = RENDERMANAGER->getLightNames();

	for (iter = names->begin(); iter != names->end(); ++iter) {

		if (p->hasLight(*iter))
			b = true;
		else
			b = false;
		wxString str(wxT("Lights."));
		wxString aux((*iter).c_str());
		str.Append(wxString((*iter).c_str()));
		m_PG->SetPropertyValue(str, b);
	}
	delete names;

	//// COLOR & DEPTH
	//m_PG->SetPropertyValue(wxT("Clear Color"), p->getPropb(Pass::COLOR_CLEAR));
	//m_PG->SetPropertyValue(wxT("Clear Depth"), p->getPropb(Pass::DEPTH_CLEAR));


	//if (m_PG->GetPropertyByName(wxT("Parameters")))
	//	m_PG->DeleteProperty(wxT("Parameters"));
	//
	//std::map<std::string, float> params = p->getParamsf();

	//wxPGProperty* pgprop;
	//pgprop = m_PG->Append(new wxPGProperty(wxT("Parameters"), wxPG_LABEL));

	//std::map<std::string, float>::iterator pIter = params.begin();

	//for( ; pIter != params.end() ; ++pIter) {

	//	m_PG->AppendIn(pgprop, new wxFloatProperty(wxString(pIter->first.c_str()), wxPG_LABEL, pIter->second));
	//}

	if (m_PG->GetPropertyByName(wxT("Material Maps")))
		m_PG->DeleteProperty(wxT("Material Maps"));

	std::map<std::string, nau::material::MaterialID> mm = p->getMaterialMap();

	wxPGProperty *pgMM;
	pgMM = m_PG->Append(new wxPGProperty(wxT("Material Maps"), wxPG_LABEL));

	std::map<std::string, nau::material::MaterialID>::iterator iterMM = mm.begin();
	MaterialID mid;
	wxString mName,propName;

	if (mm.size() != 0 && iterMM->first == "*") {
		mid = iterMM->second;
		mName = wxString(mid.getLibName().c_str());
		mName.append(wxT("::"));
		mName.append(wxString(mid.getMaterialName().c_str()));
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxT("*"), wxPG_LABEL,m_pgMaterialListPlus));
		propName = wxT("Material Maps.*");
		m_PG->SetPropertyValue(propName, mName);

		++iterMM;
	}
	else {
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxT("*"), wxPG_LABEL,m_pgMaterialListPlus));
		propName = wxT("Material Maps.*");
		m_PG->SetPropertyValue(propName, wxT("None"));	
	}

	for ( ; iterMM != mm.end() ; ++iterMM) {

		mid = iterMM->second;
		mName = wxString(mid.getLibName().c_str());
		mName.append(wxT("::"));
		mName.append(wxString(mid.getMaterialName().c_str()));
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxString(iterMM->first.c_str()), wxPG_LABEL,m_pgMaterialList));
		propName = wxT("Material Maps.");
		propName.append(wxString(iterMM->first.c_str()));
		m_PG->SetPropertyValue(propName, mName);
		//property name is the first value of the map, the prop value is the second value of the map
	}

	PropertyManager::updateGrid(m_PG, Pass::Attribs, (AttributeValues *)p);

	Refresh();

	//m_PG->RefreshGrid();//->Refresh();
}
Ejemplo n.º 3
0
void DlgPass::updateProperties(Pass *p) {

	//
	m_PG->SetPropertyValue(wxT("Class"), wxString(p->getClassName().c_str()));

	// CAMERA
	if (p->getClassName() == "quad")
		m_PG->DisableProperty(wxT("Camera"));
	else
		m_PG->EnableProperty(wxT("Camera"));

	m_PG->SetPropertyValue(wxT("Camera"), wxString(p->getCameraName().c_str()));

	// VIEWPORT
	std::shared_ptr<Viewport> v = p->getViewport();

	if (p->hasRenderTarget() && p->isRenderTargetEnabled()) {
		m_PG->SetPropertyValue(wxT("Viewport"), wxT("From Render Target"));
		m_PG->DisableProperty(wxT("Viewport"));
	}
	else if (!v) {
		m_PG->EnableProperty(wxT("Viewport"));
		m_PG->SetPropertyValue(wxT("Viewport"), wxT("From Camera"));
	}
	else {
		m_PG->EnableProperty(wxT("Viewport"));
		m_PG->SetPropertyValue(wxT("Viewport"), wxString(v->getName().c_str()));
	}

	// RENDER TARGET
	if (RESOURCEMANAGER->getNumRenderTargets()) {
		m_PG->EnableProperty(wxT("Render Target"));
		m_PG->EnableProperty(wxT("Use Render Target"));
	}
	else {
		m_PG->DisableProperty(wxT("Render Target"));
		m_PG->DisableProperty(wxT("Use Render Target"));
	}

	if (p->hasRenderTarget())
		m_PG->SetPropertyValue(wxT("Render Target"), wxString(p->getRenderTarget()->getName().c_str()));
	else
		m_PG->SetPropertyValue(wxT("Render Target"), wxT("None"));
		
	m_PG->SetPropertyValue(wxT("Use Render Target"),p->isRenderTargetEnabled());

	// SCENES
	std::vector<std::string> names;
	RENDERMANAGER->getAllSceneNames(&names);
	std::vector<std::string>::iterator iter;
	bool b;

	for (iter = names.begin(); iter != names.end(); ++iter) {

		if (p->hasScene(*iter))
			b = true;
		else
			b = false;
		wxString str(wxT("Scenes."));
		str.Append(wxString(*iter).c_str());
		m_PG->SetPropertyValue(str, b);
	}

	// LIGHTS
	std::vector<std::string> lNames;
	RENDERMANAGER->getLightNames(&lNames);

	for (auto & name:lNames) {

		if (p->hasLight(name))
			b = true;
		else
			b = false;
		wxString str(wxT("Lights."));
		wxString aux(name.c_str());
		str.Append(wxString(name.c_str()));
		m_PG->SetPropertyValue(str, b);
	}

	if (m_PG->GetPropertyByName(wxT("Material Maps")))
		m_PG->DeleteProperty(wxT("Material Maps"));

	std::map<std::string, nau::material::MaterialID> mm = p->getMaterialMap();

	wxPGProperty *pgMM;
	pgMM = m_PG->Append(new wxPGProperty(wxT("Material Maps"), wxPG_LABEL));

	std::map<std::string, nau::material::MaterialID>::iterator iterMM = mm.begin();
	MaterialID mid;
	wxString mName,propName;

	if (mm.size() != 0 && iterMM->first == "*") {
		mid = iterMM->second;
		mName = wxString(mid.getLibName().c_str());
		mName.append(wxT("::"));
		mName.append(wxString(mid.getMaterialName().c_str()));
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxT("*"), wxPG_LABEL,m_pgMaterialListPlus));
		propName = wxT("Material Maps.*");
		m_PG->SetPropertyValue(propName, mName);

		++iterMM;
	}
	else {
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxT("*"), wxPG_LABEL,m_pgMaterialListPlus));
		propName = wxT("Material Maps.*");
		m_PG->SetPropertyValue(propName, wxT("None"));	
	}

	for ( ; iterMM != mm.end() ; ++iterMM) {

		mid = iterMM->second;
		mName = wxString(mid.getLibName().c_str());
		mName.append(wxT("::"));
		mName.append(wxString(mid.getMaterialName().c_str()));
		m_PG->AppendIn(pgMM, new wxEnumProperty(wxString(iterMM->first.c_str()), wxPG_LABEL,m_pgMaterialList));
		propName = wxT("Material Maps.");
		propName.append(wxString(iterMM->first.c_str()));
		m_PG->SetPropertyValue(propName, mName);
		//property name is the first value of the map, the prop value is the second value of the map
	}

	PropertyManager::updateGrid(m_PG, Pass::Attribs, (AttributeValues *)p);

	Refresh();

	//m_PG->RefreshGrid();//->Refresh();
}