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


C++ Fvector2类代码示例

本文整理汇总了C++中Fvector2的典型用法代码示例。如果您正苦于以下问题:C++ Fvector2类的具体用法?C++ Fvector2怎么用?C++ Fvector2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: calcSphereSector

IC int	calcSphereSector(Fvector& dir)
{
	Fvector2			flat;

	// flatten
	flat.set			(dir.x,dir.z);
	flat.norm			();

	// analyze
	if (_abs(flat.x)>_abs(flat.y))	{
		// sector 0,7,3,4
		if (flat.x<0)	{
			// sector 3,4
			if (flat.y>0)	return 3;
			else			return 4;
		} else {
			// sector 0,7
			if (flat.y>0)	return 0;
			else			return 7;
		}
	} else {
		// sector 1,2,6,5
		if (flat.x<0)	{
			// sector 2,5
			if (flat.y>0)	return 2;
			else			return 5;
		} else {
			// sector 1,6
			if (flat.y>0)	return 1;
			else			return 6;
		}
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:33,代码来源:compiler_cover.cpp

示例2: iCeil

void	CRenderTarget::u_calc_tc_noise		(Fvector2& p0, Fvector2& p1)
{
	CTexture*	T					= RCache.get_ActiveTexture	(2);
	VERIFY2		(T, "Texture #3 in noise shader should be setted up");
	u32			tw					= iCeil(float(T->get_Width	())*param_noise_scale+EPS_S);
	u32			th					= iCeil(float(T->get_Height ())*param_noise_scale+EPS_S);
	VERIFY2		(tw && th, "Noise scale can't be zero in any way");

	// calculate shift from FPSes
	im_noise_time					-= Device.fTimeDelta;
	if (im_noise_time<0)			{
		im_noise_shift_w			= ::Random.randI(tw?tw:1);
		im_noise_shift_h			= ::Random.randI(th?th:1);
		float	fps_time			= 1/param_noise_fps;
		while (im_noise_time<0)		im_noise_time += fps_time;
	}

	u32			shift_w				= im_noise_shift_w;
	u32			shift_h				= im_noise_shift_h;
	float		start_u				= (float(shift_w)+.5f)/(tw);
	float		start_v				= (float(shift_h)+.5f)/(th);
	u32			_w					= Device.dwWidth;
	u32			_h					= Device.dwHeight;
	u32			cnt_w				= _w / tw;
	u32			cnt_h				= _h / th;
	float		end_u				= start_u + float(cnt_w) + 1;
	float		end_v				= start_v + float(cnt_h) + 1;
 
	p0.set		(start_u,	start_v	);
	p1.set		(end_u,		end_v	);
}
开发者ID:2asoft,项目名称:xray-16,代码行数:31,代码来源:r3_rendertarget_phase_PP.cpp

示例3: UI

void CUIArtefactDetectorElite::Draw()
{

	Fmatrix						LM;
	GetUILocatorMatrix			(LM);

	IUIRender::ePointType bk	= UI().m_currentPointType;

	UI().m_currentPointType	= IUIRender::pttLIT;

	UIRender->CacheSetXformWorld(LM);
	UIRender->CacheSetCullMode	(IUIRender::cmNONE);

	CUIWindow::Draw				();

//.	Frect r						= m_wrk_area->GetWndRect();
	Fvector2 wrk_sz				= m_wrk_area->GetWndSize();
	Fvector2					rp; 
	m_wrk_area->GetAbsolutePos	(rp);

	Fmatrix						M, Mc;
	float h,p;
	Device.vCameraDirection.getHP(h,p);
	Mc.setHPB					(h,0,0);
	Mc.c.set					(Device.vCameraPosition);
	M.invert					(Mc);

	UI().ScreenFrustumLIT().CreateFromRect(Frect().set(	rp.x,
													rp.y,
													wrk_sz.x,
													wrk_sz.y ));

	xr_vector<SDrawOneItem>::const_iterator it	 = m_items_to_draw.begin();
	xr_vector<SDrawOneItem>::const_iterator it_e = m_items_to_draw.end();
	for(;it!=it_e;++it)
	{
		Fvector					p = (*it).pos;
		Fvector					pt3d;
		M.transform_tiny		(pt3d,p);
		float kz				= wrk_sz.y / m_parent->m_fAfDetectRadius;
		pt3d.x					*= kz;
		pt3d.z					*= kz;

		pt3d.x					+= wrk_sz.x/2.0f;	
		pt3d.z					-= wrk_sz.y;

		Fvector2				pos;
		pos.set					(pt3d.x, -pt3d.z);
		pos.sub					(rp);
		if(1 /* r.in(pos)*/ )
		{
			(*it).pStatic->SetWndPos	(pos);
			(*it).pStatic->Draw			();
		}
	}

	UI().m_currentPointType		= bk;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:58,代码来源:EliteDetector.cpp

示例4:

void S2DVert::rotate_pt(const Fvector2& pivot, float cosA, float sinA, float kx)
{
	Fvector2 t		= pt;
	t.sub			(pivot);
	pt.x			= t.x*cosA+t.y*sinA;
	pt.y			= t.y*cosA-t.x*sinA;
	pt.x			*= kx;
	pt.add			(pivot);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:ui_base.cpp

示例5: u32

u32	 CLevelGraph::check_position_in_direction_slow	(u32 start_vertex_id, const Fvector2 &start_position, const Fvector2 &finish_position) const
{
	if (!valid_vertex_position(v3d(finish_position)))
		return				(u32(-1));

	u32						cur_vertex_id = start_vertex_id, prev_vertex_id = u32(-1);
	Fbox2					box;
	Fvector2				identity, start, dest, dir;

	identity.x = identity.y	= header().cell_size()*.5f;
	start					= start_position;
	dest					= finish_position;
	dir.sub					(dest,start);
	u32						dest_xz = vertex_position(v3d(dest)).xz();
	Fvector2				temp;
	unpack_xz				(vertex(start_vertex_id),temp.x,temp.y);

	float					cur_sqr = _sqr(temp.x - dest.x) + _sqr(temp.y - dest.y);
	for (;;) {
		const_iterator		I,E;
		begin				(cur_vertex_id,I,E);
		bool				found = false;
		for ( ; I != E; ++I) {
			u32				next_vertex_id = value(cur_vertex_id,I);
			if ((next_vertex_id == prev_vertex_id) || !valid_vertex_id(next_vertex_id))
				continue;
			CVertex			*v = vertex(next_vertex_id);
			unpack_xz		(v,temp.x,temp.y);
			box.min			= box.max = temp;
			box.grow		(identity);
			if (box.pick_exact(start,dir)) {

				if (dest_xz == v->position().xz()) {
					return	(is_accessible(next_vertex_id) ? next_vertex_id : u32(-1));
				}
				Fvector2		temp;
				temp.add		(box.min,box.max);
				temp.mul		(.5f);
				float			dist = _sqr(temp.x - dest.x) + _sqr(temp.y - dest.y);
				if (dist > cur_sqr)
					continue;
				
				if (!is_accessible(next_vertex_id))
					return		(u32(-1));

				cur_sqr			= dist;
				found			= true;
				prev_vertex_id	= cur_vertex_id;
				cur_vertex_id	= next_vertex_id;
				break;
			}
		}
		if (!found) {
			return			(u32(-1));
		}
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:57,代码来源:level_graph_vertex.cpp

示例6: Draw

void CUIDragItem::Draw()
{
	Fvector2 tmp;
	tmp.sub					(GetWndPos(), GetUICursor().GetCursorPosition());
	tmp.sub					(m_pos_offset);
	tmp.mul					(-1.0f);
	MoveWndDelta			(tmp);
	inherited::Draw			();
	if(m_custom_draw) 
		m_custom_draw->OnDraw(this);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,代码来源:UICellItem.cpp

示例7: GetHeight

void CUIWeaponCellItem::InitAddon(CUIStatic* s, LPCSTR section, Fvector2 addon_offset, bool b_rotate)
{
	
		Frect					tex_rect;
		Fvector2				base_scale;

		if(Heading())
		{
			base_scale.x			= GetHeight()/(INV_GRID_WIDTHF*m_grid_size.x);
			base_scale.y			= GetWidth()/(INV_GRID_HEIGHTF*m_grid_size.y);
		}else
		{
			base_scale.x			= GetWidth()/(INV_GRID_WIDTHF*m_grid_size.x);
			base_scale.y			= GetHeight()/(INV_GRID_HEIGHTF*m_grid_size.y);
		}
		Fvector2				cell_size;
		cell_size.x				= pSettings->r_u32(section, "inv_grid_width")*INV_GRID_WIDTHF;
		cell_size.y				= pSettings->r_u32(section, "inv_grid_height")*INV_GRID_HEIGHTF;

		tex_rect.x1				= pSettings->r_u32(section, "inv_grid_x")*INV_GRID_WIDTHF;
		tex_rect.y1				= pSettings->r_u32(section, "inv_grid_y")*INV_GRID_HEIGHTF;

		tex_rect.rb.add			(tex_rect.lt,cell_size);

		cell_size.mul			(base_scale);

		if(b_rotate)
		{
			s->SetWndSize		(Fvector2().set(cell_size.y, cell_size.x) );
			Fvector2 new_offset;
			new_offset.x		= addon_offset.y*base_scale.x;
			new_offset.y		= GetHeight() - addon_offset.x*base_scale.x - cell_size.x;
			addon_offset		= new_offset;
		}else
		{
			s->SetWndSize		(cell_size);
			addon_offset.mul	(base_scale);
		}

		s->SetWndPos			(addon_offset);
		s->SetOriginalRect		(tex_rect);
		s->SetStretchTexture	(true);

		s->EnableHeading		(b_rotate);
		
		if(b_rotate)
		{
			s->SetHeading			(GetHeading());
			Fvector2 offs;
			offs.set				(0.0f, s->GetWndSize().y);
			s->SetHeadingPivot		(Fvector2().set(0.0f,0.0f), /*Fvector2().set(0.0f,0.0f)*/offs, true);
		}
}
开发者ID:2asoft,项目名称:xray,代码行数:53,代码来源:UICellCustomItems.cpp

示例8: UI

void CUIArtefactDetectorElite::Draw()
{
	Fmatrix						LM;
	GetUILocatorMatrix			(LM);

	IUIRender::ePointType bk	= UI()->m_currentPointType;

	UI()->m_currentPointType	= IUIRender::pttLIT;

	UIRender->CacheSetXformWorld(LM);
	UIRender->CacheSetCullMode	(IUIRender::cmNONE);

	CUIWindow::Draw				();

	Frect r						= m_wrk_area->GetWndRect();
	Fvector2					rp; 
	m_wrk_area->GetAbsolutePos	(rp);

	Fmatrix						M, Mc;
	float h,p;
	Device.vCameraDirection.getHP(h,p);
	Mc.setHPB					(h,0,0);
	Mc.c.set					(Device.vCameraPosition);
	M.invert					(Mc);

	xr_vector<Fvector>::const_iterator it	 = m_af_to_draw.begin();
	xr_vector<Fvector>::const_iterator it_e  = m_af_to_draw.end();
	for(;it!=it_e;++it)
	{
		Fvector					p = (*it);
		Fvector					pt3d;
		M.transform_tiny		(pt3d,p);
//		float kx				= m_wrk_area->GetWndSize().x / m_parent->m_fAfDetectRadius;
		float kz				= m_wrk_area->GetWndSize().y / m_parent->m_fAfDetectRadius;
		pt3d.x					*= kz;
		pt3d.z					*= kz;

		pt3d.x					+= m_wrk_area->GetWndSize().x/2.0f;	
		pt3d.z					-= m_wrk_area->GetWndSize().y;

		Fvector2				pos;
		pos.set					(pt3d.x, -pt3d.z);
		pos.sub					(rp);
		if( r.in(pos) )
		{
			m_af_sign->SetWndPos	(pos);
			m_af_sign->Draw			();
		}
	}

	UI()->m_currentPointType		= bk;
}
开发者ID:2asoft,项目名称:xray,代码行数:52,代码来源:EliteDetector.cpp

示例9:

void CDeflector::GetRect	(Fvector2 &min, Fvector2 &max)
{
	// Calculate bounds
	xr_vector<UVtri>::iterator it=UVpolys.begin();
	min = max = it->uv[0];
	for (;it != UVpolys.end(); it++)
	{
		for (int i=0; i<3; i++) {
			min.min(it->uv[i]);
			max.max(it->uv[i]);
		}
	}
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:13,代码来源:xrDeflector.cpp

示例10: Draw

void CUIDragItem::Draw()
{
	Fvector2 tmp;
	tmp.sub					(GetWndPos(), GetUICursor()->GetCursorPosition());
	tmp.sub					(m_pos_offset);
	tmp.mul					(-1.0f);
	MoveWndDelta			(tmp);
	UI()->PushScissor		(UI()->ScreenRect(),true);

	inherited::Draw();

	UI()->PopScissor();
}
开发者ID:Karlan88,项目名称:xray,代码行数:13,代码来源:UICellItem.cpp

示例11:

void CUIPdaWnd::DrawUpdatedSections				()
{
	m_updatedSectionImage->Update				();
	m_oldSectionImage->Update					();
	
	Fvector2									tab_pos;
	UITabControl->GetAbsolutePos				(tab_pos);

	Fvector2 pos;

	pos = m_sign_places_main[eptQuests];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::quests)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptMap];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::map)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptDiary];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::diary)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptContacts];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::contacts)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptRanking];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::ranking)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptActorStatistic];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::statistics)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);

	pos = m_sign_places_main[eptEncyclopedia];
	pos.add(tab_pos);
	if(g_pda_info_state&pda_section::encyclopedia)
		draw_sign								(m_updatedSectionImage, pos);
	else
		draw_sign								(m_oldSectionImage, pos);
	
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:60,代码来源:UIPdaWnd.cpp

示例12: Render

void CUICustomItem::Render(FVF::TL*& Pointer, const Fvector2& pos, u32 color, 
						   float x1, float y1, float x2, float y2)
{
	CTexture* T		= RCache.get_ActiveTexture(0);
	Fvector2		ts;
	ts.set			(float(T->get_Width()),float(T->get_Height()));
	
	if (!(uFlags&flValidRect)){
		SetRect		(0,0,ts.x,ts.y);
	}
	if (!(uFlags&flValidOriginalRect)){
		iOriginalRect.set(0,0,ts.x,ts.y);
		uFlags |= flValidOriginalRect;
	}

	Fvector2 LTp,RBp;
	Fvector2 LTt,RBt;
	//координаты на экране в пикселях
	UI()->ClientToScreenScaled	(LTp, x1,y1);
	LTp.add						(pos);

	UI()->ClientToScreenScaled	(RBp, x2,y2);
	RBp.add						(pos);

	//текстурные координаты
	LTt.set			( iOriginalRect.x1/ts.x, iOriginalRect.y1/ts.y);
	RBt.set			( iOriginalRect.x2/ts.x, iOriginalRect.y2/ts.y);

	// Check mirror mode
	if (tmMirrorHorisontal == eMirrorMode || tmMirrorBoth == eMirrorMode)	std::swap	(LTt.x,RBt.x);
	if (tmMirrorVertical == eMirrorMode || tmMirrorBoth == eMirrorMode)		std::swap	(LTt.y,RBt.y);
	// clip poly
	sPoly2D			S; S.resize(4);
	S[0].set		(LTp.x-0.5f,LTp.y-0.5f,	LTt.x,LTt.y);	// LT
	S[1].set		(RBp.x-0.5f,LTp.y-0.5f,	RBt.x,LTt.y);	// RT
	S[2].set		(RBp.x-0.5f,RBp.y-0.5f,	RBt.x,RBt.y);	// RB
	S[3].set		(LTp.x-0.5f,RBp.y-0.5f,	LTt.x,RBt.y);	// LB
	
	sPoly2D D;
//	const C2DFrustum& FF = UI()->ScreenFrustum();
	sPoly2D* R		= UI()->ScreenFrustum().ClipPoly(S,D);
//	sPoly2D* R		= &S;
	if (R&&R->size()){
		for (u32 k=0; k<R->size()-2; k++){
			Pointer->set	((*R)[0+0].pt.x, (*R)[0+0].pt.y,	color, (*R)[0+0].uv.x, (*R)[0+0].uv.y); Pointer++;
			Pointer->set	((*R)[k+1].pt.x, (*R)[k+1].pt.y,	color, (*R)[k+1].uv.x, (*R)[k+1].uv.y); Pointer++;
			Pointer->set	((*R)[k+2].pt.x, (*R)[k+2].pt.y,	color, (*R)[k+2].uv.x, (*R)[k+2].uv.y); Pointer++;
		}
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:50,代码来源:UICustomItem.cpp

示例13: InitInternal

void CUICursor::InitInternal()
{
	m_static					= xr_new<CUIStatic>();
	m_static->InitTextureEx		("ui\\ui_ani_cursor", "hud\\cursor");
	Frect						rect;
	rect.set					(0.0f,0.0f,40.0f,40.0f);
	m_static->SetOriginalRect	(rect);
	Fvector2					sz;
	sz.set						(rect.rb);
	if(UI()->is_16_9_mode())
		sz.x					/= 1.2f;

	m_static->SetWndSize		(sz);
	m_static->SetStretchTexture	(true);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:UICursor.cpp

示例14: ConvertRealToLocalNoTransform

Fvector2 CUICustomMap::ConvertRealToLocal  (const Fvector2& src)// meters->pixels (relatively own left-top pos)
{
	Fvector2 res;
	if( !Heading() ){
		return ConvertRealToLocalNoTransform(src);
	}else{
		Fvector2 heading_pivot = GetStaticItem()->GetHeadingPivot();
	
		res = ConvertRealToLocalNoTransform(src);
		res.sub(heading_pivot);
		rotation_(res.x, res.y, GetHeading(), res.x, res.y);
		res.add(heading_pivot);
		return res;
	};
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:UIMap.cpp

示例15: Draw

void CUILevelMap::Draw()
{
	if(MapWnd()){
		for(WINDOW_LIST_it it = m_ChildWndList.begin(); m_ChildWndList.end() != it; ++it)
		{
			CMapSpot* sp			= smart_cast<CMapSpot*>((*it));
			if(sp&&sp->m_bScale){
				Fvector2 sz			= sp->m_originSize;
				sz.mul				(MapWnd()->GlobalMap()->GetCurrentZoom());
				sp->SetWndSize		(sz);
			}
		}
	}
	inherited::Draw();

}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:16,代码来源:UIMap.cpp


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