示例#1
0
文件: gkMesh.cpp 项目: Draion/Gamekit
	unsigned int getVertexIndex(gkSubMesh* sub, unsigned int index, const gkVertex& ref)
	{
		UTsize i = m_indexMap.find((int)index), fnd = UT_NPOS, size = sub->m_verts.size();

		if (i != UT_NPOS)
		{
			UTsize sp = m_indexMap.at(i);
			if (sp < size && vertEq(sub, sub->m_verts.at(sp), ref))
				fnd = sp;
		}

		if (fnd == UT_NPOS)
		{
			sub->m_bounds.merge(ref.co);
			sub->m_verts.push_back(ref);
			m_indexMap.insert((int)index, size);
			return (unsigned int)size;
		}

		return (unsigned int)fnd;
	}
示例#2
0
文件: main.m.cpp 项目: alsofly/itint5
bool process(
    const JobID id,
    int& index,
    const map<JobID, vector<JobID> > &deps, 
    vector<JobID> &result)
{
    JobIndex jobIndex(index, index);
    indexMap.insert(make_pair(id, jobIndex));
    ++index;
    st.push(id);
    st_set.insert(id);
    
    map<JobID, vector<JobID> >::const_iterator jobIt = deps.find(id);
    if ( jobIt != deps.end() )
    {
        for ( int i = 0, len = jobIt->second.size(); i < len; ++i )
        {
            JobID currId = (jobIt->second)[i];
            IndexMapIt mapIt = indexMap.find(currId);
            if ( mapIt == indexMap.end() )
            {
                if ( !process(currId, index, deps, result) ) return false;
                
            }
            else if ( st_set.find(currId) != st_set.end() )
            {
                return false;
            }
        }
    }
    
    result.push_back(id);
    st.pop();
    st_set.erase(id);
    
    return true;
}