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


C++ Vec3fa函数代码示例

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


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

示例1: main

  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* for best performance set FTZ and DAZ flags in MXCSR control and status register */
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
    _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

    /* set default camera */
    g_camera.from = Vec3fa(2.5f,2.5f,2.5f);
    g_camera.to   = Vec3fa(0.0f,0.0f,0.0f);

    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    if (g_numThreads) 
      g_rtcore += ",threads=" + toString(g_numThreads);

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* render to disk */
    if (outFilename.str() != "") {
      renderToFile(outFilename);
      return 0;
    } 

    /* initialize GLUT */
    initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
    
    /* enter the GLUT run loop */
    enterWindowRunLoop();

    return 0;
  }
开发者ID:Dade916,项目名称:embree,代码行数:36,代码来源:lazy_geometry.cpp

示例2: main

  void main(int argc, char **argv) 
  {
    std::cout << " === Possible cmd line options: -lazy, -pregenerate, -cache === " << std::endl;

    /* set default camera */
    g_camera.from = Vec3fa(1.5f,1.5f,-1.5f);
    g_camera.to   = Vec3fa(0.0f,0.0f,0.0f);

    /*! Parse command line options. */  
    parseCommandLine(new ParseStream(new CommandLineStream(argc, argv)), FileName());

    /*! Set the thread count in the Embree configuration string. */
    if (g_numThreads) g_rtcore += ",threads=" + std::stringOf(g_numThreads);
    g_rtcore += g_subdiv_mode;

    /*! Initialize the task scheduler. */
#if !defined(RTCORE_EXPORT_ALL_SYMBOLS)
    TaskScheduler::create(g_numThreads);
#endif

    /*! Initialize Embree state. */
    init(g_rtcore.c_str());

    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop();
    }
  }
开发者ID:JianpingCAI,项目名称:libigl,代码行数:33,代码来源:tutorial09.cpp

示例3: main

  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* for best performance set FTZ and DAZ flags in MXCSR control and status register */
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
    _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

    /* initialize ray tracing core and force bvh4.triangle4v hierarchy for triangles */
    rtcInit("tri_accel=bvh4.triangle4v");
    
    /* set error handler */
    rtcSetErrorFunction(error_handler);
    
    /* create scene */
    g_scene = rtcNewScene(RTC_SCENE_STATIC,RTC_INTERSECT1);
    addCube(g_scene,Vec3fa(-1,0,0));
    addCube(g_scene,Vec3fa(1,0,0));
    addCube(g_scene,Vec3fa(0,0,-1));
    addCube(g_scene,Vec3fa(0,0,1));
    addHair(g_scene);
    addGroundPlane(g_scene);
    rtcCommit (g_scene);

    /* print triangle BVH */
    print_bvh(g_scene);

    /* cleanup */
    rtcDeleteScene (g_scene);
    rtcExit();
    return 0;
  }
开发者ID:pierremoreau,项目名称:embree,代码行数:31,代码来源:bvh_access.cpp

示例4: device_init

/* called by the C++ code for initialization */
extern "C" void device_init (char* cfg)
{
  /* create scene */
  g_scene = rtcNewScene(g_device);
  rtcSetSceneFlags(g_scene,RTC_SCENE_FLAG_DYNAMIC | RTC_SCENE_FLAG_ROBUST);
  rtcSetSceneBuildQuality(g_scene,RTC_BUILD_QUALITY_LOW);

  /* create some triangulated spheres */
  for (int i=0; i<numSpheres; i++)
  {
    const float phi = i*2.0f*float(pi)/numSpheres;
    const float r = 2.0f*float(pi)/numSpheres;
    const Vec3fa p = 2.0f*Vec3fa(sin(phi),0.0f,-cos(phi));
    //RTCBuildQuality quality = i%3 == 0 ? RTC_BUILD_QUALITY_MEDIUM : i%3 == 1 ? RTC_BUILD_QUALITY_REFIT : RTC_BUILD_QUALITY_LOW;
    RTCBuildQuality quality = i%2 ? RTC_BUILD_QUALITY_REFIT : RTC_BUILD_QUALITY_LOW;
    //RTCBuildQuality quality = RTC_BUILD_QUALITY_REFIT;
    int id = createSphere(quality,p,r);
    position[id] = p;
    radius[id] = r;
    colors[id].x = (i%16+1)/17.0f;
    colors[id].y = (i%8+1)/9.0f;
    colors[id].z = (i%4+1)/5.0f;
  }

  /* add ground plane to scene */
  int id = addGroundPlane(g_scene);
  colors[id] = Vec3fa(1.0f,1.0f,1.0f);

  /* commit changes to scene */
  rtcCommitScene (g_scene);

  /* set start render mode */
  renderTile = renderTileStandard;
  key_pressed_handler = device_key_pressed_default;
}
开发者ID:appleseedhq,项目名称:appleseed-deps,代码行数:36,代码来源:dynamic_scene_device.cpp

示例5: Tutorial

 Tutorial()
     : TutorialApplication("displacement_geometry",FEATURE_RTCORE)
 {
     /* set default camera */
     camera.from = Vec3fa(1.5f,1.5f,-1.5f);
     camera.to   = Vec3fa(0.0f,0.0f,0.0f);
 }
开发者ID:embree,项目名称:embree,代码行数:7,代码来源:displacement_geometry.cpp

示例6: Tutorial

 Tutorial()
   : TutorialApplication("intersection_filter",FEATURE_RTCORE) 
 {
   /* set default camera */
   camera.from = Vec3fa(2.5f,2.5f,2.5f);
   camera.to   = Vec3fa(0.0f,0.0f,0.0f);
 }
开发者ID:ElrosMorlin,项目名称:embree,代码行数:7,代码来源:lazy_geometry.cpp

示例7: occluded_vec3f

    static __forceinline bool occluded_vec3f(const Ray& ray, const Triangle1& tri, const void* geom)
    {
      /* load triangle */
      STAT3(shadow.trav_prims,1,1,1);
      const Vec3f tri_v0 = tri.v0;
      const Vec3f tri_v1 = tri.v1;
      const Vec3f tri_v2 = tri.v2;
      const Vec3f tri_Ng = tri.Ng;

      /* calculate denominator */
      const Vec3f O = Vec3fa(ray.org);
      const Vec3f D = Vec3fa(ray.dir);
      const Vec3f C = tri_v0 - O;
      const Vec3f R = cross(D,C);
      const float den = dot(tri_Ng,D);
      const float absDen = abs(den);
      const float sgnDen = den < 0.0f ? -1.0f : 1.0f;
      const Vec3fa e1 = tri_v0-tri_v1;
      const Vec3fa e2 = tri_v2-tri_v0;

      /* perform edge tests */
      const float U = dot(R,e2) * sgnDen;
      if (unlikely(U < 0.0f)) return false;
      const float V = dot(R,e1) * sgnDen;
      if (unlikely(V < 0.0f)) return false;
      const float W = absDen-U-V;
      if (unlikely(W < 0.0f)) return false;
      
      /* perform depth test */
      const float T = dot(tri_Ng,C) * sgnDen;
      if (unlikely(absDen*ray.tfar < T)) return false;
      if (unlikely(T < absDen*ray.tnear)) return false;

      return true;
    }
开发者ID:cpaalman,项目名称:embree,代码行数:35,代码来源:bvh4i_intersector1_scalar.cpp

示例8: geometry

    Ref<SceneGraph::Node> geometry()
    {
      OBJMaterial material(1.0f,Vec3fa(1.0f),Vec3fa(0.0f),1.0f);
      Ref<SceneGraph::MaterialNode> mnode = new SceneGraph::MaterialNode((Material&)material);
      Ref<SceneGraph::TriangleMeshNode> mesh = new SceneGraph::TriangleMeshNode(mnode);

      const size_t width = texture->width;
      const size_t height = texture->height;
      
      mesh->v.resize(height*width);
      for (size_t y=0; y<height; y++) 
        for (size_t x=0; x<width; x++) 
          mesh->v[y*width+x] = at(x,y);

      mesh->triangles.resize(2*(height-1)*(width-1));
      for (size_t y=0; y<height-1; y++) {
        for (size_t x=0; x<width-1; x++) {
          const size_t p00 = (y+0)*width+(x+0);
          const size_t p01 = (y+0)*width+(x+1);
          const size_t p10 = (y+1)*width+(x+0);
          const size_t p11 = (y+1)*width+(x+1);
          const size_t tri = y*(width-1)+x;
          mesh->triangles[2*tri+0] = SceneGraph::TriangleMeshNode::Triangle(p00,p01,p10);
          mesh->triangles[2*tri+1] = SceneGraph::TriangleMeshNode::Triangle(p01,p11,p10);
        }
      }
      return mesh.dynamicCast<SceneGraph::Node>();
    }
开发者ID:horzelski,项目名称:embree,代码行数:28,代码来源:convert.cpp

示例9: device_init

/* called by the C++ code for initialization */
extern "C" void device_init (int8* cfg)
{
  /* initialize ray tracing core */
  rtcInit(cfg);

  /* set error handler */
  rtcSetErrorFunction(error_handler);
  
  /* set start render mode */
  renderPixel = renderPixelStandard;

  /* create random bounding boxes */
  const size_t N = 2300000;
  isa::PrimInfo pinfo(empty);
  vector_t<PrimRef> prims; 
  for (size_t i=0; i<N; i++) {
    const Vec3fa p = 1000.0f*Vec3fa(drand48(),drand48(),drand48());
    const BBox3fa b = BBox3fa(p,p+Vec3fa(1.0f));
    pinfo.add(b);
    const PrimRef prim = PrimRef(b,i);
    prims.push_back(prim);
  }

  build_sah(prims,pinfo);
  build_morton(prims,pinfo);
}
开发者ID:davenso,项目名称:embree,代码行数:27,代码来源:tutorial11_device.cpp

示例10: renderPixelStandard

/* task that renders a single screen tile */
Vec3fa renderPixelStandard(float x, float y, const ISPCCamera& camera, RayStats& stats)
{
  /* initialize ray */
  Ray ray(Vec3fa(camera.xfm.p), Vec3fa(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz)), 0.0f, inf);

  /* intersect ray with scene */
  RTCIntersectContext context;
  rtcInitIntersectContext(&context);
  rtcIntersect1(g_scene,&context,RTCRayHit_(ray));
  RayStats_addRay(stats);

  /* shade pixels */
  Vec3fa color = Vec3fa(0.0f);
  if (ray.geomID != RTC_INVALID_GEOMETRY_ID)
  {
    Vec3fa diffuse = colors[ray.geomID];
    color = color + diffuse*0.1f;
    Vec3fa lightDir = normalize(Vec3fa(-1,-1,-1));

    /* initialize shadow ray */
    Ray shadow(ray.org + ray.tfar*ray.dir, neg(lightDir), 0.001f, inf);

    /* trace shadow ray */
    rtcOccluded1(g_scene,&context,RTCRay_(shadow));
    RayStats_addShadowRay(stats);

    /* add light contribution */
    if (shadow.tfar >= 0.0f)
      color = color + diffuse*clamp(-dot(lightDir,normalize(ray.Ng)),0.0f,1.0f);
  }
  return color;
}
开发者ID:appleseedhq,项目名称:appleseed-deps,代码行数:33,代码来源:dynamic_scene_device.cpp

示例11: main

  int main(int argc, char **argv) 
  {
    /* for best performance set FTZ and DAZ flags in MXCSR control and status register */
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
    _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);

    std::cout << " === Possible cmd line options: -pregenerate, -cache === " << std::endl;

    /* set default camera */
    g_camera.from = Vec3fa(1.5f,1.5f,-1.5f);
    g_camera.to   = Vec3fa(0.0f,0.0f,0.0f);

    /*! Parse command line options. */  
    parseCommandLine(new ParseStream(new CommandLineStream(argc, argv)), FileName());

    /*! Set the thread count in the Embree configuration string. */
    if (g_numThreads) g_rtcore += ",threads=" + std::to_string((long long)g_numThreads);
    g_rtcore += g_subdiv_mode;

    /*! Initialize Embree state. */
    init(g_rtcore.c_str());

    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop();
    }
    return 0;
  }
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:33,代码来源:subdivision_geometry.cpp

示例12: intersectionFilterN

/* intersection filter function */
void intersectionFilterN(int* valid,
                                  void* ptr,
                                  const RTCIntersectContext* context,
                                  RTCRayN* ray,
                                  const RTCHitN* potentialHit,
                                  const size_t N)
{
  /* avoid crashing when debug visualizations are used */
  if (context == nullptr)
    return;

  /* iterate over all rays in ray packet */
  for (unsigned int ui=0; ui<N; ui+=1)
  {
    /* calculate loop and execution mask */
    unsigned int vi = ui+0;
    if (vi>=N) continue;

    /* ignore inactive rays */
    if (valid[vi] != -1) continue;

    /* read ray from ray structure */
    Vec3fa ray_org = Vec3fa(RTCRayN_org_x(ray,N,ui),RTCRayN_org_y(ray,N,ui),RTCRayN_org_z(ray,N,ui));
    Vec3fa ray_dir = Vec3fa(RTCRayN_dir_x(ray,N,ui),RTCRayN_dir_y(ray,N,ui),RTCRayN_dir_z(ray,N,ui));
    unsigned ray_mask = RTCRayN_mask(ray,N,ui);
    float hit_t = RTCHitN_t(potentialHit,N,ui);

    /* decode ray IDs */
    int pid = (ray_mask & 0xFFFF) / 1;
    int rid = (ray_mask & 0xFFFF) % 1;

    /* calculate transparency */
    Vec3fa h = ray_org + ray_dir*hit_t;
    float T = transparencyFunction(h);

    /* ignore hit if completely transparent */
    if (T >= 1.0f) valid[vi] = 0;

    /* otherwise accept hit and remember transparency */
    else
    {
      RTCRayN_instID(ray,N,ui) = RTCHitN_instID(potentialHit,N,ui);
      RTCRayN_geomID(ray,N,ui) = RTCHitN_geomID(potentialHit,N,ui);
      RTCRayN_primID(ray,N,ui) = RTCHitN_primID(potentialHit,N,ui);

      RTCRayN_u(ray,N,ui) = RTCHitN_u(potentialHit,N,ui);
      RTCRayN_v(ray,N,ui) = RTCHitN_v(potentialHit,N,ui);
      RTCRayN_tfar(ray,N,ui) = RTCHitN_t(potentialHit,N,ui);

      RTCRayN_Ng_x(ray,N,ui) = RTCHitN_Ng_x(potentialHit,N,ui);
      RTCRayN_Ng_y(ray,N,ui) = RTCHitN_Ng_y(potentialHit,N,ui);
      RTCRayN_Ng_z(ray,N,ui) = RTCHitN_Ng_z(potentialHit,N,ui);

      if (context) {
        RTCRay2* eray = (RTCRay2*) context->userRayExt;
        scatter(eray->transparency,sizeof(RTCRay2),pid,rid,T);
      }
    }
  }
}
开发者ID:karimnaaji,项目名称:aobaker,代码行数:61,代码来源:intersection_filter_device.cpp

示例13: device_init

/* called by the C++ code for initialization */
extern "C" void device_init (char* cfg)
{
  /* create new Embree device */
  g_device = rtcNewDevice(cfg);
  error_handler(nullptr,rtcDeviceGetError(g_device));

  /* set error handler */
  rtcDeviceSetErrorFunction2(g_device,error_handler,nullptr);

  /* create scene */
  RTCAlgorithmFlags aflags;
  if (g_mode == MODE_NORMAL) aflags = RTC_INTERSECT1;
  else                       aflags = RTC_INTERSECT1 | RTC_INTERSECT_STREAM;
  g_scene = rtcDeviceNewScene(g_device, RTC_SCENE_STATIC | RTC_SCENE_HIGH_QUALITY,aflags);

  /* add cube */
  addCube(g_scene,Vec3fa(0.0f,0.0f,0.0f),Vec3fa(10.0f,1.0f,1.0f),45.0f);
  //addSubdivCube(g_scene);

  /* add ground plane */
  addGroundPlane(g_scene);

  /* commit changes to scene */
  rtcCommit (g_scene);

  /* set start render mode */
  if (g_mode == MODE_NORMAL) renderTile = renderTileStandard;
  else                       renderTile = renderTileStandardStream;
  key_pressed_handler = device_key_pressed_default;
}
开发者ID:karimnaaji,项目名称:aobaker,代码行数:31,代码来源:intersection_filter_device.cpp

示例14: main

  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* set default camera */
    g_camera.from = Vec3fa(2.5f,2.5f,2.5f);
    g_camera.to   = Vec3fa(0.0f,0.0f,0.0f);

    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::stringOf(g_numThreads);

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* render to disk */
    if (outFilename.str() != "") {
      renderToFile(outFilename);
      return 0;
    } 

    /* initialize GLUT */
    initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
    
    /* enter the GLUT run loop */
    enterWindowRunLoop();

    return 0;
  }
开发者ID:davenso,项目名称:embree,代码行数:32,代码来源:tutorial04.cpp

示例15: device_init

 /* called by the C++ code for initialization */
 extern "C" void device_init (char* cfg)
 {
   /* create new Embree device */
   g_device = rtcNewDevice(cfg);
   error_handler(rtcDeviceGetError(g_device));
   
   /* set error handler */
   rtcDeviceSetErrorFunction(g_device,error_handler);
   
   /* set start render mode */
   renderTile = renderTileStandard;
   
   /* create random bounding boxes */
   const size_t N = 2300000;
   isa::PrimInfo pinfo(empty);
   avector<PrimRef> prims; 
   for (size_t i=0; i<N; i++) {
     const float x = float(drand48());
     const float y = float(drand48());
     const float z = float(drand48());
     const Vec3fa p = 1000.0f*Vec3fa(x,y,z);
     const BBox3fa b = BBox3fa(p,p+Vec3fa(1.0f));
     pinfo.add(b);
     const PrimRef prim = PrimRef(b,i);
     prims.push_back(prim);
   }
   
   build_sah(prims,pinfo);
   build_morton(prims,pinfo);
 }
开发者ID:ElrosMorlin,项目名称:embree,代码行数:31,代码来源:bvh_builder_device.cpp


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