view Renderer/Engine/polygon_pack.h @ 1245:a97b4dd4574c draft

Added tag real_matrix for changeset cd50c48f45e7
author Kakeru TAMASIRO <e095736@ie.u-ryukyu.ac.jp>
date Fri, 11 Nov 2011 17:04:13 +0900
parents f308a6bd5479
children ada0b6ff6575
line wrap: on
line source

#ifndef INCLUDED_POLYGON_PACK
#define INCLUDED_POLYGON_PACK

#include "types.h"

#define MAX_SIZE_TRIANGLE 128
//#define MAX_SIZE_TRIANGLE 64

#define POLYGONPACK_SEGMENT_NUM 2

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

typedef struct NormalPack {
  float x;
  float y;
  float z;
} NormalPack, *NormalPackPtr; // 12  

typedef struct TriTexInfo {
    uint32 *addr;
    int width;
    int height;
    int scale_max;
} TriangleTexInfo, *TriangleTexInfoPtr; // 16

typedef struct TrianglePack {
    TriTexInfo tex_info; // 16
    VertexPack ver1;     // 20
    VertexPack ver2;     // 20
    VertexPack ver3;     // 20
    NormalPack normal1;  // 12
    NormalPack normal2;  // 12
    NormalPack normal3;  // 12
} TrianglePack, *TrianglePackPtr; // 112 (16 * 7)


typedef struct PolygonPack {

    TrianglePack tri[MAX_SIZE_TRIANGLE];

    struct POLYGON_info {
	int size;
	int light_pos[3];
	int light_rgb[3];

        int span_num;
        int pad[3];

    }info;

    PolygonPack* next;

    void init(void) {
	info.size = 0;
	info.span_num = 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; // サイズは 14384 みたい。

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

#endif