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


C++ Reader::Vector3f方法代码示例

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


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

示例1: LoadAnimations

void BinaryConverter::LoadAnimations(Serializer::Reader &rd)
{
	//load channels and PRS keys
	const Uint32 numAnims = rd.Int32();
	for (Uint32 i = 0; i < numAnims; i++) {
		const std::string animName = rd.String();
		const double duration = rd.Double();
		Animation *anim = new Animation(animName, duration);
		const Uint32 numChans = rd.Int32();
		for (Uint32 j = 0; j < numChans; j++) {
			const std::string tgtName = rd.String();
			MatrixTransform* tgtNode = dynamic_cast<MatrixTransform*>(m_model->m_root->FindNode(tgtName));
			anim->m_channels.push_back(AnimationChannel(tgtNode));
			auto& chan = anim->m_channels.back();
			for (Uint32 numKeys = rd.Int32(); numKeys > 0; numKeys--) {
				const double ktime = rd.Double();
				const vector3f kpos = rd.Vector3f();
				chan.positionKeys.push_back(PositionKey(ktime, kpos));
			}
			for (Uint32 numKeys = rd.Int32(); numKeys > 0; numKeys--) {
				const double ktime = rd.Double();
				const Quaternionf krot = rd.RdQuaternionf();
				chan.rotationKeys.push_back(RotationKey(ktime, krot));
			}
			for (Uint32 numKeys = rd.Int32(); numKeys > 0; numKeys--) {
				const double ktime = rd.Double();
				const vector3f kscale = rd.Vector3f();
				chan.scaleKeys.push_back(ScaleKey(ktime, kscale));
			}
		}
		m_model->m_animations.push_back(anim);
	}
}
开发者ID:Ash-Bash,项目名称:pioneer-horizons,代码行数:33,代码来源:BinaryConverter.cpp

示例2: numIndicies

GeomTree::GeomTree(Serializer::Reader &rd)
{
	m_numVertices = rd.Int32();
	m_numEdges = rd.Int32();
	m_numTris = rd.Int32();
	m_radius = rd.Double();

	m_aabb.max = rd.Vector3d();
	m_aabb.min = rd.Vector3d();
	m_aabb.radius = rd.Double();

	const Uint32 numAabbs = rd.Int32();
	m_aabbs.resize(numAabbs);
	for (Uint32 iAabb = 0; iAabb < numAabbs; ++iAabb) {
		m_aabbs[iAabb].max = rd.Vector3d();
		m_aabbs[iAabb].min = rd.Vector3d();
		m_aabbs[iAabb].radius = rd.Double();
	}

	m_edges.resize(m_numEdges);
	for (Sint32 iEdge = 0; iEdge < m_numEdges; ++iEdge) {
		m_edges[iEdge].Load(rd);
	}

	m_vertices.resize(m_numVertices);
	for (Sint32 iVert = 0; iVert < m_numVertices; ++iVert) {
		m_vertices[iVert] = rd.Vector3f();
	}

	const int numIndicies(m_numTris * 3);
	m_indices.resize(numIndicies);
	for (Sint32 iIndi = 0; iIndi < numIndicies; ++iIndi) {
		m_indices[iIndi] = rd.Int16();
	}

	m_triFlags.resize(m_numTris);
	for (Sint32 iTri = 0; iTri < m_numTris; ++iTri) {
		m_triFlags[iTri] = rd.Int32();
	}

	// activeTris = tris we are still trying to put into leaves
	std::vector<int> activeTris;
	activeTris.reserve(m_numTris);
	// So, we ignore tris with flag >= 0x8000
	for (int i = 0; i<m_numTris; i++)
	{
		if (m_triFlags[i] >= IGNORE_FLAG) continue;
		activeTris.push_back(i * 3);
	}
	// regenerate the aabb data
	Aabb *aabbs = new Aabb[activeTris.size()];
	for (unsigned int i = 0; i<activeTris.size(); i++)
	{
		const vector3d v1 = vector3d(m_vertices[m_indices[activeTris[i] + 0]]);
		const vector3d v2 = vector3d(m_vertices[m_indices[activeTris[i] + 1]]);
		const vector3d v3 = vector3d(m_vertices[m_indices[activeTris[i] + 2]]);
		aabbs[i].min = aabbs[i].max = v1;
		aabbs[i].Update(v2);
		aabbs[i].Update(v3);
	}
	m_triTree.reset(new BVHTree(activeTris.size(), &activeTris[0], aabbs));
	delete[] aabbs;

	//
	int *edgeIdxs = new int[m_numEdges];
	memset(edgeIdxs, 0, sizeof(int)*m_numEdges);
	for (int i = 0; i<m_numEdges; i++) {
		edgeIdxs[i] = i;
	}
	m_edgeTree.reset(new BVHTree(m_numEdges, edgeIdxs, &m_aabbs[0]));
}
开发者ID:RevReese,项目名称:pioneer-sp,代码行数:71,代码来源:GeomTree.cpp


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