本文整理汇总了C++中xr_vector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::size方法的具体用法?C++ xr_vector::size怎么用?C++ xr_vector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_vector
的用法示例。
在下文中一共展示了xr_vector::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
示例2: 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();
}
示例3: 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;
}
示例4: float
virtual void Execute()
{
CDeflector* D = 0;
for (;;)
{
// Get task
task_CS.Enter ();
thProgress = 1.f - float(task_pool.size())/float(g_deflectors.size());
if (task_pool.empty())
{
task_CS.Leave ();
return;
}
D = g_deflectors[task_pool.back()];
task_pool.pop_back ();
task_CS.Leave ();
// Perform operation
try {
D->Light (&DB,&LightsSelected,H);
} catch (...)
{
clMsg("* ERROR: CLMThread::Execute - light");
}
}
}
示例5: OnBnClickedGSRefreshList
void CClientDlg::OnBnClickedGSRefreshList()
{
if (!net_Hosts.size()) return;
int nItem = -1;
for (int i=0; i<m_pServerList.GetItemCount(); i++)
{
if (m_pServerList.GetItemState(i, (UINT)-1) & LVIS_SELECTED)
{
nItem = i;
break;
}
}
if (nItem == -1) return;
HOST_NODE N = net_Hosts[m_pServerList.GetItemData(nItem)];
UINT res = m_pServerList.GetItemState(nItem, (UINT)-1);
if (!N.dpServer) return;
// m_pGameSpyUpdateList.EnableWindow(FALSE);
// m_pGameSpyRefreshList.EnableWindow(FALSE);
m_bQuickRefresh = TRUE;
ServerBrowserAuxUpdateServer(m_serverBrowser, N.dpServer, SBTrue, SBTrue);
// if(!m_timerID)
// m_timerID = SetTimer(TIMER_ID, TIMER_FREQUENCY, NULL);
// m_pGameSpyUpdateList.EnableWindow(TRUE);
// m_pGameSpyRefreshList.EnableWindow(TRUE);
}
示例6: retrive_data_from_mender_otput
void retrive_data_from_mender_otput( vecOGF_V &vertices,
vecOGF_F &faces,
const xr_vector<float> &o_position,
const xr_vector<float> &o_normal,
const xr_vector<float> &o_tc,
const xr_vector<float> &o_tangent,
const xr_vector<float> &o_binormal,
const xr_vector<float> &o_color,
const xr_vector<int> &o_indices )
{
// retriving data
u32 v_cnt = o_position.size();
v_cnt /= 3;
u32 o_idx = 0;
for (itOGF_F face_it=faces.begin(); face_it!=faces.end(); face_it++){
OGF_Face &iF = *face_it;
iF.v[0] = o_indices[o_idx++];
iF.v[1] = o_indices[o_idx++];
iF.v[2] = o_indices[o_idx++];
}
vertices.clear (); vertices.resize(v_cnt);
for (u32 v_idx=0; v_idx!=v_cnt; v_idx++){
OGF_Vertex &iV = vertices[v_idx];
iV.P.set (o_position[v_idx*3+0], o_position[v_idx*3+1], o_position[v_idx*3+2]);
iV.N.set (o_normal[v_idx*3+0], o_normal[v_idx*3+1], o_normal[v_idx*3+2]);
iV.T.set (o_tangent[v_idx*3+0], o_tangent[v_idx*3+1], o_tangent[v_idx*3+2]);
iV.B.set (o_binormal[v_idx*3+0], o_binormal[v_idx*3+1], o_binormal[v_idx*3+2]);
iV.UV.resize(1);
iV.UV[0].set(o_tc[v_idx*3+0], o_tc[v_idx*3+1]);
iV.Color._set(o_color[v_idx*3+0], o_color[v_idx*3+1], o_color[v_idx*3+2]);
}
}
示例7: dump_list_wnd
void dump_list_wnd(){
Msg("------Total wnds %d",dbg_list_wnds.size());
xr_vector<DBGList>::iterator _it = dbg_list_wnds.begin();
for(;_it!=dbg_list_wnds.end();++_it)
if(!(*_it).closed)
Msg("--leak detected ---- wnd = %d",(*_it).num);
}
示例8: CreatePN
void CreatePN(u32& group_id)
{
// grab results
Fvector min,max;
min.set(flt_max,flt_max,flt_max);
max.set(flt_min,flt_min,flt_min);
NodeMerged NM;
for (u32 L=0; L<BestQuad.size(); L++)
{
vecDW& vec = BestQuad[L];
for (u32 N=0; N<vec.size(); N++)
{
u32 ID = vec[N];
used[ID] = true;
g_nodes[ID].Group = group_id;
NM.contains.push_back(ID);
}
}
g_merged.push_back(NM);
group_id++;
}
示例9:
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;
}
示例10: SaveSectors
void CBuild::SaveSectors(IWriter& fs)
{
CMemoryWriter MFS;
Status("Processing...");
// validate & save
for (u32 I=0; I<g_sectors.size(); I++)
{
MFS.open_chunk(I);
g_sectors[I]->Validate();
g_sectors[I]->Save(MFS);
MFS.close_chunk();
Progress(float(I)/float(g_sectors.size()));
}
fs.w_chunk(fsL_SECTORS,MFS.pointer(),MFS.size());
}
示例11: 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));
}
}
示例12: vfOptimizeParameters
void vfOptimizeParameters(xr_vector<xr_vector<REAL> > &A, xr_vector<xr_vector<REAL> > &B, xr_vector<REAL> &C, xr_vector<REAL> &D, REAL dEpsilon, REAL dAlpha, REAL dBeta, REAL dNormaFactor, u32 dwMaxIterationCount)
{
u32 dwTestCount = (u32)B.size();
xr_vector<REAL> daGradient;
xr_vector<REAL> daDelta;
xr_vector<xr_vector<REAL> > daEvalResults; daEvalResults.resize(dwTestCount);
if (!B.size()) {
clMsg ("! ERROR : there are no parameters to fit!");
return;
}
u32 dwParameterCount = (u32)B[0].size();
C.assign (dwParameterCount,1.0f);
D.assign (dwParameterCount,0.0f);
daDelta.assign (dwParameterCount,0);
daGradient.assign (dwParameterCount,0);
{
for (u32 i=0; i<dwTestCount; i++)
daEvalResults[i].resize(dwParameterCount);
}
u32 i = 0;
REAL dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D), dPreviousFunctional;
//clMsg ("* MU-fitter: %6d : %17.8f (%17.8f)",i,dFunctional,dFunctional/dwTestCount);
do {
dPreviousFunctional = dFunctional;
dafGradient (daEvalResults, daGradient, B, dNormaFactor);
std::transform (daGradient.begin(), daGradient.end(), daGradient.begin(), std::bind2nd(std::multiplies<REAL>(), -dAlpha));
std::transform (daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), dBeta));
std::transform (daGradient.begin(), daGradient.end(), daDelta.begin(), daDelta.begin(), std::plus<REAL>());
std::transform (C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
std::transform (D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D);
i++;
}
while ((((dPreviousFunctional - dFunctional)/dwTestCount) > dEpsilon) && (i <= dwMaxIterationCount));
if (dPreviousFunctional < dFunctional) {
std::transform (daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), -1));
std::transform (C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
std::transform (D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
}
dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D);
//clMsg ("* MU-fitter: %6d : %17.8f (%17.8f)",i,dFunctional,dFunctional/dwTestCount);
}
示例13: highlight_ammo_for_weapon
void CUIActorMenu::highlight_ammo_for_weapon( PIItem weapon_item, CUIDragDropListEx* ddlist )
{
VERIFY( weapon_item );
VERIFY( ddlist );
static xr_vector<shared_str> ammo_types;
ammo_types.clear_not_free();
CWeapon* weapon = smart_cast<CWeapon*>(weapon_item);
if ( !weapon )
{
return;
}
ammo_types.assign( weapon->m_ammoTypes.begin(), weapon->m_ammoTypes.end() );
CWeaponMagazinedWGrenade* wg = smart_cast<CWeaponMagazinedWGrenade*>(weapon_item);
if ( wg )
{
if ( wg->IsGrenadeLauncherAttached() && wg->m_ammoTypes2.size() )
{
ammo_types.insert( ammo_types.end(), wg->m_ammoTypes2.begin(), wg->m_ammoTypes2.end() );
}
}
if ( ammo_types.size() == 0 )
{
return;
}
xr_vector<shared_str>::iterator ite = ammo_types.end();
u32 const cnt = ddlist->ItemsCount();
for ( u32 i = 0; i < cnt; ++i )
{
CUICellItem* ci = ddlist->GetItemIdx(i);
PIItem item = (PIItem)ci->m_pData;
if ( !item )
{
continue;
}
CWeaponAmmo* ammo = smart_cast<CWeaponAmmo*>(item);
if ( !ammo )
{
highlight_addons_for_weapon( weapon_item, ci );
continue; // for i
}
shared_str const& ammo_name = item->object().cNameSect();
xr_vector<shared_str>::iterator itb = ammo_types.begin();
for ( ; itb != ite; ++itb )
{
if ( ammo_name._get() == (*itb)._get() )
{
ci->m_select_armament = true;
break; // itb
}
}
}//for i
}
示例14: bfGetActionSuccessProbability
bool bfGetActionSuccessProbability(GroupHierarchyHolder::MEMBER_REGISTRY &Members, const xr_vector<const CEntityAlive *> &VisibleEnemies, float fMinProbability, CBaseFunction &fSuccessProbabilityFunction)
{
int i = 0, j = 0, I = (int)Members.size(), J = (int)VisibleEnemies.size();
xr_vector<const CEntityAlive*>::const_iterator II = VisibleEnemies.begin();
for ( ; (i < I) && (j < J); ) {
ai().ef_storage().non_alife().member() = smart_cast<CEntityAlive *>(Members[i]);
if (!(ai().ef_storage().non_alife().member()) || !(ai().ef_storage().non_alife().member()->g_Alive())) {
++i;
continue;
}
ai().ef_storage().non_alife().enemy() = *II;
if (!(ai().ef_storage().non_alife().enemy()) || !(ai().ef_storage().non_alife().enemy()->g_Alive())) {
++j;
++II;
continue;
}
float fProbability = fSuccessProbabilityFunction.ffGetValue()/100.f, fCurrentProbability;
if (fProbability > fMinProbability) {
fCurrentProbability = fProbability;
for (++j; (i < I) && (j < J); ++j) {
ai().ef_storage().non_alife().enemy() = *II;
if (!(ai().ef_storage().non_alife().enemy()) || !(ai().ef_storage().non_alife().enemy()->g_Alive())) {
++j;
++II;
continue;
}
fProbability = fSuccessProbabilityFunction.ffGetValue()/100.f;
if (fCurrentProbability*fProbability < fMinProbability) {
++i;
break;
}
else
fCurrentProbability *= fProbability;
}
}
else {
fCurrentProbability = 1.0f - fProbability;
for (++i; (i < I) && (j < J); ++i) {
ai().ef_storage().non_alife().member() = smart_cast<CEntityAlive *>(Members[i]);
if (!(ai().ef_storage().non_alife().member()) || !(ai().ef_storage().non_alife().member()->g_Alive())) {
++i;
continue;
}
fProbability = 1.0f - fSuccessProbabilityFunction.ffGetValue()/100.f;
if (fCurrentProbability*fProbability < (1.f - fMinProbability)) {
++II;
++j;
break;
}
else
fCurrentProbability *= fProbability;
}
}
}
return(j >= J);
}
示例15: CalculateTB
// Calculate T&B
void OGF::CalculateTB()
{
remove_isolated_verts( data.vertices, data.faces );
// ************************************* Declare inputs
Status ( "Declarator..." );
u32 v_count_reserve = iFloor( float( data.vertices.size() )*1.33f );
u32 i_count_reserve = 3*data.faces.size();
mender_mapping_out_to_in_vert .clear( );
mender_mapping_out_to_in_vert .reserve( v_count_reserve );
mender_in_out_verts .reserve( v_count_reserve );
mender_in_out_indices .reserve( i_count_reserve );
mender_in_out_verts .clear( );
mender_in_out_indices .clear( );
fill_mender_input( data.vertices, data.faces, mender_in_out_verts, mender_in_out_indices );
u32 v_was = data.vertices.size();
u32 v_become= mender_in_out_verts.size();
clMsg ("duplication: was[%d] / become[%d] - %2.1f%%",v_was,v_become,100.f*float(v_become-v_was)/float(v_was));
// ************************************* Perform mungle
Status ("Calculating basis...");
MeshMender mender ;
if ( !mender.Mend (
mender_in_out_verts,
mender_in_out_indices,
mender_mapping_out_to_in_vert,
1,
0.5,
0.5,
0.0f,
MeshMender::DONT_CALCULATE_NORMALS,
MeshMender::RESPECT_SPLITS,
MeshMender::DONT_FIX_CYLINDRICAL
)
)
{
xrDebug::Fatal (DEBUG_INFO, "NVMeshMender failed " );
//xrDebug::Fatal (DEBUG_INFO,"NVMeshMender failed (%s)",mender.GetLastError().c_str());
}
// ************************************* Bind declarators
// bind
retrive_data_from_mender_otput( data.vertices, data.faces, mender_in_out_verts, mender_in_out_indices, mender_mapping_out_to_in_vert );
remove_isolated_verts( data.vertices, data.faces );
mender_in_out_verts .clear( );
mender_in_out_indices .clear( );
mender_mapping_out_to_in_vert .clear( );
}