本文整理汇总了C++中Matrix4::Transpose方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::Transpose方法的具体用法?C++ Matrix4::Transpose怎么用?C++ Matrix4::Transpose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4
的用法示例。
在下文中一共展示了Matrix4::Transpose方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Determinant
Matrix4 Matrix4::Inverse() const
{
Matrix4 m;
GLfloat det = Determinant();
if(fabs(det) < 0.000001f) return(m);
for(GLuint c=0; c<4; c++)
for(GLuint r=0; r<4; r++)
m.mat[c*4+r]=Cofactor(c, r)/det;
return(m.Transpose());
}
示例2:
void NodeIntersector<real>::TransformIntersectionToGlobalCoordinates( const CoreLib::Node<real>* node, Intersection<real>& ioIntersection )
{
// newPosition = M * position
// newNormal = M^{-T} * normal
const Matrix4<real>& localToGlobal = node->GetLocalToGlobal();
Matrix4<real> localToGlobalForNormals = node->GetGlobalToLocal();
localToGlobalForNormals.Transpose();
ioIntersection.SetPosition( localToGlobal * ioIntersection.GetPosition() );
ioIntersection.SetNormal( localToGlobalForNormals ^ ioIntersection.GetNormal() );
}
示例3: SetParameter
void SpriteShader::SetParameter(const std::string ¶meterName, const Matrix4 &value)
{
if(pimpl->uniforms.find(parameterName) == pimpl->uniforms.end())
throw std::runtime_error("Couldn't find the named SpriteEffect parameter: " + parameterName);
auto &uniformData = pimpl->uniforms[parameterName];
if(uniformData.type != GL_FLOAT_MAT4)
throw std::runtime_error("Type mismatch for named SpriteEffect paramater: " + parameterName);
glUniformMatrix4fv(uniformData.location, 1, GL_FALSE, value.Transpose());
}
示例4: GetCameraRotationMatrix
Matrix4 Camera3D::GetCameraViewMatrix(){
//get transform matrix
Matrix4 cameraTransformMatrix;
cameraTransformMatrix.Translate(m_position);
cameraTransformMatrix.m_translation.x *= -1.0f; //stopgap fix for -zUP issue
cameraTransformMatrix.m_translation.z *= -1.0f; //stopgap fix for -zUP issue
Matrix4 viewMatrix = /* GetCameraRotationMatrix() * */ cameraTransformMatrix * GetCameraRotationMatrix();
//R*T = rotate around origin, movement correct
//T*R = rotate correct, absolute movement
viewMatrix.Transpose();
//the movement is absolute regardless of rotation for whatever reason...
return viewMatrix;
}
示例5:
void Matrix4::Adjoint( Matrix4* adjoint ) const
{
Matrix4 cofactor;
Cofactor( &cofactor );
cofactor.Transpose( adjoint );
}
示例6: InverseMVP
Matrix4 InverseMVP(const Matrix4 &invP, const Vector3 &T, const Matrix4 &R)
{
return R.Transpose() * Matrix4::Translation(T).Transpose() * invP;
}
示例7: RotationTransform
Transform RotationTransform(float radians, float x, float y, float z) {
const Matrix4 mat = RotationMatrix(radians, x, y, z);
const Matrix4 inv = mat.Transpose();
return Transform(mat, inv);
}
示例8: RecompileInternal
//.........这里部分代码省略.........
}
case UT_INT:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_INT_VEC2:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_INT_VEC3:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_INT_VEC4:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_BOOL:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_BOOL_VEC2:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_BOOL_VEC3:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_BOOL_VEC4:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
//VI: Matrices are returned from the shader in column-major order so need to transpose the matrix.
case UT_FLOAT_MAT2:
{
RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
Matrix2* m = (Matrix2*)uniformStruct->cacheValue;
Matrix2 t;
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
t._data[i][j] = m->_data[j][i];
*m = t;
break;
}
case UT_FLOAT_MAT3:
{
RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
Matrix3* m = (Matrix3*)uniformStruct->cacheValue;
Matrix3 t;
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
t._data[i][j] = m->_data[j][i];
*m = t;
break;
}
case UT_FLOAT_MAT4:
{
RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
Matrix4* m = (Matrix4*)uniformStruct->cacheValue;
m->Transpose();
break;
}
case UT_SAMPLER_2D:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
case UT_SAMPLER_CUBE:
{
RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
break;
}
}
}
}