当前位置: 首页>>代码示例>>C++>>正文


C++ xr_vector::push_back方法代码示例

本文整理汇总了C++中xr_vector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::push_back方法的具体用法?C++ xr_vector::push_back怎么用?C++ xr_vector::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xr_vector的用法示例。


在下文中一共展示了xr_vector::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QuadFit

BOOL QuadFit(u32 Base, u32 Size)
{
	// ***** build horizontal line
	vecDW			BaseLine;
	BaseLine.reserve(Size);
	
	// middle
	vertex&			BaseNode = g_nodes[Base];
	BaseLine.push_back(Base);
	
	// right expansion
	for (; BaseLine.size()<Size; ) 
	{
		vertex&	B	= g_nodes[BaseLine.back()];
		u32	RP	= B.nRight();
		
		if (RP==InvalidNode)					break;
		if (used[RP])							break;
		if (!NodeSimilar(BaseNode,g_nodes[RP]))	break;
		
		BaseLine.push_back(RP);
	}
	if (BaseLine.size()<Size)	return FALSE;
	
	// down expansion
	BestQuad.clear	();
	BestQuad_Count	= 0;
	BestQuad.reserve		(Size);
	BestQuad.push_back		(BaseLine);
	
	for (; BestQuad.size() < Size;) {
		// create _new list
		BestQuad.push_back	(vecDW());
		vecDW&	src			= BestQuad[BestQuad.size()-2];
		vecDW&	dest		= BestQuad[BestQuad.size()-1];
		dest.reserve		(Size);
		
		// iterate on it
		vecDW_it I			= src.begin	();
		vecDW_it E			= src.end	();
		for (; I!=E; I++)
		{
			u32	id	= g_nodes[*I].nBack();
			if	(id==InvalidNode)						return FALSE;
			if	(used[id])								return FALSE;
			if	(!NodeSimilar(g_nodes[id],BaseNode))	return FALSE;
			dest.push_back	(id);
		}
	}
	return TRUE;
}
开发者ID:galek,项目名称:xray,代码行数:51,代码来源:compiler_merge.cpp

示例2:

void CDeflector::RemapUV	(xr_vector<UVtri>& dest, u32 base_u, u32 base_v, u32 size_u, u32 size_v, u32 lm_u, u32 lm_v, BOOL bRotate)
{
	dest.clear	();
	dest.reserve(UVpolys.size());
	
	// UV rect (actual)
	Fvector2		a_min,a_max,a_size;
	GetRect		(a_min,a_max);
	a_size.sub	(a_max,a_min);
	
	// UV rect (dedicated)
	Fvector2		d_min,d_max,d_size;
	d_min.x		= (float(base_u)+.5f)/float(lm_u);
	d_min.y		= (float(base_v)+.5f)/float(lm_v);
	d_max.x		= (float(base_u+size_u)-.5f)/float(lm_u);
	d_max.y		= (float(base_v+size_v)-.5f)/float(lm_v);
	if (d_min.x>=d_max.x)	{ d_min.x=d_max.x=(d_min.x+d_max.x)/2; d_min.x-=EPS_S; d_max.x+=EPS_S; }
	if (d_min.y>=d_max.y)	{ d_min.y=d_max.y=(d_min.y+d_max.y)/2; d_min.y-=EPS_S; d_max.y+=EPS_S; }
	d_size.sub	(d_max,d_min);
	
	// Remapping
	Fvector2		tc;
	UVtri		tnew;
	if (bRotate)	{
		for (UVIt it = UVpolys.begin(); it!=UVpolys.end(); it++)
		{
			UVtri&	T	= *it;
			tnew.owner	= T.owner;
			for (int i=0; i<3; i++) 
			{
				tc.x = ((T.uv[i].y-a_min.y)/a_size.y)*d_size.x + d_min.x;
				tc.y = ((T.uv[i].x-a_min.x)/a_size.x)*d_size.y + d_min.y;
				tnew.uv[i].set(tc);
			}
			dest.push_back	(tnew);
		}
	} else {
		for (UVIt it = UVpolys.begin(); it!=UVpolys.end(); it++)
		{
			UVtri&	T	= *it;
			tnew.owner	= T.owner;
			for (int i=0; i<3; i++) 
			{
				tc.x = ((T.uv[i].x-a_min.x)/a_size.x)*d_size.x + d_min.x;
				tc.y = ((T.uv[i].y-a_min.y)/a_size.y)*d_size.y + d_min.y;
				tnew.uv[i].set(tc);
			}
			dest.push_back	(tnew);
		}
	}
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:51,代码来源:xrDeflector.cpp

示例3:

template <class T> IC void CCar::fill_wheel_vector(LPCSTR S,xr_vector<T>& type_wheels)
{
	IKinematics* pKinematics	=smart_cast<IKinematics*>(Visual());
	string64					S1;
	int count =					_GetItemCount(S);
	for (int i=0 ;i<count; ++i) 
	{
		_GetItem					(S,i,S1);

		u16 bone_id	=				pKinematics->LL_BoneID(S1);

		type_wheels.push_back		(T());
		T& twheel				= type_wheels.back();


		BONE_P_PAIR_IT J		= bone_map.find(bone_id);
		if (J == bone_map.end()) 
		{
			bone_map.insert(mk_pair(bone_id,physicsBone()));


			SWheel& wheel			=	(m_wheels_map.insert(mk_pair(bone_id,SWheel(this)))).first->second;
			wheel.bone_id			=	bone_id;
			twheel.pwheel			=	&wheel;
			wheel						.Load(S1);
			twheel						.Load(S1);
		}
		else
		{
			twheel.pwheel			=	&(m_wheels_map.find(bone_id))->second;
			twheel						.Load(S1);
		}
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:34,代码来源:Car.cpp

示例4: mark_nodes_in_direction

float CLevelGraph::mark_nodes_in_direction(u32 start_vertex_id, const Fvector &start_point, const Fvector &finish_point, xr_vector<u32> &tpaStack, xr_vector<bool> *tpaMarks) const
{
	SContour				_contour;
	const_iterator			I,E;
	int						saved_index, iPrevIndex = -1, iNextNode;
	Fvector					temp_point = start_point;
	float					fDistance = start_point.distance_to(finish_point), fCurDistance = 0.f;
	u32						dwCurNode = start_vertex_id;

	while (!inside(vertex(dwCurNode),finish_point) && (fCurDistance < (fDistance + EPS_L))) {
		begin				(dwCurNode,I,E);
		saved_index			= -1;
		contour				(_contour,dwCurNode);
		for ( ; I != E; ++I) {
			iNextNode = value(dwCurNode,I);
			if (valid_vertex_id(iNextNode) && (iPrevIndex != iNextNode))
				choose_point(start_point,finish_point,_contour, iNextNode,temp_point,saved_index);
		}

		if (saved_index > -1) {
			fCurDistance	= start_point.distance_to_xz(temp_point);
			iPrevIndex		= dwCurNode;
			dwCurNode		= saved_index;
		}
		else
			return(fCurDistance);

		if (tpaMarks)
			(*tpaMarks)[dwCurNode]	= true;
		tpaStack.push_back	(dwCurNode);
	}

	return					(fCurDistance);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:34,代码来源:level_graph_vertex.cpp

示例5:

int	CompressSelected()
{
	if (g_selected.size()>1)
	{
		std::sort	(g_selected.begin(),g_selected.end());
		vecW_IT I = std::unique	(g_selected.begin(),g_selected.end());
		g_selected.erase(I,g_selected.end());
	}

	// Search placeholder
	u32 sz					= g_selected.size();
	u32 sz_bytes				= sz*sizeof(u16);
	treeCompressPair	Range	= g_compress_tree.equal_range(sz);

	for (treeCompressIt it=Range.first; it!=Range.second; it++)
	{
		treeCompressType	&V	= *it;
		u32	entry			= V.second;
		vecW	&entry_data		= g_pvs[entry];
		if (0!=memcmp(entry_data.begin(),g_selected.begin(),sz_bytes)) continue;

		// Ok-Ob :)
		return entry;
	}

	// If we get here - need to register _new set of data
	u32 entry = g_pvs.size();
	g_pvs.push_back(g_selected);
	g_compress_tree.insert(mk_pair(sz,entry));
	return entry;
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:31,代码来源:xrPVS.cpp

示例6:

u16		RegisterShader		(LPCSTR T) 
{
	for (u32 it=0; it<g_Shaders.size(); it++)
		if (0==stricmp(T,g_Shaders[it]))	return it;
	g_Shaders.push_back		(xr_strdup(T));
	return g_Shaders.size	()-1;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:xrSaveOGF.cpp

示例7: tele_find_objects

void CPolterTele::tele_find_objects(xr_vector<CObject*> &objects, const Fvector &pos) 
{
	m_nearest.clear_not_free		();
	Level().ObjectSpace.GetNearest	(m_nearest, pos, m_pmt_radius, NULL);

	for (u32 i=0;i<m_nearest.size();i++) {
		CPhysicsShellHolder *obj			= smart_cast<CPhysicsShellHolder *>(m_nearest[i]);
		CCustomMonster		*custom_monster	= smart_cast<CCustomMonster *>(m_nearest[i]);
		if (!obj || 
			!obj->PPhysicsShell() || 
			!obj->PPhysicsShell()->isActive()|| 
			custom_monster ||
			(obj->spawn_ini() && obj->spawn_ini()->section_exist("ph_heavy")) || 
			(obj->m_pPhysicsShell->getMass() < m_pmt_object_min_mass) || 
			(obj->m_pPhysicsShell->getMass() > m_pmt_object_max_mass) || 
			(obj == m_object) || 
			m_object->CTelekinesis::is_active_object(obj) || 
			!obj->m_pPhysicsShell->get_ApplyByGravity()) continue;

		
		Fvector center;
		Actor()->Center(center);
		
		if (trace_object(obj, center) || trace_object(obj, get_head_position(Actor())))
			objects.push_back(obj);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:27,代码来源:poltergeist_telekinesis.cpp

示例8: PlaceData

u32 PlaceData(xr_vector<vecW> &C, vecW &P)
{
	if (P.size()>1) {
		std::sort	(P.begin(),P.end());
		vecW::iterator I = std::unique	(P.begin(),P.end());
		P.erase(I,P.end());
	}

	// Search placeholder
	u32 sz	= P.size();
	u32 pos	= 0;
	for (xr_vector<vecW>::iterator it=C.begin(); it!=C.end(); it++)
	{
		u32 S = it->size();
		if (S!=sz) { pos+=S+1; continue; }
		if (0!=memcmp(it->begin(),P.begin(),S*sizeof(u16))) { pos+=S+1; continue; }

		// Ok-Ob :)
		goto exit;
	}

	// If we get here - need to register _new set of data
	C.push_back(P);

exit:
	P.clear();
	return pos*sizeof(u16);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:28,代码来源:xrVis.cpp

示例9: format_register

    void format_register(LPCSTR ext)
    {
    	if (ext&&ext[0]){
			for (u32 i=0; i<exts.size(); i++)
    			if (0==stricmp(exts[i],ext)) return;
    		exts.push_back(xr_strdup(ext));
        }
    }
开发者ID:NeoAnomaly,项目名称:xray,代码行数:8,代码来源:xrLoadSurface.cpp

示例10:

void fill_needed_levels	(LPSTR levels, xr_vector<LPCSTR> &result)
{
	LPSTR					I = levels;
	for (LPSTR J = I; ; ++I) {
		if (*I != ',') {
			if (*I)
				continue;

			result.push_back(J);
			break;
		}

		*I					= 0;
		result.push_back	(J);
		J					= I + 1;
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:17,代码来源:xr_graph_merge.cpp

示例11: if

void		sort_tlist_mat			
(
 xr_vector<mapMatrixTextures::TNode*,render_alloc<mapMatrixTextures::TNode*> >& lst,
 xr_vector<mapMatrixTextures::TNode*,render_alloc<mapMatrixTextures::TNode*> >& temp,
 mapMatrixTextures&					textures,
 BOOL	bSSA
 )
{
	int amount			= textures.begin()->key->size();
	if (bSSA)	
	{
		if (amount<=1)
		{
			// Just sort by SSA
			textures.getANY_P			(lst);
			std::sort					(lst.begin(), lst.end(), cmp_textures_ssa_mat);
		} 
		else 
		{
			// Split into 2 parts
			mapMatrixTextures::TNode* _it	= textures.begin	();
			mapMatrixTextures::TNode* _end	= textures.end		();
			for (; _it!=_end; _it++)	{
				if (_it->val.ssa > r_ssaHZBvsTEX)	lst.push_back	(_it);
				else								temp.push_back	(_it);
			}

			// 1st - part - SSA, 2nd - lexicographically
			std::sort					(lst.begin(),	lst.end(),	cmp_textures_ssa_mat);
			if (2==amount)				std::sort	(temp.begin(),	temp.end(),	cmp_textures_lex2_mat);
			else if (3==amount)			std::sort	(temp.begin(),	temp.end(),	cmp_textures_lex3_mat);
			else						std::sort	(temp.begin(),	temp.end(),	cmp_textures_lexN_mat);

			// merge lists
			lst.insert					(lst.end(),temp.begin(),temp.end());
		}
	}
	else 
	{
		textures.getANY_P			(lst);
		if (2==amount)				std::sort	(lst.begin(),	lst.end(),	cmp_textures_lex2_mat);
		else if (3==amount)			std::sort	(lst.begin(),	lst.end(),	cmp_textures_lex3_mat);
		else						std::sort	(lst.begin(),	lst.end(),	cmp_textures_lexN_mat);
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:45,代码来源:r__dsgraph_render.cpp

示例12:

CUIXml::CUIXml()
{
#ifdef LOG_ALL_XMLS
	ListXmlCount++;
	m_dbg_id = ListXmlCount;
	dbg_list_xmls.push_back(DBGList_());
	dbg_list_xmls.back().num		= m_dbg_id;
	dbg_list_xmls.back().closed		= false;
#endif
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:10,代码来源:xrUIXmlParser.cpp

示例13:

CUILine::CUILine(const CUILine& other){
	m_subLines = other.m_subLines;
	m_tmpLine = NULL;
#ifdef LOG_ALL_LINES
	ListLinesCount++;
	dbg_list_lines.push_back(DBGList());
	dbg_list_lines.back().wnd = this;
	dbg_list_lines.back().num = ListLinesCount;
#endif
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:10,代码来源:UILine.cpp

示例14: GetMapEntities

void game_cl_ArtefactHunt::GetMapEntities(xr_vector<SZoneMapEntityData>& dst)
{
	inherited::GetMapEntities(dst);

	SZoneMapEntityData D;
	u32 color_enemy_with_artefact		=		0xffff0000;
	u32 color_artefact					=		0xffffffff;
	u32 color_friend_with_artefact		=		0xffffff00;


	s16 local_team						=		local_player->team;


	CObject* pObject = Level().Objects.net_Find(artefactID);
	if(!pObject)
		return;

	CArtefact* pArtefact = smart_cast<CArtefact*>(pObject);
	VERIFY(pArtefact);

	CObject* pParent = pArtefact->H_Parent();
	if(!pParent){// Artefact alone
		D.color	= color_artefact;
		D.pos	= pArtefact->Position();
		dst.push_back(D);
		return;
	};

	if (pParent && pParent->ID() == artefactBearerID && GetPlayerByGameID(artefactBearerID)){
		CObject* pBearer = Level().Objects.net_Find(artefactBearerID);
		VERIFY(pBearer);
		D.pos	= pBearer->Position();

		game_PlayerState*	ps  =	GetPlayerByGameID		(artefactBearerID);
		(ps->team==local_team)? D.color=color_friend_with_artefact:D.color=color_enemy_with_artefact;
		
		//remove previous record about this actor !!!
		dst.push_back(D);
		return;
	}

}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:42,代码来源:game_cl_artefacthunt.cpp

示例15: construct_restriction_vector

void construct_restriction_vector(shared_str restrictions, xr_vector<ALife::_OBJECT_ID> &result)
{
	result.clear();
	string64	temp;
	u32			n = _GetItemCount(*restrictions);
	for (u32 i=0; i<n; ++i) {
		CObject	*object = Level().Objects.FindObjectByName(_GetItem(*restrictions,i,temp));
		if (!object)
			continue;
		result.push_back(object->ID());
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:12,代码来源:script_game_object_inventory_owner.cpp


注:本文中的xr_vector::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。