本文整理汇总了C++中Mat4::Ref方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::Ref方法的具体用法?C++ Mat4::Ref怎么用?C++ Mat4::Ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4
的用法示例。
在下文中一共展示了Mat4::Ref方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
Mat::Mat(const Mat4 &m) : data(m.Ref()), rows(4 | VL_REF_FLAG), cols(4)
{
}
示例2: UpdateCL
void Engine::UpdateCL()
{
Mat4 world(16.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f);
Mat4 invWorldView = inv(world) * cam->GetTransform();
Vec4 camObjectPos;
memcpy(camObjectPos.Ref(), cam->Position.Ref(), sizeof(float) * 3);
camObjectPos[3] = 1.0f;
camObjectPos = camObjectPos * inv(world);
camObjectPos[3] = 0.0f;
memcpy(RTParams.camPos, camObjectPos.Ref(), sizeof(float) * 4);
if (camObjectPos[0] > 0.0f && camObjectPos[0] < 1.0f && camObjectPos[1] > 0.0f && camObjectPos[1] < 1.0f && camObjectPos[2] > 0.0f && camObjectPos[2] < 1.0f)
{
RTParams.camPos[3] = 1.0f;
}
memcpy(&RTParams.sizeX, &voxelSize.x, sizeof(int) * 3);
RTParams.sizeW = voxelBuilder.GetMaxNumMips() - 1;
memcpy(RTParams.invWorldView, invWorldView.Ref(), sizeof(float) * 16);
RTParams.invSize[0] = 1.0 / voxelSize.x;
RTParams.invSize[1] = 1.0 / voxelSize.y;
RTParams.invSize[2] = 1.0 / voxelSize.z;
memcpy(RTParams.lightPos, lightPos->Ref(), sizeof(float) * 3);
#ifndef INTEL
clEnqueueAcquireGLObjects(ocl.queue, 1, &ocl.output, 0, NULL, NULL);
#endif
size_t globalWorkSize[] = { RTWidth, RTHeight };
memset(counters, 0, sizeof(counters));
clEnqueueWriteBuffer(ocl.queue, ocl.paramBuffer, false, 0, sizeof(RTParams), &RTParams, 0, NULL, NULL);
clEnqueueWriteBuffer(ocl.queue, ocl.rtCounterBuffer, false, 0, sizeof(int) * 2, &counters, 0, NULL, NULL);
if (voxels)
{
if (ocl.rtKernel)
{
clEnqueueNDRangeKernel(ocl.queue, ocl.rtKernel, 2, NULL, globalWorkSize, NULL, 0, NULL, NULL);
}
}
else
{
if (ocl.octRTKernel)
{
clEnqueueNDRangeKernel(ocl.queue, ocl.octRTKernel, 2, NULL, globalWorkSize, 0, NULL, NULL, NULL);
}
}
clEnqueueReadBuffer(ocl.queue, ocl.rtCounterBuffer, false, 0, sizeof(int) * 2, &counters, 0, NULL, NULL);
#ifndef INTEL
clEnqueueReleaseGLObjects(ocl.queue, 1, &ocl.output, 0, NULL, NULL);
#endif
clFinish(ocl.queue);
averageIterations = (float)counters[1] / (float)counters[0];
}