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

C++ boltInfo_v类代码示例

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

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



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

示例1: G2_Add_Bolt_Surf_Num

//=========================================================================================
//// Public Bolt Routines
int G2_Add_Bolt_Surf_Num(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_v &slist, const int surfNum)
{
	assert(ghlInfo && ghlInfo->mValid);
	boltInfo_t			tempBolt;
	int					i;

	// first up, make sure have a surface first
	if (surfNum >= slist.size())
	{
		return -1;
	}

	 // look through entire list - see if it's already there first
	for(i=0; i<bltlist.size(); i++)
	{
		// already there??
		if (bltlist[i].surfaceNumber == surfNum)
		{
			// increment the usage count
			bltlist[i].boltUsed++;
			return i;
		}
	}

	// we have a surface 
	// look through entire list - see if it's already there first
	for(i=0; i<bltlist.size(); i++)
	{
		// if this surface entry has info in it, bounce over it
	  	if (bltlist[i].boneNumber == -1 && bltlist[i].surfaceNumber == -1)
		{
			// if we found an entry that had a -1 for the bone / surface number, then we hit a surface / bone slot that was empty
			bltlist[i].surfaceNumber = surfNum;
			bltlist[i].surfaceType = G2SURFACEFLAG_GENERATED;
			bltlist[i].boltUsed = 1;
	 		return i;
		}
	}
	
	// ok, we didn't find an existing surface of that name, or an empty slot. Lets add an entry
	tempBolt.surfaceNumber = surfNum;
	tempBolt.surfaceType = G2SURFACEFLAG_GENERATED;
	tempBolt.boneNumber = -1;
	tempBolt.boltUsed = 1;
	bltlist.push_back(tempBolt);
	return bltlist.size()-1;

}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:50,代码来源:G2_bolts.cpp


示例2: G2_Remove_Bolt

// Given a model handle, and a bone name, we want to remove this bone from the bone override list
qboolean G2_Remove_Bolt (boltInfo_v &bltlist, int index)
{
	// did we find it?
	if (index != -1)
	{
		bltlist[index].boltUsed--;
		if (!bltlist[index].boltUsed)
		{
			// set this bone to not used
			bltlist[index].boneNumber = -1;
			bltlist[index].surfaceNumber = -1;

			unsigned int newSize = bltlist.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=bltlist.size()-1; i>-1; i--)
			{
				if ((bltlist[i].surfaceNumber == -1) && (bltlist[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 != bltlist.size())
			{
				// yes, so lets do it
				bltlist.resize(newSize);
			}

		}
		return qtrue;
	}

	assert(0);

	// no
	return qfalse;
}
开发者ID:entdark,项目名称:jaMME,代码行数:43,代码来源:G2_bolts.cpp


示例3: G2_Find_Bolt_Surface_Num

// Given a bone number, see if that surface is already in our surfacelist list
int G2_Find_Bolt_Surface_Num(boltInfo_v &bltlist, const int surfaceNum, const int flags)
{
	// look through entire list
	for(size_t i=0; i<bltlist.size(); i++)
	{
		if ((bltlist[i].surfaceNumber == surfaceNum) && ((bltlist[i].surfaceType & flags) == flags))
		{
			return i;
		}
	}

	// didn't find it
	return -1;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:15,代码来源:G2_bolts.cpp


示例4: G2_Find_Bolt_Bone_Num

// Given a bone number, see if that bone is already in our bone list
int G2_Find_Bolt_Bone_Num(boltInfo_v &bltlist, const int boneNum)
{
	// look through entire list
	for(size_t i=0; i<bltlist.size(); i++)
	{
		if (bltlist[i].boneNumber == boneNum)
		{
			return i;
		}
	}

	// didn't find it
	return -1;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:15,代码来源:G2_bolts.cpp


示例5: G2_RemoveRedundantBolts

// remove any bolts that reference original surfaces, generated surfaces, or bones that aren't active anymore 
void G2_RemoveRedundantBolts(boltInfo_v &bltlist, surfaceInfo_v &slist, int *activeSurfaces, int *activeBones)
{
	// walk the bolt list
	for (size_t i=0; i<bltlist.size(); i++)
	{
		// are we using this bolt?
		if ((bltlist[i].surfaceNumber != -1) || (bltlist[i].boneNumber != -1))
		{
			// is this referenceing a surface?
			if (bltlist[i].surfaceNumber != -1)
			{
				// is this bolt looking at a generated surface?
				if (bltlist[i].surfaceType)
				{
					// yes, so look for it in the surface list
					if (!G2_FindOverrideSurface(bltlist[i].surfaceNumber, slist))
					{
						// no - we want to remove this bolt, regardless of how many people are using it
						bltlist[i].boltUsed = 1;
						G2_Remove_Bolt(bltlist, i);
					}
				}
				// no, it's an original, so look for it in the active surfaces list
				{
					if (!activeSurfaces[bltlist[i].surfaceNumber])
					{
						// no - we want to remove this bolt, regardless of how many people are using it
						bltlist[i].boltUsed = 1;
						G2_Remove_Bolt(bltlist, i);
					}
				}
			}
			// no, must be looking at a bone then
			else
			{
				// is that bone active then?
				if (!activeBones[bltlist[i].boneNumber])
				{
					// no - we want to remove this bolt, regardless of how many people are using it
					bltlist[i].boltUsed = 1;
					G2_Remove_Bolt(bltlist, i);
				}
			}
		}
	}
}
开发者ID:entdark,项目名称:jaMME,代码行数:47,代码来源:G2_bolts.cpp


示例6: G2_Remove_Bolt

// Given a model handle, and a bone name, we want to remove this bone from the bone override list
qboolean G2_Remove_Bolt (boltInfo_v &bltlist, int index)
{
	assert(index>=0&&index<(int)bltlist.size());
	// did we find it?
	if (index != -1)
	{
		bltlist[index].boltUsed--;
		if (!bltlist[index].boltUsed)
		{
			// set this bone to not used
			bltlist[index].boneNumber = -1;
			bltlist[index].surfaceNumber = -1;
		}
		return qtrue;
	}
	return qfalse;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:18,代码来源:G2_bolts.cpp


示例7: G2_Find_Bolt_Surface_Num

// Given a bone number, see if that surface is already in our surfacelist list
int G2_Find_Bolt_Surface_Num(boltInfo_v &bltlist, const int surfaceNum, const int flags)
{
	// look through entire list
	for (size_t i = 0; i<bltlist.size(); i++)
	{
		// if this bone entry has no info in it, bounce over it
		if (bltlist[i].surfaceNumber == -1)
		{
			continue;
		}

		if ((bltlist[i].surfaceNumber == surfaceNum) && ((bltlist[i].surfaceType & flags) == flags))
		{
			return i;
		}
	}

	// didn't find it
	return -1;
}
开发者ID:entdark,项目名称:jaMME,代码行数:21,代码来源:G2_bolts.cpp


示例8: G2_Find_Bolt_Bone_Num

// Given a bone number, see if that bone is already in our bone list
int G2_Find_Bolt_Bone_Num(boltInfo_v &bltlist, const int boneNum)
{
	// look through entire list
	for (size_t i = 0; i<bltlist.size(); i++)
	{
		// if this bone entry has no info in it, bounce over it
		if (bltlist[i].boneNumber == -1)
		{
			continue;
		}

		if (bltlist[i].boneNumber == boneNum)
		{
			return i;
		}
	}

	// didn't find it
	return -1;
}
开发者ID:entdark,项目名称:jaMME,代码行数:21,代码来源:G2_bolts.cpp


示例9: G2_Init_Bolt_List

// set the bolt list to all unused so the bone transformation routine ignores it.
void G2_Init_Bolt_List(boltInfo_v &bltlist)
{
	bltlist.clear();
}
开发者ID:entdark,项目名称:jaMME,代码行数:5,代码来源:G2_bolts.cpp


示例10: G2_Add_Bolt

int G2_Add_Bolt(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_v &slist, const char *boneName)
{
	assert(ghlInfo && ghlInfo->mValid);
	model_t		*mod_m = (model_t *)ghlInfo->currentModel;
	model_t		*mod_a = (model_t *)ghlInfo->animModel;
	int					x, surfNum = -1;
	mdxaSkel_t			*skel;
	mdxaSkelOffsets_t	*offsets;
	mdxmHierarchyOffsets_t	*surfOffsets;
	boltInfo_t			tempBolt;
	int					flags;
  
	surfOffsets = (mdxmHierarchyOffsets_t *)((byte*)mod_m->mdxm + sizeof(mdxmHeader_t));
	// first up, we'll search for that which this bolt names in all the surfaces
	surfNum = G2_IsSurfaceLegal((void*)mod_m, boneName, &flags);

	// did we find it as a surface?
	if (surfNum != -1)
	{
		 // look through entire list - see if it's already there first
		for (size_t i = 0; i<bltlist.size(); i++)
		{
			// already there??
			if (bltlist[i].surfaceNumber == surfNum)
			{
				// increment the usage count
				bltlist[i].boltUsed++;
				return i;
			}
		}

		 // look through entire list - see if we can re-use one
		for (size_t i = 0; i<bltlist.size(); i++)
		{
			// if this surface entry has info in it, bounce over it
		  	if (bltlist[i].boneNumber == -1 && bltlist[i].surfaceNumber == -1)
			{
				// if we found an entry that had a -1 for the bone / surface number, then we hit a surface / bone slot that was empty
				bltlist[i].surfaceNumber = surfNum;
				bltlist[i].boltUsed = 1;
				bltlist[i].surfaceType = 0;
		 		return i;
			}
		}
	
		// ok, we didn't find an existing surface of that name, or an empty slot. Lets add an entry
		tempBolt.surfaceNumber = surfNum;
		tempBolt.boneNumber = -1;
		tempBolt.boltUsed = 1;
		tempBolt.surfaceType = 0;
		bltlist.push_back(tempBolt);
		return bltlist.size()-1;
	}

	// no, check to see if it's a bone then

   	offsets = (mdxaSkelOffsets_t *)((byte *)mod_a->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_a->mdxa->numBones; x++)
 	{
 		skel = (mdxaSkel_t *)((byte *)mod_a->mdxa + sizeof(mdxaHeader_t) + offsets->offsets[x]);
 		// if name is the same, we found it
 		if (!Q_stricmp(skel->name, boneName))
		{
			break;
		}
	}

	// check to see we did actually make a match with a bone in the model
	if (x == mod_a->mdxa->numBones)
	{
		// didn't find it? Error
		//assert(0&&x == mod_a->mdxa->numBones);
#ifdef _DEBUG
//		Com_Printf("WARNING: %s not found on skeleton\n", boneName);
#endif
		return -1;
	}

	// look through entire list - see if it's already there first
	for (size_t i = 0; i<bltlist.size(); i++)
	{
		// already there??
		if (bltlist[i].boneNumber == x)
		{
			// increment the usage count
			bltlist[i].boltUsed++;
			return i;
		}
	}

	// look through entire list - see if we can re-use it
	for (size_t i = 0; i<bltlist.size(); i++)
	{
		// if this bone entry has info in it, bounce over it
		if (bltlist[i].boneNumber == -1 && bltlist[i].surfaceNumber == -1)
		{
			// if we found an entry that had a -1 for the bonenumber, then we hit a bone slot that was empty
			bltlist[i].boneNumber = x;
//.........这里部分代码省略.........
开发者ID:entdark,项目名称:jaMME,代码行数:101,代码来源:G2_bolts.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ boneInfo_v类代码示例发布时间:2022-05-31
下一篇:
C++ board类代码示例发布时间: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