本文整理汇总了C++中Mat4f::col方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4f::col方法的具体用法?C++ Mat4f::col怎么用?C++ Mat4f::col使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4f
的用法示例。
在下文中一共展示了Mat4f::col方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCameraToWorld
void CameraControls::setCameraToWorld(const Mat4f& m)
{
m_position = m.col(3).toCartesian();
m_forward = -normalize(Vec4f(m.col(2)).getXYZ());
if (!m_keepAligned)
m_up = normalize(Vec4f(m.col(1)).getXYZ());
}
示例2: handleEvent
bool App::handleEvent(const Window::Event& ev)
{
if (ev.type == Window::EventType_Close)
{
m_window.showModalMessage("Exiting...");
delete this;
return true;
}
Action action = m_action;
m_action = Action_None;
String name;
Mat4f mat;
switch (action)
{
case Action_None:
break;
case Action_LoadMesh:
name = m_window.showFileLoadDialog("Load mesh", getMeshImportFilter());
if (name.getLength()) {
Bvh::setBvhMode((Bvh::BvhMode)m_bvhMode);
loadMesh(name);
}
break;
case Action_ReloadMesh:
if (m_meshFileName.getLength()) {
Bvh::setBvhMode((Bvh::BvhMode)m_bvhMode);
loadMesh(m_meshFileName);
}
break;
case Action_SaveMesh:
name = m_window.showFileSaveDialog("Save mesh", getMeshExportFilter());
if (name.getLength())
saveMesh(name);
break;
case Action_ResetCamera:
if (m_mesh)
{
m_cameraCtrl.initForMesh(m_mesh);
m_commonCtrl.message("Camera reset");
}
break;
case Action_EncodeCameraSignature:
m_window.setVisible(false);
printf("\nCamera signature:\n");
printf("%s\n", m_cameraCtrl.encodeSignature().getPtr());
waitKey();
break;
case Action_DecodeCameraSignature:
{
m_window.setVisible(false);
printf("\nEnter camera signature:\n");
char buf[1024];
if (scanf_s("%s", buf, FW_ARRAY_SIZE(buf)))
m_cameraCtrl.decodeSignature(buf);
else
setError("Signature too long!");
if (!hasError())
printf("Done.\n\n");
else
{
printf("Error: %s\n", getError().getPtr());
clearError();
waitKey();
}
}
break;
case Action_NormalizeScale:
if (m_mesh)
{
Vec3f lo, hi;
m_mesh->getBBox(lo, hi);
m_mesh->xform(Mat4f::scale(Vec3f(2.0f / (hi - lo).max())) * Mat4f::translate((lo + hi) * -0.5f));
}
break;
case Action_FlipXY:
nvswap(mat.col(0), mat.col(1));
if (m_mesh)
{
m_mesh->xform(mat);
m_mesh->flipTriangles();
}
break;
case Action_FlipYZ:
nvswap(mat.col(1), mat.col(2));
if (m_mesh)
{
m_mesh->xform(mat);
//.........这里部分代码省略.........
示例3: renderObject
String CudaRenderer::renderObject(
Image& frame,
OctreeRuntime* runtime,
int objectID,
const Mat4f& octreeToWorld,
const Mat4f& worldToCamera,
const Mat4f& projection)
{
FW_ASSERT(runtime);
// Check frame buffer validity.
if (frame.getSize().min() <= 0)
return "";
if (frame.getFormat() != ImageFormat::ABGR_8888 ||
frame.getStride() != frame.getSize().x * frame.getBPP())
{
return "CudaRenderer: Incompatible framebuffer!";
}
// Determine preprocessor defines.
const Array<AttachIO::AttachType>& attach = runtime->getAttachTypes(objectID);
FW_ASSERT(attach.getSize() == AttachSlot_Max);
m_compiler.clearDefines();
bool enableContours = (attach[AttachSlot_Contour] == AttachIO::ContourAttach && m_params.enableContours);
if (enableContours)
m_compiler.define("ENABLE_CONTOURS");
switch (attach[AttachSlot_Attribute])
{
case AttachIO::ColorNormalPaletteAttach: m_compiler.define("VOXELATTRIB_PALETTE"); m_compiler.define("DISABLE_PUSH_OPTIMIZATION"); break;
case AttachIO::ColorNormalCornerAttach: m_compiler.define("VOXELATTRIB_CORNER"); m_compiler.define("DISABLE_PUSH_OPTIMIZATION"); break;
case AttachIO::ColorNormalDXTAttach: m_compiler.define("VOXELATTRIB_DXT"); break;
default: return "Unsupported attribute attachment!";
}
if (attach[AttachSlot_AO] == AttachIO::AOAttach)
m_compiler.define("VOXELATTRIB_AO");
if (m_params.measureRaycastPerf)
m_compiler.define("KERNEL_RAYCAST_PERF");
else
m_compiler.define("KERNEL_RENDER");
if (m_params.enablePerfCounters)
m_compiler.define("ENABLE_PERF_COUNTERS");
if (m_params.enableLargeReconstruction)
m_compiler.define("LARGE_RECONSTRUCTION_KERNEL");
if (m_params.enableJitterLOD)
m_compiler.define("JITTER_LOD");
if (m_params.visualization == Visualization_PrimaryAndShadow)
m_compiler.define("ENABLE_SHADOWS");
if (!m_blurLUT.getSize())
constructBlurLUT();
m_compiler.define("BLUR_LUT_SIZE", String(m_blurLUT.getSize()));
// Determine flags.
U32 flags = 0;
if (m_params.visualization == Visualization_IterationCount)
flags |= RenderFlags_VisualizeIterations;
else if (m_params.visualization == Visualization_RaycastLevel)
flags |= RenderFlags_VisualizeRaycastLevel;
// Set input.
m_input.frameSize = frame.getSize();
m_input.flags = flags;
m_input.batchSize = m_params.batchSize;
m_input.aaRays = (m_params.enableAntialias) ? 4 : 1;
m_input.maxVoxelSize = m_params.maxVoxelSize;
m_input.brightness = m_params.brightness;
m_input.coarseSize = m_params.coarseSize;
m_input.coarseFrameSize = (m_input.frameSize + (m_params.coarseSize - 1)) / m_params.coarseSize + 1;
m_input.frame = frame.getBuffer().getMutableCudaPtr();
m_input.rootNode = runtime->getRootNodeCuda(objectID);
OctreeMatrices& om = m_input.octreeMatrices;
Vec3f scale = Vec3f(Vec2f(2.0f) / Vec2f(m_input.frameSize), 1.0f);
om.viewportToCamera = projection.inverted() * Mat4f::translate(Vec3f(-1.0f, -1.0f, 0.0f)) * Mat4f::scale(scale);
om.cameraToOctree = Mat4f::translate(Vec3f(1.0f)) * (worldToCamera * octreeToWorld).inverted();
Mat4f vto = om.cameraToOctree * om.viewportToCamera;
om.pixelInOctree = sqrt(Vec4f(vto.col(0)).getXYZ().cross(Vec4f(vto.col(1)).getXYZ()).length());
om.octreeToWorld = octreeToWorld * Mat4f::translate(Vec3f(-1.0f));
om.worldToOctree = invert(om.octreeToWorld);
om.octreeToWorldN = octreeToWorld.getXYZ().inverted().transposed();
om.cameraPosition = invert(worldToCamera) * Vec3f(0.f, 0.f, 0.f);
om.octreeToViewport = invert(om.viewportToCamera) * invert(om.cameraToOctree);
om.viewportToOctreeN = (om.octreeToViewport).transposed();
// Setup frame-related buffers.
//.........这里部分代码省略.........