我要发帖 回复

中级会员

10

主题

106

积分

0

专家分

兴趣点(最多三项):

视景仿真

私信
发表时间 : 2012-9-6 11:23:42 | 浏览 : 993    评论 : 1
#include<vg.h>


void main()
{
  vgDataSet *ds;
  vgObject *obj,*obj1;
  vgPosition *pos,*pos1;
  vgScene *scene;
vgPlayer *plyr;
vgObserver *obs;
vgMotion *mot;
vgPosition *pos2;


vgInitSys();
vgDefineSys("mytown.adf");
vgConfigSys();


  /* 添加car模型对象*/
  ds=vgNewDS();
  vgName(ds,"esprit.flt");
  vgLoadDS(ds);
  obj=vgNewObj();
  vgName(obj,"car");       
  vgProp(obj,VGOBJ_CS,VGOBJ_DYNAMIC);
  vgProp(obj,VGOBJ_SCALE,2);
  pos=vgNewPos();
  vgPosVec(pos,0.5f,1.0f,0,90.0f,0.0,0.0);
   vgPos(obj,pos);
   vgDelPos(pos);
  vgObjDS(obj,ds);
scene=vgGetScene(0);
vgAddSceneObj(scene,obj);

    /*绑定0bj*/   
plyr=vgNewPlyr();
vgName(plyr,"player_car");
vgProp(plyr,VGPLYR_MOTION,VG_ON);
vgProp(plyr,VGCOMMON_ENABLED, VG_ON );
vgProp( plyr, VGPLYR_TYPE, VG_GROUND );
obj1=vgFindObj("car");
vgAddPlyrObj( plyr, obj1 );
pos1 = vgNewPos();
vgPosVec( pos1, 0, 0, 0, 90.0f, 0.0f, 0.0f );
vgPos( plyr, pos1 );
vgDelPos(pos1);
/*绑定obs和plyr*/   
obs=vgGetObserv(0);
vgProp( obs, VGCOMMON_ENABLED, VG_ON );
vgProp( obs, VGOBS_TETHERSTATE, VGOBS_FIXED);
vgProp(obs, VGOBS_TETHERCOORD, VGOBS_TPLAYER );
vgProp(obs, VGOBS_TETHERSTATE, VGOBS_DYNAMIC);
plyr = vgGetPlyr( 0 );
vgObservPlyr(obs, plyr );
vgObservScene(obs,scene);


//mot = vgGetObservMot( obs );
//mot = vgGetMot( 0 );
mot=vgNewMot();
vgProp(mot, VGMOT_MODEL, VGMOT_DRIVE);
pos2=vgNewPos();
vgPosVec(pos2,2500,2500,2.5,0,0,0);
vgPos(mot,pos2);
vgObservMot(obs, mot);
vgDelPos(pos2);




  while(1)
  {   
          
          
          vgSyncFrame();
          vgFrame();
  }

}

最近VR访客

lwd8805 评论于2012-9-6 17:12:11
求助啊,止步

手机版|VR开发网 统计 津ICP备18009691号
网安备12019202000257

GMT+8, 2021-8-5 10:58 PM

返回顶部