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


C++ btAlignedObjectArray::reserve方法代码示例

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


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

示例1: LoadMeshFromCollada

void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray<GLInstanceGraphicsShape>& visualShapes, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, btTransform& upAxisTransform, float& unitMeterScaling, int clientUpAxis, struct CommonFileIOInterface* fileIO)
{
	//	GLInstanceGraphicsShape* instance = 0;

	//usually COLLADA files don't have that many visual geometries/shapes
	visualShapes.reserve(MAX_VISUAL_SHAPES);

	float extraScaling = 1;  //0.01;
	btHashMap<btHashString, int> name2ShapeIndex;
	
	char filename[1024];
	if (!fileIO->findResourcePath(relativeFileName, filename, 1024))
	{
		b3Warning("File not found: %s\n", filename);
		return;
	}

	XMLDocument doc;
	//doc.Parse((const char*)filedata, 0, TIXML_ENCODING_UTF8);
	b3AlignedObjectArray<char> xmlString;
	int fileHandle = fileIO->fileOpen(filename,"r");
	if (fileHandle>=0)
	{
		int size = fileIO->getFileSize(fileHandle);
		xmlString.resize(size);
		int actual = fileIO->fileRead(fileHandle, &xmlString[0],size);
		if (actual==size)
		{
		}
	}
	if (xmlString.size()==0)
		return;

	if (doc.Parse(&xmlString[0], xmlString.size()) != XML_SUCCESS)
	//if (doc.LoadFile(filename) != XML_SUCCESS)
		return;

	//We need units to be in meter, so apply a scaling using the asset/units meter
	unitMeterScaling = 1;
	upAxisTransform.setIdentity();

	//Also we can optionally compensate all transforms using the asset/up_axis as well as unit meter scaling
	getUnitMeterScalingAndUpAxisTransform(doc, upAxisTransform, unitMeterScaling, clientUpAxis);

	btMatrix4x4 ident;
	ident.setIdentity();

	readLibraryGeometries(doc, visualShapes, name2ShapeIndex, extraScaling);

	readVisualSceneInstanceGeometries(doc, name2ShapeIndex, visualShapeInstances);
}
开发者ID:Hongtae,项目名称:bullet3,代码行数:51,代码来源:LoadMeshFromCollada.cpp

示例2: adder

void	readFloatArray(TiXmlElement* source, btAlignedObjectArray<float>& floatArray, int& componentStride) 
{
	int numVals, stride;
	TiXmlElement* array = source->FirstChildElement("float_array");
	if(array) 
	{
		componentStride = 1;
		if (source->FirstChildElement("technique_common")->FirstChildElement("accessor")->QueryIntAttribute("stride", &stride)!= TIXML_NO_ATTRIBUTE)
		{
			componentStride = stride;
		}
		array->QueryIntAttribute("count", &numVals);
		TokenFloatArray adder(floatArray);
		floatArray.reserve(numVals);
		tokenize(array->GetText(),adder);
		assert(floatArray.size() == numVals);
	}
}
开发者ID:Aatch,项目名称:bullet3,代码行数:18,代码来源:LoadMeshFromCollada.cpp

示例3: LoadMeshFromCollada

void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray<GLInstanceGraphicsShape>& visualShapes, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, btTransform& upAxisTransform, float& unitMeterScaling,int clientUpAxis)
{

	GLInstanceGraphicsShape* instance = 0;
	
	//usually COLLADA files don't have that many visual geometries/shapes
	visualShapes.reserve(32);

	float extraScaling = 1;//0.01;
	btHashMap<btHashString, int> name2ShapeIndex;
	b3FileUtils f;
	char filename[1024];
	if (!f.findFile(relativeFileName,filename,1024))
	{
		printf("File not found: %s\n", filename);
		return;
	}
	 
	TiXmlDocument doc(filename);
	if (!doc.LoadFile())
		return;

	//We need units to be in meter, so apply a scaling using the asset/units meter 
	unitMeterScaling=1;
	upAxisTransform.setIdentity();

	//Also we can optionally compensate all transforms using the asset/up_axis as well as unit meter scaling
	getUnitMeterScalingAndUpAxisTransform(doc, upAxisTransform, unitMeterScaling,clientUpAxis);
	
	btMatrix4x4 ident;
	ident.setIdentity();

	readLibraryGeometries(doc, visualShapes, name2ShapeIndex, extraScaling);
	
	readVisualSceneInstanceGeometries(doc, name2ShapeIndex, visualShapeInstances);

}
开发者ID:Aatch,项目名称:bullet3,代码行数:37,代码来源:LoadMeshFromCollada.cpp


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