//---------------------------------------------------------------------------------------------------------------------- bool Vec2::operator!=(const Vec2& _v )const noexcept { return ( !FCompare(_v.m_x,m_x) || !FCompare(_v.m_y,m_y) ); }
//---------------------------------------------------------------------------------------------------------------------- bool Vec2::operator==(const Vec2& _v )const noexcept { return ( FCompare(_v.m_x,m_x) && FCompare(_v.m_y,m_y) ); }
//---------------------------------------------------------------------------------------------------------------------- bool Vec3::operator!=(const Vec3& _v )const { return ( !FCompare(_v.m_x,m_x) || !FCompare(_v.m_y,m_y) || !FCompare(_v.m_z,m_z) ); }
//---------------------------------------------------------------------------------------------------------------------- bool Vec3::operator==(const Vec3& _v )const { return ( FCompare(_v.m_x,m_x) && FCompare(_v.m_y,m_y) && FCompare(_v.m_z,m_z) ); }
//---------------------------------------------------------------------------------------------------------------------- void AbstractMesh::writeToRibSubdiv(RibExport& _ribFile )const noexcept { // Declare the variables std::list< int > lVertLink; std::list< int >::iterator vertLinkItr; std::vector< float > vVerts; std::vector< float >::iterator vertsItr; // Check if the rib exists if( _ribFile.isOpen() != 0 ) { _ribFile.comment( "OBJ AbstractMeshect" ); // Start printing the SubdivisionPolygons tag to the rib _ribFile.getStream() << "SubdivisionMesh \"catmull-clark\" [ "; // Loop through all the Polygons for (unsigned long int I=0; I<m_nVerts; ++I) { // Print the count of vertices for the current polygon to the rib _ribFile.getStream() << m_face[I].m_numVerts << " "; // Start building the vertids and parameterlist for (unsigned long int i = 0; i < m_face[I].m_numVerts; ++i) { // Set the verts vector size and testing variables int iVecSize = vVerts.size(); bool bTest = false; int counter = 0; // Loop through the expanding vector checking whether // the current vertice exists for (int j = 0; j < iVecSize; j = j + 3) { // If the vertice if found in the vector, set the test // flag and exit the loop. Else keep going. if( ( FCompare(m_verts[i].m_x ,vVerts[j]) ) && ( FCompare(m_verts[i].m_y,vVerts[j + 1]) ) && ( FCompare(m_verts[i].m_y,vVerts[j + 2]) ) ) { bTest = true; break; } else { counter++; } } //end for // Add the vertice to the vector if it is not found if( bTest == false ) { vVerts.push_back( m_verts[m_face[I].m_vert[i]].m_x ); vVerts.push_back( m_verts[m_face[I].m_vert[i]].m_y ); vVerts.push_back( m_verts[m_face[I].m_vert[i]].m_z ); lVertLink.push_back( counter ); } else { lVertLink.push_back( counter ); } }// end outer for }// end if _ribFile.getStream() << "] [ "; // Print the vertids to the rib std::list< int >::iterator vertLinkEnd=lVertLink.end(); for (vertLinkItr = lVertLink.begin(); vertLinkItr != vertLinkEnd; ++vertLinkItr) { _ribFile.getStream() << *vertLinkItr << " "; } _ribFile.getStream() << "] [\"interpolateboundary\"] [0 0] [] [] \"P\" [ "; // Print the parameterlist to the rib std::vector< float >::iterator vVertEnd=vVerts.end(); for (vertsItr = vVerts.begin(); vertsItr != vVertEnd; ++vertsItr) { _ribFile.getStream() << *vertsItr << " "; } // Print new lines to the rib _ribFile.getStream() << "]\n\n"; } }