// **************************************************************************** // // Function Name: RCompositeSelection::Unselect( ) // // Description: Removes a selection from this composite // // Returns: Nothing // // Exceptions: Memory // // **************************************************************************** // void RCompositeSelection::Unselect( const RComponentView* pSelectableObject, BOOLEAN fRender ) { YSelectionCollectionIterator iterator = m_SelectionCollection.Start( ); for( ; iterator != m_SelectionCollection.End( ); ++iterator ) { TpsAssert( dynamic_cast<RSingleSelection*>( *iterator ), "Nested compounds not implemented yet." ); if( ( *iterator )->IsSelected( pSelectableObject ) ) { // Create a drawing surface and transform RViewDrawingSurface drawingSurface( m_pView ); R2dTransform transform; SetupRender( drawingSurface, transform ); RRealRect rect( m_pView->GetSize( ) ); if( ShouldRenderSelection( ) && fRender ) ( *iterator )->Render( drawingSurface, transform, rect ); delete *iterator; m_SelectionCollection.RemoveAt( iterator ); return; } } // Tell the view the selection is changing m_pView->OnChangeSelection( ); TpsAssert( FALSE, "Object was not selected." ); }
// **************************************************************************** // // Function Name: RCompositeSelection::Select( ) // // Description: Adds a selection to this composite // // Returns: Nothing // // Exceptions: Memory // // **************************************************************************** // void RCompositeSelection::Select( const RComponentView* pSelectableObject, BOOLEAN fRender ) { // Validate TpsAssert( pSelectableObject, "NULL Selection" ); TpsAssertValid( pSelectableObject ); // Dont select if it is not selectable if( !pSelectableObject->GetComponentAttributes( ).IsSelectable( ) ) return; // Check to see if it already in the selection list TpsAssert( IsSelected( pSelectableObject ) == FALSE, "Selection is already in this composite." ); // Create a new selection and add it RSingleSelection* pNewSelection = new RSingleSelection( pSelectableObject, m_pView ); m_SelectionCollection.InsertAtEnd( pNewSelection ); // Create a drawing surface and transform RViewDrawingSurface drawingSurface( m_pView ); R2dTransform transform; SetupRender( drawingSurface, transform ); RRealRect rect( m_pView->GetSize( ) ); if( fRender && ShouldRenderSelection( ) ) pNewSelection->Render( drawingSurface, transform, rect ); // Tell the view the selection is changing m_pView->OnChangeSelection( ); }
// **************************************************************************** // // Function Name: RCompositeSelection::UnselectAll( ) // // Description: Removes all selections from this composite. // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RCompositeSelection::UnselectAll( BOOLEAN fRender ) { // Create a drawing surface and transform RViewDrawingSurface drawingSurface( m_pView ); R2dTransform transform; SetupRender( drawingSurface, transform ); RRealRect rect( m_pView->GetSize( ) ); // Remove all selections YSelectionCollectionIterator iterator = m_SelectionCollection.Start( ); while( iterator != m_SelectionCollection.End( ) ) { YSelectionCollectionIterator temp = iterator; ++iterator; if( ShouldRenderSelection( ) && fRender ) ( *temp )->Render( drawingSurface, transform, rect ); delete *temp; m_SelectionCollection.RemoveAt( temp ); } // Tell the view the selection is changing m_pView->OnChangeSelection( ); }
void ClothRender::Render() { CVirtualClothTryOnDoc* doc = GetActiveDocument();//有了doc就有了绘制需要的数据文件 if (!doc) return; SetupCamera(doc->m_pCamera3D); SetupRender(); //下面可以测试绘制一些具体的图形 GLDrawTriangle(); }
// **************************************************************************** // // Function Name: RCompositeSelection::Render( ) // // Description: Creates a view drawingsurface and renders // // Returns: Nothing // // Exceptions: Memory // // **************************************************************************** // void RCompositeSelection::DoRender( BOOLEAN fRenderIfLocked ) const { // Create a drawing surface and transform RViewDrawingSurface drawingSurface( m_pView ); R2dTransform transform; SetupRender( drawingSurface, transform ); RRealRect rect( m_pView->GetSize( ) ); // Go through our selection collection and render each selection YSelectionCollectionIterator iterator = m_SelectionCollection.Start( ); for( ; iterator != m_SelectionCollection.End( ); ++iterator ) ( *iterator )->Render( drawingSurface, transform, rect, fRenderIfLocked ); }
// **************************************************************************** // // Function Name: RCompositeSelection::Unselect( ) // // Description: Removes a selection from this composite // // Returns: Nothing // // Exceptions: Memory // // **************************************************************************** // void RCompositeSelection::Unselect( RSingleSelection* pSelection ) { // Find the selection YSelectionCollectionIterator iterator = m_SelectionCollection.Find( pSelection ); TpsAssert( iterator != m_SelectionCollection.End( ), "Object was not selected." ); // Create a drawing surface and transform RViewDrawingSurface drawingSurface( m_pView ); R2dTransform transform; SetupRender( drawingSurface, transform ); RRealRect rect( m_pView->GetSize( ) ); if( ShouldRenderSelection( ) ) ( *iterator )->Render( drawingSurface, transform, rect ); delete *iterator; m_SelectionCollection.RemoveAt( iterator ); // Tell the view the selection is changing m_pView->OnChangeSelection( ); return; }