本文整理汇总了C++中eigen::Matrix3f::data方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3f::data方法的具体用法?C++ Matrix3f::data怎么用?C++ Matrix3f::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Matrix3f
的用法示例。
在下文中一共展示了Matrix3f::data方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderTexture
void TextureWarpShader::renderTexture(GLenum mode, GLuint target, GLuint id, const Eigen::Matrix3fr &homography, const Eigen::Vector2i &imageSize, const Eigen::Vector4f *vertices,
const Eigen::Vector2f *textureCoords, int count)
{
assert(target == GL_TEXTURE_2D);
glUseProgram(mProgram.getId());
Eigen::Matrix3f finalH;
finalH = adjustHomography(imageSize, homography);
glUniformMatrix3fv(mUniformHomographyMatrix, 1, false, finalH.data());
// setup uniforms
glActiveTexture(GL_TEXTURE0);
glBindTexture(target, id);
glUniform1i(mUniformTexture, 0);
// drawing quad
glVertexAttribPointer(mAttribPosCoord, 4, GL_FLOAT, GL_FALSE, 0, vertices);
glVertexAttribPointer(mAttribTexCoord, 2, GL_FLOAT, GL_FALSE, 0, textureCoords);
glEnableVertexAttribArray(mAttribPosCoord);
glEnableVertexAttribArray(mAttribTexCoord);
glDrawArrays(mode, 0, count);
glDisableVertexAttribArray(mAttribPosCoord);
glDisableVertexAttribArray(mAttribTexCoord);
}
示例2: set_uniform
void ObjectRenderer::set_uniform(const char* name, const Eigen::Matrix3f& value)
{
assert(program.isLinked());
program.bind();
GLuint id = glGetUniformLocation(program.programId(),name);
if(id==-1)
printf("!!!WARNING: shader '%d' does not contain uniform variable '%s'\n", program.programId(), name);
glUniformMatrix3fv(id, 1, GL_FALSE, value.data());
program.release();
}
示例3: render
void Cube::render(const Eigen::Matrix4f& mvMatrix, const Eigen::Matrix4f& prMatrix, const Eigen::Matrix3f& nmMatrix) {
m_prog.use();
m_prog.setUniformMat4("mvM", mvMatrix.data());
m_prog.setUniformMat4("prM", prMatrix.data());
m_prog.setUniformMat3("nmM", nmMatrix.data());
m_geom.bind();
glDrawElements(GL_TRIANGLE_STRIP, 14, GL_UNSIGNED_INT, (char*)NULL);
m_geom.release();
}
示例4: setUniformValue
bool ShaderProgram::setUniformValue(const std::string& name,
const Eigen::Matrix3f& matrix)
{
GLint location = static_cast<GLint>(findUniform(name));
if (location == -1) {
m_error = "Could not set uniform " + name + ". No such uniform.";
return false;
}
glUniformMatrix3fv(location, 1, GL_FALSE,
static_cast<const GLfloat*>(matrix.data()));
return true;
}
示例5: pca
mat3 pca(PointCloud &pc) {
mat3 cov = pc.calcCov();
Eigen::Matrix3f mat = Eigen::Map<Eigen::Matrix3f>(value_ptr(cov));
Eigen::EigenSolver<Eigen::Matrix3f> solver(mat);
Eigen::Vector3f eigenVals = solver.eigenvalues().real();
Eigen::Matrix3f eigenVecs = solver.eigenvectors().real();
// Matrix containing eigenvectors in COLUMNS
mat3 eigM;
memcpy(value_ptr(eigM), eigenVecs.data(), sizeof(mat3));
// Sort on eigenvalues (quick bubble-sort)
float x = 0.0f, y = 0.0f, z = 0.0f;
int xI = 0, yI = 0, zI = 0;
for (int i = 0; i < 3; i++) {
float e = eigenVals[i];
if (e > x) {
// shuffle down
z = y;
zI = yI;
y = x;
yI = xI;
x = e;
xI = i;
}
else if (e > y) {
z = y;
zI = yI;
y = e;
yI = i;
}
else {
z = e;
zI = i;
}
}
// Ordered eigenvectors
mat3 sortedEig;
sortedEig[0] = eigM[xI];
sortedEig[1] = eigM[yI];
sortedEig[2] = eigM[zI];
static mat3 prevEig = sortedEig;
// Stabilization - match up the dot-sign
for (int i = 0; i < 3; i++) {
sortedEig[i] *= (dot(sortedEig[i], prevEig[i]) < 0) ? -1 : 1;
}
prevEig = sortedEig;
return sortedEig;
}
示例6: applyBL
void CUDABuildLinearSystemRGBD::applyBL(CameraTrackingInput cameraTrackingInput, Eigen::Matrix3f& intrinsics, CameraTrackingParameters cameraTrackingParameters, float3 anglesOld, float3 translationOld, unsigned int imageWidth, unsigned int imageHeight, unsigned int level, Matrix6x7f& res, LinearSystemConfidence& conf)
{
unsigned int localWindowSize = 12;
if(level != 0) localWindowSize = max(1, localWindowSize/(4*level));
const unsigned int blockSize = 64;
const unsigned int dimX = (unsigned int)ceil(((float)imageWidth*imageHeight)/(localWindowSize*blockSize));
Eigen::Matrix3f intrinsicsRowMajor = intrinsics.transpose(); // Eigen is col major / cuda is row major
computeNormalEquations(imageWidth, imageHeight, d_output, cameraTrackingInput, intrinsicsRowMajor.data(), cameraTrackingParameters, anglesOld, translationOld, localWindowSize, blockSize);
cutilSafeCall(cudaMemcpy(h_output, d_output, sizeof(float)*30*dimX, cudaMemcpyDeviceToHost));
// Copy to CPU
res = reductionSystemCPU(h_output, dimX, conf);
}
示例7:
// Eigen types to GLM types
glm::mat3 eigen_matrix3f_to_glm_mat3(const Eigen::Matrix3f &m)
{
return glm::make_mat3x3((const float *)m.data());
}
示例8: setHomography
void WarpPosShader::setHomography(const Eigen::Matrix3f &h)
{
glUseProgram(mProgram.getId());
glUniformMatrix3fv(mUniformHomography, 1, false, h.data());
}