• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rt_getmem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: fakeimage

static 
int fakeimage(char * name, int * xres, int * yres, unsigned char ** imgdata) {
  int i, imgsize;

  fprintf(stderr, "Error loading image %s.  Faking it.\n", name);
   
  *xres = 2;
  *yres = 2;
  imgsize = 3 * (*xres) * (*yres);
  *imgdata = (unsigned char *)rt_getmem(imgsize);
  for (i=0; i<imgsize; i++) {
    (*imgdata)[i] = 255;
  }

  return IMAGENOERR;
}
开发者ID:jjDiego,项目名称:EDA,代码行数:16,代码来源:imageio.cpp


示例17: engrid_cell

static int engrid_cell(grid * gold, gridindex *index) {
  vector gmin, gmax, gsize;
  flt len;
  int numobj, numcbrt, xs, ys, zs;
  grid * g;
  objectlist **list;
  objectlist * newobj;

  list = &gold->cells[index->z*gold->xsize*gold->ysize + 
                     index->y*gold->xsize  + index->x];

  if (*list == NULL)
    return 0;

  numobj =  cellbound(gold, index, &gmin, &gmax);

  VSub(&gmax, &gmin, &gsize);
  len = 1.0 / (MYMAX( MYMAX(gsize.x, gsize.y), gsize.z ));
  gsize.x *= len;  
  gsize.y *= len;  
  gsize.z *= len;  

  if (numobj > 16) {
    numcbrt = (int) cbrt(2*numobj); 
    
    xs = (int) ((flt) numcbrt * gsize.x);
    if (xs < 1) xs = 1;
    ys = (int) ((flt) numcbrt * gsize.y);
    if (ys < 1) ys = 1;
    zs = (int) ((flt) numcbrt * gsize.z);
    if (zs < 1) zs = 1;

    g = (grid *) newgrid(xs, ys, zs, gmin, gmax);
    engrid_objectlist(g, list);

    newobj = (objectlist *) rt_getmem(sizeof(objectlist));    
    newobj->obj = (object *) g;
    newobj->next = *list;
    *list = newobj;

    g->nextobj = gold->objects;
    gold->objects = (object *) g;
  }

  return 1;
}
开发者ID:YoonJungsik,项目名称:Kinect,代码行数:46,代码来源:grid.cpp


示例18: trace_shm

void trace_shm(scenedef scene, /*char * buffer,  */ int startx, int stopx, int starty, int stopy) {

  thr_parms * parms;

  parms = (thr_parms *) rt_getmem(sizeof(thr_parms));  

  parms->tid=0;
  parms->nthr=1;
  parms->scene=scene;
  parms->startx=startx;
  parms->stopx=stopx;
  parms->starty=starty;
  parms->stopy=stopy;

  thread_trace(parms);

  rt_freemem(parms);
}
开发者ID:Chalenko,项目名称:PCM,代码行数:18,代码来源:trace_rest.cpp


示例19: LoadVol

void LoadVol(scalarvol * vol) { 
  FILE * dfile;
  int status;
  char msgtxt[2048];
 
  dfile=fopen(vol->name, "r");
  if (dfile==NULL) {
    char msgtxt[2048];
    sprintf(msgtxt, "Vol: can't open %s for input!!! Aborting\n",vol->name); 
    rt_ui_message(MSG_ERR, msgtxt);
    rt_ui_message(MSG_ABORT, "Rendering Aborted.");
    exit(1);
  }  
 
  sprintf(msgtxt, "loading %dx%dx%d volume set from %s",
      vol->xres, vol->yres, vol->zres, vol->name);
  rt_ui_message(MSG_0, msgtxt);

  vol->data = (unsigned char *)rt_getmem(vol->xres * vol->yres * vol->zres);

  status=fread(vol->data, 1, (vol->xres * vol->yres * vol->zres), dfile);
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:22,代码来源:vol.cpp


示例20: engrid_object

static int engrid_object(grid * g, object * obj) {
  vector omin, omax; 
  gridindex low, high;
  int x, y, z, zindex, yindex, voxindex;
  objectlist * tmp;
 
  if (obj->methods->bbox(obj, &omin, &omax)) { 
    if (!pos2grid(g, &omin, &low) || !pos2grid(g, &omax, &high)) {
      return 0; /* object is not wholly contained in the grid */
    }
  }
  else {
    return 0; /* object is unbounded */
  }

  /* add the object to the complete list of objects in the grid */
  obj->nextobj = g->objects;
  g->objects = obj;

  /* add this object to all voxels it inhabits */
  for (z=low.z; z<=high.z; z++) {
    zindex = z * g->xsize * g->ysize;
    for (y=low.y; y<=high.y; y++) {
      yindex = y * g->xsize;
      for (x=low.x; x<=high.x; x++) {
        voxindex = x + yindex + zindex; 
        tmp = (objectlist *) rt_getmem(sizeof(objectlist));
        tmp->next = g->cells[voxindex];
        tmp->obj = obj;
        g->cells[voxindex] = tmp;
      }
    }
  }
 
  return 1;
}
开发者ID:YoonJungsik,项目名称:Kinect,代码行数:36,代码来源:grid.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rt_hw_board_init函数代码示例发布时间:2022-05-30
下一篇:
C++ rt_get_time函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap