当前位置: 首页>>代码示例>>C++>>正文


C++ rt_getmem函数代码示例

本文整理汇总了C++中rt_getmem函数的典型用法代码示例。如果您正苦于以下问题:C++ rt_getmem函数的具体用法?C++ rt_getmem怎么用?C++ rt_getmem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rt_getmem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: newgrid

object * newgrid(int xsize, int ysize, int zsize, vector min, vector max) {
  grid * g;

  g = (grid *) rt_getmem(sizeof(grid));
  memset(g, 0, sizeof(grid));  

  g->methods = &grid_methods;
  g->id = new_objectid();

  g->xsize = xsize;
  g->ysize = ysize;
  g->zsize = zsize;

  g->min = min;
  g->max = max;

  VSub(&g->max, &g->min, &g->voxsize);
  g->voxsize.x /= (flt) g->xsize; 
  g->voxsize.y /= (flt) g->ysize; 
  g->voxsize.z /= (flt) g->zsize; 

  g->cells = (objectlist **) rt_getmem(xsize*ysize*zsize*sizeof(objectlist *));
  memset(g->cells, 0, xsize*ysize*zsize * sizeof(objectlist *));

/* fprintf(stderr, "New grid, size: %8d %8d %8d\n", g->xsize, g->ysize, g->zsize); */

  return (object *) g;
}
开发者ID:YoonJungsik,项目名称:Kinect,代码行数:28,代码来源:grid.cpp

示例2: newscalarvol

void * newscalarvol(void * intex, vector min, vector max, 
                    int xs, int ys, int zs, char * fname, scalarvol * invol) {
  box * bx;
  texture * tx, * tex;
  scalarvol * vol;

  tex=(texture *)intex;
  tex->shadowcast = 0; /* doesn't cast a shadow */

  tx=(texture *)rt_getmem(sizeof(texture));

  /* is the volume data already loaded? */
  if (invol==NULL) {
    vol=(scalarvol *)rt_getmem(sizeof(scalarvol));
    vol->loaded=0;
    vol->data=NULL;
  }
  else
    vol=invol;

  vol->opacity=tex->opacity;
  vol->xres=xs;
  vol->yres=ys;
  vol->zres=zs;
  strcpy(vol->name, fname);

  tx->ctr.x = 0.0;
  tx->ctr.y = 0.0;
  tx->ctr.z = 0.0;
  tx->rot   = tx->ctr;
  tx->scale = tx->ctr;
  tx->uaxs  = tx->ctr;
  tx->vaxs  = tx->ctr;

  tx->islight = 0;
  tx->shadowcast = 0; /* doesn't cast a shadow */

  tx->col = tex->col;
  tx->ambient  = 1.0;
  tx->diffuse  = 0.0;
  tx->specular = 0.0;
  tx->opacity  = 1.0;
  tx->img = vol;
  tx->texfunc = (color(*)(void *, void *, void *))(scalar_volume_texture);

  bx=newbox(tx, min, max);
  tx->obj = (void *) bx; /* XXX hack! */

  return (void *) bx;
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:50,代码来源:vol.cpp

示例3: readppm

int readppm(char * name, int * xres, int * yres, unsigned char **imgdata) {
  char data[200];  
  FILE * ifp;
  int i, bytesread;
  int datasize;
 
  ifp=fopen(name, "r");  
  if (ifp==NULL) {
    return IMAGEBADFILE; /* couldn't open the file */
  }
  fscanf(ifp, "%s", data);
 
  if (strcmp(data, "P6")) {
     fclose(ifp);
     return IMAGEUNSUP; /* not a format we support */
  }

  *xres=getint(ifp);
  *yres=getint(ifp);
      i=getint(ifp); /* eat the maxval number */
  fread(&i, 1, 1, ifp); /* eat the newline */ 
  datasize = 3 * (*xres) * (*yres);

  *imgdata=(unsigned char *)rt_getmem(datasize); 

  bytesread=fread(*imgdata, 1, datasize, ifp);   

  fclose(ifp);

  if (bytesread != datasize) 
    return IMAGEREADERR;
  
  return IMAGENOERR;
}
开发者ID:HeliumProject,项目名称:ThreadBuildingBlocks,代码行数:34,代码来源:ppm.cpp

示例4: AllocateImage

rawimage * AllocateImage(char * filename) { 
  rawimage * newimage = NULL;
  int i, len, intable;

  intable=0;
  if (numimages!=0) {
    for (i=0; i<numimages; i++) {
      if (!strcmp(filename, imagelist[i]->name)) {
        newimage=imagelist[i];
        intable=1;
      }
    }
  }

  if (!intable) {
    newimage=(rawimage *)rt_getmem(sizeof(rawimage));
    newimage->loaded=0;
    newimage->xres=0;
    newimage->yres=0;
    newimage->bpp=0;
    newimage->data=NULL;
    len=strlen(filename);
    if (len > 80) rtbomb("Filename too long in image map!!"); 
    strcpy(newimage->name, filename);

    imagelist[numimages]=newimage;  /* add new one to the table       */ 
    numimages++;                    /* increment the number of images */
  }
 
  return newimage;
}
开发者ID:enicolasgomez,项目名称:tbb,代码行数:31,代码来源:imap.cpp

示例5: newtri

object * newtri(void * tex, vector v0, vector v1, vector v2) {
  tri * t;
  vector edge1, edge2, edge3;

  VSub(&v1, &v0, &edge1);
  VSub(&v2, &v0, &edge2);
  VSub(&v2, &v1, &edge3);

  /* check to see if this will be a degenerate triangle before creation */
  if ((VLength(&edge1) >= EPSILON) && 
      (VLength(&edge2) >= EPSILON) && 
      (VLength(&edge3) >= EPSILON)) {

    t=(tri *) rt_getmem(sizeof(tri));

    t->nextobj = NULL;
    t->methods = &tri_methods;

    t->tex = (texture *)tex;
    t->v0 = v0;
    t->edge1 = edge1;
    t->edge2 = edge2;
 
    return (object *) t;
  }
  
  return NULL; /* was a degenerate triangle */
}
开发者ID:SPLURGE831,项目名称:practice,代码行数:28,代码来源:triangle.cpp

示例6: rt_texture

void * rt_texture(apitexture * apitex) {
  texture * tex;

  tex=(texture *)rt_getmem(sizeof(texture));
  apitextotex(apitex, tex); 
  return(tex);
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:7,代码来源:api.cpp

示例7: newextvol

extvol * newextvol(void * voidtex, vector min, vector max, 
                   int samples, flt (* evaluator)(flt, flt, flt)) { 
  extvol * xvol;
  texture * tex;
  
  tex = (texture *) voidtex;

  xvol = (extvol *) rt_getmem(sizeof(extvol));
  memset(xvol, 0, sizeof(extvol));

  xvol->methods = &extvol_methods;

  xvol->min=min;
  xvol->max=max;
  xvol->evaluator = evaluator;
  xvol->ambient = tex->ambient;
  xvol->diffuse = tex->diffuse;
  xvol->opacity = tex->opacity;  
  xvol->samples = samples;

  xvol->tex = (texture *)rt_getmem(sizeof(texture));
  memset(xvol->tex, 0, sizeof(texture));

  xvol->tex->ctr.x = 0.0;
  xvol->tex->ctr.y = 0.0;
  xvol->tex->ctr.z = 0.0;
  xvol->tex->rot = xvol->tex->ctr;
  xvol->tex->scale = xvol->tex->ctr;
  xvol->tex->uaxs = xvol->tex->ctr;
  xvol->tex->vaxs = xvol->tex->ctr;
  xvol->tex->islight = 0;
  xvol->tex->shadowcast = 0;

  xvol->tex->col=tex->col;
  xvol->tex->ambient=1.0;
  xvol->tex->diffuse=0.0;
  xvol->tex->specular=0.0;
  xvol->tex->opacity=1.0;
  xvol->tex->img=NULL;
  xvol->tex->texfunc=(color(*)(void *, void *, void *))(ext_volume_texture);
  xvol->tex->obj = (void *) xvol; /* XXX hack! */

  return xvol;
}
开发者ID:RRIE,项目名称:to3ds,代码行数:44,代码来源:extvol.cpp

示例8: newquadric

quadric * newquadric() {
    quadric * q;

    q=(quadric *) rt_getmem(sizeof(quadric));
    memset(q, 0, sizeof(quadric));
    q->ctr.x=0.0;
    q->ctr.y=0.0;
    q->ctr.z=0.0;
    q->methods = &quadric_methods;

    return q;
}
开发者ID:connorimes,项目名称:parsec-3.0,代码行数:12,代码来源:quadric.cpp

示例9: newbox

box * newbox(void * tex, vector min, vector max) {
  box * b;
  
  b=(box *) rt_getmem(sizeof(box));
  memset(b, 0, sizeof(box));
  b->methods = &box_methods;
  b->tex = (texture *)tex;
  b->min = min; 
  b->max = max;

  return b;
}
开发者ID:Gorfaal,项目名称:CIS410Parallel,代码行数:12,代码来源:box.cpp

示例10: newsphere

object * newsphere(void * tex, vector ctr, flt rad) {
  sphere * s;
  
  s=(sphere *) rt_getmem(sizeof(sphere));
  memset(s, 0, sizeof(sphere));
  s->methods = &sphere_methods;

  s->tex=(texture *)tex;
  s->ctr=ctr;
  s->rad=rad;

  return (object *) s;
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:13,代码来源:sphere.cpp

示例11: newlight

point_light * newlight(void * tex, vector ctr, flt rad) {
  point_light * l;
  
  l=(point_light *) rt_getmem(sizeof(point_light));
  memset(l, 0, sizeof(point_light));
  l->methods = &light_methods;

  l->tex=(texture *)tex;
  l->ctr=ctr;
  l->rad=rad;

  return l;
}
开发者ID:adiog,项目名称:tbb,代码行数:13,代码来源:light.cpp

示例12: newcylinder

object * newcylinder(void * tex, vector ctr, vector axis, flt rad) {
  cylinder * c;
  
  c=(cylinder *) rt_getmem(sizeof(cylinder));
  memset(c, 0, sizeof(cylinder));
  c->methods = &cylinder_methods;

  c->tex=(texture *) tex;
  c->ctr=ctr;
  c->axis=axis;
  c->rad=rad;
  return (object *) c;
}
开发者ID:Gorfaal,项目名称:CIS410Parallel,代码行数:13,代码来源:cylinder.cpp

示例13: newbndbox

bndbox * newbndbox(vector min, vector max) {
  bndbox * b;
  
  b=(bndbox *) rt_getmem(sizeof(bndbox));
  memset(b, 0, sizeof(bndbox));
  b->min=min;
  b->max=max;
  b->methods = &bndbox_methods;

  b->objlist=NULL;
  b->tex=NULL;
  b->nextobj=NULL;
  return b;
}
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:14,代码来源:bndbox.cpp

示例14: newplane

object * newplane(void * tex, vector ctr, vector norm) {
  plane * p;
  
  p=(plane *) rt_getmem(sizeof(plane));
  memset(p, 0, sizeof(plane));
  p->methods = &plane_methods;

  p->tex = (texture *)tex;
  p->norm = norm;
  VNorm(&p->norm);
  p->d = -VDot(&ctr, &p->norm);

  return (object *) p;
}
开发者ID:HeliumProject,项目名称:ThreadBuildingBlocks,代码行数:14,代码来源:plane.cpp

示例15: newring

object * newring(void * tex, vector ctr, vector norm, flt inrad, flt outrad) {
  ring * r;
  
  r=(ring *) rt_getmem(sizeof(ring));
  memset(r, 0, sizeof(ring));
  r->methods = &ring_methods;

  r->tex = (texture *)tex;
  r->ctr = ctr;
  r->norm = norm;
  r->inrad = inrad;
  r->outrad= outrad;

  return (object *) r;
}
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:15,代码来源:ring.cpp


注:本文中的rt_getmem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。