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


C++ Transformation::ApplyInverse方法代码示例

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


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

示例1: Intersects

	IResult Intersects(const Ray3& ray, const Transformation& objT) const{
		if (!mBV)
			return IResult(false, FLT_MAX);
		Ray3 localRay = objT.ApplyInverse(ray);
		Ray3::IResult ret = localRay.Intersects(mBV.get());
		return ret;
	}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:7,代码来源:FBCollisionShape.cpp

示例2: TestCollision

	bool TestCollision(const BoundingVolume* pBV, const Transformation& objT) const{
		if (!mBV)
			return false;

		auto newCenter = objT.ApplyInverse(pBV->GetCenter());
		Real newRad = pBV->GetRadius();
		BoundingVolumePtr localBV = BoundingVolume::Create();
		localBV->SetCenter(newCenter);
		localBV->SetRadius(newRad);
		return mBV->TestIntersection(localBV.get());
	}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:11,代码来源:FBCollisionShape.cpp

示例3: GatherPointLightData

	void GatherPointLightData(const BoundingVolume* aabb, const Transformation& transform, POINT_LIGHT_CONSTANTS* plConst)
	{
		struct GatheredData
		{
			GatheredData(Real distSQ, unsigned idx)
				:mDistanceSQ(distSQ), mIndex(idx)
			{

			}
			Real mDistanceSQ;
			unsigned mIndex;
		};
		static std::vector<GatheredData> gathered;
		gathered.reserve(50);

		unsigned i = 0;
		for (auto it = mPointLights.begin(); it != mPointLights.end(); /**/)
		{		
			IteratingWeakContainer(mPointLights, it, p);
			if (!p->GetEnabled())
				continue;
			Ray3 ray(p->GetPosition(), transform.GetTranslation() - p->GetPosition());
			Ray3 localRay = transform.ApplyInverse(ray);
			auto iresult = localRay.Intersects(aabb);
			Real distSQ = Squared(iresult.second);
			Real range = p->GetRange();
			if (distSQ < (range*range))
			{
				gathered.push_back(GatheredData(distSQ, i));
			}
			++i;
		}

		std::sort(gathered.begin(), gathered.end(), [](const GatheredData& a, const GatheredData& b){
			return a.mDistanceSQ < b.mDistanceSQ;
		}
		);

		plConst->gPointLightColor[0].w = 0;
		int count = std::min(3, (int)gathered.size());
		unsigned validNumber = 0;
		for (int i = 0; i < count; i++)
		{
			PointLightPtr p = mPointLights[gathered[i].mIndex].lock();
			if (p){
				plConst->gPointLightPos[validNumber] = Vec4(p->GetPosition(), p->GetRange());
				plConst->gPointLightColor[validNumber] = Vec4(p->GetColorPowered(), (Real)count);
				++validNumber;
			}
		}

		gathered.clear();
	}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:53,代码来源:PointLightManager.cpp

示例4: GetRandomPosInVolume

	Vec3 GetRandomPosInVolume(const Vec3* nearWorld, const Transformation& objT) const{
		if (!mBV)
		{
			return Vec3(0, 0, 0);
		}

		if (nearWorld)
		{
			Vec3 nearLocal = objT.ApplyInverse(*nearWorld);
			return mBV->GetRandomPosInVolume(&nearLocal);
		}
		return mBV->GetRandomPosInVolume();
	}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:13,代码来源:FBCollisionShape.cpp


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