亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? glm.cpp

?? 詳細介紹c++編程
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
	/* eat up rest of line */
	fgets(buf, sizeof(buf), file);
	numvertices++;
	break;
      case 'n':				/* normal */
	/* eat up rest of line */
	fgets(buf, sizeof(buf), file);
	numnormals++;
	break;
      case 't':				/* texcoord */
	/* eat up rest of line */
	fgets(buf, sizeof(buf), file);
	numtexcoords++;
	break;
      default:
	printf("glmFirstPass(): Unknown token \"%s\".\n", buf);
	exit(1);
	break;
      }
      break;
    case 'm':
      fgets(buf, sizeof(buf), file);
      sscanf(buf, "%s %s", buf, buf);
      model->mtllibname = strdup(buf);
      glmReadMTL(model, buf);
      break;
    case 'u':
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
      break;
    case 'g':				/* group */
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
#if SINGLE_STRING_GROUP_NAMES
      sscanf(buf, "%s", buf);
#else
      buf[strlen(buf)-1] = '\0';	/* nuke '\n' */
#endif
      group = glmAddGroup(model, buf);
      break;
    case 'f':				/* face */
      v = n = t = 0;
      fscanf(file, "%s", buf);
      /* can be one of %d, %d//%d, %d/%d, %d/%d/%d %d//%d */
      if (strstr(buf, "//")) {
	/* v//n */
	sscanf(buf, "%d//%d", &v, &n);
	fscanf(file, "%d//%d", &v, &n);
	fscanf(file, "%d//%d", &v, &n);
	numtriangles++;
	group->numtriangles++;
	while(fscanf(file, "%d//%d", &v, &n) > 0) {
	  numtriangles++;
	  group->numtriangles++;
	}
      } else if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3) {
	/* v/t/n */
	fscanf(file, "%d/%d/%d", &v, &t, &n);
	fscanf(file, "%d/%d/%d", &v, &t, &n);
	numtriangles++;
	group->numtriangles++;
	while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0) {
	  numtriangles++;
	  group->numtriangles++;
	}
      } else if (sscanf(buf, "%d/%d", &v, &t) == 2) {
	/* v/t */
	fscanf(file, "%d/%d", &v, &t);
	fscanf(file, "%d/%d", &v, &t);
	numtriangles++;
	group->numtriangles++;
	while(fscanf(file, "%d/%d", &v, &t) > 0) {
	  numtriangles++;
	  group->numtriangles++;
	}
      } else {
	/* v */
	fscanf(file, "%d", &v);
	fscanf(file, "%d", &v);
	numtriangles++;
	group->numtriangles++;
	while(fscanf(file, "%d", &v) > 0) {
	  numtriangles++;
	  group->numtriangles++;
	}
      }
      break;

    default:
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
      break;
    }
  }

  /* set the stats in the model structure */
  model->numvertices  = numvertices;
  model->numnormals   = numnormals;
  model->numtexcoords = numtexcoords;
  model->numtriangles = numtriangles;

  /* allocate memory for the triangles in each group */
  group = model->groups;
  while(group) {
    group->triangles = (GLuint*)malloc(sizeof(GLuint) * group->numtriangles);
    group->numtriangles = 0;
    group = group->next;
  }
}

/* glmSecondPass: second pass at a Wavefront OBJ file that gets all
 * the data.
 *
 * model - properly initialized GLMmodel structure
 * file  - (fopen'd) file descriptor 
 */
static GLvoid glmSecondPass(GLMmodel* model, FILE* file) 
{
  GLuint    numvertices;		/* number of vertices in model */
  GLuint    numnormals;			/* number of normals in model */
  GLuint    numtexcoords;		/* number of texcoords in model */
  GLuint    numtriangles;		/* number of triangles in model */
  GLfloat*  vertices;			/* array of vertices  */
  GLfloat*  normals;			/* array of normals */
  GLfloat*  texcoords;			/* array of texture coordinates */
  GLMgroup* group;			/* current group pointer */
  GLuint    material;			/* current material */
  GLuint    v, n, t;
  char      buf[128];

  /* set the pointer shortcuts */
  vertices     = model->vertices;
  normals      = model->normals;
  texcoords    = model->texcoords;
  group        = model->groups;

  /* on the second pass through the file, read all the data into the
     allocated arrays */
  numvertices = numnormals = numtexcoords = 1;
  numtriangles = 0;
  material = 0;
  while(fscanf(file, "%s", buf) != EOF) {
    switch(buf[0]) {
    case '#':				/* comment */
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
      break;
    case 'v':				/* v, vn, vt */
      switch(buf[1]) {
      case '\0':			/* vertex */
	fscanf(file, "%f %f %f", 
	       &vertices[3 * numvertices + 0], 
	       &vertices[3 * numvertices + 1], 
	       &vertices[3 * numvertices + 2]);
	numvertices++;
	break;
      case 'n':				/* normal */
	fscanf(file, "%f %f %f", 
	       &normals[3 * numnormals + 0],
	       &normals[3 * numnormals + 1], 
	       &normals[3 * numnormals + 2]);
	numnormals++;
	break;
      case 't':				/* texcoord */
	fscanf(file, "%f %f", 
	       &texcoords[2 * numtexcoords + 0],
	       &texcoords[2 * numtexcoords + 1]);
	numtexcoords++;
	break;
      }
      break;
    case 'u':
      fgets(buf, sizeof(buf), file);
      sscanf(buf, "%s %s", buf, buf);
      group->material = material = glmFindMaterial(model, buf);
      break;
    case 'g':				/* group */
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
#if SINGLE_STRING_GROUP_NAMES
      sscanf(buf, "%s", buf);
#else
      buf[strlen(buf)-1] = '\0';	/* nuke '\n' */
#endif
      group = glmFindGroup(model, buf);
      group->material = material;
      break;
    case 'f':				/* face */
      v = n = t = 0;
      fscanf(file, "%s", buf);
      /* can be one of %d, %d//%d, %d/%d, %d/%d/%d %d//%d */
      if (strstr(buf, "//")) {
	/* v//n */
	sscanf(buf, "%d//%d", &v, &n);
	T(numtriangles).vindices[0] = v;
	T(numtriangles).nindices[0] = n;
	fscanf(file, "%d//%d", &v, &n);
	T(numtriangles).vindices[1] = v;
	T(numtriangles).nindices[1] = n;
	fscanf(file, "%d//%d", &v, &n);
	T(numtriangles).vindices[2] = v;
	T(numtriangles).nindices[2] = n;
	group->triangles[group->numtriangles++] = numtriangles;
	numtriangles++;
	while(fscanf(file, "%d//%d", &v, &n) > 0) {
	  T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
	  T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0];
	  T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
	  T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2];
	  T(numtriangles).vindices[2] = v;
	  T(numtriangles).nindices[2] = n;
	  group->triangles[group->numtriangles++] = numtriangles;
	  numtriangles++;
	}
      } else if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3) {
	/* v/t/n */
	T(numtriangles).vindices[0] = v;
	T(numtriangles).tindices[0] = t;
	T(numtriangles).nindices[0] = n;
	fscanf(file, "%d/%d/%d", &v, &t, &n);
	T(numtriangles).vindices[1] = v;
	T(numtriangles).tindices[1] = t;
	T(numtriangles).nindices[1] = n;
	fscanf(file, "%d/%d/%d", &v, &t, &n);
	T(numtriangles).vindices[2] = v;
	T(numtriangles).tindices[2] = t;
	T(numtriangles).nindices[2] = n;
	group->triangles[group->numtriangles++] = numtriangles;
	numtriangles++;
	while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0) {
	  T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
	  T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0];
	  T(numtriangles).nindices[0] = T(numtriangles-1).nindices[0];
	  T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
	  T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2];
	  T(numtriangles).nindices[1] = T(numtriangles-1).nindices[2];
	  T(numtriangles).vindices[2] = v;
	  T(numtriangles).tindices[2] = t;
	  T(numtriangles).nindices[2] = n;
	  group->triangles[group->numtriangles++] = numtriangles;
	  numtriangles++;
	}
      } else if (sscanf(buf, "%d/%d", &v, &t) == 2) {
	/* v/t */
	T(numtriangles).vindices[0] = v;
	T(numtriangles).tindices[0] = t;
	fscanf(file, "%d/%d", &v, &t);
	T(numtriangles).vindices[1] = v;
	T(numtriangles).tindices[1] = t;
	fscanf(file, "%d/%d", &v, &t);
	T(numtriangles).vindices[2] = v;
	T(numtriangles).tindices[2] = t;
	group->triangles[group->numtriangles++] = numtriangles;
	numtriangles++;
	while(fscanf(file, "%d/%d", &v, &t) > 0) {
	  T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
	  T(numtriangles).tindices[0] = T(numtriangles-1).tindices[0];
	  T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
	  T(numtriangles).tindices[1] = T(numtriangles-1).tindices[2];
	  T(numtriangles).vindices[2] = v;
	  T(numtriangles).tindices[2] = t;
	  group->triangles[group->numtriangles++] = numtriangles;
	  numtriangles++;
	}
      } else {
	/* v */
	sscanf(buf, "%d", &v);
	T(numtriangles).vindices[0] = v;
	fscanf(file, "%d", &v);
	T(numtriangles).vindices[1] = v;
	fscanf(file, "%d", &v);
	T(numtriangles).vindices[2] = v;
	group->triangles[group->numtriangles++] = numtriangles;
	numtriangles++;
	while(fscanf(file, "%d", &v) > 0) {
	  T(numtriangles).vindices[0] = T(numtriangles-1).vindices[0];
	  T(numtriangles).vindices[1] = T(numtriangles-1).vindices[2];
	  T(numtriangles).vindices[2] = v;
	  group->triangles[group->numtriangles++] = numtriangles;
	  numtriangles++;
	}
      }
      break;

    default:
      /* eat up rest of line */
      fgets(buf, sizeof(buf), file);
      break;
    }
  }

#if 0
  /* announce the memory requirements */
  printf(" Memory: %d bytes\n",
	 numvertices  * 3*sizeof(GLfloat) +
	 numnormals   * 3*sizeof(GLfloat) * (numnormals ? 1 : 0) +
	 numtexcoords * 3*sizeof(GLfloat) * (numtexcoords ? 1 : 0) +
	 numtriangles * sizeof(GLMtriangle));
#endif
}

/* glmUnitize: "unitize" a model by translating it to the origin and
 * scaling it to fit in a unit cube around the origin (-1 to 1 in all
 * dimensions).  
 * Returns the scalefactor used.
 *
 * model - properly initialized GLMmodel structure 
 */
GLfloat glmUnitize(GLMmodel* model)
{
  GLuint  i;
  GLfloat maxx, minx, maxy, miny, maxz, minz;
  GLfloat cx, cy, cz, w, h, d;
  GLfloat scale;

  assert(model);
  assert(model->vertices);

  /* get the max/mins */
  maxx = minx = model->vertices[3 + 0];
  maxy = miny = model->vertices[3 + 1];
  maxz = minz = model->vertices[3 + 2];
  for (i = 1; i <= model->numvertices; i++) {
    if (maxx < model->vertices[3 * i + 0])
      maxx = model->vertices[3 * i + 0];
    if (minx > model->vertices[3 * i + 0])
      minx = model->vertices[3 * i + 0];

    if (maxy < model->vertices[3 * i + 1])
      maxy = model->vertices[3 * i + 1];
    if (miny > model->vertices[3 * i + 1])
      miny = model->vertices[3 * i + 1];

    if (maxz < model->vertices[3 * i + 2])
      maxz = model->vertices[3 * i + 2];
    if (minz > model->vertices[3 * i + 2])
      minz = model->vertices[3 * i + 2];
  }

  /* calculate model width, height, and depth */
  w = glmAbs(maxx) + glmAbs(minx);
  h = glmAbs(maxy) + glmAbs(miny);
  d = glmAbs(maxz) + glmAbs(minz);

  /* calculate center of the model */
  cx = (maxx + minx) / 2.0f;
  cy = (maxy + miny) / 2.0f;
  cz = (maxz + minz) / 2.0f;

  /* calculate unitizing scale factor */
  scale = 2.0f / glmMax(glmMax(w, h), d);

  /* translate around center then scale */
  for (i = 1; i <= model->numvertices; i++) {
    model->vertices[3 * i + 0] -= cx;
    model->vertices[3 * i + 1] -= cy;
    model->vertices[3 * i + 2] -= cz;
    model->vertices[3 * i + 0] *= scale;
    model->vertices[3 * i + 1] *= scale;
    model->vertices[3 * i + 2] *= scale;
  }

  return scale;
}

/* glmDimensions: Calculates the dimensions (width, height, depth) of
 * a model.
 *
 * model      - initialized GLMmodel structure
 * dimensions - array of 3 GLfloats (GLfloat dimensions[3])
 */
GLvoid glmDimensions(GLMmodel* model, GLfloat* dimensions)
{
  GLuint i;
  GLfloat maxx, minx, maxy, miny, maxz, minz;

  assert(model);
  assert(model->vertices);
  assert(dimensions);

  /* get the max/mins */
  maxx = minx = model->vertices[3 + 0];
  maxy = miny = model->vertices[3 + 1];
  maxz = minz = model->vertices[3 + 2];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品在线观看网站| 色妹子一区二区| 亚洲一区二区三区中文字幕| 91麻豆精品国产91久久久资源速度 | 亚洲自拍偷拍麻豆| 久久久久久电影| 91碰在线视频| 国产精品亚洲а∨天堂免在线| 亚洲桃色在线一区| 日韩欧美一卡二卡| 欧美亚男人的天堂| 一本一道波多野结衣一区二区| 麻豆成人久久精品二区三区红 | 亚洲美女在线一区| 欧美激情在线观看视频免费| 日韩视频免费观看高清在线视频| 97精品电影院| 99在线热播精品免费| 国产尤物一区二区在线| 午夜精品福利在线| 亚洲狠狠爱一区二区三区| 国产精品乱码一区二区三区软件| www国产亚洲精品久久麻豆| 日韩欧美卡一卡二| 欧美精品一区二区三区蜜桃视频| 91麻豆精品国产91久久久久久 | 午夜精品视频在线观看| 亚洲精品乱码久久久久久| 国产精品乱人伦中文| 国产精品国产三级国产a| 中文字幕制服丝袜一区二区三区 | 高清不卡一二三区| 一道本成人在线| 欧美日韩在线三级| 精品国产乱码久久久久久闺蜜| 精品国产网站在线观看| 中文字幕第一区二区| 中文字幕亚洲电影| 亚洲成年人影院| 青青草国产成人av片免费| 久久99久久99| 99久久免费精品| 日韩一区二区影院| 久久一留热品黄| 亚洲最大成人网4388xx| 国产在线一区二区| 色哟哟在线观看一区二区三区| 欧美日韩精品免费| 欧美国产日韩在线观看| 亚洲综合久久av| 国产99久久久国产精品潘金| 欧美日韩久久久一区| 亚洲国产精华液网站w| 日韩电影在线免费看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 中文字幕制服丝袜一区二区三区 | 日韩一区二区精品| 国产精品欧美久久久久一区二区| 亚洲自拍另类综合| 东方aⅴ免费观看久久av| 欧美一区二区在线免费观看| 国产精品乱码一区二区三区软件 | 欧美欧美午夜aⅴ在线观看| 国产日产欧美一区二区三区| 日韩 欧美一区二区三区| 97久久精品人人做人人爽50路| 精品国产乱码久久久久久久| 亚洲一区二区三区在线看| 色综合欧美在线视频区| 一区二区三区精品在线| 中文字幕一区日韩精品欧美| 亚洲第一成年网| 欧美色精品天天在线观看视频| 国产精品久久久久精k8| av在线不卡网| 一区视频在线播放| 波多野洁衣一区| 欧美一区二区三区在线| 日韩成人一级片| 亚洲精品一区二区精华| 国产一区二区调教| 久久久高清一区二区三区| 国产福利不卡视频| 国产精品视频观看| 色悠悠亚洲一区二区| 一区二区三区自拍| 欧美一区二区三区免费在线看| 亚洲伊人伊色伊影伊综合网| 欧美日韩国产成人在线91| 亚洲精品日日夜夜| 99re热视频这里只精品| 亚洲第一会所有码转帖| 日韩一级片网站| 播五月开心婷婷综合| 亚洲欧美在线aaa| 欧美日韩精品一区二区天天拍小说| 日本va欧美va欧美va精品| 国产午夜精品久久久久久久| 91啪九色porn原创视频在线观看| 亚洲一级二级在线| 久久久久久久电影| 777奇米成人网| 91色porny蝌蚪| 精品一区二区三区免费视频| 亚洲丝袜精品丝袜在线| 国产风韵犹存在线视精品| 亚洲午夜在线视频| 中文字幕免费一区| 久久综合久久综合久久| 在线观看中文字幕不卡| 国产不卡视频在线播放| 午夜久久久久久电影| 亚洲色图欧美在线| 国产欧美日韩在线| 精品三级在线看| 欧美日本一区二区三区四区| 99热在这里有精品免费| 国产成人av电影在线| 加勒比av一区二区| 免费在线观看一区二区三区| 亚洲国产精品一区二区久久 | 一级女性全黄久久生活片免费| 中文文精品字幕一区二区| 亚洲精品在线电影| 欧美精品一区二区在线观看| 日韩欧美在线网站| 91精品久久久久久久91蜜桃| 91精品国产综合久久久蜜臀图片| 在线观看视频91| 欧美日韩精品欧美日韩精品| 欧美色视频一区| 日韩视频免费观看高清在线视频| 日韩女优制服丝袜电影| 日韩欧美一级二级三级久久久| 日韩美女视频一区二区在线观看| 欧美电影一区二区| 精品国产乱码久久久久久免费 | 国内成人自拍视频| 成人精品鲁一区一区二区| 色香蕉成人二区免费| 欧美年轻男男videosbes| 日韩一区二区在线看| 国产亚洲欧美中文| 一区二区三区中文字幕电影| 日日摸夜夜添夜夜添亚洲女人| 激情五月婷婷综合| 久久av老司机精品网站导航| 日韩精品一区二区三区视频播放| 欧美性生活影院| 精品久久99ma| 亚洲男女毛片无遮挡| 久久黄色级2电影| 色域天天综合网| 337p日本欧洲亚洲大胆精品| 亚洲精品欧美二区三区中文字幕| 天天综合天天做天天综合| 国产精品综合网| 3d动漫精品啪啪| 17c精品麻豆一区二区免费| 美女在线视频一区| 在线精品视频免费观看| 国产精品毛片高清在线完整版 | 欧美一区日本一区韩国一区| 国产精品国模大尺度视频| 视频在线在亚洲| 欧美怡红院视频| 亚洲欧美视频在线观看视频| 国产麻豆精品theporn| 日韩欧美在线不卡| 亚洲bdsm女犯bdsm网站| 日本高清成人免费播放| 中文字幕 久热精品 视频在线 | 2017欧美狠狠色| 青青草精品视频| 91精品国产免费| 亚洲mv大片欧洲mv大片精品| 欧美最新大片在线看| 综合激情网...| 91国偷自产一区二区开放时间| 国产精品丝袜在线| 国产精品一区久久久久| 久久影院午夜论| 成人深夜在线观看| 亚洲国产精品99久久久久久久久| 国产成a人亚洲| 国产精品久久久久毛片软件| 91免费观看视频在线| 亚洲人成7777| 69精品人人人人| 精品一区二区免费| 久久久久久综合| 91黄色免费网站| 免费国产亚洲视频| 国产精品二三区| 欧美日韩国产a| 国产又黄又大久久| 中文字幕一区二区三区蜜月 | 欧美影视一区二区三区| 日韩av在线发布| 国产精品成人网|