本文整理汇总了C++中Sphere::Intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ Sphere::Intersect方法的具体用法?C++ Sphere::Intersect怎么用?C++ Sphere::Intersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sphere
的用法示例。
在下文中一共展示了Sphere::Intersect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exhaustive
inline float Exhaustive(const Ray charles, float t, const BVHNode& node,
const vector<Sphere> spheres, unsigned int &sphereId) {
exhaustives += node.GetPrimitiveRange();
for (unsigned int p = node.GetFirstPrimitive();
p < node.GetFirstPrimitive() + node.GetPrimitiveRange(); ++p) {
const Sphere sphere = spheres[p];
const float tSphere = sphere.Intersect(charles);
if (0 < tSphere && tSphere < t) {
sphereId = p;
t = tSphere;
}
}
return t;
}
示例2: Exhaustive
inline void Exhaustive(vector<BoundedRay> &rays, vector<int> &rayIndices, const int indexOffset, const int indexCount,
const vector<Sphere> &spheres, vector<int> &sphereIDs, const int sphereOffset, const int sphereCount,
vector<Hit> &hits) {
for (int i = indexOffset; i < indexOffset + indexCount; ++i) {
const int rayID = rayIndices[i];
const Ray charles = rays[rayID].ToRay();
float tHit = rays[rayID].t == 0.0f ? 1e30 : rays[rayID].t;
Hit hit = hits[rayID];
for (int s = sphereOffset; s < sphereOffset + sphereCount; ++s) {
++exhaustives;
const Sphere sphere = spheres[sphereIDs[s]];
const float t = sphere.Intersect(charles);
if (0 < t && t < tHit) {
hit = Hit(sphereIDs[s]);
tHit = t;
}
}
hits[rayID] = hit;
rays[rayID].t = tHit;
}
}