switched d3d im2d to use a VS so we can have fog

This commit is contained in:
aap
2021-02-12 20:09:37 +01:00
parent fb859c0fa6
commit 41ae7b9b61
12 changed files with 275 additions and 76 deletions

View File

@@ -64,15 +64,17 @@ struct Im3DVertex
struct Im2DVertex
{
float32 x, y, z;
float32 q;
//float32 q; // recipz no longer used because we have a vertex stage now
float32 w;
uint32 color;
float32 u, v;
void setScreenX(float32 x) { this->x = x; }
void setScreenY(float32 y) { this->y = y; }
void setScreenZ(float32 z) { this->z = z; }
void setCameraZ(float32 z) { }
void setRecipCameraZ(float32 recipz) { this->q = recipz; }
void setCameraZ(float32 z) { this->w = z; }
// void setRecipCameraZ(float32 recipz) { this->q = recipz; }
void setRecipCameraZ(float32 recipz) { this->w = 1.0f/recipz; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) { this->color = COLOR_ARGB(a, r, g, b); }
void setU(float32 u, float recipZ) { this->u = u; }
void setV(float32 v, float recipZ) { this->v = v; }
@@ -80,8 +82,10 @@ struct Im2DVertex
float getScreenX(void) { return this->x; }
float getScreenY(void) { return this->y; }
float getScreenZ(void) { return this->z; }
float getCameraZ(void) { return 1.0f/this->q; }
float getRecipCameraZ(void) { return this->q; }
// float getCameraZ(void) { return 1.0f/this->q; }
// float getRecipCameraZ(void) { return this->q; }
float getCameraZ(void) { return this->w; }
float getRecipCameraZ(void) { return 1.0f/this->w; }
RGBA getColor(void) { return makeRGBA(this->color>>16 & 0xFF, this->color>>8 & 0xFF,
this->color & 0xFF, this->color>>24 & 0xFF); }
float getU(void) { return this->u; }
@@ -396,6 +400,7 @@ extern void *default_amb_dir_VS;
extern void *default_all_VS;
extern void *default_PS;
extern void *default_tex_PS;
extern void *im2d_VS;
extern void *im2d_PS;
extern void *im2d_tex_PS;
void createDefaultShaders(void);