Пример #1
0
cCaveTunnel::cCaveTunnel(
	int a_BlockStartX, int a_BlockStartY, int a_BlockStartZ, int a_StartRadius,
	int a_BlockEndX,   int a_BlockEndY,   int a_BlockEndZ,   int a_EndRadius,
	cNoise & a_Noise
)
{
	m_Points.push_back(cCaveDefPoint(a_BlockStartX, a_BlockStartY, a_BlockStartZ, a_StartRadius));
	m_Points.push_back(cCaveDefPoint(a_BlockEndX,   a_BlockEndY,   a_BlockEndZ,   a_EndRadius));

	if ((a_BlockStartY <= 0) && (a_BlockEndY <= 0))
	{
		// Don't bother detailing this cave, it's under the world anyway
		m_MinBlockX = m_MaxBlockX = 0;
		m_MinBlockY = m_MaxBlockY = -1;
		m_MinBlockZ = m_MaxBlockZ = 0;
		return;
	}

	Randomize(a_Noise);
	Smooth();

	// We know that the linear finishing won't affect the bounding box, so let's calculate it now, as we have less data:
	CalcBoundingBox();

	FinishLinear();
}
Пример #2
0
cStructGenRavines::cRavine::cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) :
	super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{
	// Calculate the ravine shape-defining points:
	GenerateBaseDefPoints(a_OriginX, a_OriginZ, a_Size, a_Noise);

	// Smooth the ravine. Two passes are needed:
	Smooth();
	Smooth();

	// Linearly interpolate the neighbors so that they're close enough together:
	FinishLinear();
}