示例#1
0
    void modelInit() {
        //  メッシュ読み込み
        t3::FilePath obj_path("bunny.obj");

        //  モデル作成
        model_ = t3::Model::create(obj_path);

        
        //  カメラ生成
        const t3::Sphere& sphere = model_->mesh()->boundingSphere();
        cam_update_.position(sphere.position() + t3::Vec3(0, 0, sphere.radius() * 2));
        cam_update_.targetPosition(sphere.position());
    }
示例#2
0
// Add item to output streamer list
void EvtCollectionStream::addItem(const std::string& descriptor)   {
  MsgStream log(msgSvc(), name());
  int sep = descriptor.rfind("#");
  int level = 0;
  std::string obj_path (descriptor,0,sep);
  std::string slevel   (descriptor,sep+1,descriptor.length());
  if ( slevel == "*" )  {
    level = 9999999;
  }
  else   {
    level = ::atoi(slevel.c_str());
  }
  DataStoreItem* item = new DataStoreItem(obj_path, level);
  log << MSG::INFO << "Adding OutputStream item " << item->path()
      << " with " << item->depth()
      << " level(s)." << endmsg;
  m_itemList.push_back( item );
}
示例#3
0
    void initialize(){
        //  レイヤー準備
        layer_.name("SimpleMesh3Scene::DrawLayer");
        layer_.setUpdateCallback(this, &SceneContext::layerUpdate);
        layer_.setRenderCallback(this, &SceneContext::layerRender);


        //  モデル作成
        t3::FilePath obj_path("character_chr_old.obj");
        model_ = t3::Model::create(obj_path);

        
        //  カメラ位置調整
        float len = model_->mesh()->boundingSphere().radius();
//        cam_updater_ = createTask<t3::LookAtCameraUpdater>();
        cam_updater_->position(0, len*2, len*4);
        cam_updater_->targetPosition(0,0,0);
        
        //  シーングラフ初期化
        scene_graph_.camera(cam_updater_->camera());
        node1_ = scene_graph_.createNode();
        node1_->entity(model_);
    }