view TaskManager/Test/test_render/polygon_pack.h @ 186:06cdf8baa989 draft

fix
author gongo@localhost.localdomain
date Tue, 06 Jan 2009 16:18:37 +0900
parents 2c7d9057dd5d
children e75f9eb97180
line wrap: on
line source

#ifndef INCLUDED_POLYGON_PACK
#define INCLUDED_POLYGON_PACK

#ifndef INCLUDED_TYPES
#  include "types.h"
#endif

#define MAX_SIZE_TRIANGLE 128

typedef struct VertexPack {
    float x;
    float y;
    float z;
    float tex_x;
    float tex_y;
} VertexPack, *VertexPackPtr; // 20 byte


typedef struct TrianglePack {
    struct {
	uint32 *addr;
	int width;
	int height;
	int scale_max;
    } tex_info;

    VertexPack ver1;
    VertexPack ver2;
    VertexPack ver3;

} TrianglePack, *TrianglePackPtr; //4*4 + 20*3 = 76


typedef struct PolygonPack {
    struct PORIGON_info {
	int size;
	int light_pos[3];
	int light_rgb[3];
    }info;

    TrianglePack tri[MAX_SIZE_TRIANGLE];

    PolygonPack* next;

    void init(void) {
	info.size = 0;
	next = 0;
    }

    void clear(void) {
	PolygonPack *q = 0;
	PolygonPack *q1 = 0;
	
	q = this->next;
	while (q) {
	    q1 = q->next;
	    delete(q);
	    q = q1;
	}
	this->init();
    }
} PolygonPack, *PolygonPackPtr; // 4*7 + 76*128 + 4 = 9760

typedef struct PolygonPackList {
    int size;
    PolygonPack *list;
} PolygonPackList;

#endif