mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-23 20:59:58 +01:00
Add comments
This commit is contained in:
parent
b7de74034d
commit
9fe207eebe
1 changed files with 10 additions and 0 deletions
10
small3dlib.h
10
small3dlib.h
|
@ -1878,6 +1878,11 @@ void S3L_drawScene(S3L_Scene scene)
|
|||
S3L_sortArray[S3L_sortArrayLength].triangleIndex = triangleIndex;
|
||||
S3L_sortArray[S3L_sortArrayLength].sortValue =
|
||||
(transformed0.z + transformed1.z + transformed2.z) >> 2;
|
||||
/* ^ As a simple approximation we sort by the triangle center point,
|
||||
which is a mean coordinate -- we don't actually have to divide by 3
|
||||
(or anything), that is unnecessary for sorting! We shift by 2 just
|
||||
as a fast operation to prevent overflow of the sum ver uint_16t. */
|
||||
|
||||
S3L_sortArrayLength++;
|
||||
#endif
|
||||
}
|
||||
|
@ -1913,6 +1918,11 @@ void S3L_drawScene(S3L_Scene scene)
|
|||
previousModel = modelIndex;
|
||||
}
|
||||
|
||||
/* Here we project the points again, which is redundant and slow as they've
|
||||
already been projected above, but saving the projected points would
|
||||
require a lot of memory, which for small resolutions could be even
|
||||
worse than z-bufer. So this seems to be the best way memory-wise. */
|
||||
|
||||
_S3L_projectVertex(model,triangleIndex,0,&matFinal,
|
||||
&transformed0,scene.camera.focalLength);
|
||||
|
||||
|
|
Loading…
Reference in a new issue