this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "added pixelcenter=false argument to the textri() api #1862"

This reverts commit e80e72d49a06b72b428696225f4b17761fbafe82.

nesbox d6e385ca e80e72d4

+21 -50
+2 -3
demos/wasm/src/tic80.zig
··· 133 133 extern fn sfx(id: i32, note: i32, octave: i32, duration: i32, channel: i32, volumeLeft: i32, volumeRight: i32, speed: i32) void; 134 134 extern fn spr(id: i32, x: i32, y: i32, trans_colors: ?[*]const u8, color_count: i32, scale: i32, flip: i32, rotate: i32, w: i32, h: i32) void; 135 135 extern fn sync(mask: i32, bank: i32, tocart: bool) void; 136 - extern fn textri(x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, u1: f32, v1: f32, u2: f32, v2: f32, u3: f32, v3: f32, texsrc: i32, trans_colors: ?[*]const u8, color_count: i32, pixelcenter: bool) void; 136 + extern fn textri(x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, u1: f32, v1: f32, u2: f32, v2: f32, u3: f32, v3: f32, texsrc: i32, trans_colors: ?[*]const u8, color_count: i32) void; 137 137 extern fn tri(x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, color: i32) void; 138 138 extern fn trib(x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, color: i32) void; 139 139 extern fn time() f32; ··· 263 263 const TextriArgs = struct { 264 264 texsrc : i32 = 0, 265 265 transparent: []const u8 = .{}, 266 - pixelcenter: bool = false, 267 266 }; 268 267 269 268 pub fn textri(x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, @"u1": f32, v1: f32, @"u2": f32, v2: f32, @"u3": f32, v3: f32, args: TextriArgs) void { 270 269 const color_count = @intCast(u8,args.transparent.len); 271 270 const trans_colors = args.transparent.ptr; 272 - raw.textri(x1, y1, x2, y2, x3, y3, @"u1", v1, @"u2", v2, @"u3", v3, args.texsrc, trans_colors, color_count, args.pixelcenter); 271 + raw.textri(x1, y1, x2, y2, x3, y3, @"u1", v1, @"u2", v2, @"u3", v3, args.texsrc, trans_colors, color_count); 273 272 } 274 273 275 274 // ----
+3 -4
src/api.h
··· 682 682 \ 683 683 \ 684 684 macro(textri, \ 685 - "textri(x1 y1 x2 y2 x3 y3 u1 v1 u2 v2 u3 v3 texsrc=0 chromakey=-1 pixelcenter=false)", \ 685 + "textri(x1 y1 x2 y2 x3 y3 u1 v1 u2 v2 u3 v3 texsrc=0 chromakey=-1)", \ 686 686 \ 687 687 "It renders a triangle filled with texture from image ram, map ram or vbank.\n" \ 688 688 "Use in 3D graphics.\n" \ ··· 693 693 "Note that the sprite sheet or map in this case is treated as a single large image, " \ 694 694 "with U and V addressing its pixels directly, rather than by sprite ID.\n" \ 695 695 "So for example the top left corner of sprite #2 would be located at u=16, v=0.", \ 696 - 15, \ 696 + 14, \ 697 697 12, \ 698 698 0, \ 699 699 void, \ 700 700 tic_mem*, float x1, float y1, float x2, float y2, float x3, float y3, \ 701 - float u1, float v1, float u2, float v2, float u3, float v3, tic_texture_src texsrc, u8* colors, s32 count, \ 702 - bool pixelcenter) \ 701 + float u1, float v1, float u2, float v2, float u3, float v3, tic_texture_src texsrc, u8* colors, s32 count) \ 703 702 \ 704 703 \ 705 704 macro(clip, \
+1 -4
src/api/js.c
··· 847 847 } 848 848 } 849 849 850 - bool pixelcenter = duk_is_null_or_undefined(duk, 14) ? false : duk_to_boolean(duk, 14); 851 - 852 850 tic_api_textri(tic, pt[0], pt[1], // xy 1 853 851 pt[2], pt[3], // xy 2 854 852 pt[4], pt[5], // xy 3 ··· 856 854 pt[8], pt[9], // uv 2 857 855 pt[10], pt[11], // uv 3 858 856 src, // texture source 859 - colors, count, // chroma 860 - pixelcenter); // pixelcenter 857 + colors, count); // chroma 861 858 862 859 return 0; 863 860 }
+2 -7
src/api/lua.c
··· 435 435 static u8 colors[TIC_PALETTE_SIZE]; 436 436 s32 count = 0; 437 437 tic_texture_src src = tic_tiles_texture; 438 - bool pixelcenter = false; 439 438 440 439 // check for texture src 441 440 if (top >= 13) ··· 472 471 } 473 472 } 474 473 475 - if(top >= 15) 476 - pixelcenter = lua_toboolean(lua, 15); 477 - 478 474 tic_api_textri(tic, pt[0], pt[1], // xy 1 479 475 pt[2], pt[3], // xy 2 480 476 pt[4], pt[5], // xy 3 ··· 482 478 pt[8], pt[9], // uv 2 483 479 pt[10], pt[11], // uv 3 484 480 src, // texture source 485 - colors, count, // chroma 486 - pixelcenter); // pixelcenter 481 + colors, count); // chroma 487 482 } 488 - else luaL_error(lua, "invalid parameters, textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,[src=0],[chroma=off],[pixelcenter=false])\n"); 483 + else luaL_error(lua, "invalid parameters, textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,[src=0],[chroma=off])\n"); 489 484 return 0; 490 485 } 491 486
+3 -4
src/api/mruby.c
··· 301 301 { 302 302 mrb_value chroma = mrb_fixnum_value(0xff); 303 303 mrb_int src = tic_tiles_texture; 304 - mrb_bool pixelcenter = false; 305 304 306 305 mrb_float x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3; 307 - mrb_int argc = mrb_get_args(mrb, "ffffffffffff|iob", 306 + mrb_int argc = mrb_get_args(mrb, "ffffffffffff|io", 308 307 &x1, &y1, &x2, &y2, &x3, &y3, 309 308 &u1, &v1, &u2, &v2, &u3, &v3, 310 - &src, &chroma, &pixelcenter); 309 + &src, &chroma); 311 310 312 311 mrb_int count; 313 312 u8 *chromas; ··· 333 332 tic_api_textri(memory, 334 333 x1, y1, x2, y2, x3, y3, 335 334 u1, v1, u2, v2, u3, v3, 336 - src, chromas, count, pixelcenter); 335 + src, chromas, count); 337 336 338 337 free(chromas); 339 338
+2 -12
src/api/squirrel.c
··· 516 516 count = 1; 517 517 } 518 518 519 - bool pixelcenter = false; 520 - // check for pixel center 521 - if (top >= 15) 522 - { 523 - SQBool b = SQFalse; 524 - sq_getbool(vm, 15, &b); 525 - pixelcenter = (b != SQFalse); 526 - } 527 - 528 519 tic_api_textri(tic, pt[0], pt[1], // xy 1 529 520 pt[2], pt[3], // xy 2 530 521 pt[4], pt[5], // xy 3 ··· 532 523 pt[8], pt[9], // uv 2 533 524 pt[10], pt[11], // uv 3 534 525 src, // texture source 535 - colors, count, // chroma 536 - pixelcenter); // pixel center 526 + colors, count); // chroma 537 527 } 538 - else return sq_throwerror(vm, "invalid parameters, textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,[texsrc=0],[chroma=off],[pixelcenter=false])\n"); 528 + else return sq_throwerror(vm, "invalid parameters, textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,[texsrc=0],[chroma=off])\n"); 539 529 return 0; 540 530 } 541 531
+2 -3
src/api/wasm.c
··· 280 280 m3ApiGetArg (int32_t, texsrc) 281 281 m3ApiGetArgMem (u8*, trans_colors) 282 282 m3ApiGetArg (int8_t, colorCount) 283 - m3ApiGetArg (bool, pixelcenter) 284 283 if (trans_colors == NULL) { 285 284 colorCount = 0; 286 285 } ··· 288 287 tic_mem* tic = (tic_mem*)getWasmCore(runtime); 289 288 290 289 tic_api_textri(tic, x1, y1, x2, y2, x3, y3, 291 - u1, v1, u2, v2, u3, v3, texsrc, trans_colors, colorCount, pixelcenter != 0); 290 + u1, v1, u2, v2, u3, v3, texsrc, trans_colors, colorCount); 292 291 293 292 m3ApiSuccess(); 294 293 } ··· 992 991 _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "trace", "v(*i)", &wasmtic_trace))); 993 992 _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "tri", "v(iiiiiii)", &wasmtic_tri))); 994 993 _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "trib", "v(iiiiiii)", &wasmtic_trib))); 994 + _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "textri", "v(iiiiiiiiiiiiiii)", &wasmtic_textri))); 995 995 _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "vbank", "i(i)", &wasmtic_vbank))); 996 - _ (SuppressLookupFailure (m3_LinkRawFunction (module, "env", "textri", "v(iiiiiiiiiiiiiiii)", &wasmtic_textri))); 997 996 998 997 _catch: 999 998 return result;
+1 -6
src/api/wren.c
··· 76 76 foreign static textri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3)\n\ 77 77 foreign static textri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src)\n\ 78 78 foreign static textri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src, alpha_color)\n\ 79 - foreign static textri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src, alpha_color, pixelcenter)\n\ 80 79 foreign static pix(x, y)\n\ 81 80 foreign static pix(x, y, color)\n\ 82 81 foreign static line(x0, y0, x1, y1, color)\n\ ··· 775 774 count = 1; 776 775 } 777 776 778 - bool pixelcenter = top > 15 ? wrenGetSlotBool(vm, 15) : 0; 779 - 780 777 tic_api_textri(tic, pt[0], pt[1], // xy 1 781 778 pt[2], pt[3], // xy 2 782 779 pt[4], pt[5], // xy 3 ··· 784 781 pt[8], pt[9], // uv 2 785 782 pt[10], pt[11], // uv 3 786 783 src, // texture source 787 - colors, count, // chroma 788 - pixelcenter); // pixelcenter 784 + colors, count); // chroma 789 785 } 790 786 791 787 static void wren_pix(WrenVM* vm) ··· 1380 1376 if (strcmp(signature, "static TIC.textri(_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_textri; 1381 1377 if (strcmp(signature, "static TIC.textri(_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_textri; 1382 1378 if (strcmp(signature, "static TIC.textri(_,_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_textri; 1383 - if (strcmp(signature, "static TIC.textri(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_textri; 1384 1379 1385 1380 if (strcmp(signature, "static TIC.pix(_,_)" ) == 0) return wren_pix; 1386 1381 if (strcmp(signature, "static TIC.pix(_,_,_)" ) == 0) return wren_pix;
+5 -7
src/core/draw.c
··· 635 635 return (b->x - a->x) * (c->y - a->y) - (b->y - a->y) * (c->x - a->x); 636 636 } 637 637 638 - static void drawTri(tic_mem* tic, const Vec2* v0, const Vec2* v1, const Vec2* v2, PixelShader shader, void* data, bool pixelcenter) 638 + static void drawTri(tic_mem* tic, const Vec2* v0, const Vec2* v1, const Vec2* v2, PixelShader shader, void* data) 639 639 { 640 640 ShaderAttr a = {data, v0, v1, v2}; 641 641 ··· 666 666 for(s32 i = 0; i != 3; ++i) 667 667 { 668 668 // pixel center 669 - const double Center = pixelcenter ? 0.5 - 1e-07 : 0.0; 669 + const double Center = 0.5 - 1e-07; 670 670 Vec2 p = {min.x + Center, min.y + Center}; 671 671 672 672 s32 c = (i + 1) % 3, n = (i + 2) % 3; ··· 708 708 &(Vec2){x1, y1}, 709 709 &(Vec2){x2, y2}, 710 710 &(Vec2){x3, y3}, 711 - triColorShader, &color, 712 - true); 711 + triColorShader, &color); 713 712 } 714 713 715 714 void tic_api_trib(tic_mem* tic, float x1, float y1, float x2, float y2, float x3, float y3, u8 color) ··· 800 799 return data->mapping[tic_tool_peek4(data->vram->data, v * TIC80_WIDTH + u)]; 801 800 } 802 801 803 - void tic_api_textri(tic_mem* tic, float x1, float y1, float x2, float y2, float x3, float y3, float u1, float v1, float u2, float v2, float u3, float v3, tic_texture_src texsrc, u8* colors, s32 count, bool pixelcenter) 802 + void tic_api_textri(tic_mem* tic, float x1, float y1, float x2, float y2, float x3, float y3, float u1, float v1, float u2, float v2, float u3, float v3, tic_texture_src texsrc, u8* colors, s32 count) 804 803 { 805 804 TexData texData = 806 805 { ··· 818 817 ? triTexVbankShader 819 818 : texsrc == tic_map_texture 820 819 ? triTexMapShader 821 - : triTexTileShader, &texData, 822 - pixelcenter); 820 + : triTexTileShader, &texData); 823 821 } 824 822 825 823 void tic_api_map(tic_mem* memory, s32 x, s32 y, s32 width, s32 height, s32 sx, s32 sy, u8* colors, u8 count, s32 scale, RemapFunc remap, void* data)