Week7 [09/11] - [11/11]
Added Backface Culling Methods to the Model Class Added Depth, Normal and Culled Flag Variables to the Polygon3D Class Added Vector3D Class Added - operator to the Vertex Class Cleaned up Code, Adding Void to Params etc
This commit is contained in:
@ -90,7 +90,9 @@ void Rasteriser::Render(const Bitmap& bitmap)
|
||||
workingMatrix *= currentTransform;
|
||||
}
|
||||
currentModel.ApplyTransformToLocalVertices(workingMatrix);
|
||||
currentModel.CalculateBackfaces(mainCamera);
|
||||
currentModel.ApplyTransformToTransformedVertices(mainCamera.GetCurrentCameraTransformMatrix());
|
||||
currentModel.Sort();
|
||||
currentModel.ApplyTransformToTransformedVertices(_currentPerspectiveMatrix);
|
||||
currentModel.DehomogenizeAllVertices();
|
||||
currentModel.ApplyTransformToTransformedVertices(_currentViewMatrix);
|
||||
@ -139,19 +141,25 @@ void Rasteriser::DrawWireFrame(HDC hDc, Model& model)
|
||||
vector<POINT> pointArray;
|
||||
vector<int> sizeArray;
|
||||
|
||||
int unculledPolyCount = 0;
|
||||
int modelPolygonCount = (int) model.GetPolygonCount();
|
||||
for (int i = 0; i < modelPolygonCount; i++)
|
||||
{
|
||||
int currentPolygonVertexCount = (int) model.GetPolygon(i).GetPolygonVertexCount();
|
||||
for (int j = 0; j < currentPolygonVertexCount; j++)
|
||||
{
|
||||
|
||||
if (!model.GetPolygon(i).GetCulled())
|
||||
{
|
||||
POINT newPoint;
|
||||
newPoint.x = (long) model.GetVertex(i, j).GetX();
|
||||
newPoint.y = (long) model.GetVertex(i, j).GetY();
|
||||
pointArray.push_back(newPoint);
|
||||
int currentPolygonVertexCount = (int)model.GetPolygon(i).GetPolygonVertexCount();
|
||||
for (int j = 0; j < currentPolygonVertexCount; j++)
|
||||
{
|
||||
POINT newPoint;
|
||||
newPoint.x = (long)model.GetVertex(i, j).GetX();
|
||||
newPoint.y = (long)model.GetVertex(i, j).GetY();
|
||||
pointArray.push_back(newPoint);
|
||||
}
|
||||
sizeArray.push_back(currentPolygonVertexCount);
|
||||
unculledPolyCount++;
|
||||
}
|
||||
sizeArray.push_back(currentPolygonVertexCount);
|
||||
}
|
||||
|
||||
PolyPolygon(hDc, pointArray.data(), sizeArray.data(), modelPolygonCount);
|
||||
PolyPolygon(hDc, pointArray.data(), sizeArray.data(), unculledPolyCount);
|
||||
}
|
Reference in New Issue
Block a user