1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-21 20:39:57 +01:00

Add depth to pixelinfo

This commit is contained in:
Miloslav Číž 2019-05-21 14:13:07 +02:00
parent bf9223c4c4
commit 6ff62a8995
2 changed files with 31 additions and 24 deletions

19
s3l.h
View file

@ -112,15 +112,21 @@
#include <stdint.h>
#ifndef S3L_RESOLUTION_X
#define S3L_RESOLUTION_X 640 //< Redefine to your screen x resolution.
#define S3L_RESOLUTION_X 640 ///< Redefine to your screen x resolution.
#endif
#ifndef S3L_RESOLUTION_Y
#define S3L_RESOLUTION_Y 480 //< Redefine to your screen y resolution.
#define S3L_RESOLUTION_Y 480 ///< Redefine to your screen y resolution.
#endif
#ifndef S3L_COMPUTE_DEPTH
#define S3L_COMPUTE_DEPTH 0 /**< Whether to compute depth for each pixel
(fragment). Some other options may turn this
on. */
#endif
#ifndef S3L_PERSPECTIVE_CORRECTION
#define S3L_PERSPECTIVE_CORRECTION 0 /**< Specifies what type of perspective
#define S3L_PERSPECTIVE_CORRECTION 0 /**< Specifies what type of perspective
correction (PC) to use. Remember
this is an expensive operation!
Possible values:
@ -151,12 +157,12 @@ typedef int16_t S3L_ScreenCoord;
typedef uint16_t S3L_Index;
#ifndef S3L_NEAR
#define S3L_NEAR (S3L_FRACTIONS_PER_UNIT) /**< Distance of the near clipping
plane. */
#define S3L_NEAR (S3L_FRACTIONS_PER_UNIT / 4) /**< Distance of the near
clipping plane. */
#endif
#ifndef S3L_FAST_LERP_QUALITY
#define S3L_FAST_LERP_QUALITY 8 /**< Quality (scaling) of SOME linear
#define S3L_FAST_LERP_QUALITY 8 /**< Quality (scaling) of SOME linear
interpolations. 0 will most likely be
faster, but artifacts can occur for
bigger tris, while higher values can fix
@ -346,6 +352,7 @@ typedef struct
S3L_Unit barycentric1; ///< Baryc. coord 1 (corresponds to 2nd vertex).
S3L_Unit barycentric2; ///< Baryc. coord 2 (corresponds to 3rd vertex).
S3L_Index triangleID;
S3L_Unit depth; ///< Depth (only if depth is turned on).
} S3L_PixelInfo; /**< Used to pass the info about a rasterized pixel
(fragment) to the user-defined drawing func. */

View file

@ -12,7 +12,7 @@
#define S3L_RESOLUTION_X 640
#define S3L_RESOLUTION_Y 480
#define S3L_PERSPECTIVE_CORRECTION 1
#define S3L_PERSPECTIVE_CORRECTION 0
#include "s3l.h"