本文整理汇总了C++中ogre::SubMesh::_getRenderOperation方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::_getRenderOperation方法的具体用法?C++ SubMesh::_getRenderOperation怎么用?C++ SubMesh::_getRenderOperation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SubMesh
的用法示例。
在下文中一共展示了SubMesh::_getRenderOperation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderFirstPerson
void GfxBody::renderFirstPerson (const GfxShaderGlobals &g,
bool alpha_blend)
{
if (!enabled || fade < 0.000001) return;
bool do_wireframe = (wireframe || gfx_option(GFX_WIREFRAME));
bool do_regular = !(do_wireframe && gfx_option(GFX_WIREFRAME_SOLID));
bool fade_dither = fade < 1;
bool instanced = false;
unsigned bone_weights = mesh->getNumBlendWeightsPerVertex();
const Ogre::Matrix4 &world = node->_getFullTransform();
// TODO(dcunnin): object parameters
// this is to protect the material to texture mappings which might be
// concurrently read by the background loading thread
// TODO: use a RW lock to avoid stalls
GFX_MAT_SYNC;
for (unsigned i=0 ; i<subList.size() ; ++i) {
Sub *sub = subList[i];
GfxMaterial *mat = sub->material;
// Skip if wrong kind of material for this set of passes
bool mat_alpha = mat->getSceneBlend() != GFX_MATERIAL_OPAQUE;
if (alpha_blend != mat_alpha) continue;
Ogre::SubMesh *sm = mesh->getSubMesh(i);
if (do_regular) {
// render sm using mat
const GfxMaterialTextureMap &mat_texs = mat->getTextures();
mat->getShader()->bindShader(GfxShader::FIRST_PERSON,
fade_dither, instanced, bone_weights,
g, world, boneWorldMatrixes, numBoneMatrixes, fade,
mat_texs, mat->getBindings());
switch (mat->getSceneBlend()) {
case GFX_MATERIAL_OPAQUE:
ogre_rs->_setDepthBufferParams(true, true, Ogre::CMPF_LESS_EQUAL);
ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);
break;
case GFX_MATERIAL_ALPHA:
ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);
ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
break;
case GFX_MATERIAL_ALPHA_DEPTH:
ogre_rs->_setDepthBufferParams(true, true, Ogre::CMPF_LESS_EQUAL);
ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
break;
}
ogre_rs->_setPolygonMode(Ogre::PM_SOLID);
ogre_rs->setStencilCheckEnabled(false);
Ogre::RenderOperation op;
sm->_getRenderOperation(op);
ogre_rs->_render(op);
for (unsigned i=0 ; i<mat_texs.size() ; ++i) {
ogre_rs->_disableTextureUnit(i);
}
}
if (do_wireframe) {
mat->getShader()->bindShader(GfxShader::WIRE_FRAME, false, false, 0,
g, world, boneWorldMatrixes, numBoneMatrixes, 1,
GfxMaterialTextureMap(), mat->getBindings());
ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);
ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);
ogre_rs->_setPolygonMode(Ogre::PM_WIREFRAME);
ogre_rs->setStencilCheckEnabled(false);
Ogre::RenderOperation op;
sm->_getRenderOperation(op);
ogre_rs->_render(op);
}
}
}