void COp::SetCountOut( unsigned int uiCountOut ) { if( ( m_uiFlags & OP_FLAG_DYNAMIC_OUTPUTS ) && uiCountOut && uiCountOut != m_uiCountOut ) { double * pdOutOld = m_pdOut; unsigned int uiCountOutOld = m_uiCountOut; unsigned int uiCopyMax = uiCountOut; InitOutputs( uiCountOut ); if( uiCountOutOld <= m_uiCountOut ) uiCopyMax = uiCountOutOld; OP_MEM_COPY( m_pdOut, pdOutOld, uiCopyMax * sizeof(double) ); //while( uiCopyMax ) //{ // --uiCopyMax; // m_pdOut[uiCopyMax] = pdOutOld[uiCopyMax]; //} if( pdOutOld ) delete [] pdOutOld; #ifdef OP_USE_RUNTIME_INFO m_oArrStrNameOut.Resize( m_uiCountOut ); m_oArrStrInfoOut.Resize( m_uiCountOut ); #endif // OP_USE_RUNTIME_INFO } }
COp & COp::operator = ( const COp &roOp ) { ClearInputs(); ClearOutputs(); InitInputs( roOp.m_uiCountIn ); // m_uiCountIn / m_ppoOpIn InitOutputs( roOp.m_uiCountOut ); // m_uiCountOut / m_pdValOut //for( unsigned int i=0; i<m_uiCountIn; ++i ) // m_poIn[i] = roOp.m_poIn[i]; //for( unsigned int i=0; i<m_uiCountOut; ++i ) // m_pdOut[i] = roOp.m_pdOut[i]; if( m_uiCountIn ) OP_MEM_COPY( m_poIn, roOp.m_poIn, m_uiCountIn * sizeof(CLink) ); if( m_uiCountOut ) OP_MEM_COPY( m_pdOut, roOp.m_pdOut, m_uiCountOut * sizeof(double) ); m_uiState = roOp.m_uiState; m_bIsNotValid = roOp.m_bIsNotValid; // m_uiID bleibt! m_uiFlags = roOp.m_uiFlags; #ifdef OP_USE_INTERNALS /* // rem: Kann nur in der spezifischen Klasse im Konstruktur initialisiert werden. if( m_uiCountInternalInt != roOp.m_uiCountInternalInt ) SetCountInternalInt( roOp.m_uiCountInternalInt ); if( m_uiCountInternalUInt != roOp.m_uiCountInternalUInt ) SetCountInternalUInt( roOp.m_uiCountInternalUInt ); if( m_uiCountInternalFlt != roOp.m_uiCountInternalFlt ) SetCountInternalFlt( roOp.m_uiCountInternalFlt ); OP_MEM_COPY( m_pptPtrInternalInt, roOp.m_pptPtrInternalInt, m_uiCountInternalInt * sizeof(int *) ); OP_MEM_COPY( m_pptPtrInternalUInt, roOp.m_pptPtrInternalUInt, m_uiCountInternalUInt * sizeof(unsigned int *) ); OP_MEM_COPY( m_pptPtrInternalFlt, roOp.m_pptPtrInternalFlt, m_uiCountInternalFlt * sizeof(double *) ); */ for( unsigned int i=0; i<m_uiCountInternalInt; ++i ) *(m_pptPtrInternalInt[i]) = *(roOp.m_pptPtrInternalInt[i]); for( unsigned int i=0; i<m_uiCountInternalUInt; ++i ) *(m_pptPtrInternalUInt[i]) = *(roOp.m_pptPtrInternalUInt[i]); for( unsigned int i=0; i<m_uiCountInternalFlt; ++i ) *(m_pptPtrInternalFlt[i]) = *(roOp.m_pptPtrInternalFlt[i]); #endif // OP_USE_INTERNALS #ifdef OP_USE_RUNTIME_INFO m_oStrNameInstance = roOp.m_oStrNameInstance; m_oArrStrNameIn = roOp.m_oArrStrNameIn; m_oArrStrNameOut = roOp.m_oArrStrNameOut; m_oArrStrInfoIn = roOp.m_oArrStrInfoIn; m_oArrStrInfoOut = roOp.m_oArrStrInfoOut; #ifdef OP_USE_ROUTINES m_oArrStrNameRoutine = roOp.m_oArrStrNameRoutine; m_oArrStrInfoRoutine = roOp.m_oArrStrInfoRoutine; #endif // OP_USE_ROUTINES #endif // OP_USE_RUNTIME_INFO #ifdef OP_USE_USER_DATA m_pvData = roOp.m_pvData; #endif // OP_USE_USER_DATA return *this; }
void CMesh::Simplify(int iVertices2Remain, float fMaxError, bool bConsiderMaterials) { TEdge *pEdge; bool bRemoveSecond; m_bConsiderMaterials = bConsiderMaterials; if (!m_arrCollapses.m_iCount) { InitOutputs(); InitBorders(); } InitEdgeEvaluation(); while (m_hashVertices.m_iCount > iVertices2Remain) { if (!SelectEdge(pEdge, bRemoveSecond, fMaxError)) break; RecordCollapse(pEdge, bRemoveSecond); CollapseEdge(pEdge, bRemoveSecond); // CheckEdges(); } }
COp::COp( unsigned int uiCountIn, unsigned int uiCountOut ) : m_poIn( 0 ) , m_uiCountIn( 0 ) , m_pdOut( 0 ) , m_uiCountOut( 0 ) , m_uiState( 0 ) , m_bIsNotValid( true ) , m_uiID( m_uiIDMax_ ) , m_uiFlags( OP_FLAG_NONE ) #ifdef OP_USE_INTERNALS , m_uiCountInternalInt( 0 ) , m_uiCountInternalUInt( 0 ) , m_uiCountInternalFlt( 0 ) , m_pptPtrInternalInt( 0 ) , m_pptPtrInternalUInt( 0 ) , m_pptPtrInternalFlt( 0 ) #endif // OP_USE_INTERNALS #ifdef OP_USE_RUNTIME_INFO , m_oStrNameInstance( "" ) , m_oArrStrNameIn( uiCountIn ) , m_oArrStrNameOut( uiCountOut ) , m_oArrStrInfoIn( uiCountIn ) , m_oArrStrInfoOut( uiCountOut ) #ifdef OP_USE_ROUTINES // Spezialfall. , m_oArrStrNameRoutine() , m_oArrStrInfoRoutine() #endif // OP_USE_ROUTINES #endif // OP_USE_RUNTIME_INFO #ifdef OP_USE_USER_DATA , m_pvData( 0 ) #endif // OP_USE_USER_DATA { ++m_uiIDMax_; InitInputs( uiCountIn ); InitOutputs( uiCountOut ); }