Untitled

mail@pastecode.io avatar
unknown
c_cpp
4 months ago
562 B
10
Indexable
Never
__inline bool GraphicsConvertToWindowSpace(Vertex* inV, Vertex* outV, float* matrix)
{
	Vertex v = *inV;
	if (!GraphicsProjectVertex(&v, (float*)matrix)) // Если вершина не проходит в клиппинг - мы не рисуем весь примитив
		return false;

	outV->X = XVALUE_TO_WINDOW_SPACE(v.X / v.Q, 640);
	outV->Y = YVALUE_TO_WINDOW_SPACE(v.Y / v.Q, 480);
	outV->Z = 65535.0f / absF(v.Z);
	outV->Q = 1 / v.Q;

	outV->tmuvtx[0].U = v.tmuvtx[0].U / v.Q;
	outV->tmuvtx[0].V = v.tmuvtx[0].V / v.Q;

	return true;
}
Leave a Comment