本文整理汇总了C++中CGhoul2Info_v::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ CGhoul2Info_v::resize方法的具体用法?C++ CGhoul2Info_v::resize怎么用?C++ CGhoul2Info_v::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGhoul2Info_v
的用法示例。
在下文中一共展示了CGhoul2Info_v::resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G2API_CopySpecificG2Model
void G2API_CopySpecificG2Model(CGhoul2Info_v &ghoul2From, int modelFrom, CGhoul2Info_v &ghoul2To, int modelTo)
{
qboolean forceReconstruct = qfalse;
// have we real ghoul2 models yet?
if (((int)&ghoul2From) && ((int)&ghoul2To))
{
// assume we actually have a model to copy from
if (ghoul2From.size() > modelFrom)
{
// if we don't have enough models on the to side, resize us so we do
if (ghoul2To.size() <= modelTo)
{
ghoul2To.resize(modelTo + 1);
forceReconstruct = qtrue;
}
// do the copy
ghoul2To[modelTo] = ghoul2From[modelFrom];
if (forceReconstruct)
{ //rww - we should really do this shouldn't we? If we don't mark a reconstruct after this,
//and we do a GetBoltMatrix in the same frame, it doesn't reconstruct the skeleton and returns
//a completely invalid matrix
ghoul2To[0].mSkelFrameNum = 0;
}
}
}
}
示例2: G2API_CopyGhoul2Instance
// copy a model from one ghoul2 instance to another, and reset the root surface on the new model if need be
// NOTE if modelIndex = -1 then copy all the models
// returns the last model index in destination. -1 equals nothing copied.
int G2API_CopyGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v &g2To, int modelIndex)
{
int returnval=-1;
int i, model;
int from = 0;
int to = g2From.size();
/*
assert(g2To);
if (!g2From)
{
assert(g2From);
return(returnval);
}
*/
// determing if we are only copying one model or not
if (modelIndex != -1)
{
from = modelIndex;
to = modelIndex + 1;
}
model = 0;
// now copy the models
for (i=from; i<to; i++)
{
// find a free spot in the list
for (; model< g2To.size(); model++)
{
if (g2To[model].mModelindex == -1)
{
// Copy model to clear position
g2To[model] = g2From[i];
break;
}
}
if (model >= g2To.size())
{ // didn't find a spare slot, so new ones to add
break;
}
}
if (i < to)
{ // add in any other ones to the end
model = g2To.size();
g2To.resize(model + to - i);
for(;i<to;i++)
{
g2To[model] = g2From[i];
model++;
}
}
return returnval;
}
示例3: G2_LoadGhoul2Model
void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
{
int i,x;
// first thing, lets see how many ghoul2 models we have, and resize our buffers accordingly
int newSize = *(int*)buffer;
ghoul2.resize(newSize);
buffer += 4;
// did we actually resize to a value?
if (!newSize)
{
// no, ok, well, done then.
return;
}
// this one isn't a define since I couldn't work out how to figure it out at compile time
int ghoul2BlockSize = (int)&ghoul2[0].mTransformedVertsArray - (int)&ghoul2[0].mModelindex;
// now we have enough instances, lets go through each one and load up the relevant details
for (i=0; i<ghoul2.size(); i++)
{
ghoul2[i].mSkelFrameNum = 0;
ghoul2[i].mModelindex=-1;
ghoul2[i].mFileName[0]=0;
ghoul2[i].mValid=false;
// load the ghoul2 info from the buffer
memcpy(&ghoul2[i].mModelindex, buffer, ghoul2BlockSize);
buffer +=ghoul2BlockSize;
if (ghoul2[i].mModelindex!=-1&&ghoul2[i].mFileName[0])
{
ghoul2[i].mModelindex = i;
G2_SetupModelPointers(&ghoul2[i]);
}
// give us enough surfaces to load up the data
ghoul2[i].mSlist.resize(*(int*)buffer);
buffer +=4;
// now load all the surfaces
for (x=0; x<ghoul2[i].mSlist.size(); x++)
{
memcpy(&ghoul2[i].mSlist[x], buffer, SURFACE_SAVE_BLOCK_SIZE);
buffer += SURFACE_SAVE_BLOCK_SIZE;
}
// give us enough bones to load up the data
ghoul2[i].mBlist.resize(*(int*)buffer);
buffer +=4;
// now load all the bones
for (x=0; x<ghoul2[i].mBlist.size(); x++)
{
memcpy(&ghoul2[i].mBlist[x], buffer, BONE_SAVE_BLOCK_SIZE);
buffer += BONE_SAVE_BLOCK_SIZE;
}
// give us enough bolts to load up the data
ghoul2[i].mBltlist.resize(*(int*)buffer);
buffer +=4;
// now load all the bolts
for (x=0; x<ghoul2[i].mBltlist.size(); x++)
{
memcpy(&ghoul2[i].mBltlist[x], buffer, BOLT_SAVE_BLOCK_SIZE);
buffer += BOLT_SAVE_BLOCK_SIZE;
}
}
}