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


C++ CDataReader::setSeek方法代码示例

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


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

示例1: if

uint8			CBMPFormat::detectBMPVersion(void)
{
	CDataReader *pDataReader = CDataReader::getInstance();

	uint8 uiBMPVersion = 0;
	pDataReader->setPeek(true);
	string strHeader = pDataReader->readString(2);
	if (strHeader.c_str()[0] == '\0' && strHeader.c_str()[1] == '\0')
	{
		// BMP version 1.x
		uiBMPVersion = 1;
	}
	else if (strHeader.c_str()[0] == 'B' && strHeader.c_str()[1] == 'M')
	{
		// BMP version 2.x, 3.x or 4.x
		pDataReader->setSeek(12);
		switch (pDataReader->readUint32())
		{
		case 12: // BMP version 2.x
			uiBMPVersion = 2;
			break;
		case 40: // BMP version 3.x
			uiBMPVersion = 3;
			break;
		case 108: // BMP version 4.x
			uiBMPVersion = 4;
		}
	}
	pDataReader->setPeek(false);
	pDataReader->setSeek(0);
	return uiBMPVersion;
}
开发者ID:X-Seti,项目名称:KGM,代码行数:32,代码来源:CBMPFormat.cpp

示例2: getCOLVersion

uint32	CCOLEntry::calculateShadowMeshVertexCount(void)
{
	CDataReader *pDataReader = CDataReader::getInstance();
	eCOLVersion eCOLVersionValue = getCOLVersion() == nullptr ? COL_UNKNOWN : getCOLVersion()->getVersionId();

	//CDebugger::log("getHeaderStartOffset(): " + CStringUtility::toString(getHeaderStartOffset()));
	//CDebugger::log("getShadowMeshFacesOffset(): " + CStringUtility::toString(getShadowMeshFacesOffset()));
	//CDebugger::log("getShadowMeshFaceCount(): " + CStringUtility::toString(getShadowMeshFaceCount()));
	//CDebugger::log("getCOLVersion(): " + CStringUtility::toString(getCOLVersion()));
	pDataReader->setSeek(getHeaderStartOffset() + 4 + getShadowMeshFacesOffset());
	string strShadowMeshFacesData = pDataReader->readString(getShadowMeshFaceCount() * (eCOLVersionValue == 1 ? 16 : 8)); // 12 or 6 = sizeof(TVertex)
	//CDebugger::log("part 2 -- strShadowMeshFacesData.length(): " + CStringUtility::toString(strShadowMeshFacesData.length()));
	uint32 uiSeek = 0;
	uint32 uiHighestVertexIndex = 0;
	if (getShadowMeshFaceCount() == 0)
	{
		return 0;
	}
	if (eCOLVersionValue == COL_1)
	{
		// COL 1
		for (uint32 i = 0, j = getShadowMeshFaceCount(); i < j; i++)
		{
			for (uint8 i2 = 0; i2 < 3; i2++)
			{
				uint32 uiVertexIndex = CStringUtility::unpackUint32(strShadowMeshFacesData.substr(uiSeek, 4), false);
				if (uiVertexIndex > uiHighestVertexIndex)
				{
					uiHighestVertexIndex = uiVertexIndex;
				}
				uiSeek += 4; // 4 is sizeof(uint32)
			}
			uiSeek += 4; // 4 is sizeof(TSurface)
		}
	}
	else
	{
		// COL 2, 3 & 4
		for (uint32 i = 0, j = getShadowMeshFaceCount(); i < j; i++)
		{
			for (uint8 i2 = 0; i2 < 3; i2++)
			{
				uint32 uiVertexIndex = CStringUtility::unpackUint16(strShadowMeshFacesData.substr(uiSeek, 2), false);
				if (uiVertexIndex > uiHighestVertexIndex)
				{
					uiHighestVertexIndex = uiVertexIndex;
				}
				uiSeek += 2; // 2 is sizeof(uint16)
			}
			uiSeek += 2; // 1 byte for material, 1 byte for light
		}
	}
	return uiHighestVertexIndex + 1;
}
开发者ID:X-Seti,项目名称:KGM,代码行数:54,代码来源:CCOLEntry.cpp

示例3:

eDATPathFormat			CDATPathFormat::detectPathsFormat(void)
{
	CDataReader *pDataReader = CDataReader::getInstance();
	eDATPathFormat eDATPathFormatValue;

	uint32 uiPreviousSeek = pDataReader->getSeek();
	pDataReader->setPeek(true);

	if (CStringUtility::unpackUint32(pDataReader->readString(4), false) == 0xFFFFFFFF && pDataReader->readString(4) == "FM92")
	{
		eDATPathFormatValue = DAT_PATH_FASTMAN92;
	}
	else
	{
		eDATPathFormatValue = DAT_PATH_DEFAULT;
	}

	pDataReader->setSeek(uiPreviousSeek);
	pDataReader->setPeek(false);

	return eDATPathFormatValue;
}
开发者ID:X-Seti,项目名称:KGM,代码行数:22,代码来源:CDATPathFormat.cpp


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