• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ boneInfo_v类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中boneInfo_v的典型用法代码示例。如果您正苦于以下问题:C++ boneInfo_v类的具体用法?C++ boneInfo_v怎么用?C++ boneInfo_v使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了boneInfo_v类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: G2_Add_Bone

// we need to add a bone to the list - find a free one and see if we can find a corresponding bone in the gla file
int G2_Add_Bone (const model_t *mod, boneInfo_v &blist, const char *boneName)
{
	int i, x;
	mdxaSkel_t			*skel;
	mdxaSkelOffsets_t	*offsets;
	boneInfo_t			tempBone;

   	offsets = (mdxaSkelOffsets_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t));

 	// walk the entire list of bones in the gla file for this model and see if any match the name of the bone we want to find
 	for (x=0; x< mod->mdxa->numBones; x++)
 	{
 		skel = (mdxaSkel_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t) + offsets->offsets[x]);
 		// if name is the same, we found it
 		if (!stricmp(skel->name, boneName))
		{
			break;
		}
	}

	// check to see we did actually make a match with a bone in the model
	if (x == mod->mdxa->numBones)
	{
		// didn't find it? Error
		assert(0);
		return -1;
	}

	// look through entire list - see if it's already there first
	for(i=0; i<blist.size(); i++)
	{
		// if this bone entry has info in it, bounce over it
		if (blist[i].boneNumber != -1)
		{
			skel = (mdxaSkel_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t) + offsets->offsets[blist[i].boneNumber]);
			// if name is the same, we found it
			if (!stricmp(skel->name, boneName))
			{
				return i;
			}
		}
		else
		{
			// if we found an entry that had a -1 for the bonenumber, then we hit a bone slot that was empty
			blist[i].boneNumber = x;
			blist[i].flags = 0;
	 		return i;
		}
	}

	// ok, we didn't find an existing bone of that name, or an empty slot. Lets add an entry
	tempBone.boneNumber = x;
	tempBone.flags = 0;
	blist.push_back(tempBone);
	return blist.size()-1;
}
开发者ID:ouned,项目名称:jk2mf,代码行数:57,代码来源:G2_bones.cpp


示例2: G2_Get_Bone_Anim_Index

// given a model, bonelist and bonename, return the current frame, startframe and endframe of the current animation
// NOTE if we aren't running an animation, then qfalse is returned
qboolean G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int currentTime, 
						  float *retcurrentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed,int numFrames)
{
  
	// did we find it?
	if ((index>=0) && !((index >= blist.size()) || (blist[index].boneNumber == -1)))
	{ 

		// are we an animating bone?
		if (blist[index].flags & (BONE_ANIM_OVERRIDE_LOOP | BONE_ANIM_OVERRIDE))
		{
			int currentFrame,newFrame;
			float lerp;
			G2_TimingModel(blist[index],currentTime,numFrames,currentFrame,newFrame,lerp);

			*retcurrentFrame =float(currentFrame)+lerp;
			*startFrame = blist[index].startFrame;
			*endFrame = blist[index].endFrame;
			*flags = blist[index].flags;
			*retAnimSpeed = blist[index].animSpeed;
			return qtrue;
		}
	}
	*startFrame=0;
	*endFrame=1;
	*retcurrentFrame=0.0f;
	*flags=0;
	*retAnimSpeed=0.0f;
	return qfalse;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:32,代码来源:g2_bones.cpp


示例3: G2_Find_Bone

// Given a bone name, see if that bone is already in our bone list - note the model_t pointer that gets passed in here MUST point at the 
// gla file, not the glm file type.
int G2_Find_Bone(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName)
{
	int					i;
	mdxaSkel_t			*skel;
	mdxaSkelOffsets_t	*offsets;
   	offsets = (mdxaSkelOffsets_t *)((byte *)ghlInfo->aHeader + sizeof(mdxaHeader_t));
	skel = (mdxaSkel_t *)((byte *)ghlInfo->aHeader + sizeof(mdxaHeader_t) + offsets->offsets[0]);

	// look through entire list
	for(i=0; i<blist.size(); i++)
	{
		// if this bone entry has no info in it, bounce over it
		if (blist[i].boneNumber == -1)
		{
			continue;
		}

		// figure out what skeletal info structure this bone entry is looking at
		skel = (mdxaSkel_t *)((byte *)ghlInfo->aHeader + sizeof(mdxaHeader_t) + offsets->offsets[blist[i].boneNumber]);

		// if name is the same, we found it
		if (!stricmp(skel->name, boneName))
		{
			return i;
		}
	}
#if _DEBUG
	G2_Bone_Not_Found(boneName,ghlInfo->mFileName);
#endif	
	// didn't find it
	return -1;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:34,代码来源:g2_bones.cpp


示例4: G2_Pause_Bone_Anim_Index

// given a model, bonelist and bonename, lets pause an anim if it's playing.
qboolean G2_Pause_Bone_Anim_Index( boneInfo_v &blist, const int boneIndex, const int currentTime,int numFrames)
{
	if (boneIndex>=0&&boneIndex<blist.size())
	{
		// are we pausing or un pausing?
		if (blist[boneIndex].pauseTime)
		{
			int		startFrame, endFrame, flags;
			float	currentFrame, animSpeed;

			// figure out what frame we are on now
			if	(G2_Get_Bone_Anim_Index( blist, boneIndex, blist[boneIndex].pauseTime, &currentFrame, &startFrame, &endFrame, &flags, &animSpeed,numFrames))
			{
				// reset start time so we are actually on this frame right now
				G2_Set_Bone_Anim_Index( blist, boneIndex, startFrame, endFrame, flags, animSpeed, currentTime, currentFrame, 0,numFrames);
				// no pausing anymore
				blist[boneIndex].pauseTime = 0;
			}
			else
			{
				return qfalse;
			}
		}
		// ahh, just pausing, the easy bit
		else
		{
			blist[boneIndex].pauseTime = currentTime;
		}
		
		return qtrue;
	}
	assert(0);
	return qfalse;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:35,代码来源:g2_bones.cpp


示例5: G2_Set_Bone_Angles_Index

// Given a model handle, and a bone name, we want to set angles specifically for overriding
qboolean G2_Set_Bone_Angles_Index( boneInfo_v &blist, const int index,
							const float *angles, const int flags, const Eorientations yaw,
							const Eorientations pitch, const Eorientations roll, qhandle_t *modelList,
							const int modelIndex, const int blendTime, const int currentTime)
{
	if ((index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		// we are attempting to set a bone override that doesn't exist
		assert(0);
		return qfalse;
	}

	if (flags & (BONE_ANGLES_PREMULT | BONE_ANGLES_POSTMULT))
	{
		// you CANNOT call this with an index with these kinds of bone overrides - we need the model details for these kinds of bone angle overrides
		assert(0);
		return qfalse;
	}

	// yes, so set the angles and flags correctly
	blist[index].flags &= ~(BONE_ANGLES_TOTAL);
	blist[index].flags |= flags;
	blist[index].boneBlendStart = currentTime;
	blist[index].boneBlendTime = blendTime;
#if DEBUG_PCJ
	OutputDebugString(va("PCJ %2d %6d   (%6.2f,%6.2f,%6.2f) %d %d %d %d\n",index,currentTime,angles[0],angles[1],angles[2],yaw,pitch,roll,flags));
#endif

	G2_Generate_Matrix(NULL, blist, index, angles, flags, yaw, pitch, roll);
	return qtrue;

}
开发者ID:ouned,项目名称:jk2mf,代码行数:33,代码来源:G2_bones.cpp


示例6: G2_Remove_Bone_Index

// Given a model handle, and a bone name, we want to remove this bone from the bone override list
qboolean G2_Remove_Bone_Index ( boneInfo_v &blist, int index)
{
	// did we find it?
	if (index != -1)
	{
		// check the flags first - if it's still being used Do NOT remove it
		if (!blist[index].flags)
		{

			// set this bone to not used
			blist[index].boneNumber = -1;

		   	int newSize = blist.size();
			// now look through the list from the back and see if there is a block of -1's we can resize off the end of the list
			for (int i=blist.size()-1; i>-1; i--)
			{
				if (blist[i].boneNumber == -1)
				{
					newSize = i;
				}
				// once we hit one that isn't a -1, we are done.
				else
				{
					break;
				}
			}
			// do we need to resize?
			if (newSize != blist.size())
			{
				// yes, so lets do it
				blist.resize(newSize);
			}

			return qtrue;
		}
	}

//	assert(0);
	// no
	return qfalse;
}
开发者ID:ouned,项目名称:jk2mf,代码行数:42,代码来源:G2_bones.cpp


示例7: G2_Stop_Bone_Anim_Index

// given a model, bonelist and bonename, lets stop an anim if it's playing.
qboolean G2_Stop_Bone_Anim_Index(boneInfo_v &blist, const int index)
{
 
	if (index<0 || (index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		// we are attempting to set a bone override that doesn't exist
		return qfalse;
	}

	blist[index].flags &= ~(BONE_ANIM_TOTAL);
	return G2_Remove_Bone_Index(blist, index);
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:13,代码来源:g2_bones.cpp


示例8: G2_Find_Bone_In_List

// given a bone number, see if there is an override bone in the bone list
int	G2_Find_Bone_In_List(boneInfo_v &blist, const int boneNum)
{
	int i; 
	
	// look through entire list
	for(i=0; i<blist.size(); i++)
	{
		if (blist[i].boneNumber == boneNum)
		{
			return i;
		}
	}
	return -1;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:15,代码来源:g2_bones.cpp


示例9: G2_Get_Bone_Anim_Range_Index

qboolean G2_Get_Bone_Anim_Range_Index(boneInfo_v &blist, const int boneIndex, int *startFrame, int *endFrame)
{
	if (boneIndex != -1)
	{ 
		assert(boneIndex>=0&&boneIndex<blist.size());
		// are we an animating bone?
		if (blist[boneIndex].flags & (BONE_ANIM_OVERRIDE_LOOP | BONE_ANIM_OVERRIDE))
		{
			*startFrame = blist[boneIndex].startFrame;
			*endFrame = blist[boneIndex].endFrame;
			return qtrue;
		}
	}
	return qfalse;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:15,代码来源:g2_bones.cpp


示例10: G2_Stop_Bone_Angles_Index

// given a model, bonelist and bonename, lets stop an anim if it's playing.
qboolean G2_Stop_Bone_Angles_Index(boneInfo_v &blist, const int index)
{

	if ((index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		// we are attempting to set a bone override that doesn't exist
		assert(0);
		return qfalse;
	}

	blist[index].flags &= ~(BONE_ANGLES_TOTAL);
	// try and remove this bone if we can
	return G2_Remove_Bone_Index(blist, index);

}
开发者ID:ouned,项目名称:jk2mf,代码行数:16,代码来源:G2_bones.cpp


示例11: G2_RemoveRedundantBoneOverrides

void G2_RemoveRedundantBoneOverrides(boneInfo_v &blist, int *activeBones)
{
	int		i;

	// walk the surface list, removing surface overrides or generated surfaces that are pointing at surfaces that aren't active anymore
	for (i=0; i<blist.size(); i++)
	{
		if (blist[i].boneNumber != -1)
		{
			if (!activeBones[blist[i].boneNumber])
			{
				blist[i].flags = 0;
				G2_Remove_Bone_Index(blist, i);
			}
		}
	}
}
开发者ID:ouned,项目名称:jk2mf,代码行数:17,代码来源:G2_bones.cpp


示例12: G2_Set_Bone_Angles_Matrix_Index

// Given a model handle, and a bone name, we want to set angles specifically for overriding - using a matrix directly
qboolean G2_Set_Bone_Angles_Matrix_Index(boneInfo_v &blist, const int index,
								   const mdxaBone_t &matrix, const int flags,
								   const int blendTime, const int currentTime)
{

	if (index<0||(index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		// we are attempting to set a bone override that doesn't exist
		assert(0);
		return qfalse;
	}
	// yes, so set the angles and flags correctly
	blist[index].flags &= ~(BONE_ANGLES_TOTAL);
	blist[index].flags |= flags;
	blist[index].boneBlendStart = currentTime;
	blist[index].boneBlendTime = blendTime;

	memcpy(&blist[index].matrix, &matrix, sizeof(mdxaBone_t));
	memcpy(&blist[index].newMatrix, &matrix, sizeof(mdxaBone_t));
	return qtrue;

}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:23,代码来源:g2_bones.cpp


示例13: G2_Set_Bone_Angles_Index

// Given a model handle, and a bone name, we want to set angles specifically for overriding
qboolean G2_Set_Bone_Angles_Index(CGhoul2Info *ghlInfo, boneInfo_v &blist, const int index,
							const float *angles, const int flags, const Eorientations yaw,
							const Eorientations pitch, const Eorientations roll,
							const int blendTime, const int currentTime)
{
	
	if (index<0||(index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		return qfalse;
	}
	
	// yes, so set the angles and flags correctly
	blist[index].flags &= ~(BONE_ANGLES_TOTAL);
	blist[index].flags |= flags;
	blist[index].boneBlendStart = currentTime;
	blist[index].boneBlendTime = blendTime;
#if DEBUG_PCJ
	OutputDebugString(va("%8x  %2d %6d   (%6.2f,%6.2f,%6.2f) %d %d %d %d\n",(int)ghlInfo,index,currentTime,angles[0],angles[1],angles[2],yaw,pitch,roll,flags));
#endif
	G2_Generate_Matrix(ghlInfo->animModel, blist, index, angles, flags, yaw, pitch, roll);
	return qtrue;

}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:24,代码来源:g2_bones.cpp


示例14: G2_Init_Bone_List

// set the bone list to all unused so the bone transformation routine ignores it.
void G2_Init_Bone_List(boneInfo_v &blist)
{
	blist.clear();
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:5,代码来源:g2_bones.cpp


示例15: G2_Set_Bone_Anim_Index

// given a model, bone name, a bonelist, a start/end frame number, a anim speed and some anim flags, set up or modify an existing bone entry for a new set of anims
qboolean G2_Set_Bone_Anim_Index(
	boneInfo_v &blist,
	const int index,
	const int startFrame,
	const int endFrame,
	const int flags,
	const float animSpeed,
	const int currentTime,
	const float setFrame,
	const int blendTime)
{
	int			modFlags = flags;

	if ((index >= blist.size()) || (blist[index].boneNumber == -1))
	{
		// we are attempting to set a bone override that doesn't exist
		assert(0);
		return qfalse;
	}

	if (setFrame != -1)
	{
		assert((setFrame >= startFrame) && (setFrame <= endFrame));
	}
	if (flags & BONE_ANIM_BLEND)
	{
		float	currentFrame, animSpeed;
		int 	startFrame, endFrame, flags;
		// figure out where we are now
		if (G2_Get_Bone_Anim_Index(blist, index, currentTime, &currentFrame, &startFrame, &endFrame, &flags, &animSpeed, NULL, 0))
		{
			if (blist[index].blendStart == currentTime)	//we're replacing a blend in progress which hasn't started
			{
				// set the amount of time it's going to take to blend this anim with the last frame of the last one
				blist[index].blendTime = blendTime;
			}
			else
			{
				if (animSpeed<0.0f)
				{
					blist[index].blendFrame = floor(currentFrame);
					blist[index].blendLerpFrame = floor(currentFrame);
				}
				else
				{
					blist[index].blendFrame = currentFrame;
					blist[index].blendLerpFrame = currentFrame+1;

					// cope with if the lerp frame is actually off the end of the anim
					if (blist[index].blendFrame >= endFrame )
					{
						// we only want to lerp with the first frame of the anim if we are looping
						if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP)
						{
							blist[index].blendFrame = startFrame;
						}
						// if we intend to end this anim or freeze after this, then just keep on the last frame
						else
						{
						//	assert(endFrame>0);
							if (endFrame <= 0)
							{
								blist[index].blendLerpFrame = 0;
							}
							else
							{
								blist[index].blendFrame = endFrame -1;
							}
						}
					}

					// cope with if the lerp frame is actually off the end of the anim
					if (blist[index].blendLerpFrame >= endFrame )
					{
						// we only want to lerp with the first frame of the anim if we are looping
						if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP)
						{
							blist[index].blendLerpFrame = startFrame;
						}
						// if we intend to end this anim or freeze after this, then just keep on the last frame
						else
						{
						//	assert(endFrame>0);
							if (endFrame <= 0)
							{
								blist[index].blendLerpFrame = 0;
							}
							else
							{
								blist[index].blendLerpFrame = endFrame - 1;
							}
						}
					}
				}
				// set the amount of time it's going to take to blend this anim with the last frame of the last one
				blist[index].blendTime = blendTime;
				blist[index].blendStart = currentTime;

			}
//.........这里部分代码省略.........
开发者ID:ouned,项目名称:jk2mf,代码行数:101,代码来源:G2_bones.cpp


示例16: G2_Set_Bone_Anim_Index

// given a model, bone name, a bonelist, a start/end frame number, a anim speed and some anim flags, set up or modify an existing bone entry for a new set of anims
qboolean G2_Set_Bone_Anim_Index(boneInfo_v &blist, const int index, const int startFrame, 
						  const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int AblendTime,int numFrames)
{
	int			modFlags = flags;
	int			blendTime=AblendTime;

	if (r_Ghoul2BlendMultiplier)
	{
		if (r_Ghoul2BlendMultiplier->value!=1.0f)
		{
			if (r_Ghoul2BlendMultiplier->value<=0.0f)
			{
				modFlags&=~BONE_ANIM_BLEND;
			}
			else
			{
				blendTime=ceil(float(AblendTime)*r_Ghoul2BlendMultiplier->value);
			}
		}
	}
 

	if (index<0||index >= blist.size()||blist[index].boneNumber<0)
	{
		return qfalse;
	}

	// sanity check to see if setfram is within animation bounds
	if (setFrame != -1)
	{
		assert((setFrame >= startFrame) && (setFrame < endFrame));
	}


	// since we already existed, we can check to see if we want to start some blending
	if (modFlags & BONE_ANIM_BLEND)
	{
		float	currentFrame, animSpeed; 
		int 	startFrame, endFrame, flags;
		// figure out where we are now
		if (G2_Get_Bone_Anim_Index(blist, index, currentTime, &currentFrame, &startFrame, &endFrame, &flags, &animSpeed,numFrames))
		{
			if (blist[index].blendStart == currentTime)	//we're replacing a blend in progress which hasn't started
			{
				// set the amount of time it's going to take to blend this anim with the last frame of the last one
				blist[index].blendTime = blendTime;
			}
			else
			{
				if (animSpeed<0.0f)
				{
					blist[index].blendFrame = floor(currentFrame);
					blist[index].blendLerpFrame = floor(currentFrame);
				}
				else
				{
					blist[index].blendFrame = currentFrame;
					blist[index].blendLerpFrame = currentFrame+1;
					
					// cope with if the lerp frame is actually off the end of the anim
					if (blist[index].blendFrame >= blist[index].endFrame )
					{
						// we only want to lerp with the first frame of the anim if we are looping 
						if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP)
						{
							blist[index].blendFrame = blist[index].startFrame;
						}
						// if we intend to end this anim or freeze after this, then just keep on the last frame
						else
						{
							assert(blist[index].endFrame>0);
							blist[index].blendFrame = blist[index].endFrame -1;
						}
					}
					
					// cope with if the lerp frame is actually off the end of the anim
					if (blist[index].blendLerpFrame >= blist[index].endFrame )
					{
						// we only want to lerp with the first frame of the anim if we are looping 
						if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP)
						{
							blist[index].blendLerpFrame = blist[index].startFrame;
						}
						// if we intend to end this anim or freeze after this, then just keep on the last frame
						else
						{
							assert(blist[index].endFrame>0);
							blist[index].blendLerpFrame = blist[index].endFrame - 1;
						}
					}
				}
				// set the amount of time it's going to take to blend this anim with the last frame of the last one
				blist[index].blendTime = blendTime;
				blist[index].blendStart = currentTime;
			}
		}
		// hmm, we weren't animating on this bone. In which case disable the blend
		else
		{
//.........这里部分代码省略.........
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:101,代码来源:g2_bones.cpp


示例17: G2_Get_Bone_Anim_Index

// given a model, bonelist and bonename, return the current frame, startframe and endframe of the current animation
// NOTE if we aren't running an animation, then qfalse is returned
qboolean G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int currentTime,
						  float *currentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed, qhandle_t *modelList, int modelIndex)
{

	// did we find it?
	if ((index != -1) && !((index >= blist.size()) || (blist[index].boneNumber == -1)))
	{
		// are we an animating bone?
		if (blist[index].flags & (BONE_ANIM_OVERRIDE_LOOP | BONE_ANIM_OVERRIDE))
		{
			// yes - add in animation speed to current frame
			float	animSpeed = blist[index].animSpeed;
			float	time = (currentTime - blist[index].startTime) / 50.0f;
			float	mendFrame = (float)blist[index].endFrame ;

			// are we a paused anim?
			if (blist[index].pauseTime)
			{
				time = (blist[index].pauseTime - blist[index].startTime) / 50.0f;
			}
			if (time<0)
			{
				time=0;
			}

			float	newFrame_g = blist[index].startFrame + (time * animSpeed);
			*currentFrame = newFrame_g;

			int		animSize = blist[index].endFrame - blist[index].startFrame;
			// we are supposed to be animating right?
			if (animSize)
			{
				// did we run off the end?
				if (((animSpeed > 0.0f) && (newFrame_g > mendFrame-1)) ||
					((animSpeed < 0.0f) && (newFrame_g < mendFrame+1)))
				{
					// yep - decide what to do
					if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP)
					{

						if (animSpeed < 0.0f)
						{
							if (newFrame_g <= mendFrame+1)
							{
								newFrame_g=mendFrame+fmod(newFrame_g-mendFrame,animSize)-animSize;
							}
						}
						else
						{
							if (newFrame_g >= mendFrame)
							{
								newFrame_g=mendFrame+fmod(newFrame_g-mendFrame,animSize)-animSize;
							}
						}

						*currentFrame = newFrame_g;
					}
					else
					{
						// nope, we ran off the end of the current anim
						if (blist[index].flags & BONE_ANIM_OVERRIDE_FREEZE)
						{
							if (animSpeed > 0.0f)
							{
								*currentFrame = blist[index].endFrame -1;
							}
							else
							{
								*currentFrame = blist[index].endFrame +1;
							}
						}
						else
						{
							*currentFrame = 0;
						}
					}
				}
			}
			else
			{
				*currentFrame = blist[index].startFrame;
			}

			*startFrame = blist[index].startFrame;
			*endFrame = blist[index].endFrame;
			*flags = blist[index].flags;
			*retAnimSpeed = animSpeed;
			return qtrue;
		}
	}
	*startFrame =0;
	*endFrame =1;
	*currentFrame =0;
	*flags = 0;
	*retAnimSpeed = 1.0f;
	return qfalse;
}
开发者ID:ouned,项目名称:jk2mf,代码行数:99,代码来源:G2_bones.cpp


示例18: G2_Add_Bone

// we need to add a bone to the list - find a free one and see if we can find a corresponding bone in the gla file
int G2_Add_Bone (const model_t *mod, boneInfo_v &blist, const char *boneName)
{
	int i, x;
	mdxaSkel_t			*skel;
	mdxaSkelOffsets_t	*offsets;
	boneInfo_t			tempBone;
	 
   	offsets = (mdxaSkelOffsets_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t));

 	// walk the entire list of bones in the gla file for this model and see if any match the name of the bone we want to find
 	for (x=0; x< mod->mdxa->numBones; x++)
 	{
 		skel = (mdxaSkel_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t) + offsets->offsets[x]);
 		// if name is the same, we found it
 		if (!stricmp(skel->name, boneName))
		{
			break;
		}
	}

	// check to see we did actually make a match with a bone in the model
	if (x == mod->mdxa->numBones)
	{
#if _DEBUG
		G2_Bone_Not_Found(boneName,mod->name);
#endif	
		return -1;
	}

	// look through entire list - see if it's already there first
	for(i=0; i<blist.size(); i++)
	{
		// if this bone entry has info in it, bounce over it
		if (blist[i].boneNumber != -1)
		{
			skel = (mdxaSkel_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t) + offsets->offsets[blist[i].boneNumber]);
			// if name is the same, we found it
			if (!stricmp(skel->name, boneName))
			{
#if DEBUG_G2_BONES
				{
					char mess[1000];
					sprintf(mess,"ADD BONE1 blistIndex=%3d    physicalIndex=%3d   %s\n",
						i,
						x,
						boneName);
					OutputDebugString(mess);
				}
#endif
				return i;
			}
		}
		else
		{
			// if we found an entry that had a -1 for the bonenumber, then we hit a bone slot that was empty
			blist[i].boneNumber = x;
			blist[i].flags = 0;
#if DEBUG_G2_BONES
			{
				char mess[1000];
				sprintf(mess,"ADD BONE1 blistIndex=%3d    physicalIndex=%3d   %s\n",
					i,
					x,
					boneName);
				OutputDebugString(mess);
			}
#endif
	 		return i;
		}
	}
	
	// ok, we didn't find an existing bone of that name, or an empty slot. Lets add an entry
	tempBone.boneNumber = x;
	tempBone.flags = 0;
	blist.push_back(tempBone);
#if DEBUG_G2_BONES
	{
		char mess[1000];
		sprintf(mess,"ADD BONE1 blistIndex=%3d    physicalIndex=%3d   %s\n",
			blist.size()-1,
			x,
			boneName);
		OutputDebugString(mess);
	}
#endif
	return blist.size()-1;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:88,代码来源:g2_bones.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ boost类代码示例发布时间:2022-05-31
下一篇:
C++ boltInfo_v类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap