GLdc/GL/clip.h

51 lines
1.0 KiB
C
Raw Normal View History

#ifndef CLIP_H
#define CLIP_H
#include <stdint.h>
#include "../containers/aligned_vector.h"
#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;
#define A8IDX 3
#define R8IDX 2
#define G8IDX 1
#define B8IDX 0
typedef struct {
/* Same 32 byte layout as pvr_vertex_t */
uint32_t flags;
float xyz[3];
float uv[2];
uint8_t bgra[4];
uint32_t oargb;
2018-08-01 11:00:56 +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 */
float w;
2018-08-19 20:10:42 +00:00
float st[2];
} ClipVertex;
2018-07-16 07:42:15 +00:00
void clipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t);
void clipTriangleStrip(const ClipVertex* vertices, const unsigned int count, AlignedVector* outBuffer);
void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset);
#ifdef __cplusplus
}
#endif
#endif // CLIP_H