mirror of
https://github.com/yquake2/ref_vk.git
synced 2024-12-02 16:31:51 +00:00
parent
2df43a26d5
commit
6291bcb84c
3 changed files with 55 additions and 38 deletions
|
@ -197,8 +197,11 @@ typedef struct
|
||||||
void (EXPORT *DrawFill) (int x, int y, int w, int h, int c);
|
void (EXPORT *DrawFill) (int x, int y, int w, int h, int c);
|
||||||
void (EXPORT *DrawFadeScreen) (void);
|
void (EXPORT *DrawFadeScreen) (void);
|
||||||
|
|
||||||
// Draw images for cinematic rendering (which can have a different palette). Note that calls
|
/*
|
||||||
void (EXPORT *DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data);
|
* Draw images for cinematic rendering (which can have a different palette if bits equals to 8).
|
||||||
|
* Note that calls
|
||||||
|
*/
|
||||||
|
void (EXPORT *DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** video mode and refresh state management entry points
|
** video mode and refresh state management entry points
|
||||||
|
@ -278,7 +281,7 @@ void Draw_CharScaled(int x, int y, int num, float scale);
|
||||||
void Draw_TileClear(int x, int y, int w, int h, char *name);
|
void Draw_TileClear(int x, int y, int w, int h, char *name);
|
||||||
void Draw_Fill(int x, int y, int w, int h, int c);
|
void Draw_Fill(int x, int y, int w, int h, int c);
|
||||||
void Draw_FadeScreen(void);
|
void Draw_FadeScreen(void);
|
||||||
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
|
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||||
//int R_Init(void *hinstance, void *hWnd);
|
//int R_Init(void *hinstance, void *hWnd);
|
||||||
//void R_Shutdown(void);
|
//void R_Shutdown(void);
|
||||||
void R_SetPalette(const unsigned char *palette);
|
void R_SetPalette(const unsigned char *palette);
|
||||||
|
|
|
@ -231,7 +231,7 @@ void RE_Draw_CharScaled (int x, int y, int num, float scale);
|
||||||
void RE_Draw_TileClear (int x, int y, int w, int h, char *name);
|
void RE_Draw_TileClear (int x, int y, int w, int h, char *name);
|
||||||
void RE_Draw_Fill (int x, int y, int w, int h, int c);
|
void RE_Draw_Fill (int x, int y, int w, int h, int c);
|
||||||
void RE_Draw_FadeScreen (void);
|
void RE_Draw_FadeScreen (void);
|
||||||
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data);
|
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||||
|
|
||||||
qboolean RE_EndWorldRenderpass( void );
|
qboolean RE_EndWorldRenderpass( void );
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ RE_Draw_StretchRaw
|
||||||
static int vk_rawTexture_height;
|
static int vk_rawTexture_height;
|
||||||
static int vk_rawTexture_width;
|
static int vk_rawTexture_width;
|
||||||
|
|
||||||
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
|
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -272,6 +272,18 @@ void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *d
|
||||||
if (!vk_frameStarted)
|
if (!vk_frameStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (bits == 32)
|
||||||
|
{
|
||||||
|
raw_image32 = malloc(cols * rows * sizeof(unsigned));
|
||||||
|
if (!raw_image32)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(raw_image32, data, cols * rows * sizeof(unsigned));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (r_retexturing->value)
|
if (r_retexturing->value)
|
||||||
{
|
{
|
||||||
// triple scaling
|
// triple scaling
|
||||||
|
@ -297,7 +309,7 @@ void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *d
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_scaled = data;
|
image_scaled = (byte *)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
raw_image32 = malloc(cols * rows * sizeof(unsigned));
|
raw_image32 = malloc(cols * rows * sizeof(unsigned));
|
||||||
|
@ -313,12 +325,13 @@ void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *d
|
||||||
dest[rowOffset + j] = r_rawpalette[palIdx];
|
dest[rowOffset + j] = r_rawpalette[palIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (r_retexturing->value)
|
if (r_retexturing->value)
|
||||||
{
|
{
|
||||||
free(image_scaled);
|
|
||||||
|
|
||||||
int scaled_size = cols * rows;
|
int scaled_size = cols * rows;
|
||||||
|
|
||||||
|
free(image_scaled);
|
||||||
SmoothColorImage(raw_image32, scaled_size, (scaled_size) >> 7);
|
SmoothColorImage(raw_image32, scaled_size, (scaled_size) >> 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +364,7 @@ void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *d
|
||||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.memory,
|
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.memory,
|
||||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: raw texture");
|
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: raw texture");
|
||||||
}
|
}
|
||||||
|
|
||||||
free(raw_image32);
|
free(raw_image32);
|
||||||
|
|
||||||
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
|
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
|
||||||
|
|
Loading…
Reference in a new issue