1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-24 21:09: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

15
s3l.h
View file

@ -112,11 +112,17 @@
#include <stdint.h> #include <stdint.h>
#ifndef S3L_RESOLUTION_X #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 #endif
#ifndef S3L_RESOLUTION_Y #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 #endif
#ifndef S3L_PERSPECTIVE_CORRECTION #ifndef S3L_PERSPECTIVE_CORRECTION
@ -151,8 +157,8 @@ typedef int16_t S3L_ScreenCoord;
typedef uint16_t S3L_Index; typedef uint16_t S3L_Index;
#ifndef S3L_NEAR #ifndef S3L_NEAR
#define S3L_NEAR (S3L_FRACTIONS_PER_UNIT) /**< Distance of the near clipping #define S3L_NEAR (S3L_FRACTIONS_PER_UNIT / 4) /**< Distance of the near
plane. */ clipping plane. */
#endif #endif
#ifndef S3L_FAST_LERP_QUALITY #ifndef S3L_FAST_LERP_QUALITY
@ -346,6 +352,7 @@ typedef struct
S3L_Unit barycentric1; ///< Baryc. coord 1 (corresponds to 2nd vertex). S3L_Unit barycentric1; ///< Baryc. coord 1 (corresponds to 2nd vertex).
S3L_Unit barycentric2; ///< Baryc. coord 2 (corresponds to 3rd vertex). S3L_Unit barycentric2; ///< Baryc. coord 2 (corresponds to 3rd vertex).
S3L_Index triangleID; S3L_Index triangleID;
S3L_Unit depth; ///< Depth (only if depth is turned on).
} S3L_PixelInfo; /**< Used to pass the info about a rasterized pixel } S3L_PixelInfo; /**< Used to pass the info about a rasterized pixel
(fragment) to the user-defined drawing func. */ (fragment) to the user-defined drawing func. */

View file

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