本文整理汇总了C++中Fvector2::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Fvector2::set方法的具体用法?C++ Fvector2::set怎么用?C++ Fvector2::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fvector2
的用法示例。
在下文中一共展示了Fvector2::set方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitHeader
void CServerList::InitHeader()
{
Fvector2 pos;
pos.set (0,0);
m_header[0].SetWidth (m_itemInfo.size.icon);
pos.x += m_itemInfo.size.icon;
m_header[1].SetWidth (m_itemInfo.size.server);
m_header[1].SetWndPos (pos);
m_header[1].TextItemControl()->SetTextST ("server name");
pos.x += m_itemInfo.size.server;
m_header[2].SetWidth (m_itemInfo.size.map);
m_header[2].SetWndPos (pos);
m_header[2].TextItemControl()->SetTextST ("map");
pos.x += m_itemInfo.size.map;
m_header[3].SetWidth (m_itemInfo.size.game);
m_header[3].SetWndPos (pos);
m_header[3].TextItemControl()->SetTextST ("game type");
pos.x += m_itemInfo.size.game;
m_header[4].SetWidth (m_itemInfo.size.players);
m_header[4].SetWndPos (pos);
m_header[4].TextItemControl()->SetTextST ("players");
pos.x += m_itemInfo.size.players;
m_header[5].SetWidth (m_itemInfo.size.ping);
m_header[5].SetWndPos (pos);
m_header[5].TextItemControl()->SetTextST ("ping");
pos.x += m_itemInfo.size.ping;
m_header[6].SetWidth (m_itemInfo.size.version);
m_header[6].SetWndPos (pos);
m_header[6].TextItemControl()->SetTextST ("version");
for(int i=0; i<LST_COLUMN_COUNT;++i)
{
m_header_frames[i].SetWndPos (m_header[i].GetWndPos());
m_header_frames[i].SetWidth (m_header[i].GetWndSize().x);
m_header_frames[i].Enable (true);
m_header_frames[i].Show (true);
m_header_frames[i].SetVisible (true);
}
}
示例2: SetActivePoint
// try to positioning clipRect center to vNewPoint
void CUICustomMap::SetActivePoint(const Fvector &vNewPoint)
{
Fvector2 pos;
pos.set(vNewPoint.x,vNewPoint.z);
Frect bound = BoundRect();
if( FALSE==bound.in(pos) )return;
Fvector2 pos_on_map = ConvertRealToLocalNoTransform(pos);
Frect map_abs_rect;
GetAbsoluteRect(map_abs_rect);
Fvector2 pos_abs;
pos_abs.set(map_abs_rect.lt);
pos_abs.add(pos_on_map);
Frect clip_abs_rect = GetClipperRect();
Fvector2 clip_center;
clip_abs_rect.getcenter(clip_center);
clip_center.sub(pos_abs);
MoveWndDelta (clip_center);
SetHeadingPivot (pos_on_map, Fvector2().set(0,0), false);
}
示例3: Update
void CUICellItem::Update()
{
EnableHeading(m_pParentList->GetVerticalPlacement());
if(Heading())
{
SetHeading ( 90.0f * (PI/180.0f) );
SetHeadingPivot (Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true);
}else
ResetHeadingPivot ();
inherited::Update();
if ( CursorOverWindow() )
{
Frect clientArea;
m_pParentList->GetClientArea(clientArea);
Fvector2 cp = GetUICursor().GetCursorPosition();
if(clientArea.in(cp))
GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_FOCUSED_UPDATE, NULL);
}
PIItem item = (PIItem)m_pData;
if ( item )
{
m_has_upgrade = item->has_any_upgrades();
// Fvector2 size = GetWndSize();
// Fvector2 up_size = m_upgrade->GetWndSize();
// pos.x = size.x - up_size.x - 4.0f;
Fvector2 pos;
pos.set( m_upgrade_pos );
if ( ChildsCount() )
{
pos.x += m_text->GetWndSize().x + 2.0f;
}
m_upgrade->SetWndPos( pos );
}
m_upgrade->Show( m_has_upgrade );
}
示例4: GetPointerTo
//position and heading for drawing pointer to src pos
bool CUICustomMap::GetPointerTo(const Fvector2& src, float item_radius, Fvector2& pos, float& heading)
{
Frect clip_rect_abs = GetClipperRect(); //absolute rect coords
Frect map_rect_abs;
GetAbsoluteRect(map_rect_abs);
Frect rect;
BOOL res = rect.intersection(clip_rect_abs, map_rect_abs);
if(!res) return false;
rect = clip_rect_abs;
rect.sub(map_rect_abs.lt.x,map_rect_abs.lt.y);
Fbox2 f_clip_rect_local;
f_clip_rect_local.set(rect.x1, rect.y1, rect.x2, rect.y2 );
Fvector2 f_center;
f_clip_rect_local.getcenter(f_center);
Fvector2 f_dir, f_src;
f_src.set(src.x, src.y );
f_dir.sub(f_center, f_src );
f_dir.normalize_safe();
Fvector2 f_intersect_point;
res = f_clip_rect_local.Pick2(f_src,f_dir,f_intersect_point);
VERIFY(res);
heading = -f_dir.getH();
f_intersect_point.mad(f_intersect_point,f_dir,item_radius );
pos.set( iFloor(f_intersect_point.x), iFloor(f_intersect_point.y) );
return true;
}
示例5: RearrangeTabButtons
void RearrangeTabButtons(CUITabControl* pTab)
{
TABS_VECTOR * btn_vec = pTab->GetButtonsVector();
TABS_VECTOR::iterator it = btn_vec->begin();
TABS_VECTOR::iterator it_e = btn_vec->end();
Fvector2 pos;
pos.set ((*it)->GetWndPos());
float size_x;
for ( ; it != it_e; ++it )
{
(*it)->SetWndPos (pos);
(*it)->AdjustWidthToText();
size_x = (*it)->GetWndSize().x + 30.0f;
(*it)->SetWidth (size_x);
pos.x += size_x - 6.0f;
}
pTab->SetWidth( pos.x + 5.0f );
pos.x = pTab->GetWndPos().x - pos.x;
pos.y = pTab->GetWndPos().y;
pTab->SetWndPos( pos );
}
示例6: Render
void CUICustomItem::Render(FVF::TL*& Pointer, const Fvector2& pos_ns, u32 color, float angle)
{
//. angle = -0.3f;
CTexture* T = RCache.get_ActiveTexture(0);
Fvector2 ts;
Fvector2 hp;
ts.set (float(T->get_Width()),float(T->get_Height()));
hp.set (0.5f/ts.x,0.5f/ts.y);
if (!(uFlags&flValidRect)) SetRect (0,0,ts.x,ts.y);
if (!(uFlags&flValidOriginalRect)){
iOriginalRect.set(0,0,ts.x,ts.y);
uFlags |= flValidOriginalRect;
}
Fvector2 pivot,offset,SZ;
SZ.set (iVisRect.rb);
// UI()->ClientToScreenScaled (SZ, iVisRect.x2, iVisRect.y2);
float cosA = _cos(angle);
float sinA = _sin(angle);
// Rotation
if(!(uFlags&flValidHeadingPivot)) pivot.set(iVisRect.x2/2.f, iVisRect.y2/2.f);
else pivot.set(iHeadingPivot.x, iHeadingPivot.y);
//. UI()->ClientToScreenScaled (pivot, pivot.x, pivot.y);
pivot.set (pivot);
offset.set (pos_ns);
Fvector2 LTt,RBt;
LTt.set (iOriginalRect.x1/ts.x+hp.x, iOriginalRect.y1/ts.y+hp.y);
RBt.set (iOriginalRect.x2/ts.x+hp.x, iOriginalRect.y2/ts.y+hp.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);
// LT
S[0].set (0.f,0.f,LTt.x,LTt.y);
S[0].rotate_pt (pivot,cosA,sinA);
S[0].pt.add (offset);
// RT
S[1].set (SZ.x,0.f,RBt.x,LTt.y);
S[1].rotate_pt (pivot,cosA,sinA);
S[1].pt.add (offset);
// RB
S[2].set (SZ.x,SZ.y,RBt.x,RBt.y);
S[2].rotate_pt (pivot,cosA,sinA);
S[2].pt.add (offset);
// LB
S[3].set (0.f,SZ.y,LTt.x,RBt.y);
S[3].rotate_pt (pivot,cosA,sinA);
S[3].pt.add (offset);
sPoly2D D;
sPoly2D* R = UI()->ScreenFrustum().ClipPoly(S,D);
if (R&&R->size())
for (u32 k=0; k<R->size(); k++,Pointer++)
{
Fvector2 _pt;
UI()->ClientToScreenScaled (_pt, (*R)[k].pt.x, (*R)[k].pt.y);
Pointer->set (_pt.x, _pt.y, color, (*R)[k].uv.x, (*R)[k].uv.y);
}
}
示例7: Init
void CUIFactionWarWnd::Init()
{
CUIXml xml;
xml.Load( CONFIG_PATH, UI_PATH, PDA_FACTION_WAR_XML );
CUIXmlInit::InitWindow( xml, "main_wnd", 0, this );
m_background = UIHelper::CreateFrameLine( xml, "background", this );
m_center_background = UIHelper::CreateStatic( xml, "center_background", this );
m_target_static = UIHelper::CreateStatic( xml, "target_static", this );
m_target_caption = UIHelper::CreateStatic( xml, "target_caption", this );
//m_target_caption->SetElipsis( 1, 0 );
m_tc_pos = m_target_caption->GetWndPos();
m_target_desc = UIHelper::CreateStatic( xml, "target_decs", this );
m_td_pos = m_target_desc->GetWndPos();
m_state_static = UIHelper::CreateStatic( xml, "state_static", this );
m_our_icon = UIHelper::CreateStatic( xml, "static_our_icon", this );
m_our_icon_over = UIHelper::CreateStatic( xml, "static_our_icon_over", this );
m_our_name = UIHelper::CreateStatic( xml, "static_our_name", this );
m_st_our_frac_info = UIHelper::CreateStatic( xml, "static_our_frac_info", this );
m_st_our_mem_count = UIHelper::CreateStatic( xml, "static_our_mem_count", this );
m_st_our_resource = UIHelper::CreateStatic( xml, "static_our_resource", this );
m_pb_our_state = UIHelper::CreateProgressBar( xml, "progress_our_state", this );
m_pb_our_mem_count = UIHelper::CreateProgressBar( xml, "progress_our_mem_count", this );
m_pb_our_resource = UIHelper::CreateProgressBar( xml, "progress_our_resource", this );
m_enemy_icon = UIHelper::CreateStatic( xml, "static_enemy_icon", this );
m_enemy_icon_over = UIHelper::CreateStatic( xml, "static_enemy_icon_over", this );
m_enemy_name = UIHelper::CreateStatic( xml, "static_enemy_name", this );
m_st_enemy_frac_info = UIHelper::CreateStatic( xml, "static_enemy_frac_info", this );
m_st_enemy_mem_count = UIHelper::CreateStatic( xml, "static_enemy_mem_count", this );
m_st_enemy_resource = UIHelper::CreateStatic( xml, "static_enemy_resource", this );
m_pb_enemy_state = UIHelper::CreateProgressBar( xml, "progress_enemy_state", this );
m_pb_enemy_mem_count = UIHelper::CreateProgressBar( xml, "progress_enemy_mem_count", this );
m_pb_enemy_resource = UIHelper::CreateProgressBar( xml, "progress_enemy_resource", this );
m_static_line1 = UIHelper::CreateFrameLine( xml, "static_line1", this );
m_static_line2 = UIHelper::CreateFrameLine( xml, "static_line2", this );
m_static_line3 = UIHelper::CreateFrameLine( xml, "static_line3", this );
m_static_line4 = UIHelper::CreateFrameLine( xml, "static_line4", this );
m_static_line_left = UIHelper::CreateFrameLine( xml, "static_line_left", this );
m_static_line_right = UIHelper::CreateFrameLine( xml, "static_line_right", this );
VERIFY( hint_wnd );
m_war_states_parent = new CUIWindow();
m_war_states_parent->SetAutoDelete( true );
AttachChild( m_war_states_parent );
Fvector2 pos;
pos.x = xml.ReadAttribFlt( "static_vs_state", 0, "x" );
pos.y = xml.ReadAttribFlt( "static_vs_state", 0, "y" );
m_war_states_parent->SetWndPos( pos );
for ( u8 i = 0; i < max_war_state; ++i )
{
m_war_state[i] = new UIWarState();
m_war_state[i]->InitXML( xml, "static_vs_state", m_war_states_parent );
m_war_state[i]->set_hint_wnd( hint_wnd );
}
float dx = xml.ReadAttribFlt( "static_vs_state", 0, "dx" );
m_war_states_dx = dx;
m_war_states_xcenter = xml.ReadAttribFlt( "static_vs_state", 0, "xcenter", 511.0f );
pos.set( 0.0f, 0.0f );
m_war_state[0]->SetWndPos( pos );
for ( u8 i = 1; i < max_war_state; ++i )
{
pos.x += m_war_state[i-1]->GetWndSize().x + dx;
m_war_state[i]->SetWndPos( pos );
}
for ( u8 i = 0; i < max_bonuce; ++i )
{
m_our_bonuces[i] = UIHelper::CreateStatic( xml, "static_our_bonuce", this );
}
dx = xml.ReadAttribFlt( "static_our_bonuce", 0, "dx" );
pos = m_our_bonuces[0]->GetWndPos();
for ( u8 i = 1; i < max_bonuce; ++i )
{
pos.x += m_our_bonuces[i-1]->GetWndSize().x + dx;
m_our_bonuces[i]->SetWndPos( pos );
}
for ( u8 i = 0; i < max_bonuce; ++i )
{
m_enemy_bonuces[i] = UIHelper::CreateStatic( xml, "static_enemy_bonuce", this );
}
dx = xml.ReadAttribFlt( "static_enemy_bonuce", 0, "dx" );
pos = m_enemy_bonuces[0]->GetWndPos();
for ( u8 i = 1; i < max_bonuce; ++i )
{
pos.x += m_enemy_bonuces[i-1]->GetWndSize().x + dx;
m_enemy_bonuces[i]->SetWndPos( pos );
//.........这里部分代码省略.........
示例8: GetActiveTextureResolution
void dxUIRender::GetActiveTextureResolution(Fvector2 &res)
{
CTexture* T = RCache.get_ActiveTexture(0);
res.set (float(T->get_Width()),float(T->get_Height()));
}
示例9: float
void CDeflector::L_Direct (CDB::COLLIDER* DB, base_lighting* LightsSelected, HASH& H)
{
R_ASSERT (DB);
R_ASSERT (LightsSelected);
lm_layer& lm = layer;
// Setup variables
Fvector2 dim,half;
dim.set (float(lm.width),float(lm.height));
half.set (.5f/dim.x,.5f/dim.y);
// Jitter data
Fvector2 JS;
JS.set (.4999f/dim.x, .4999f/dim.y);
u32 Jcount;
Fvector2* Jitter;
Jitter_Select(Jitter, Jcount);
// Lighting itself
DB->ray_options (0);
for (u32 V=0; V<lm.height; V++) {
for (u32 U=0; U<lm.width; U++) {
u32 Fcount = 0;
base_color_c C;
try {
for (u32 J=0; J<Jcount; J++)
{
// LUMEL space
Fvector2 P;
P.x = float(U)/dim.x + half.x + Jitter[J].x * JS.x;
P.y = float(V)/dim.y + half.y + Jitter[J].y * JS.y;
xr_vector<UVtri*>& space = H.query(P.x,P.y);
// World space
Fvector wP,wN,B;
for (UVtri** it=&*space.begin(); it!=&*space.end(); it++)
{
if ((*it)->isInside(P,B)) {
// We found triangle and have barycentric coords
Face *F = (*it)->owner;
Vertex *V1 = F->v[0];
Vertex *V2 = F->v[1];
Vertex *V3 = F->v[2];
wP.from_bary(V1->P,V2->P,V3->P,B);
//. не нужно использовать if (F->Shader().flags.bLIGHT_Sharp) { wN.set(F->N); }
// else
{
wN.from_bary(V1->N,V2->N,V3->N,B); exact_normalize (wN);
wN.add (F->N); exact_normalize (wN);
}
try {
LightPoint (DB, RCAST_Model, C, wP, wN, *LightsSelected, (b_norgb?LP_dont_rgb:0)|(b_nosun?LP_dont_sun:0)|LP_UseFaceDisable, F); //.
Fcount += 1;
} catch (...) {
clMsg("* ERROR (CDB). Recovered. ");
}
break;
}
}
}
} catch (...) {
clMsg("* ERROR (Light). Recovered. ");
}
if (Fcount) {
C.scale (Fcount);
C.mul (.5f);
lm.surface [V*lm.width+U]._set(C);
lm.marker [V*lm.width+U] = 255;
} else {
lm.surface [V*lm.width+U]._set(C); // 0-0-0-0-0
lm.marker [V*lm.width+U] = 0;
}
}
}
// *** Render Edges
float texel_size = (1.f/float(_max(lm.width,lm.height)))/8.f;
for (u32 t=0; t<UVpolys.size(); t++)
{
UVtri& T = UVpolys[t];
Face* F = T.owner;
R_ASSERT (F);
try {
L_Direct_Edge (DB,LightsSelected, T.uv[0], T.uv[1], F->v[0]->P, F->v[1]->P, F->N, texel_size,F);
L_Direct_Edge (DB,LightsSelected, T.uv[1], T.uv[2], F->v[1]->P, F->v[2]->P, F->N, texel_size,F);
L_Direct_Edge (DB,LightsSelected, T.uv[2], T.uv[0], F->v[2]->P, F->v[0]->P, F->N, texel_size,F);
} catch (...)
{
clMsg("* ERROR (Edge). Recovered. ");
}
}
}
示例10: Render
void CUICustomItem::Render(const Fvector2& pos_ns, u32 color, float angle)
{
Fvector2 ts;
Fvector2 hp;
UIRender->GetActiveTextureResolution(ts);
hp.set (0.5f/ts.x,0.5f/ts.y);
if ( !uFlags.test(flValidRect) )
SetRect (0,0,ts.x,ts.y);
if (!uFlags.test(flValidOriginalRect) )
{
iOriginalRect.set(0,0,ts.x,ts.y);
uFlags.set(flValidOriginalRect,TRUE);
}
Fvector2 pivot,offset,SZ;
SZ.set (iVisRect.rb);
float cosA = _cos(angle);
float sinA = _sin(angle);
// Rotation
if( !uFlags.test(flValidHeadingPivot) )
pivot.set(iVisRect.x2/2.f, iVisRect.y2/2.f);
else
pivot.set(iHeadingPivot.x, iHeadingPivot.y);
pivot.set (pivot);
offset.set (pos_ns);
offset.add (iHeadingOffset);
Fvector2 LTt,RBt;
LTt.set (iOriginalRect.x1/ts.x+hp.x, iOriginalRect.y1/ts.y+hp.y);
RBt.set (iOriginalRect.x2/ts.x+hp.x, iOriginalRect.y2/ts.y+hp.y);
float kx = (UI()->is_16_9_mode())?0.8333f:1.0f;
// clip poly
sPoly2D S;
S.resize (4);
// LT
S[0].set (0.f,0.f,LTt.x,LTt.y);
S[0].rotate_pt (pivot,cosA,sinA,kx);
S[0].pt.add (offset);
// RT
S[1].set (SZ.x,0.f,RBt.x,LTt.y);
S[1].rotate_pt (pivot,cosA,sinA,kx);
S[1].pt.add (offset);
// RB
S[2].set (SZ.x,SZ.y,RBt.x,RBt.y);
S[2].rotate_pt (pivot,cosA,sinA,kx);
S[2].pt.add (offset);
// LB
S[3].set (0.f,SZ.y,LTt.x,RBt.y);
S[3].rotate_pt (pivot,cosA,sinA,kx);
S[3].pt.add (offset);
for(int i=0; i<4;++i)
UI()->ClientToScreenScaled (S[i].pt);
sPoly2D D;
sPoly2D* R = UI()->ScreenFrustum().ClipPoly(S,D);
if (R&&R->size()){
for (u32 k=0; k<R->size()-2; k++)
{
UIRender->PushPoint((*R)[0+0].pt.x, (*R)[0+0].pt.y, 0, color, (*R)[0+0].uv.x, (*R)[0+0].uv.y);
UIRender->PushPoint((*R)[k+1].pt.x, (*R)[k+1].pt.y, 0, color, (*R)[k+1].uv.x, (*R)[k+1].uv.y);
UIRender->PushPoint((*R)[k+2].pt.x, (*R)[k+2].pt.y, 0, color, (*R)[k+2].uv.x, (*R)[k+2].uv.y);
}
}
/* this is tri-fan drawing
if (R&&R->size())
for (u32 k=0; k<R->size(); k++)
{
UIRender->PushPoint((*R)[k].pt.x, (*R)[k].pt.y, 0, color, (*R)[k].uv.x, (*R)[k].uv.y);
}
*/
}
示例11: UpdateSpot
//.........这里部分代码省略.........
m_position_on_map = map->ConvertRealToLocal(position, true); //for drawing
sp->SetWndPos (m_position_on_map);
}
if(b_pointer)
UpdateSpotPointer( map, GetSpotPointer(sp) );
}
else if ( Level().name() == map->MapName() && GetSpotPointer(sp) )
{
GameGraph::_GRAPH_ID dest_graph_id;
dest_graph_id = m_owner_se_object->m_tGraphID;
map_point_path.clear();
VERIFY( Actor() );
GraphEngineSpace::CGameVertexParams params(Actor()->locations().vertex_types(),flt_max);
bool res = ai().graph_engine().search(
ai().game_graph(),
Actor()->ai_location().game_vertex_id(),
dest_graph_id,
&map_point_path,
params
);
if ( res )
{
xr_vector<u32>::reverse_iterator it = map_point_path.rbegin();
xr_vector<u32>::reverse_iterator it_e = map_point_path.rend();
xr_vector<CLevelChanger*>::iterator lit = g_lchangers.begin();
//xr_vector<CLevelChanger*>::iterator lit_e = g_lchangers.end();
bool bDone = false;
//for(; (it!=it_e)&&(!bDone) ;++it){
// for(lit=g_lchangers.begin();lit!=lit_e; ++lit){
// if((*it)==(*lit)->ai_location().game_vertex_id() )
// {
// bDone = true;
// break;
// }
// }
//}
static bool bbb = false;
if(!bDone&&bbb)
{
Msg("! Error. Path from actor to selected map spot does not contain level changer :(");
Msg("Path:");
xr_vector<u32>::iterator it = map_point_path.begin();
xr_vector<u32>::iterator it_e = map_point_path.end();
for(; it!=it_e;++it){
// Msg("%d-%s",(*it),ai().game_graph().vertex(*it));
Msg("[%d] level[%s]",(*it),*ai().game_graph().header().level(ai().game_graph().vertex(*it)->level_id()).name());
}
Msg("- Available LevelChangers:");
xr_vector<CLevelChanger*>::iterator lit,lit_e;
lit_e = g_lchangers.end();
for(lit=g_lchangers.begin();lit!=lit_e; ++lit){
GameGraph::_GRAPH_ID gid = (*lit)->ai_location().game_vertex_id();
Msg("[%d]",gid);
Fvector p = ai().game_graph().vertex(gid)->level_point();
Msg("lch_name=%s pos=%f %f %f",*ai().game_graph().header().level(ai().game_graph().vertex(gid)->level_id()).name(), p.x, p.y, p.z);
}
};
if(bDone)
{
Fvector2 position;
position.set ((*lit)->Position().x, (*lit)->Position().z);
m_position_on_map = map->ConvertRealToLocal(position, false);
UpdateSpotPointer (map, GetSpotPointer(sp));
}
else
{
xr_vector<u32>::reverse_iterator it = map_point_path.rbegin();
xr_vector<u32>::reverse_iterator it_e = map_point_path.rend();
for(; (it!=it_e)&&(!bDone) ;++it)
{
if(*ai().game_graph().header().level(ai().game_graph().vertex(*it)->level_id()).name()==Level().name())
break;
}
if(it!=it_e)
{
Fvector p = ai().game_graph().vertex(*it)->level_point();
if(Actor()->Position().distance_to_sqr(p)>45.0f*45.0f)
{
Fvector2 position;
position.set (p.x, p.z);
m_position_on_map = map->ConvertRealToLocal(position, false);
UpdateSpotPointer (map, GetSpotPointer(sp));
}
}
}
}
}
}
示例12: ClientToScreenScaled
void ui_core::ClientToScreenScaled(Fvector2& src_and_dest)
{
src_and_dest.set(ClientToScreenScaledX(src_and_dest.x), ClientToScreenScaledY(src_and_dest.y));
}
示例13: catch
void OGF::MakeProgressive (float metric_limit)
{
// test
// there is no-sense to simplify small models
// for batch size 50,100,200 - we are CPU-limited anyway even on nv30
// for nv40 and up the better guess will probably be around 500
if (faces.size()<c_PM_FaceLimit) return ;
//. AlexMX added for draft build mode
if (g_params.m_quality==ebqDraft) return ;
progressive_cs.Enter ();
//////////////////////////////////////////////////////////////////////////
// NORMAL
vecOGF_V _saved_vertices = vertices ;
vecOGF_F _saved_faces = faces ;
{
// prepare progressive geom
VIPM_Init ();
//clMsg("--- append v start .");
for (u32 v_idx=0; v_idx<vertices.size(); v_idx++)
VIPM_AppendVertex (vertices[v_idx].P, vertices[v_idx].UV[0] );
//clMsg("--- append f start .");
for (u32 f_idx=0; f_idx<faces.size(); f_idx++)
VIPM_AppendFace (faces[f_idx].v[0], faces[f_idx].v[1], faces[f_idx].v[2] );
//clMsg("--- append end.");
// Convert
VIPM_Result* VR = 0;
try {
VR = VIPM_Convert (u32(25),1.f,1);
} catch (...) {
progressive_clear () ;
clMsg ("* mesh simplification failed: access violation");
}
if (0==VR) {
progressive_clear () ;
clMsg ("* mesh simplification failed");
}
while (VR && VR->swr_records.size()>0) {
// test metric
u32 _full = vertices.size () ;
u32 _remove = VR->swr_records.size() ;
u32 _simple = _full - _remove ;
float _metric = float(_remove)/float(_full);
if (_metric<metric_limit) {
progressive_clear () ;
clMsg ("* mesh simplified from [%4dv] to [%4dv], nf[%4d] ==> em[%0.2f]-discarded",_full,_simple,VR->indices.size()/3,metric_limit);
break ;
} else {
clMsg ("* mesh simplified from [%4dv] to [%4dv], nf[%4d] ==> em[%0.2f]-accepted", _full,_simple,VR->indices.size()/3,metric_limit);
}
// OK
// Permute vertices
for(u32 i=0; i<vertices.size(); i++)
vertices[VR->permute_verts[i]]=_saved_vertices[i];
// Fill indices
faces.resize (VR->indices.size()/3);
for (u32 f_idx=0; f_idx<faces.size(); f_idx++){
faces[f_idx].v[0] = VR->indices[f_idx*3+0];
faces[f_idx].v[1] = VR->indices[f_idx*3+1];
faces[f_idx].v[2] = VR->indices[f_idx*3+2];
}
// Fill SWR
m_SWI.count = VR->swr_records.size();
m_SWI.sw = xr_alloc<FSlideWindow>(m_SWI.count);
for (u32 swr_idx=0; swr_idx!=m_SWI.count; swr_idx++){
FSlideWindow& dst = m_SWI.sw[swr_idx];
VIPM_SWR& src = VR->swr_records[swr_idx];
dst.num_tris = src.num_tris;
dst.num_verts = src.num_verts;
dst.offset = src.offset;
}
break ;
}
// cleanup
VIPM_Destroy ();
}
//////////////////////////////////////////////////////////////////////////
// FAST-PATH
if (progressive_test() && x_vertices.size() && x_faces.size())
{
// prepare progressive geom
VIPM_Init ();
Fvector2 zero; zero.set (0,0);
for (u32 v_idx=0; v_idx<x_vertices.size(); v_idx++) VIPM_AppendVertex (x_vertices[v_idx].P, zero );
for (u32 f_idx=0; f_idx<x_faces.size(); f_idx++) VIPM_AppendFace (x_faces[f_idx].v[0], x_faces[f_idx].v[1], x_faces[f_idx].v[2] );
VIPM_Result* VR = 0;
try {
VR = VIPM_Convert (u32(25),1.f,1);
} catch (...) {
faces = _saved_faces ;
vertices = _saved_vertices ;
//.........这里部分代码省略.........
示例14: Draw
void CUIProgressShape::Draw()
{
if(m_bText)
DrawText ();
UIRender->SetShader (*GetShader());
Fvector2 tsize;
UIRender->GetActiveTextureResolution(tsize);
UIRender->StartPrimitive (m_sectorCount*3,IUIRender::ptTriList, UI().m_currentPointType);
Frect pos_rect;
GetAbsoluteRect (pos_rect);
UI().ClientToScreenScaled (pos_rect.lt, pos_rect.x1, pos_rect.y1);
UI().ClientToScreenScaled (pos_rect.rb, pos_rect.x2, pos_rect.y2);
Fvector2 center_pos;
pos_rect.getcenter (center_pos);
Frect tex_rect = GetUIStaticItem().GetTextureRect();
tex_rect.lt.x /= tsize.x;
tex_rect.lt.y /= tsize.y;
tex_rect.rb.x /= tsize.x;
tex_rect.rb.y /= tsize.y;
Fvector2 center_tex;
tex_rect.getcenter (center_tex);
float radius_pos = pos_rect.width()/2.0f;
float radius_tex = tex_rect.width()/2.0f;
float curr_angle = m_angle_begin;
float sin_a = _sin(curr_angle);
float cos_a = _cos(curr_angle);
Fvector2 start_pos_pt, prev_pos_pt;
Fvector2 start_tex_pt, prev_tex_pt;
start_pos_pt.set (0.0f, -radius_pos);
prev_pos_pt = start_pos_pt;
start_tex_pt.set (0.0f, -radius_tex);
prev_tex_pt = start_tex_pt;
_make_rot_tex(prev_pos_pt, start_pos_pt.y, sin_a, cos_a);
_make_rot_tex(prev_tex_pt, start_tex_pt.y, sin_a, cos_a);
float angle_range = PI_MUL_2;
if ( m_bClockwise )
{
angle_range = -abs( m_angle_end - m_angle_begin );
}
else
{
angle_range = abs( m_angle_end - m_angle_begin );
}
for ( u32 i = 0; i < m_sectorCount; ++i )
{
float ffff = calc_color (i+1, m_sectorCount, m_stage, 1.0f, m_blend);
u32 color = color_argb_f (ffff,1.0f,1.0f,1.0f);
UIRender->PushPoint(center_pos.x, center_pos.y, 0, color, center_tex.x, center_tex.y);
Fvector2 tp;
tp.set (prev_pos_pt);
tp.add (center_pos);
Fvector2 tx;
tx.set (prev_tex_pt);
tx.add (center_tex);
Fvector2 tp1;
Fvector2 tx1;
tp1.set(tp);
tx1.set(tx);
curr_angle += angle_range/float(m_sectorCount);
sin_a = _sin(curr_angle);
cos_a = _cos(curr_angle);
_make_rot_tex(prev_pos_pt, start_pos_pt.y, sin_a, cos_a);
_make_rot_tex(prev_tex_pt, start_tex_pt.y, sin_a, cos_a);
tp.set (prev_pos_pt);
tp.add (center_pos);
tx.set (prev_tex_pt);
tx.add (center_tex);
if (m_bClockwise)
{
UIRender->PushPoint(tp1.x, tp1.y, 0, color, tx1.x, tx1.y);
UIRender->PushPoint(tp.x, tp.y, 0, color, tx.x, tx.y);
}
else
{
//.........这里部分代码省略.........