本文整理汇总了C++中Ray::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ Ray::Transform方法的具体用法?C++ Ray::Transform怎么用?C++ Ray::Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ray
的用法示例。
在下文中一共展示了Ray::Transform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Intersect
bool RayTesselatedSpherePrimitive::Intersect(const Ray& ray, Intersection* intersection) {
Vec3f p;
float r;
float rayEpsilon;
Matrix4d m;
Matrix4d mi;
_ResolveSphereAttrib(p,r,m,mi);
// xform the ray
Ray xformRay = ray;
xformRay.Transform(mi);
float t;
bool hit = IntersectSphere(p, r, xformRay, &t, &rayEpsilon);
if(hit) {
intersection->rayEpsilon = rayEpsilon;
intersection->t = t;
intersection->dp.P = xformRay.Eval(t);
intersection->dp.Ng = (intersection->dp.P - p).GetNormalized();
intersection->dp.N = intersection->dp.Ng;
intersection->dp.uv[0] = (atan2f(intersection->dp.N[0], intersection->dp.N[1]) + (float)PI) / (float)(2*PI);
intersection->dp.uv[1] = acosf(intersection->dp.N[2]) / (float)PI;
intersection->dp.GenerateTuTv();
intersection->dp.st = intersection->dp.uv;
intersection->m = material;
}
// xform back
if(hit) {
intersection->Transform(m);
}
return hit;
}
示例2: ColourTrace
bool GeometryNode::ColourTrace(Ray R, double& closestDist, HitInfo& Hit, Matrix4x4& M)
{
R.Transform(m_invtrans);
if (m_primitive->DepthTrace(R, closestDist, Hit, M * m_trans))
{
Hit.Mat = m_material.get();
return true;
}
return false;
}
示例3: DepthTrace
bool GeometryNode::DepthTrace(Ray R, double& closestDist, HitInfo& Hit, Matrix4x4& M)
{
R.Transform(m_invtrans);
bool ret = false;
if (m_primitive->DepthTrace(R, closestDist, Hit, M * m_trans))
{
ret = true;
}
return ret;
}
示例4: TimeTrace
bool GeometryNode::TimeTrace(Ray R, double& closestDist, HitInfo& Hit, Matrix4x4& M, const double& Time)
{
Matrix4x4 m_timetrans = M * m_trans;
if (Velocity != Vector3D())
{
m_timetrans.translate(Time * Velocity);
R.Transform(m_timetrans.invert());
}
else
{
R.Transform(m_invtrans);
}
// std::cout << "Scene:" << R.Start << "," << R.Direction << std::endl;
if (m_primitive->DepthTrace(R, closestDist, Hit, m_timetrans))
{
Hit.Mat = m_material.get();
return true;
}
return false;
}
示例5: SimpleTrace
bool SceneNode::SimpleTrace(Ray R)
{
R.Transform(m_invtrans);
for (auto iter = m_children.begin(); iter != m_children.end(); ++iter)
{
auto& Node = *iter;
if (Node->SimpleTrace(R))
{
return true;
}
}
return false;
}