当前位置: 首页>>代码示例>>C++>>正文


C++ MDrawRequest::setIsTransparent方法代码示例

本文整理汇总了C++中MDrawRequest::setIsTransparent方法的典型用法代码示例。如果您正苦于以下问题:C++ MDrawRequest::setIsTransparent方法的具体用法?C++ MDrawRequest::setIsTransparent怎么用?C++ MDrawRequest::setIsTransparent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MDrawRequest的用法示例。


在下文中一共展示了MDrawRequest::setIsTransparent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getDrawRequests


//.........这里部分代码省略.........
			break;
		}

		case M3dView::kGouraudShaded :
		{
			// Create the smooth shaded draw request
			//
			request.setToken( kDrawSmoothShaded );

			// Need to get the material info
			//
			MDagPath path = info.multiPath();	// path to your dag object 
			M3dView view = info.view();; 		// view to draw to
			MMaterial material = MPxSurfaceShapeUI::material( path );

			// Evaluate the material and if necessary, the texture.
			//
			if ( ! material.evaluateMaterial( view, path ) ) {
				cerr << "Couldnt evaluate\n";
			}

			bool drawTexture = true;
			if ( drawTexture && material.materialIsTextured() ) {
				material.evaluateTexture( data );
			}

			request.setMaterial( material );

			// request.setDisplayStyle( appearance );

			bool materialTransparent = false;
			material.getHasTransparency( materialTransparent );
			if ( materialTransparent ) {
				request.setIsTransparent( true );
			}

			queue.add( request );

			// create a draw request for wireframe on shaded if
			// necessary.
			//
			if ( (displayStatus == M3dView::kActive) ||
				 (displayStatus == M3dView::kLead) ||
				 (displayStatus == M3dView::kHilite) )
			{
				MDrawRequest wireRequest = info.getPrototype( *this );
				wireRequest.setDrawData( data );
				wireRequest.setToken( kDrawWireframeOnShaded );
				wireRequest.setDisplayStyle( M3dView::kWireFrame );

				M3dView::ColorTable activeColorTable = M3dView::kActiveColors;

				switch ( displayStatus )
				{
					case M3dView::kLead :
						wireRequest.setColor( LEAD_COLOR, activeColorTable );
						break;
					case M3dView::kActive :
						wireRequest.setColor( ACTIVE_COLOR, activeColorTable );
						break;
					case M3dView::kHilite :
						wireRequest.setColor( HILITE_COLOR, activeColorTable );
						break;

					default :	
						break;
开发者ID:DimondTheCat,项目名称:xray,代码行数:67,代码来源:apiSimpleShapeUI.cpp

示例2: getDrawRequests

/// \todo We should be firing off a separate drawRequest for the components, then we can be done with the "hiliteGroups" mechanism.
void ProceduralHolderUI::getDrawRequests( const MDrawInfo &info, bool objectAndActiveOnly, MDrawRequestQueue &requests )
{
	// it's easy if noone want to look at us
	if( !info.objectDisplayStatus( M3dView::kDisplayMeshes ) )
	{
		return;
	}

	// the node we're meant to be drawing
	ProceduralHolder *proceduralHolder = (ProceduralHolder *)surfaceShape();

	// draw data encapsulating that node
	MDrawData drawData;
	getDrawData( proceduralHolder, drawData );

	// a request for the bound if necessary
	MPlug pDrawBound( proceduralHolder->thisMObject(), ProceduralHolder::aDrawBound );
	bool drawBound = true;
	pDrawBound.getValue( drawBound );

	if( drawBound )
	{
		MDrawRequest request = info.getPrototype( *this );
		request.setDrawData( drawData );
		request.setToken( BoundDrawMode );
		request.setDisplayStyle( M3dView::kWireFrame );
		setWireFrameColors( request, info.displayStatus() );
		requests.add( request );
	}

	// requests for the scene if necessary
	MPlug pGLPreview( proceduralHolder->thisMObject(), ProceduralHolder::aGLPreview );
	bool glPreview = false;
	pGLPreview.getValue( glPreview );
	if( glPreview )
	{
		if( info.displayStyle()==M3dView::kGouraudShaded || info.displayStyle()==M3dView::kFlatShaded )
		{
			// make a request for solid drawing with a material
			MDrawRequest solidRequest = info.getPrototype( *this );
			solidRequest.setDrawData( drawData );

			MDagPath path = info.multiPath();
			M3dView view = info.view();
			MMaterial material = MPxSurfaceShapeUI::material( path );
			if( !material.evaluateMaterial( view, path ) )
			{
				MString pathName = path.fullPathName();
				IECore::msg( IECore::Msg::Warning, "ProceduralHolderUI::getDrawRequests", boost::format( "Failed to evaluate material for \"%s\"." ) % pathName.asChar() );
			}
			if( material.materialIsTextured() )
			{
				material.evaluateTexture( drawData );
			}
			solidRequest.setMaterial( material );
			// set the transparency request. we don't have a decent way of finding out
			// if shaders applied by the procedural are transparent, so we've got a transparency
			// attribute on the procedural holder for users to use. maya materials may also say
			// they're transparent. if either asks for transparency then we'll ask for it here
			bool transparent = false;
			material.getHasTransparency( transparent );
			if( !transparent )
			{
				MPlug pT( proceduralHolder->thisMObject(), ProceduralHolder::aTransparent );
				bool transparent = false;
				pT.getValue( transparent );
			}
			solidRequest.setIsTransparent( transparent );
			solidRequest.setToken( SceneDrawMode );
			requests.add( solidRequest );
			// and add another request for wireframe drawing if we're selected
			if( info.displayStatus()==M3dView::kActive || info.displayStatus()==M3dView::kLead || info.displayStatus()==M3dView::kHilite )
			{
				MDrawRequest wireRequest = info.getPrototype( *this );
				wireRequest.setDrawData( drawData );
				wireRequest.setDisplayStyle( M3dView::kWireFrame );
				wireRequest.setToken( SceneDrawMode );
				setWireFrameColors( wireRequest, info.displayStatus() );
				wireRequest.setComponent( MObject::kNullObj );

				if ( !objectAndActiveOnly )
				{

					if ( proceduralHolder->hasActiveComponents() )
					{
						MObjectArray components = proceduralHolder->activeComponents();
		    				MObject component = components[0]; // Should filter list
		   				wireRequest.setComponent( component );
					}
				}

				requests.add( wireRequest );
			}
		}
		else
		{
			MDrawRequest request = info.getPrototype( *this );
			request.setDrawData( drawData );
			setWireFrameColors( request, info.displayStatus() );
//.........这里部分代码省略.........
开发者ID:TRiGGER80,项目名称:cortex,代码行数:101,代码来源:ProceduralHolderUI.cpp

示例3: getDrawRequests

void SceneShapeUI::getDrawRequests( const MDrawInfo &info, bool objectAndActiveOnly, MDrawRequestQueue &requests )
{
	// it's easy if no one want to look at us
	if( !info.objectDisplayStatus( M3dView::kDisplayMeshes ) )
	{
		return;
	}
	// the node we're meant to be drawing
	SceneShape *sceneShape = (SceneShape *)surfaceShape();

	if( !sceneShape->getSceneInterface() )
	{
		return;
	}
	
	// draw data encapsulating that node
	MDrawData drawData;
	getDrawData( sceneShape, drawData );

	// a request for the bound if necessary
	MPlug pDrawBound( sceneShape->thisMObject(), SceneShape::aDrawRootBound );
	bool drawBound;
	pDrawBound.getValue( drawBound );
	
	if( drawBound )
	{
		bool doDrawBound = true;
		
		// If objectOnly is true, check for an object. If none found, no need to add the bound request.
		MPlug pObjectOnly( sceneShape->thisMObject(), SceneShape::aObjectOnly );
		bool objectOnly;
		pObjectOnly.getValue( objectOnly );
		if( objectOnly && !sceneShape->getSceneInterface()->hasObject() )
		{
			doDrawBound = false;
		}
		
		if( doDrawBound )
		{
			MDrawRequest request = info.getPrototype( *this );
			request.setDrawData( drawData );
			request.setToken( BoundDrawMode );
			request.setDisplayStyle( M3dView::kWireFrame );
			setWireFrameColors( request, info.displayStatus() );
			requests.add( request );
		}

	}

	MPlug pDrawAllBounds( sceneShape->thisMObject(), SceneShape::aDrawChildBounds );
	bool drawAllBounds = false;
	pDrawAllBounds.getValue( drawAllBounds );
	
	// requests for the scene if necessary
	MPlug pGLPreview( sceneShape->thisMObject(), SceneShape::aDrawGeometry );
	bool glPreview;
	pGLPreview.getValue( glPreview );
	
	if( glPreview || drawAllBounds )
	{
		if( info.displayStyle()==M3dView::kGouraudShaded || info.displayStyle()==M3dView::kFlatShaded )
		{
			// make a request for solid drawing with a material
			MDrawRequest solidRequest = info.getPrototype( *this );
			solidRequest.setDrawData( drawData );

			MDagPath path = info.multiPath();
			M3dView view = info.view();
			MMaterial material = MPxSurfaceShapeUI::material( path );
			if( !material.evaluateMaterial( view, path ) )
			{
				MString pathName = path.fullPathName();
				IECore::msg( IECore::Msg::Warning, "SceneShapeUI::getDrawRequests", boost::format( "Failed to evaluate material for \"%s\"." ) % pathName.asChar() );
			}
			if( material.materialIsTextured() )
			{
				material.evaluateTexture( drawData );
			}
			solidRequest.setMaterial( material );
			// set the transparency request. we don't have a decent way of finding out
			// if shaders applied by the procedural are transparent, so we've got a transparency
			// attribute on the procedural holder for users to use. maya materials may also say
			// they're transparent. if either asks for transparency then we'll ask for it here
			bool transparent = false;
			material.getHasTransparency( transparent );
			solidRequest.setIsTransparent( transparent );
			solidRequest.setToken( SceneDrawMode );
			requests.add( solidRequest );

			if( info.displayStatus()==M3dView::kActive || info.displayStatus()==M3dView::kLead || info.displayStatus()==M3dView::kHilite )
			{
				MDrawRequest wireRequest = info.getPrototype( *this );
				wireRequest.setDrawData( drawData );
				wireRequest.setDisplayStyle( M3dView::kWireFrame );
				wireRequest.setToken( SceneDrawMode );
				setWireFrameColors( wireRequest, info.displayStatus() );
				wireRequest.setComponent( MObject::kNullObj );

				if ( !objectAndActiveOnly )
				{
//.........这里部分代码省略.........
开发者ID:RotorStudios,项目名称:cortex,代码行数:101,代码来源:SceneShapeUI.cpp


注:本文中的MDrawRequest::setIsTransparent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。