mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
polymost_invsqrt(), reorganize pthtyp for better member alignment
git-svn-id: https://svn.eduke32.com/eduke32@4636 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0f5be25a68
commit
ff74aa613e
1 changed files with 27 additions and 13 deletions
|
@ -6,7 +6,7 @@
|
||||||
#include "glbuild.h"
|
#include "glbuild.h"
|
||||||
#include "hightile.h"
|
#include "hightile.h"
|
||||||
|
|
||||||
typedef struct { char r, g, b, a; } coltype;
|
typedef struct { uint8_t r, g, b, a; } coltype;
|
||||||
|
|
||||||
extern int32_t rendmode;
|
extern int32_t rendmode;
|
||||||
extern float gtang;
|
extern float gtang;
|
||||||
|
@ -117,6 +117,19 @@ static inline int polymost_is_npotmode(void)
|
||||||
r_npotwallmode;
|
r_npotwallmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline float polymost_invsqrt(float x)
|
||||||
|
{
|
||||||
|
#ifdef B_LITTLE_ENDIAN
|
||||||
|
const float haf = x*.5f;
|
||||||
|
struct conv { union { uint32_t i; float f; } u; } * const n = (struct conv *)&x;
|
||||||
|
n->u.i = 0x5f3759df-(n->u.i>>1);
|
||||||
|
return n->u.f*(1.5f-haf*(n->u.f*n->u.f));
|
||||||
|
#else
|
||||||
|
// this is the comment
|
||||||
|
return 1.f/Bsqrtf(x);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Flags of the <dameth> argument of various functions
|
// Flags of the <dameth> argument of various functions
|
||||||
enum {
|
enum {
|
||||||
DAMETH_CLAMPED = 4,
|
DAMETH_CLAMPED = 4,
|
||||||
|
@ -128,7 +141,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DAMETH_CLAMPED -> PTH_CLAMPED conversion
|
// DAMETH_CLAMPED -> PTH_CLAMPED conversion
|
||||||
#define TO_PTH_CLAMPED(dameth) ((((dameth)&4))>>2)
|
#define TO_PTH_CLAMPED(dameth) (((dameth)&DAMETH_CLAMPED)>>2)
|
||||||
|
|
||||||
// Do we want a NPOT-y-as-classic texture for this <dameth> and <ysiz>?
|
// Do we want a NPOT-y-as-classic texture for this <dameth> and <ysiz>?
|
||||||
static inline int polymost_want_npotytex(int32_t dameth, int32_t ysiz)
|
static inline int polymost_want_npotytex(int32_t dameth, int32_t ysiz)
|
||||||
|
@ -152,18 +165,19 @@ enum {
|
||||||
typedef struct pthtyp_t
|
typedef struct pthtyp_t
|
||||||
{
|
{
|
||||||
struct pthtyp_t *next;
|
struct pthtyp_t *next;
|
||||||
uint32_t glpic;
|
struct pthtyp_t *ofb; // fullbright pixels
|
||||||
int16_t picnum;
|
hicreplctyp *hicr;
|
||||||
char palnum;
|
|
||||||
char shade;
|
|
||||||
char effects;
|
|
||||||
char flags; // 1 = clamped (dameth&4), 2 = hightile, 4 = skybox face, 8 = hasalpha, 16 = hasfullbright, 128 = invalidated
|
|
||||||
char skyface;
|
|
||||||
hicreplctyp *hicr;
|
|
||||||
|
|
||||||
uint16_t sizx, sizy;
|
uint32_t glpic;
|
||||||
float scalex, scaley;
|
vec2f_t scale;
|
||||||
struct pthtyp_t *ofb; // only fullbright
|
vec2_t siz;
|
||||||
|
int16_t picnum;
|
||||||
|
|
||||||
|
char palnum;
|
||||||
|
char shade;
|
||||||
|
char effects;
|
||||||
|
char flags; // 1 = clamped (dameth&4), 2 = hightile, 4 = skybox face, 8 = hasalpha, 16 = hasfullbright, 128 = invalidated
|
||||||
|
char skyface;
|
||||||
} pthtyp;
|
} pthtyp;
|
||||||
|
|
||||||
extern void gloadtile_art(int32_t,int32_t,int32_t,int32_t,pthtyp *,int32_t);
|
extern void gloadtile_art(int32_t,int32_t,int32_t,int32_t,pthtyp *,int32_t);
|
||||||
|
|
Loading…
Reference in a new issue