updated render testing.

This commit is contained in:
madrocketsci committed 2025-10-24 13:12:17 -04:00
1 parent 91a7c7d50c
commit 4b5354f1c6
5 files changed
+16 -6

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -203,12 +203,18 @@ void test_fontatlas2()
void test_rendertext_simple1() void test_rendertext_simple1()
{ {
int I; int I;
amsstring s = "Hello World.\n This is a newline."; amsstring s = "Hello World.\n This is a newline.\nCan you see the dangling chars?\n\ttabby tab tab.";
amsfontatlas fa; amsfontatlas fa;
rendertext_simple_pars rpars; rendertext_simple_pars rpars;
rendertext_simple_mesh mesh; rendertext_simple_mesh mesh;
amsimage fontrender;
fa.load("../notes/amstestfont.amsfont"); fa.load("../notes/amstestfont.amsfont");
fa.rendercontrol.spacewidth = fa.charheight*0.5;
fa.rendercontrol.tabwidth = fa.rendercontrol.spacewidth*3;
fa.rendercontrol.print();
printf("debug: fa.Nglyphs: %d, range length %d\n",fa.Nglyphs,(int) fa.range.length); printf("debug: fa.Nglyphs: %d, range length %d\n",fa.Nglyphs,(int) fa.range.length);
// for(I=0;I<fa.range.length;I++) // for(I=0;I<fa.range.length;I++)
@@ -216,15 +222,19 @@ void test_rendertext_simple1()
// fa.range[I].print(); // fa.range[I].print();
// } // }
rpars.charheight = 30;
rpars.color = amspixel(255,0,0,255);
rendertext_simple( rendertext_simple(
s,fa,rpars,&mesh s,fa,rpars,&mesh
); );
for(I=0;I<mesh.vertices.length/3;I++) // for(I=0;I<mesh.vertices.length/3;I++)
{ // {
printf("%d: (%1.3f, %1.3f, %1.3f)\n",I,mesh.vertices[3*I+0],mesh.vertices[3*I+1],mesh.vertices[3*I+2]); // printf("%d: (%1.3f, %1.3f, %1.3f)\n",I,mesh.vertices[3*I+0],mesh.vertices[3*I+1],mesh.vertices[3*I+2]);
} // }
rendertext_rendertoimg(&mesh,&fa,&fontrender);
write_image("../notes/testfontrender.png",&fontrender);
return; return;
} }