summaryrefslogtreecommitdiff
path: root/src/core/rasterizer.h
blob: eceb8c7a209056b57aa966815be0a0095e8a8cf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef _SOFTSHADEROOM_GEOMETRY_H_
#define _SOFTSHADEROOM_GEOMETRY_H_

#include "../math/math.h"
#include "shader.h"
#include "clip.h"

void ssrR_putline(int x0, int y0, int x1, int y1, Color color);

float ssrR_area(Vec2* v1, Vec2* v2, Vec2* v3); /*计算三角形面积,注意v1v2v3按逆时针顺序定义*/

bool ssrR_barycentric(Vec2* A, Vec2* B, Vec2* C, Vec2* p, Vec3* out); /*计算重心坐标*/
void ssrR_center(Vec2* A, Vec2* B, Vec2* C, Vec2* out); /*获得重心*/
bool ssrR_ispointintriangle(Vec2* A, Vec2* B, Vec2* C, Vec2* p);

void ssrR_triangle(Vec4* CA, Vec4* CB, Vec4* CC, 
	Vert* A, Vert* B, Vert* C, 
	bool from_reg, 
	ClippedVert* CVA, ClippedVert* CVB, ClippedVert* CVC, 
	Program* program, UniformCollection* uniforms
);

#endif