当前位置: 首页>>代码示例>>C++>>正文


C++ CGhoul2Info_v::resize方法代码示例

本文整理汇总了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;
			}
		}
	}
}
开发者ID:ouned,项目名称:jk2mf,代码行数:28,代码来源:G2_API.cpp

示例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;
}
开发者ID:ouned,项目名称:jk2mf,代码行数:62,代码来源:G2_API.cpp

示例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;
		}
	}
}
开发者ID:Ced2911,项目名称:massive-tyrion,代码行数:69,代码来源:g2_misc.cpp


注:本文中的CGhoul2Info_v::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。