#ifndef INCLUDED_SPAN
#define INCLUDED_SPAN

#include "Tapestry.h"
#include "types.h"

#define MAX_TILE_LIST 64

#if 0
typedef struct tile {
    void *tile;
    int tix, tiy;
     //int padding; // 16バイト倍数にする用
} TileInfo, *TileInfoPtr;

typedef struct tile_list {
    int size;
    struct tile_list *next;
    int pad[2];
    TileInfo tileinfo[MAX_TILE_LIST];

    void init(void) {
	size = 0;
	next = 0;
    }
} TileInfoList, *TileInfoListPtr; // 4*4+64*sizeof(Tile) = 16+768
#endif

class Span {
public:
    uint32 *tex_addr;
    int tex_width;
    int tex_height;
    int x;
    int y;
    int length_x;
    float start_z;
    float end_z;
    float tex_x1;
    float tex_x2;
    float tex_y1;
    float tex_y2;
    float normal_x;
    float normal_y;
    float normal_z;

#if 0
    TileInfoListPtr tilelist;
#endif

#if 0
    void init(void) {
	tilelist = 0;
    }
    
    void reinit(void) {
	TileInfoListPtr tlist = this->tilelist;
	TileInfoListPtr t;

	while (tlist) {
	    t = tlist->next;
	    free(tlist);
	    tlist = t;
	}

	tilelist = 0;
    }
#endif
};

typedef Span* SpanPtr;

#endif
