2018-05-31 08:38:34 +00:00
|
|
|
#ifndef CLIP_H
|
|
|
|
#define CLIP_H
|
|
|
|
|
2018-07-10 18:48:25 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "../containers/aligned_vector.h"
|
|
|
|
|
2018-05-31 08:38:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CLIP_RESULT_ALL_IN_FRONT,
|
|
|
|
CLIP_RESULT_ALL_BEHIND,
|
|
|
|
CLIP_RESULT_ALL_ON_PLANE,
|
|
|
|
CLIP_RESULT_FRONT_TO_BACK,
|
|
|
|
CLIP_RESULT_BACK_TO_FRONT
|
|
|
|
} ClipResult;
|
|
|
|
|
2018-07-10 18:48:25 +00:00
|
|
|
|
2018-08-20 08:28:30 +00:00
|
|
|
#define A8IDX 3
|
|
|
|
#define R8IDX 2
|
|
|
|
#define G8IDX 1
|
|
|
|
#define B8IDX 0
|
|
|
|
|
|
|
|
|
2018-07-10 18:48:25 +00:00
|
|
|
typedef struct {
|
2018-08-20 20:19:12 +00:00
|
|
|
/* Same 32 byte layout as pvr_vertex_t */
|
2018-07-10 18:48:25 +00:00
|
|
|
uint32_t flags;
|
|
|
|
float xyz[3];
|
|
|
|
float uv[2];
|
2018-08-20 08:28:30 +00:00
|
|
|
uint8_t bgra[4];
|
2018-08-20 20:19:12 +00:00
|
|
|
uint32_t oargb;
|
2018-08-01 11:00:56 +00:00
|
|
|
|
2018-08-20 20:19:12 +00:00
|
|
|
/* Important, we have 24 bytes here. That means when submitting to the SQs we need to
|
|
|
|
* increment the pointer by 6 */
|
2018-08-04 20:00:26 +00:00
|
|
|
float nxyz[3]; /* Normal */
|
2018-07-10 18:48:25 +00:00
|
|
|
float w;
|
2018-08-19 20:10:42 +00:00
|
|
|
float st[2];
|
2018-07-10 18:48:25 +00:00
|
|
|
} ClipVertex;
|
|
|
|
|
2018-07-16 07:42:15 +00:00
|
|
|
void clipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t);
|
2018-09-08 19:53:28 +00:00
|
|
|
void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset, uint8_t fladeShade);
|
2018-07-10 18:48:25 +00:00
|
|
|
|
2018-05-31 08:38:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // CLIP_H
|