本文整理汇总了C++中Matrix4x4f::set_column方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4f::set_column方法的具体用法?C++ Matrix4x4f::set_column怎么用?C++ Matrix4x4f::set_column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4f
的用法示例。
在下文中一共展示了Matrix4x4f::set_column方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convert
int CudaBVH::convert(BVHRT::Node* node, int idx)
{
assert(node);
assert(idx < (int)nodes.size());
int ret = idx + 1;
if (node->left)
{
// Negative index means leaf.
nodes[idx].left_idx = node->left->is_leaf() ? -ret : ret;
ret = convert(node->left, ret);
nodes[idx].right_idx = node->right->is_leaf() ? -ret : ret;
ret = convert(node->right, ret);
aabbs_x[idx].x = node->left->aabb.min.x;
aabbs_x[idx].y = node->left->aabb.max.x;
aabbs_x[idx].z = node->right->aabb.min.x;
aabbs_x[idx].w = node->right->aabb.max.x;
aabbs_y[idx].x = node->left->aabb.min.y;
aabbs_y[idx].y = node->left->aabb.max.y;
aabbs_y[idx].z = node->right->aabb.min.y;
aabbs_y[idx].w = node->right->aabb.max.y;
aabbs_z[idx].x = node->left->aabb.min.z;
aabbs_z[idx].y = node->left->aabb.max.z;
aabbs_z[idx].z = node->right->aabb.min.z;
aabbs_z[idx].w = node->right->aabb.max.z;
}
else
{
int n = (int)node->primitives.size();
nodes[idx].left_idx = (int)vertices.size();
nodes[idx].right_idx = (int)node->primitives.size() * 3;
for (int i = 0; i < n; i++)
{
const Primitive& prim = bvh->get_primitive(node->primitives[i]);
vertices.push_back(Vector4f(prim.v0, 1.f));
vertices.push_back(Vector4f(prim.v1, 1.f));
vertices.push_back(Vector4f(prim.v2, 1.f));
#if 0
Matrix4x4f m;
m.set_column(0, Vector4f(prim.v0 - prim.v2, 0.f));
m.set_column(1, Vector4f(prim.v1 - prim.v2, 0.f));
m.set_column(2, Vector4f(cross(prim.v0 - prim.v2, prim.v1 - prim.v2) - prim.v2, 0.f));
m.set_column(3, Vector4f(prim.v2, 0.f));
m = invert(m);
Vec4x3 v;
v.v[0] = Vector4f(m.get(2, 0), m.get(2, 1), m.get(2, 2), -m.get(2, 3));
v.v[1] = Vector4f(m.get(0, 0), m.get(0, 1), m.get(0, 2), m.get(0, 3));
v.v[2] = Vector4f(m.get(1, 0), m.get(1, 1), m.get(1, 2), m.get(1, 3));
woop_tris.push_back(v);
#endif
}
}
return ret;
}