1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-21 20:39:57 +01:00

Continue image tool

This commit is contained in:
Miloslav Číž 2019-06-03 17:07:40 +02:00
parent bf79f1437e
commit 9d2020b83c
4 changed files with 559 additions and 8777 deletions

File diff suppressed because it is too large Load diff

View file

@ -123,10 +123,11 @@ if GUARDS:
if USE_PALETTE: if USE_PALETTE:
printArray(paletteArray,NAME + "Palette",str(len(paletteArray))) printArray(paletteArray,NAME + "Palette",str(len(paletteArray)))
printArray(imageArray,NAME + "Texture",NAME.upper() + "_WIDTH * " + NAME.upper() + "_HEIGHT * 3") print("#define " + NAME.upper() + "_TEXTURE_WIDTH " + str(OUT_WIDTH))
print("#define " + NAME.upper() + "_TEXTURE_HEIGHT " + str(OUT_HEIGHT))
print("")
print("#define " + NAME.upper() + "_WIDTH " + str(OUT_WIDTH)) printArray(imageArray,NAME + "Texture",NAME.upper() + "_TEXTURE_WIDTH * " + NAME.upper() + "_TEXTURE_HEIGHT * 3")
print("#define " + NAME.upper() + "_HEIGHT " + str(OUT_HEIGHT))
if GUARDS: if GUARDS:
print("\n#endif // guard") print("\n#endif // guard")

View file

@ -35,7 +35,12 @@
CONVENTIONS: CONVENTIONS:
This library should never draw pixels outside the specified screen This library should never draw pixels outside the specified screen
coordinates, so you don't have to check this! boundaries, so you don't have to check this!
You can safely suppose that triangles are rasterized one by one and from top
down, left to right (so you can utilize e.g. various caches), and if sorting
is disabled the order of rasterization will be that specified in the scene
structure (of course, some triangles and models may be skipped).
Angles are in S3L_Units, a full angle (2 pi) is S3L_FRACTIONS_PER_UNITs. Angles are in S3L_Units, a full angle (2 pi) is S3L_FRACTIONS_PER_UNITs.

View file

@ -116,10 +116,10 @@ void houseTex(int32_t u, int32_t v, uint8_t *r, uint8_t *g, uint8_t *b)
if (v < 0) if (v < 0)
v = 0; v = 0;
u %= HOUSE_WIDTH; u %= HOUSE_TEXTURE_WIDTH;
v %= HOUSE_HEIGHT; v %= HOUSE_TEXTURE_HEIGHT;
int index = (v * HOUSE_WIDTH + u) * 3; int index = (v * HOUSE_TEXTURE_WIDTH + u) * 3;
*r = houseTexture[index]; *r = houseTexture[index];
*g = houseTexture[index + 1]; *g = houseTexture[index + 1];
@ -182,8 +182,8 @@ if (p->modelIndex != 0)
uint8_t r,g,b; uint8_t r,g,b;
houseTex( houseTex(
(u / ((float) S3L_FRACTIONS_PER_UNIT)) * HOUSE_WIDTH, (u / ((float) S3L_FRACTIONS_PER_UNIT)) * HOUSE_TEXTURE_WIDTH,
(v / ((float) S3L_FRACTIONS_PER_UNIT)) * HOUSE_HEIGHT, (v / ((float) S3L_FRACTIONS_PER_UNIT)) * HOUSE_TEXTURE_HEIGHT,
&r,&g,&b); &r,&g,&b);
setPixel(p->x,p->y,r,g,b); setPixel(p->x,p->y,r,g,b);
} }