Exemple #1
0
void OptSO3::computeJacobian(Matrix3f&J, Matrix3f& R, float N)
{  
  Rot2Device(R);
  //cout<<"computeJacobian"<<endl;
  J = Matrix3f::Zero();
  robustSquaredAngleCostFctJacobianGPU(J.data(), d_J,
      d_q_, d_weights_, d_z, d_mu_, sigma_sq_, w_,h_);
  J /= N;
};
void PhongShadowProgram::setTransformMatrices(const Affine3& viewMatrix, const Affine3& modelMatrix, const Matrix4& PV)
{
    const Affine3f VM = (viewMatrix * modelMatrix).cast<float>();
    const Matrix3f N = VM.linear();
    const Matrix4f PVM = (PV * modelMatrix.matrix()).cast<float>();

    if(useUniformBlockToPassTransformationMatrices){
       transformBlockBuffer.write(modelViewMatrixIndex, VM);
       transformBlockBuffer.write(normalMatrixIndex, N);
       transformBlockBuffer.write(MVPIndex, PVM);
       transformBlockBuffer.flush();
    } else {
        glUniformMatrix4fv(modelViewMatrixLocation, 1, GL_FALSE, VM.data());
        glUniformMatrix3fv(normalMatrixLocation, 1, GL_FALSE, N.data());
        glUniformMatrix4fv(MVPLocation, 1, GL_FALSE, PVM.data());
        for(int i=0; i < numShadows_; ++i){
            ShadowInfo& shadow = shadowInfos[i];
            const Matrix4f BPVM = (shadow.BPV * modelMatrix.matrix()).cast<float>();
            glUniformMatrix4fv(shadow.shadowMatrixLocation, 1, GL_FALSE, BPVM.data());
        }
    }
}
 /// Initialize a uniform parameter with a 3x3 matrix
 void setUniform(const std::string &name, const Matrix3f &mat, bool warn = true) {
     glUniformMatrix3fv(uniform(name, warn), 1, GL_FALSE, mat.data());
 }