Exemple #1
0
void Rasterizer::DrawPolygon(NPolygon poly)
{
	int sides;
	vector<Vertex> vertices = poly.GetVertices();
	NPolygon polex;
	if ( _texMap )
	{
		ProjectVerts(vertices);
		polex = ClipCheck(vertices);
		vector<Edge> edges = polex.GetEdges();
		sides = polex.GetSides();
		if ( sides == 0)
			return;
		CheckEdges(edges , sides);
		DrawSpanBetweenBuffers();
		ResetBounds();
	}
	else
	{
		ProjectVerts(vertices);
		polex = ClipCheck(vertices);
		sides = polex.GetSides();
		vertices = polex.GetVertices();
		if ( sides == 0)
			return;
		for(int i = 0; i < sides; i++)
		{
			DrawLine(vertices[i], vertices[(i+1)%sides]);
		}
	}

}
Exemple #2
0
Rasterizer::Rasterizer(const unsigned width, const unsigned height, const float degrees)
{
	int w = width;
	int h = height;
	SetFov(degrees);
	_leftUBounds = new float[h];
	_rightUBounds = new float[h];
	_leftVBounds = new float[h];
	_rightVBounds = new float[h];
	_leftColor = new Color[h];
	_rightColor = new Color[h];
	_leftZBounds = new float[h];
	_rightZBounds = new float[h];
	_leftBounds = new int[h];
	_rightBounds = new int[h];
	_leftWBounds = new float[h];
	_rightWBounds = new float[h];
	_pixels.resize(width * height);
	_width = w;
	_height = h;
	ResetBounds();
	_nearPlane = 2;
	_farPlane  = 100;
	_zBuff.resize(width * height);
	SetUpMatrices();
	ResetZBuff();
	_basisOrigin = Vertex(0.0f, 0.0f, 0.0f);
	_basisP = Vertex(Color(1.0f, 0.0f, 0.0f), 1.0f, 0.0f, 0.0f);
	_basisQ = Vertex(Color(0.0f, 1.0f, 0.0f), 0.0f, 1.0f, 0.0f);
	_basisR = Vertex(Color(0.0f, 0.0f, 1.0f), 0.0f, 0.0f, 1.0f);
}
void Box3D::SetEmpty()
{
	Tool3D::SetEmpty();
	ResetBounds();

	if ( m_pDocument )
	{
		m_pDocument->UpdateAllViews( MAPVIEW_UPDATE_TOOL );
	}
}
Exemple #4
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
BoundBox::BoundBox(void)
{
    ResetBounds();
}