Well, I’ve been having serious issues getting my 3d cube to display correctly. I’ve tried a lot over the past two days and I can’t do it. The problem is I need it to be a bit generic in its ability to take a shape, and render it without knowing connection points or anything. Theres an engine, which has models, which has faces, which has points. So I render the scene, which renders the models, which renders the edges, which transforms and renders the points. Simple enough. However, because my edge class and point class are split up, as well as trying to be generic, I had to vary from kirupa’s tutorial. Which didn’t work out for me considering I don’t understand the math enough to devise my own methods.
I really think I’d learn better by seeing how this is done. It should help me relate since I know what my code does, I just really don’t know how to use it for the math part.
If anyone could help me with the drawing, I’d be really grateful.
Notes if helping:
I could use it, but z swapping, and is visible isn’t needed, since I’ll be using normals later. I assume the faces will need to be split into triangles.
Alright, so if the mouse is held and moved, it rotates the camera around X/Y axis (that parts in CEngine - line 227). Then I render models (from CEngine), which updates the model (from CModel - line 85) - not sure how to do that part, then renders faces (from CModel) - for some reason I’m not doing any calculations here, then updates and renders the projected points (from CFace - line 173) - I’ve got a load of commented code that didn’t work out in there. There is a CPoint (it’s render is on line 130), but atm it’s not in use because I can’t even get normal numbers to work.
The rotation is like 2 degrees, and that’s converted to radians in CMatrix, so I don’t know why it’s so jumpy. The camera’s z position is being used for the positioning in CModel, that’s why it appears to be rotating, when it shouldn’t.
CCamera is a singleton, so to use the camera anywhere it’s just CCamera.Instance().FUNCTION() or CCamera.Instance().x.
CCamera, CModel, CFace, and CPoint all have a Matrix, a Vector, and a vector for Rotation, as well as the functions to go along: GetXRot/GetZRot/GetYRot, and RotateX/RotateY/RotateZ. I’m using the ones in CCamera, and CModel, but CFace doesn’t have any calculations, and CPoint isn’t in use - the calculations for that are in CFace in the render function.
The fla, swf, and as files are in the attachment. I’d be amazed if anyone helped me out here. Thanks in advance.