⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coinhistory.cpp.in

📁 学习 open inventor 的例子
💻 IN
📖 第 1 页 / 共 5 页
字号:
  638654246,672340264,554571553,621811493,554636833,554505761,571151650,  554177313,739450412,705764394,520886047,588454691,773989166,925378359,  975775546,1059727935,1042884414,941892664,824057649,789912879,773200942,  722803243,638654246,571544866,521147167,504304158,487461661,521016607,  504108062,537662496,688723753,705829418,554768161,487330589,403312920,  453907483,453775899,453775131,487395869,924131383,1344286544,1394552915,  1109010498,1041704510,823271217,672078376,604903716,537795104,554703393,  554506529,521017375,587995171,604903972,672275752,504174622,521082399,  638719782,739580204,638720038,571676706,622008613,621877285,604968484,  638588966,655431463,672274984,588125731,588126243,571348770,554571297,  790045231,588060963,621615397,672144424,521213727,656154407,841360434,  958932537,992552763,1076636224,1042950462,958801977,891429685,840835378,  756555309,689314345,638785574,571610402,537989920,521147167,521082143,  521147679,521016351,604968484,672143656,655431975,588256547,537662496,  504108318,420089881,470552348,470683676,436932378,789715247,957817913,  1041769534};struct particleinfo{  float x;  float y;  float z;  float sx;  float sy;  float sz;  float ax;  float ay;  float az;  float m;  float delay;  float rotx;  float srotx;  SoSeparator *p;  SoRotation *rot;  SoTransform *xf;  SoText3 * t;  particleinfo()  {    x=y=z=sx=sy=sz=ax=ay=az=m=delay=rotx=srotx=0.0f;    p=NULL; xf=NULL; t=NULL;  };};int num_particles;particleinfo *particles;SbViewportRegion vp;SoSeparator * root;SoPerspectiveCamera * camera;SoSeparator * logo;SoRotation * logorot;SbTime lasttime;SbTime starttime;SbBool firstletter;float speedjitter = 0.5;double flexrand(double lower, double upper){  return lower + ((double)rand()/(double)RAND_MAX)*(upper-lower);};static void timerSensorCallback(void *data, SoSensor *){  SbTime now = SbTime::getTimeOfDay();  SbTime timediff = now-lasttime;  lasttime = now;  double diff = timediff.getValue(); // time in seconds  SbTime stimediff = now-starttime;  double sdiff = stimediff.getValue();  int leader = 0;  // rotate logo  logorot->rotation.setValue(SbVec3f(0.0f, 1.0f, 0.0f), sdiff*2*3.14*0.1);  // print text  SbTime letterdiff = now-lastlettertime;  double ldiff = letterdiff.getValue();  if (ldiff>TEXTDELAY) {    // print a new letter        char tt[2];    tt[1] = 0;    tt[0] = text2[textpos];    particles[currpart].t->string.setValue(tt);    if (spos==0) {      particles[currpart].x=XPOS;    }    else      {	SoGetBoundingBoxAction bboxa(vp);	if (currpart==0)	  {	    bboxa.apply(particles[NUM_PARTICLES-1].t);	    SbBox3f bbox = bboxa.getBoundingBox();	    float w, h, d;	    bbox.getSize(deltax,h,d);	    particles[currpart].x=particles[NUM_PARTICLES-1].x+deltax*0.12f;	  }	else	  {	    bboxa.apply(particles[currpart-1].t);	    SbBox3f bbox = bboxa.getBoundingBox();	    float w, h, d;	    bbox.getSize(deltax,h,d);	    particles[currpart].x=particles[currpart-1].x+deltax*0.12f;	  }      }    particles[currpart].y=-(float)line*1.5f;    particles[currpart].z=-0.0f;    particles[currpart].sx=flexrand(-1.0, 1.0);    particles[currpart].sy=flexrand(-1.0, 1.0);    particles[currpart].sz=10.0f;    particles[currpart].srotx=2.0f;    particles[currpart].rotx=0.0f;    particles[currpart].delay = sdiff+FALLDELAY;    particles[currpart].xf->translation.setValue(particles[currpart].x, 						 particles[currpart].y, particles[currpart].z);    particles[currpart].rot->rotation.setValue(SbVec3f(0.0f, 1.0f, 0.0f), particles[currpart].rotx);    spos++;    if ( ((text2[textpos] == ' ') && (spos>=LINE_BREAK))	 || (text2[textpos] == '\n'))      {	line++;	line %= NUM_LINES;	spos=0;      }    textpos++;    textpos%=textlen;    currpart++;    currpart %= NUM_PARTICLES;    lastlettertime=now;  }  int i;  // animate particles  for (i=0; i<num_particles; i++)    {      if (sdiff-particles[i].delay<0)	continue;      particles[i].x+=diff*particles[i].sx;      particles[i].y+=diff*particles[i].sy;      particles[i].z+=diff*particles[i].sz;      particles[i].sx+=diff*particles[i].ax;      particles[i].sy+=diff*particles[i].ay;      particles[i].sz+=diff*particles[i].az;      particles[i].rotx+=diff*particles[i].srotx;      float bound = 12.0;      float absorb = 0.65;      if (particles[i].y<-bound)	{	  particles[i].sy=1.0*fabs(particles[i].sy)*absorb;	  particles[i].sx += speedjitter*(rand()%100)/100.0;	  particles[i].sy += speedjitter*(rand()%100)/100.0;	}      if (particles[i].y>bound)	particles[i].sy=-1.0*fabs(particles[i].sy)*absorb;      /*    if (particles[i].x<-bound)	    particles[i].sx=1.0*fabs(particles[i].sx)*absorb;	    if (particles[i].x>bound)	    particles[i].sx=-1.0*fabs(particles[i].sx)*absorb;      */      float sbound = 50;        if (particles[i].sx>sbound)	particles[i].sx = sbound;      if (particles[i].sx<-sbound)	particles[i].sx = -sbound;      if (particles[i].sy>sbound)	particles[i].sy = sbound;      if (particles[i].sy<-sbound)	particles[i].sy = -sbound;      particles[i].xf->translation.setValue(particles[i].x, particles[i].y, particles[i].z);      particles[i].rot->rotation.setValue(SbVec3f(0.0f, 1.0f, 0.0f), particles[i].rotx);    }}SoSeparator * create_logo(SoTexture2 * texture){  SoSeparator * sep = new SoSeparator;  sep->ref();  SoMaterial * mat = new SoMaterial;  mat->specularColor.setValue( 1.0f, 3.0f, 1.0f );  mat->emissiveColor.setValue( 1.0f, 1.0f, 5.0f );  mat->diffuseColor.setValue( 1.0f, 5.0f, 1.0f );  mat->shininess = 0.8f;  mat->transparency = 0.7f;  sep->addChild(mat);  sep->addChild(new SoTextureCoordinateEnvironment);  sep->addChild(texture);  SoTranslation * trans = new SoTranslation;  trans->translation.setValue(-2.0f, -2.5f, 0.2f);  sep->addChild(trans);  SoScale * scale = new SoScale;  scale->scaleFactor.setValue(0.6f, 0.7f, 0.6f);  sep->addChild(scale);	  // C  SoText3 * c = new SoText3;  c->string.setValue( "C" );  c->parts.setValue( SoText3::ALL );  sep->addChild(c);  SoSeparator * separator = new SoSeparator;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -