本文整理汇总了C++中xr_vector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::clear方法的具体用法?C++ xr_vector::clear怎么用?C++ xr_vector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_vector
的用法示例。
在下文中一共展示了xr_vector::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void read( INetReader &r, CDB::MODEL &m )
{
verts.clear();
tris.clear();
r_pod_vector( r, verts );
u32 tris_count = r.r_u32();
tris.resize( tris_count );
for( u32 i = 0; i < tris_count; ++i)
::read( r, tris[i] );
m.build( &*verts.begin(), (int)verts.size(), &*tris.begin(), (int)tris.size() );
verts.clear();
tris.clear();
}
示例2: vec_spetial_clear
void vec_spetial_clear( xr_vector<T> &v )
{
typename xr_vector<T>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
clear(*i);
v.clear();
}
示例3: vec_clear
void vec_clear( xr_vector<T*> &v )
{
typename xr_vector<T*>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
xr_delete(*i);
v.clear();
}
示例4:
void CClientDlg::ClearHostList()
{
// Clean up Host _list_
net_csEnumeration.Enter ();
for (u32 i=0; i<net_Hosts.size(); i++) {
HOST_NODE& N = net_Hosts[i];
if (N.pHostAddress) N.pHostAddress->Release();
}
net_Hosts.clear ();
net_csEnumeration.Leave ();
};
示例5: 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());
}
}
示例6: restore_fixes
static void restore_fixes( )
{
struct refix {
void operator () (anim_bone_fix* fix)
{
fix->refix();
}
} rf;
std::for_each( saved_fixes.begin(), saved_fixes.end(), rf );
saved_fixes.clear();
}
示例7: GetGlobalData
bool GetGlobalData( IAgent* agent,
DWORD sessionId )
{
if(!inlc_global_data())
{
VERIFY( agent );
net_pool.clear();
/*
IGenericStream* globalDataStream=0;
HRESULT rz = agent->GetData(sessionId, dataDesc, &globalDataStream);
if (rz!=S_OK)
return false;
*/
string_path cache_dir;
HRESULT rz = agent->GetSessionCacheDirectory( sessionId, cache_dir );
if (rz!=S_OK)
return false;
strconcat(sizeof(cache_dir),cache_dir,cache_dir,gl_data_net_file_name);
/*
IWriter* file = FS.w_open( cache_dir );
R_ASSERT(file);
file->w( globalDataStream->GetCurPointer(), globalDataStream->GetLength() );
free(globalDataStream->GetCurPointer());
FS.w_close(file);
agent->FreeCachedData(sessionId, dataDesc);
ULONG r =globalDataStream->AddRef();
r = globalDataStream->Release();
if(r>0)
globalDataStream->Release();
agent->FreeCachedData(sessionId, dataDesc);
Memory.mem_compact ();
*/
DataReadCreate( cache_dir );
return true;
}
return true;
}
示例8: 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;
}
示例9:
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);
}
}
}
示例10:
void base_lighting::select (xr_vector<R_Light>& dest, xr_vector<R_Light>& src, Fvector& P, float R)
{
Fsphere Sphere;
Sphere.set (P,R);
dest.clear ();
R_Light* L = &*src.begin();
for (; L!=&*src.end(); L++)
{
if (L->type==LT_POINT) {
float dist = Sphere.P.distance_to(L->position);
if (dist>(Sphere.R+L->range)) continue;
}
dest.push_back(*L);
}
}
示例11: draw_wnds_rects
void draw_wnds_rects()
{
if(0==g_wnds_rects.size()) return;
xr_vector<Frect>::iterator it = g_wnds_rects.begin();
xr_vector<Frect>::iterator it_e = g_wnds_rects.end();
for(;it!=it_e;++it)
{
Frect& r = *it;
UI()->ClientToScreenScaled(r.lt, r.lt.x, r.lt.y);
UI()->ClientToScreenScaled(r.rb, r.rb.x, r.rb.y);
draw_rect (r,color_rgba(255,0,0,255));
};
g_wnds_rects.clear();
}
示例12: save_fixes
static void save_fixes( IKinematics *K )
{
VERIFY( K );
saved_fixes.clear();
u16 nbb = K->LL_BoneCount();
for(u16 i = 0; i < nbb; ++i )
{
CBoneInstance &bi = K->LL_GetBoneInstance( i );
if( bi.callback() == anim_bone_fix::callback )
{
VERIFY( bi.callback_param());
anim_bone_fix* fix = (anim_bone_fix*) bi.callback_param();
VERIFY( fix->bone == &bi );
saved_fixes.push_back( fix );
}
}
}
示例13: RearrangeTabButtons
void RearrangeTabButtons(CUITabControl* pTab, xr_vector<Fvector2>& vec_sign_places)
{
TABS_VECTOR * btn_vec = pTab->GetButtonsVector();
TABS_VECTOR::iterator it = btn_vec->begin();
TABS_VECTOR::iterator it_e = btn_vec->end();
vec_sign_places.clear ();
vec_sign_places.resize (btn_vec->size());
Fvector2 pos;
pos.set ((*it)->GetWndPos());
Fvector2 sign_sz;
sign_sz.set (9.0f+3.0f, 11.0f);
u32 idx = 0;
float btn_text_len = 0.0f;
CUIStatic* st = NULL;
for(;it!=it_e;++it,++idx)
{
if(idx!=0)
{
st = xr_new<CUIStatic>(); st->SetAutoDelete(true);pTab->AttachChild(st);
st->SetFont((*it)->GetFont());
st->SetTextColor (color_rgba(90,90,90,255));
st->SetText("//");
st->SetWndSize ((*it)->GetWndSize());
st->AdjustWidthToText();
st->SetWndPos (pos);
pos.x += st->GetWndSize().x;
}
vec_sign_places[idx].set(pos);
vec_sign_places[idx].y += iFloor(((*it)->GetWndSize().y - sign_sz.y)/2.0f);
vec_sign_places[idx].y = (float)iFloor(vec_sign_places[idx].y);
pos.x += sign_sz.x;
(*it)->SetWndPos (pos);
(*it)->AdjustWidthToText();
btn_text_len = (*it)->GetWndSize().x;
pos.x += btn_text_len+3.0f;
}
}
示例14: stats
IC void CSmartCastStats::show ()
{
if (m_stats.empty()) {
Msg ("CONGRATULATIONS : SmartCast stats is empty!!!");
return;
}
m_temp.clear ();
m_temp.insert (m_temp.begin(),m_stats.begin(),m_stats.end());
std::sort (m_temp.begin(),m_temp.end(),CStatsPredicate());
u32 total = 0;
xr_vector<CStats>::const_iterator I = m_temp.begin();
xr_vector<CStats>::const_iterator E = m_temp.end();
for ( ; I != E; ++I)
total += (*I).m_count;
Msg ("SmartCast stats (different %d, total %d) : ",(u32)m_stats.size(),total);
I = m_temp.begin();
for ( ; I != E; ++I)
Msg ("%8d %6.2f% : smart_cast<%s>(%s)",(*I).m_count,float((*I).m_count)*100.f/float(total),(*I).m_to,(*I).m_from);
}
示例15:
~SExts()
{
for (u32 i=0; i<exts.size(); i++)
xr_free(exts[i]);
exts.clear();
}