MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / rend_DrawChunkedBitmap

Function rend_DrawChunkedBitmap

renderer/HardwareBaseGPU.cpp:293–323  ·  view source on GitHub ↗

given a chunked bitmap, renders it.

Source from the content-addressed store, hash-verified

291
292// given a chunked bitmap, renders it.
293void rend_DrawChunkedBitmap(chunked_bitmap *chunk, int x, int y, uint8_t alpha) {
294 int *bm_array = chunk->bm_array;
295 int w = chunk->w;
296 int h = chunk->h;
297 int piece_w = bm_w(bm_array[0], 0);
298 int piece_h = bm_h(bm_array[0], 0);
299 int screen_w, screen_h;
300 int i, t;
301 rend_SetZBufferState(0);
302 rend_GetProjectionParameters(&screen_w, &screen_h);
303 for (i = 0; i < h; i++) {
304 for (t = 0; t < w; t++) {
305 int dx = x + (piece_w * t);
306 int dy = y + (piece_h * i);
307 int dw, dh;
308 if ((dx + piece_w) > screen_w)
309 dw = piece_w - ((dx + piece_w) - screen_w);
310 else
311 dw = piece_w;
312 if ((dy + piece_h) > screen_h)
313 dh = piece_h - ((dy + piece_h) - screen_h);
314 else
315 dh = piece_h;
316
317 float u2 = (float)dw / (float)piece_w;
318 float v2 = (float)dh / (float)piece_h;
319 rend_DrawSimpleBitmap(bm_array[i * w + t], dx, dy);
320 }
321 }
322 rend_SetZBufferState(1);
323}
324
325// given a chunked bitmap, renders it.scaled
326void rend_DrawScaledChunkedBitmap(chunked_bitmap *chunk, int x, int y, int neww, int newh, uint8_t alpha) {

Callers 8

ui_DrawBitmapFunction · 0.50
TelcomDrawScreenFunction · 0.50
BltBmpToScreenFunction · 0.50
InitMessageFunction · 0.50
DrawLargeBitmapFunction · 0.50
ShowStaticScreenFunction · 0.50
Credits_DisplayFunction · 0.50

Calls 5

bm_wFunction · 0.85
bm_hFunction · 0.85
rend_SetZBufferStateFunction · 0.70
rend_DrawSimpleBitmapFunction · 0.70

Tested by

no test coverage detected