本文整理汇总了C++中Affine3::matrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Affine3::matrix方法的具体用法?C++ Affine3::matrix怎么用?C++ Affine3::matrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Affine3
的用法示例。
在下文中一共展示了Affine3::matrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readJointSubNodes
void VRMLBodyLoaderImpl::readJointSubNodes(LinkInfo& iLink, MFNode& childNodes, const ProtoIdSet& acceptableProtoIds, const Affine3& T)
{
for(size_t i = 0; i < childNodes.size(); ++i){
bool doTraverse = false;
VRMLNode* childNode = childNodes[i].get();
if(!childNode->isCategoryOf(PROTO_INSTANCE_NODE)){
doTraverse = true;
} else {
VRMLProtoInstance* protoInstance = static_cast<VRMLProtoInstance*>(childNode);
int id = PROTO_UNDEFINED;
const string& protoName = protoInstance->proto->protoName;
ProtoInfoMap::iterator p = protoInfoMap.find(protoName);
if(p == protoInfoMap.end()){
doTraverse = true;
childNode = protoInstance->actualNode.get();
} else {
id = p->second.id;
if(!acceptableProtoIds.test(id)){
throw invalid_argument(str(format(_("%1% node is not in a correct place.")) % protoName));
}
if(isVerbose){
messageIndent += 2;
}
switch(id){
case PROTO_JOINT:
if(!T.matrix().isApprox(Affine3::MatrixType::Identity())){
throw invalid_argument(
str(format(_("Joint node \"%1%\" is not in a correct place.")) % protoInstance->defName));
}
iLink.link->appendChild(readJointNode(protoInstance, iLink.link->Rs()));
break;
case PROTO_SEGMENT:
readSegmentNode(iLink, protoInstance, T);
linkOriginalMap[iLink.link] = childNodes[i];
break;
case PROTO_SURFACE:
readSurfaceNode(iLink, protoInstance, T);
break;
case PROTO_DEVICE:
readDeviceNode(iLink, protoInstance, T);
break;
default:
doTraverse = true;
break;
}
if(isVerbose){
messageIndent -= 2;
}
}
}
if(doTraverse && childNode->isCategoryOf(GROUPING_NODE)){
VRMLGroup* group = static_cast<VRMLGroup*>(childNode);
if(VRMLTransform* transform = dynamic_cast<VRMLTransform*>(group)){
readJointSubNodes(iLink, group->getChildren(), acceptableProtoIds, T * transform->toAffine3d());
} else {
readJointSubNodes(iLink, group->getChildren(), acceptableProtoIds, T);
}
}
}
}
示例2: setTransformMatrices
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());
}
}
}