本文整理汇总了C++中MDrawRequest::displayStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ MDrawRequest::displayStatus方法的具体用法?C++ MDrawRequest::displayStatus怎么用?C++ MDrawRequest::displayStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDrawRequest
的用法示例。
在下文中一共展示了MDrawRequest::displayStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void DrawableHolderUI::draw( const MDrawRequest &request, M3dView &view ) const
{
MDrawData drawData = request.drawData();
DrawableHolder *drawableHolder = (DrawableHolder *)drawData.geometry();
assert( drawableHolder );
IECoreGL::ConstScenePtr s = drawableHolder->scene();
if( !s )
{
return;
}
view.beginGL();
// maya can sometimes leave an error from it's own code,
// and we don't want that to confuse us in our drawing code.
while( glGetError()!=GL_NO_ERROR )
{
}
// if we're being drawn as part of a selection operation we need
// to make sure there's a name on the name stack, as the IECoreGL::NameStateComponent
// expects to be able to load a name into it (it fails with an invalid operation if
// there's no name slot to load into).
if( view.selectMode() )
{
view.pushName( 0 );
}
try
{
// do the main render
s->render( m_displayStyle.baseState( request.displayStyle() ) );
// do a wireframe render over the top if we're selected and we just did a solid
// draw.
bool selected = request.displayStatus()==M3dView::kActive || request.displayStatus()==M3dView::kLead;
bool solid = request.displayStyle()==M3dView::kFlatShaded || request.displayStyle()==M3dView::kGouraudShaded;
if( selected && solid )
{
s->render( m_displayStyle.baseState( M3dView::kWireFrame ) );
}
}
catch( std::exception &e )
{
IECore::msg( IECore::Msg::Error, "DrawableHolderUI::draw", e.what() );
}
view.endGL();
}
示例2: draw
void BaseShapeUI::draw( const MDrawRequest & request, M3dView & view ) const {
if (s_drawData.failure)
return;
MStatus status;
view.beginGL();
if (!s_drawData.initialized)
initializeDraw();
BaseShape *shape = (BaseShape *) surfaceShape();
Model::Base base(MFnDagNode(shape->thisMObject()).parent(0, &status));
if (!status) {
status.perror("MFnDagNode::parent");
return;
}
//MDagPath path = request.multiPath();
MMaterial material = request.material();
MColor color, borderColor;
if (!(status = material.getDiffuse(color))) {
status.perror("MMaterial::getDiffuse");
return;
}
bool wireframe = (M3dView::DisplayStyle) request.token() == M3dView::kWireFrame;
if (wireframe) {
glPushAttrib(GL_POLYGON_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
glUseProgram(s_drawData.program);
switch (request.displayStatus())
{
case M3dView::kLead :
borderColor = view.colorAtIndex( LEAD_COLOR);
//glUniform1f(s_drawData.border_uniform, 1.0f);
s_drawData.updateBorderUniform(1.0f);
//glUniform3f(s_drawData.borderColor_uniform, borderColor.r, borderColor.g, borderColor.b);
s_drawData.updateBorderColorUniform(borderColor.r, borderColor.g, borderColor.b);
break;
case M3dView::kActive :
borderColor = view.colorAtIndex( ACTIVE_COLOR);
//glUniform1f(s_drawData.border_uniform, 1.0f);
s_drawData.updateBorderUniform(1.0f);
//glUniform3f(s_drawData.borderColor_uniform, borderColor.r, borderColor.g, borderColor.b);
s_drawData.updateBorderColorUniform(borderColor.r, borderColor.g, borderColor.b);
break;
case M3dView::kActiveAffected :
borderColor = view.colorAtIndex( ACTIVE_AFFECTED_COLOR);
//glUniform1f(s_drawData.border_uniform, 0.0f);
s_drawData.updateBorderUniform(0.0f);
break;
case M3dView::kDormant :
borderColor = view.colorAtIndex( DORMANT_COLOR, M3dView::kDormantColors);
//glUniform1f(s_drawData.border_uniform, 0.0f);
s_drawData.updateBorderUniform(0.0f);
break;
case M3dView::kHilite :
borderColor = view.colorAtIndex( HILITE_COLOR);
//glUniform1f(s_drawData.border_uniform, 1.0f);
s_drawData.updateBorderUniform(1.0f);
//glUniform3f(s_drawData.borderColor_uniform, borderColor.r, borderColor.g, borderColor.b);
s_drawData.updateBorderColorUniform(borderColor.r, borderColor.g, borderColor.b);
break;
}
//glUniform3f(s_drawData.color_uniform, color.r, color.g, color.b);
s_drawData.updateColorUniform(color.r, color.g, color.b);
glCallList(s_drawData.display_list);
if (wireframe)
glPopAttrib();
view.endGL();
}