.. (לתיקייה המכילה) | ||
What should we do with polygons which are partially outside the scene? | |
When a polygon is partially out of the scene, either in the X-Y axis or the Z axis it should be cut so the part that is inside the scene is still properly rendered. DO NOT cut the entire polygon. |
Can we use an external linear algebra library in our code ? | |
Any usage of external linear algebra library is *NOT* allowed. You need to implement all the appropriate classes for vectors and matrices together with their operations. |
Can we use the MoveTo and LineTo method sof CDC ? | |
As mentioned in the exercise, you are *NOT* allowed to use the MoveTo and LineTo methods of CDC. You can use either the SetPixel method or the BitBlt method of CDC, where the *BitBlt* is much preferred due to its better performance. |
Can we use <math.h> for trigonometric functions, root calculations etc. ? | |
Yes, you can. |
Can we use std::vector, std::map etc. ? | |
Yes, you can, as long as you do *NOT* use some matrix implementation. |
When trying to execute the hw example executable CGWork.exe I get the following error: | |
Try installing: Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update: https://www.microsoft.com/en-us/download/details.aspx?id=26347 If not working, try also installing: Visual C++ Redistributable for Visual Studio 2012 Update 4: https://www.microsoft.com/en-us/download/details.aspx?id=30679 If it still doesn't work - you can contact the TA for further specific help. |
Where can we find more model examples ? | |
http://www.cs.technion.ac.il/~irit/data/ And specifically a model which is represented by splines: http://www.cs.technion.ac.il/~irit/data/teapot.itd.gz |
A few models in the scene | |
A few models can be loaded to the scene either by loading a file that contains a few models, and / or by loading a few files |
The example program doesn't work exactly as required in the homework description. | |
As indicated in the homework: In a case of a discrepancy between the example project and the description, the description will govern. Don't decide how things should behave based on how they behave in the example program! |
Regarding the perspective projection. | |
You don't need to implement clipping by Znear and Zfar. If you don't implement clipping and implement the perspective projection as you saw in the lecture (the simple case, not with Perspective Warp) - pay attention to handle the different scenarios appropriately (division by 0, etc.) |
When loading a new IRIT geometry file, your program should initialize the view so that the new object is nicely scaled and positioned in the middle of the screen. | |
So if the file has only one model in it then you use the center its bounding box for that purpose. If you have more than one model in the file then you use the bounding box that bounds all the bounding boxes of all the models in the file for that purpose (which is VERY easy to calculate once you have all the bounding boxes calculated). DO NOT use the origin of the model(s) in the file in order to position it in the middle of the screen. |
Regarding the following sections: | |
You should implement as follows: -------------------------------------------- The color loaded from the OBJECT attribute in the file affects the model edges (i.e. wireframe) and normals. The user can override that color by choosing a new color, which will then affect the model edges (i.e. wireframe) and normals. The user can also set a color to the background of the window, regardless to the color of the model edges / normals described above. |
If you have performance issues with your line drawing code. | |
**** Check out the following code as an example. **** The idea is to work with a 2D matrix that is populated with all the data that needs to be rendered, and then calling BitBlt function only once. void CChildView::OnPaint() { int margin; int w; int h; int x; int y; int ret; COLORREF color; CRect rect; // Client rectangle BITMAPINFO bminfo; color = RGB(0, 0, 100); margin = 10; GetClientRect(&rect); // h = rect.bottom - rect.top; w = rect.right - rect.left; CPaintDC hdc(this); // device context for painting for (x = rect.left + margin; x < rect.right - margin; x++) { for (y = rect.top + margin; y < rect.bottom - margin; y++) { //SetPixel(hdc, x, y, color); } } HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP bm = CreateCompatibleBitmap(hdc, w, h); SelectObject(hdcMem, bm); color = RGB(100, 0, 100); bminfo.bmiHeader.biSize = sizeof(bminfo.bmiHeader); bminfo.bmiHeader.biWidth = w; bminfo.bmiHeader.biHeight = h; bminfo.bmiHeader.biPlanes = 1; bminfo.bmiHeader.biBitCount = 32; bminfo.bmiHeader.biCompression = BI_RGB; bminfo.bmiHeader.biSizeImage = 0; bminfo.bmiHeader.biXPelsPerMeter = 1; bminfo.bmiHeader.biYPelsPerMeter = 1; bminfo.bmiHeader.biClrUsed = 0; bminfo.bmiHeader.biClrImportant = 0; int* bits = new int[h * w]; for (x = rect.left + margin; x < rect.right - margin; x++) { for (y = rect.top + margin; y < rect.bottom - margin; y++) { bits[(x - rect.left) + (w * (y - rect.top))] = color; } } SetDIBits(hdcMem, bm, 0, h, bits, &bminfo, 0); ret = BitBlt(hdc, rect.left, rect.top, rect.right, rect.bottom, hdcMem, rect.left, rect.top, SRCCOPY); DeleteDC(hdcMem); DeleteObject(bm); delete bits; } |