本文整理汇总了C++中Matrix4d::Data方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::Data方法的具体用法?C++ Matrix4d::Data怎么用?C++ Matrix4d::Data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4d
的用法示例。
在下文中一共展示了Matrix4d::Data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCameraPosAndUp
/// This only needs to be done once for all the particles, because the view
/// matrix does not change any between them. If you were to modify the view
/// matrix at all, you would need to recalculate the camera pos and up vector.
void BillboardMatrixBase::GetCameraPosAndUp(Vector3d& vCameraPos, Vector3d& vCameraUp)
{
Matrix4d mView;
glGetDoublev(GL_MODELVIEW_MATRIX, mView.Data());
// The values in the view matrix for the camera are the negative values of
// the camera. This is because of the way gluLookAt works; I'm don't fully
// understand why gluLookAt does what it does, but I know doing this works:)
// I know that gluLookAt creates a the look vector as (eye - center), the
// resulting direction vector is a vector from center to eye (the oposite
// of what are view direction really is).
vCameraPos = -mView.Column(3);
vCameraUp = mView.Row(1);
// zero the translation in the matrix, so we can use the matrix to transform
// camera postion to world coordinates using the view matrix
mView.Column(3, Vector3d());
// the view matrix is how to get to the gluLookAt pos from what we gave as
// input for the camera position, so to go the other way we need to reverse
// the rotation. Transposing the matrix will do this.
mView.TransposeRotation();
// get the correct position of the camera in world space
vCameraPos = mView * vCameraPos;
}
示例2: RenderStaticModels
void ModelDisplayState::RenderStaticModels(RenderOptions& options) const
{
const std::vector<CompositeModel3d::StaticModelData>& vecStaticModels =
m_spModel->StaticList();
ATLASSERT(m_vecStaticModelTextures.size() == vecStaticModels.size());
for (size_t i=0, iMax = vecStaticModels.size(); i<iMax; i++)
{
// enable model texture, if loaded
if (m_vecStaticModelTextures[i] != NULL)
m_vecStaticModelTextures[i]->Bind();
// find mount point and matrix
const CompositeModel3d::StaticModelData& data = vecStaticModels[i];
ATLASSERT(data.m_iJointIndex >= 0);
ATLASSERT(size_t(data.m_iJointIndex) < m_vecJointRenderData.size());
size_t uiMountIndex = static_cast<size_t>(data.m_iJointIndex);
Matrix4d matGlobal = m_vecJointRenderData[uiMountIndex].GlobalMatrix();
matGlobal.Transpose();
// transform current modelview matrix
glPushMatrix();
glMultMatrixd(matGlobal.Data());
// render model
data.m_spStatic->Render(options);
// render mount point
if (options.Get(RenderOptions::optionModelJoints))
RenderMountPoint();
glPopMatrix();
}
}