~zjm/Moon3D

ref: 0e81b821a0782674dbed435a58ad682e7aef0282 Moon3D/src/3d/render.h -rw-r--r-- 759 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
#pragma once

#include <stdint.h>
#include "abstract.h"
#include "world.h"
#include "device.h"
#include "image.h"

typedef struct RenderingContext {
	Viewport *viewport;
	Camera *camera;
	RasterSettings settings;
} RenderingContext;

RenderingContext MakeRenderingContext(Viewport *viewport, Camera *camera, RasterSettings settings);
void DrawObject(Object *object, LightSource **lights, RenderingContext context);
void DrawPolygon(Polygon *polygon, Color color, RenderingContext context);
void WireframePolygon(Polygon *polygon, Color color, Viewport *viewport);
void DrawPoint(Point *p, RenderingContext context);
void DrawLine(Vertex a, Vertex b, Color color, Viewport *viewport);
void DrawAxes(Viewport *viewport);
bool BackfaceCulled(Polygon *polygon);