Пример #1
0
void TrackerRenderer::loadModels() {
  // Set up options
  Ogre::UnaryOptionList unOpt;
  Ogre::BinaryOptionList binOpt;

  unOpt["-q"] = false;
  unOpt["-3ds_ani_fix"] = false;
  unOpt["-3ds_dae_fix"] = false;
  unOpt["-shader"] = false;
  binOpt["-log"] = "ass.log";
  binOpt["-aniName"] = "";
  binOpt["-aniSpeedMod"] = 0.0f;
  binOpt["-l"] = "";
  binOpt["-v"] = "";
  binOpt["-s"] = "Distance";
  binOpt["-p"] = "";
  binOpt["-f"] = "";

  AssimpLoader::AssOptions opts;
  opts.quietMode = false;
  opts.logFile = "ass.log";
  opts.customAnimationName = "";
  opts.dest = "";
  opts.animationSpeedModifier = 1.0;
  opts.lodValue = 250000;
  opts.lodFixed = 0;
  opts.lodPercent = 20;
  opts.numLods = 0;
  opts.usePercent = true;
  opts.source =
      "/home/alessandro/projects/drone_ws/src/fato_tracker/data/ros_hydro/"
      "ros_hydro.obj";

  AssimpLoader loader;
  loader.convert(opts);

  std::cout << "assimp model loaded" << std::endl;
}
Пример #2
0
int main(int numargs, char** args)
{
    if (numargs < 2)
    {
        help();
        return -1;
    }

    // Assume success
	int retCode = 0;

    try
    {
        logMgr = new Ogre::LogManager();

        // this log catches output from the parseArgs call and routes it to stdout only
        logMgr->createLog("Temporary log", false, true, true);

        AssOptions opts = parseArgs(numargs, args);
        // use the log specified by the cmdline params
        logMgr->setDefaultLog(logMgr->createLog(opts.logFile, false, true));
        // get rid of the temporary log as we use the new log now
        logMgr->destroyLog("Temporary log");

        rgm = new Ogre::ResourceGroupManager();
        mth = new Ogre::Math();
        lodMgr = new Ogre::LodStrategyManager();
        meshMgr = new Ogre::MeshManager();
        matMgr = new Ogre::MaterialManager();
        matMgr->initialise();
        skelMgr = new Ogre::SkeletonManager();
        meshSerializer = new Ogre::MeshSerializer();
        //xmlMeshSerializer = new Ogre::XMLMeshSerializer();
        skeletonSerializer = new Ogre::SkeletonSerializer();
        //xmlSkeletonSerializer = new Ogre::XMLSkeletonSerializer();
        bufferManager = new Ogre::DefaultHardwareBufferManager(); // needed because we don't have a rendersystem
        scmgr = new Ogre::ScriptCompilerManager();
        archmgr = new Ogre::ArchiveManager();
        mfsarchf = new Ogre::FileSystemArchiveFactory();
        Ogre::ArchiveManager::getSingleton().addArchiveFactory( mfsarchf );

        if(opts.quietMode)
            opts.params |= AssimpLoader::LP_QUIET_MODE;

        AssimpLoader loader;
        loader.convert(opts.source, opts.customAnimationName, opts.params, opts.dest, opts.animationSpeedModifier);

    }
    catch(Ogre::Exception& e)
    {
        std::cerr << "FATAL ERROR: " << e.getDescription() << std::endl;
        std::cerr << "ABORTING!" << std::endl;
        retCode = 1;
    }

    //delete xmlSkeletonSerializer;
    delete skeletonSerializer;
    //delete xmlMeshSerializer;
    delete meshSerializer;
    delete skelMgr;
    delete matMgr;
    //delete meshMgr; FIX this!!
    delete bufferManager;
    delete scmgr;
    delete archmgr;
    delete mfsarchf;
    delete lodMgr;
    delete mth;
    delete rgm;
    delete logMgr;

    return retCode;

}