Ejemplo n.º 1
0
BOOST_FIXTURE_TEST_CASE(HeightMapTest1, Test4x4HeightMap)
{
	HeightMap hm;
	hm.Swap(sample4x4);
	BOOST_CHECK_EQUAL(hm.At(Point2d(1, 1)), 0.0f);
	BOOST_CHECK_EQUAL(hm.At(Point2d(1, 2)), 1.0f);
	BOOST_CHECK_EQUAL(hm.At(Point2d(1, 3)), 1.0f);
	BOOST_CHECK_EQUAL(hm.GetSize(), 4u);
}
void 
HeightMapLoaderCache::Set(const Point2d & pos, const HeightMap & hm)
{
	if (hm.GetSize() != partSize_)
	{
		throw std::runtime_error("Sizes other than part size aren't supported by height map cache (Set)");
	}

	const Size2d p = Size2d::Cast(pos);
	if (!IsCornerPoint(p, partSize_))
	{
		throw std::runtime_error("Non corner points aren't supported by height map cache (Set)");
	}

	heightMapCache_[p] = hm.GetData();

	//basePtr_->Set(pos, hm);
}