Exemplo n.º 1
0
bool CiteDict::writeAux()
{
  //msg("..writing aux file\n");
  QCString auxFileName(m_baseFileName + ".aux");
  QFile auxFile(auxFileName);
  if (!auxFile.open(IO_WriteOnly)) 
    // point it to something valid, because warn() relies on it
  {
    err("Error opening file %s for output\n", auxFileName.data()); 
    return FALSE;
  }
  FTextStream t(&auxFile);

  QDictIterator<CiteInfo> cdi(m_entries);
  for (CiteInfo *ci = 0; (ci=cdi.current()); ++cdi)
  {
    t << "\\citation{" << ci->label << "}\n";
  }

  t << "\\bibstyle{" << m_baseFileName << "}\n";

  t << "\\bibdata{";
  QStrList &citeDataList = Config_getList("CITE_BIB_FILES");
  const char *bibdata = citeDataList.first();
  while (bibdata)
  {
    QCString bibFile = bibdata;
    if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib";
    if (!bibFile.isEmpty())
    {
      QFileInfo fi(bibFile);
      if (fi.exists())
      {
        if (!copyFile(bibFile,m_baseFileName+"_"+bibFile))
        {
          return FALSE;
        }
        t << m_baseFileName+"_"+bibFile;
        bibdata = citeDataList.next();
        if (bibdata)
        {
          t << ",";
        }
      }
      else
      {
        err("The file %s specified at CITE_BIB_FILES could not be read!\n",bibdata);
        return FALSE;
      }
    }
    else
    {
      bibdata = citeDataList.next();
    }
  }
  t << "}\n";
  return TRUE;
}
Exemplo n.º 2
0
	osg::Node* MRTShaderInstancing::create(const MeshVegetationObjectVector &trees, const std::string &mesh_name, const osg::BoundingBoxd &bb)
	{
		osg::Node* geode = 0;
		osg::Group* group = 0;

		if(trees.size() > 0)
		{
			geode = (osg::Node*) m_MeshNodeMap[mesh_name]->clone( osg::CopyOp::DEEP_COPY_NODES | osg::CopyOp::DEEP_COPY_DRAWABLES | osg::CopyOp::DEEP_COPY_PRIMITIVES);
			ConvertToDrawInstanced cdi(trees.size(), bb, true);
			geode->accept( cdi );

			osg::ref_ptr<osg::Image> treeParamsImage = new osg::Image;
			treeParamsImage->allocateImage( 4*trees.size(), 1, 1, GL_RGBA, GL_FLOAT );
			unsigned int i=0;
			for(MeshVegetationObjectVector::const_iterator itr= trees.begin();
				itr!= trees.end();
				++itr,++i)
			{
				//generate matrix

				osg::Vec4f* ptr = (osg::Vec4f*)treeParamsImage->data(4*i);
				MeshObject& tree = **itr;

				osg::Matrixd trans_mat;
				trans_mat.identity();
				trans_mat.makeTranslate(tree.Position);
				trans_mat =  osg::Matrixd::rotate(tree.Rotation) * osg::Matrixd::scale(tree.Width, tree.Width, tree.Height)* trans_mat;
				double* m = trans_mat.ptr();

				ptr[0] = osg::Vec4f(m[0],m[1],m[2],tree.Color.r());
				ptr[1] = osg::Vec4f(m[4],m[5],m[6],tree.Color.g());
				ptr[2] = osg::Vec4f(m[8],m[9],m[10],tree.Color.b());
				ptr[3] = osg::Vec4f(m[12],m[13],m[14],1.0);
			}
			osg::ref_ptr<osg::TextureBuffer> tbo = new osg::TextureBuffer;
			tbo->setImage( treeParamsImage.get() );
			tbo->setInternalFormat(GL_RGBA32F_ARB);
			geode->getOrCreateStateSet()->setTextureAttribute(1, tbo.get(),osg::StateAttribute::ON);

			osg::BoundingBox bb_f(bb);
			
			geode->setInitialBound( bb_f);
			osg::Uniform* dataBufferSampler = new osg::Uniform("dataBuffer",1);
			geode->getOrCreateStateSet()->addUniform(dataBufferSampler);
		}
		return geode;
	}