本文整理汇总了C++中xr_vector::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::resize方法的具体用法?C++ xr_vector::resize怎么用?C++ xr_vector::resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_vector
的用法示例。
在下文中一共展示了xr_vector::resize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CSoundRender_TargetA::start (CSoundRender_Emitter* E)
{
inherited::start(E);
// Calc storage
buf_block = sdef_target_block*wfx.nAvgBytesPerSec/1000;
g_target_temp_data.resize(buf_block);
}
示例2: LL_GetBoneGroups
int CKinematics::LL_GetBoneGroups(xr_vector<xr_vector<u16> >& groups)
{
groups.resize (children.size());
for (u16 bone_idx=0; bone_idx<(u16)bones->size(); bone_idx++) {
CBoneData* B = (*bones)[bone_idx];
for (u32 child_idx=0; child_idx<children.size(); child_idx++){
if (!B->child_faces[child_idx].empty()){
groups[child_idx].push_back(bone_idx);
}
}
}
return groups.size();
}
示例3: 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();
}
示例4:
void lm_layer::Pack_hemi (xr_vector<u32>& dest) //.
{
dest.resize (width*height);
xr_vector<base_color>::iterator I=surface.begin ();
xr_vector<base_color>::iterator E=surface.end ();
xr_vector<u32>::iterator W=dest.begin ();
for (; I!=E; I++)
{
base_color_c C; I->_get(C);
u8 _d = u8_clr (C.sun);
u8 _h = u8_clr (C.hemi);
*W++ = color_rgba(_h,_h,_h,_d);
}
}
示例5: 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;
}
}
示例6: BuildSectors
void CBuild::BuildSectors()
{
Status("Determining sectors...");
Progress(0);
u32 SectorMax=0;
for (u32 I=0; I<g_tree.size(); I++)
if (g_tree[I]->Sector>SectorMax) SectorMax=g_tree[I]->Sector;
R_ASSERT(SectorMax<0xffff);
u32 SectorCount = SectorMax+1;
g_sectors.resize(SectorCount);
ZeroMemory(&*g_sectors.begin(),(u32)g_sectors.size()*sizeof(void*));
clMsg("%d sectors accepted.",SectorCount);
Status("Spatializing geometry...");
for (u32 I=0; I<g_tree.size(); I++)
{
u32 Sector = g_tree[I]->Sector;
if (0==g_sectors[Sector]) g_sectors[Sector] = xr_new<CSector> (Sector);
}
Status("Building hierrarhy...");
for (u32 I=0; I<g_sectors.size(); I++)
{
R_ASSERT(g_sectors[I]);
g_sectors[I]->BuildHierrarhy();
Progress(float(I)/float(g_sectors.size()));
}
Status("Assigning portals, occluders, glows, lights...");
// portals
for (u32 I=0; I<portals.size(); I++)
{
b_portal &P = portals[I];
R_ASSERT(u32(P.sector_front)<g_sectors.size());
R_ASSERT(u32(P.sector_back) <g_sectors.size());
g_sectors[u32(P.sector_front)]->add_portal (u16(I));
g_sectors[u32(P.sector_back)]->add_portal (u16(I));
}
// glows
for (u32 I=0; I<glows.size(); I++)
{
b_glow &G = glows[I];
b_material &M = materials[G.dwMaterial];
R_ASSERT(M.sector<g_sectors.size());
g_sectors[M.sector]->add_glow (u16(I));
}
// lights
for (u32 I=0; I<L_dynamic.size(); I++)
{
b_light_dynamic &L = L_dynamic[I];
if (L.data.type == D3DLIGHT_DIRECTIONAL)
{
for (u32 j=0; j<g_sectors.size(); j++)
{
R_ASSERT(g_sectors[j]);
g_sectors[j]->add_light(u16(I));
}
} else {
if (L.sectors.size()) {
for (u32 j=0; j<L.sectors.size(); j++)
{
R_ASSERT (L.sectors[j]<g_sectors.size());
g_sectors [L.sectors[j]]->add_light(u16(I));
}
} else {
clMsg("Fuck!!! Light at position %f,%f,%f non associated!!!",
L.data.position.x,L.data.position.y,L.data.position.z
);
}
}
}
}
示例7: LL_GetBindTransform
void CKinematics::LL_GetBindTransform(xr_vector<Fmatrix>& matrices)
{
matrices.resize (LL_BoneCount());
RecursiveBindTransform (this,matrices,iRoot,Fidentity);
}
示例8: float
//.........这里部分代码省略.........
exact_normalize (vN);
// multi-sample
const int n_samples = (g_params().m_quality==ebqDraft)?1:6;
for (u32 sample=0; sample<(u32)n_samples; sample++)
{
float a = 0.2f * float(sample) / float(n_samples);
Fvector P,N;
N.random_dir (vN,deg2rad(30.f));
P.mad (vP,N,a);
LightPoint (&DB, MDL, vC, P, N, lights, flags, 0);
}
vC.scale (n_samples);
vC._tmp_ = v_trans;
if (flags&LP_dont_hemi) ;
else vC.hemi += v_amb;
V->C._set (vC);
// Search
const float key = V->P.x;
mapVertIt it = g_trans.lower_bound (key);
mapVertIt it2 = it;
// Decrement to the start and inc to end
while (it!=g_trans.begin() && ((it->first+eps2)>key)) it--;
while (it2!=g_trans.end() && ((it2->first-eps2)<key)) it2++;
if (it2!=g_trans.end()) it2++;
// Search
BOOL found = FALSE;
for (; it!=it2; it++)
{
v_vertices& VL = it->second;
_vertex* Front = VL.front();
R_ASSERT (Front);
if (Front->P.similar(V->P,eps))
{
found = TRUE;
VL.push_back (V);
}
}
// Register
if (!found) {
mapVertIt ins = g_trans.insert(mk_pair(key,v_vertices()));
ins->second.reserve (32);
ins->second.push_back (V);
}
}
// Enable faces if needed
/*
if (bDisableFaces)
for (I=0; I<m_faces.size(); I++) m_faces[I]->flags.bDisableShadowCast = true;
*/
// Process all groups
for (mapVertIt it=g_trans.begin(); it!=g_trans.end(); it++)
{
// Unique
v_vertices& VL = it->second;
std::sort (VL.begin(),VL.end());
VL.erase (std::unique(VL.begin(),VL.end()),VL.end());
// Calc summary color
base_color_c C;
for (int v=0; v<int(VL.size()); v++)
{
base_color_c vC;
VL[v]->C._get (vC);
C.max (vC);
}
// Calculate final vertex color
for (u32 v=0; v<int(VL.size()); v++)
{
base_color_c vC;
VL[v]->C._get (vC);
// trans-level
float level = vC._tmp_;
//
base_color_c R;
R.lerp (vC,C,level);
R.max (vC);
R.mul (.5f);
VL[v]->C._set (R);
}
}
// Transfer colors to destination
dest.resize (m_vertices.size());
for (I = 0; I<m_vertices.size(); I++)
{
Fvector ptPos = m_vertices[I]->P;
base_color ptColor = m_vertices[I]->C;
dest[I] = ptColor;
}
}