bool TriPatchObject::UpdatePerNodeItems(const MaxSDK::Graphics::UpdateDisplayContext& updateDisplayContext, MaxSDK::Graphics::UpdateNodeContext& nodeContext, MaxSDK::Graphics::IRenderItemContainer& targetRenderItemContainer) { Mesh& mesh = patch.GetMesh(); if(mesh.getNumVerts()>0) { using namespace MaxSDK::Graphics; GenerateMeshRenderItemsContext generateRenderItemsContext; generateRenderItemsContext.GenerateDefaultContext(updateDisplayContext); generateRenderItemsContext.RemoveInvisibleMeshElementDescriptions(nodeContext.GetRenderNode()); IMeshDisplay2* pMeshDisplay = static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID)); if (NULL == pMeshDisplay) { return false; } pMeshDisplay->GetRenderItems(generateRenderItemsContext,nodeContext,targetRenderItemContainer); return true ; } return false; }
bool MaterialHandle::UpdatePerNodeItems( const MaxSDK::Graphics::UpdateDisplayContext& updateDisplayContext, MaxSDK::Graphics::UpdateNodeContext& nodeContext, MaxSDK::Graphics::IRenderItemContainer& targetRenderItemContainer) { using namespace MaxSDK::Graphics; IMeshDisplay2* pMeshDisplay = static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID)); if (NULL == pMeshDisplay) { return false; } AutoRestoreRenderNodeMaterial(nodeContext.GetRenderNode(), mSolidColorMaterialHandle); GenerateMeshRenderItemsContext generateRenderItemsContext; generateRenderItemsContext.GenerateDefaultContext(updateDisplayContext); generateRenderItemsContext.RemoveInvisibleMeshElementDescriptions(nodeContext.GetRenderNode()); RenderItemHandleArray renderItems; pMeshDisplay->GetRenderItems(generateRenderItemsContext,nodeContext,renderItems); // set SolidColorMaterialHandle to render item for (int index = 0; index < renderItems.GetNumberOfRenderItems(); index++) { RenderItemHandleDecorator decorator; decorator.Initialize(renderItems.GetRenderItem(index)); decorator.SetCustomMaterial(mSolidColorMaterialHandle); targetRenderItemContainer.AddRenderItem(decorator); } return true; }
bool mrGeomShaderObject::UpdateDisplay( const MaxSDK::Graphics::MaxContext& maxContext, const MaxSDK::Graphics::UpdateDisplayContext& displayContext) { // create a mesh to display (leave it in cache) UpdateMesh(displayContext.GetDisplayTime()); using namespace MaxSDK::Graphics; GenerateMeshRenderItemsContext generateRenderItemsContext; generateRenderItemsContext.GenerateDefaultContext(displayContext); m_mesh.GenerateRenderItems(mRenderItemHandles,generateRenderItemsContext); return true; }
bool TriPatchObject::UpdateDisplay( const MaxSDK::Graphics::MaxContext& maxContext, const MaxSDK::Graphics::UpdateDisplayContext& displayContext) { // create a mesh to display (leave it in cache) PrepareMesh(displayContext.GetDisplayTime()); Mesh& mesh = patch.GetMesh(); if(mesh.getNumVerts()>0) { using namespace MaxSDK::Graphics; GenerateMeshRenderItemsContext generateRenderItemsContext; generateRenderItemsContext.GenerateDefaultContext(displayContext); mesh.GenerateRenderItems(mRenderItemHandles,generateRenderItemsContext); return true ; } return false; }
bool TriPatchObject::PrepareDisplay(const MaxSDK::Graphics::UpdateDisplayContext& prepareDisplayContext) { PrepareMesh(prepareDisplayContext.GetDisplayTime()); Mesh& mesh = patch.GetMesh(); if(mesh.getNumVerts()>0) { using namespace MaxSDK::Graphics; mRenderItemHandles.ClearAllRenderItems(); IMeshDisplay2* pMeshDisplay = static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID)); if (NULL == pMeshDisplay) { return false; } GenerateMeshRenderItemsContext generateMeshRenderItemsContext; generateMeshRenderItemsContext.GenerateDefaultContext(prepareDisplayContext); pMeshDisplay->PrepareDisplay(generateMeshRenderItemsContext); return true ; } return false; }
bool MaterialHandle::PrepareDisplay( const MaxSDK::Graphics::UpdateDisplayContext& prepareDisplayContext) { using namespace MaxSDK::Graphics; IMeshDisplay2* pMeshDisplay = static_cast<IMeshDisplay2*>(mesh.GetInterface(IMesh_DISPLAY2_INTERFACE_ID)); if (NULL == pMeshDisplay) { return false; } GenerateMeshRenderItemsContext generateRenderItemsContext; generateRenderItemsContext.GenerateDefaultMeshElementDescriptions( prepareDisplayContext.GetRequiredComponents()); if(!mSolidColorMaterialHandle.IsValid()) { mSolidColorMaterialHandle.Initialize(); mSolidColorMaterialHandle.SetColor(AColor(1.0f,0.2f,0.2f,1.0f)); } generateRenderItemsContext.AddRequiredStreams(*mSolidColorMaterialHandle.GetRequiredStreams()); pMeshDisplay->PrepareDisplay(generateRenderItemsContext); return true; }