~zjm/Moon3D

ref: 0e81b821a0782674dbed435a58ad682e7aef0282 Moon3D/src/3d/image/project.h -rw-r--r-- 680 bytes
0e81b821Zack Michener wrap rendering objects in a RenderingContext struct 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "../abstract.h"
#include <stdbool.h>

typedef struct Perspective {
	double fov;
	double aspect;
	double near;
	double far;
} Perspective;

typedef enum ProjectionMode {
	ORTHO, PERSPECTIVE
} ProjectionMode;

void InitDeviceTransform(unsigned int width, unsigned int height);
void SetOrtho(AABBox vol);
void SetPerspective(double fov, double aspect, double near, double far);

Transform OrthoProjection(void);
Transform PerspectiveProjection(void);
Transform CameraTransform(void);
Transform GetProjection(void);

Vertex ProjectPoint(Vertex p);
Vertex ViewmapPoint(Vertex p);
Polygon *ProjectPolygon(Polygon *polygon);
void ViewmapPolygon(Polygon *polygon);