Exemple #1
0
std::string AssetsManager::materialAsText(Ogre::MaterialPtr material)
{
	if (material.isNull()) {
		return "";
	}
	Ogre::MaterialSerializer serializer;
	serializer.queueForExport(material, true, false);
	return serializer.getQueuedAsString();
}
QString OgreMaterialProperties::ToString()
{
    Ogre::MaterialPtr matPtr = ToOgreMaterial();
    if (matPtr.isNull())
        return "";

    Ogre::MaterialSerializer serializer;
    serializer.queueForExport(matPtr, true, false);
    return QString(serializer.getQueuedAsString().c_str());
}
Exemple #3
0
int OgreNodeHandler::endShape() {
  std::cout << "End Shape\n";

  if (!_currentEntity && !_currentManualObject)
  {
		std::cout << "No geometry found\n";
		return 1;
  }
  if (_currentEntity)
  {
	  _nodeStack.top()->attachObject(_currentEntity);
	  if (_currentMaterial.isNull())
	  {
		  _currentEntity->getSubEntity(0)->setMaterialName("_X3DNOMATERIAL");
		  //_currentMaterial = MaterialManager::getSingleton().create("_x3ddefaultmaterial", "X3DRENDERER");
	  }
	  else
	  {
		//std::cout << "Setting active Material: " <<  static_cast<Ogre::Entity*>(obj)->getSubEntity(0)->getMaterialName() << std::endl;
		_currentEntity->getSubEntity(0)->setMaterialName(_currentMaterial->getName());
		Ogre::MaterialSerializer serial;
		serial.queueForExport(_currentMaterial);
		std::cout << "Current material:" << std::endl << serial.getQueuedAsString();
		serial.clearQueue();
		std::cout << "Material source blend factor: " << _currentMaterial->getTechnique(0)->getPass(0)->getSourceBlendFactor();
		std::cout << "Material destination blend factor: " << _currentMaterial->getTechnique(0)->getPass(0)->getDestBlendFactor();
		std::cout << (_currentMaterial->isTransparent() ? "Material is transparent" : "Material is opaque");	
	  }
	  std::cout << "Setting active Material: " << _currentEntity->getSubEntity(0)->getMaterialName() << std::endl;
	  _currentEntity = NULL;
  }
  if (_currentManualObject)
  {
	_nodeStack.top()->attachObject(_currentManualObject);
	_currentManualObject = NULL;
  }

  _currentMaterial.setNull();
  _shapeName.clear();
  return 1;
}