Brenden
Member
My goal is to draw a 3D cube made out of primitives, for each face, and have the perspective of the cube to be off centered to look toward the top left corner a bit. The one problem is that I want the front face to be perfectly 1 to 1; That means that it should look as if you were to draw the front face facing it directly, or to better state each edge is the same length. Also the cube should be centered on the screen. Here is a rough picture of what it might look like:
I have achieved this through creating a surface and setting the main view to that surface.
Then copying the bottom right corner of that surface to the application surface.
The view and surface are are dubbed the size of the application surface so the aspect ratio should be the same.
Also this is done in the post draw event.
The perspective or projection is moved to be looking from a bit up and to the left but parallel with the cube, so that the cube is within the bottom right corner of the view.
Yet this attempt still has flaws. The face is distorted or skewed just a bit to change the pixels that make up a block on the face or to be precise the whole face.
If you need them here are the varibales for the projection
The cube is drawn with a center at 200, 200, 200 and a width, height and depth of 400
I am also viewing the cube from the negative y axis looking at the positive y.
I have achieved this through creating a surface and setting the main view to that surface.
Then copying the bottom right corner of that surface to the application surface.
The view and surface are are dubbed the size of the application surface so the aspect ratio should be the same.
Also this is done in the post draw event.
The perspective or projection is moved to be looking from a bit up and to the left but parallel with the cube, so that the cube is within the bottom right corner of the view.
Yet this attempt still has flaws. The face is distorted or skewed just a bit to change the pixels that make up a block on the face or to be precise the whole face.
If you need them here are the varibales for the projection
Code:
global.gameWidth = 2732
global.gameHeight = 1536
global.fov = 40;
global.screenDepth = -(((global.gameHeight/2)/tan(degtorad((global.fov)/2)))-200);
xFrom = 1083;
yFrom=global.screenDepth
zFrom=784
xTo=1083
yTo=400
zTo=784
xUp=0
yUp=0
zUp=1
angle=global.fov
var r = view_wview[0] / view_hview[0];
aspect=r
I am also viewing the cube from the negative y axis looking at the positive y.
Last edited: