ref: dx2: render textures

This commit is contained in:
lewa_j
2026-01-10 02:43:55 +03:00
parent e704247f9d
commit a58f2ac13b
3 changed files with 19 additions and 0 deletions

View File

@@ -478,6 +478,16 @@ static void D3D_PutProcessVertices(void** dst, DWORD flags, WORD start, WORD cou
*dst = (void*)(((D3DPROCESSVERTICES*)*dst) + 1);
}
static void D3D_PutRenderState(void** dst, D3DRENDERSTATETYPE type, DWORD arg)
{
D3DSTATE* s = (D3DSTATE*)*dst;
s->drstRenderStateType = type;
s->dwArg[0] = arg;
*dst = (void*)(((D3DSTATE*)*dst) + 1);
}
static void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum )
{
if (texnum <= 0 || texnum >= MAX_TEXTURES)
@@ -540,6 +550,11 @@ static void R_DrawStretchPic( float x, float y, float w, float h, float s1, floa
if (!(((ULONG)cur) & 7)) {
D3D_PutInstruction(&cur, D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), 0);
}
D3D_PutInstruction(&cur, D3DOP_STATERENDER, sizeof(D3DSTATE), 2);
D3D_PutRenderState(&cur, D3DRENDERSTATE_TEXTUREHANDLE, tex->d3dHandle);
D3D_PutRenderState(&cur, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_DECAL);
D3D_PutInstruction(&cur, D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), 2);
D3DTRIANGLE* tris = (D3DTRIANGLE*)cur;

View File

@@ -518,6 +518,8 @@ static qboolean GL_UploadTexture(dx_texture_t *tex, rgbdata_t *pic)
#endif
DXCheck(IDirectDraw_CreateSurface(dxc.pdd, &ddsd, &tex->dds, NULL));
DXCheck(IDirectDrawSurface_QueryInterface(tex->dds, &IID_IDirect3DTexture, (void**)&tex->d3dTex));
DXCheck(IDirect3DTexture_GetHandle(tex->d3dTex, dxc.pd3dd, &tex->d3dHandle));
tex->fogParams[0] = pic->fogParams[0];
tex->fogParams[1] = pic->fogParams[1];

View File

@@ -58,6 +58,8 @@ typedef struct dx_texture_s
#endif
IDirectDrawSurface *dds;
IDirect3DTexture *d3dTex;
D3DTEXTUREHANDLE d3dHandle;
uint hashValue;
struct dx_texture_s *nextHash;
} dx_texture_t;