Browse Source

Fixed some issues with texture atlas generation.

The image is at least stable now, but textures are still not drawing properly.
unrollquadloop
Nico de Poel 3 years ago
parent
commit
297ae187f6
  1. BIN
      atlas-start.tim
  2. 2
      ps1bsp.h
  3. BIN
      test.ps1bsp
  4. 4
      world.c

BIN
atlas-start.tim

2
ps1bsp.h

@ -42,8 +42,8 @@ typedef struct
typedef struct typedef struct
{ {
unsigned char w, h; // These may be necessary for scaling UVs, especially since we use a mix of mip0 and mip1 textures unsigned char w, h; // These may be necessary for scaling UVs, especially since we use a mix of mip0 and mip1 textures
unsigned short tpage; // Texture page in PS1 VRAM (precalculated when generating the texture atlas)
unsigned char uoffs, voffs; // Texture coordinate offset within the texture page unsigned char uoffs, voffs; // Texture coordinate offset within the texture page
unsigned short tpage; // Texture page in PS1 VRAM (precalculated when generating the texture atlas)
unsigned short nextframe; // If non-zero, the texture is animated and this points to the next texture in the sequence unsigned short nextframe; // If non-zero, the texture is animated and this points to the next texture in the sequence
} ps1bsp_texture_t; } ps1bsp_texture_t;

BIN
test.ps1bsp

4
world.c

@ -336,8 +336,8 @@ static void world_drawface(const world_t *world, const ps1bsp_face_t *face)
{ {
const ps1bsp_vertex_t *vert = &world->vertices[faceVertex->index]; const ps1bsp_vertex_t *vert = &world->vertices[faceVertex->index];
*((SVECTOR*)curVec) = *((SVECTOR*)vert); *((SVECTOR*)curVec) = *((SVECTOR*)vert);
curVec->u = faceVertex->u + faceTexture->uoffs;
curVec->v = faceVertex->v + faceTexture->voffs;
curVec->u = (u_short)faceVertex->u + faceTexture->uoffs;
curVec->v = (u_short)faceVertex->v + faceTexture->voffs;
curVec->pad = faceVertex->light; curVec->pad = faceVertex->light;
} }

Loading…
Cancel
Save