view libps2.h @ 134:42337585fb7c

fix merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 22 Jul 2011 18:32:39 +0900
parents 4f50f5a3b363
children 993d5f7e5f30
line wrap: on
line source


#ifndef LIBPS2_H
#define LIBPS2_H

#include "SceneGraph.h"

//dummy file

typedef float FVECTOR[4] __attribute__((aligned (16)));
typedef float FMATRIX[4][4] __attribute__((aligned (16)));
//typedef float FMATRIX[4][4];
//typedef float** FMATRIX;

//Object.h よりコピー
/*
typedef struct texture {
  int width;                 // texture's width size
  int height;                // texture's height size
  char *name;                // texture's name
  //  TexEnv *texenv;
  char *free_texenv;         // pointer for free texenv
  char *free_image;          // pointer for free actual image data
  //  struct ps2_image g_img;    // this struct must not be alignmented by 128bit
} TEXTURE;
*/

/*
//また object.h よりコピー cerium 側にあわせる
typedef struct surface {
  int size;
  char *surf_name;          // object's surface name                          
  char *tex_name;           // surface's texture name                         
  //TEXTURE *texture;         // pointer of this surface's texture              
  //  ps2_giftag giftag;        // own GIFtag data                                
  //  ps2_dmatag *packet;       // pointer of actual object data                  
  char *free_packet;        // pointer for free object data                   
  struct surface *next;
} SURFACE;
*/

//またまた object.h よりコピー
//本当はSceneGraphで代用?

typedef struct object {
  FVECTOR xyz;              // position
  FVECTOR angle;            // angle
  //FMATRIX transfer;         // transfer matrix
  //char *name;               // object's name
  char *free_me;            // pointer for free myself
  //SURFACE *surfaces;        //ポリゴン?

  // 計算用なのかな。
  // なにも考えずに,SceneGraph内のmatrixに渡せば良いか
  FMATRIX transfer;

  // xmlファイル内の 各 surface name の文字列入れる
  // 要素数は名前の文字数の最大数。
  char *partName[64];

  // surface数. 一つのオブジェクトが持つpartの数
  int partNum;

} OBJECT;



//typedef SceneGraph OBJECT;

/*
class OBJECT : public SceneGraph{
 public:
  FMATRIX transfer;         // transfer matrix  SceanGraph 内の matrix

  void setTransfer(void)
  {
    memcpy(transfer, this->matrix, sizeof(FMATRIX) );
  }
  
  void setMatrix(void)
  {
    memcpy(transfer, this->matrix, sizeof(FMATRIX) );
  }
  
};
*/

// sprite.hから
typedef struct {
  //__u64 rgbaq;
  // __u64 rgbaq_addr;
  // __u64 st;
  // __u64 st_addr;
  // __u64 xyz;
  //  __u64 xyz_addr;

  int xyz_addr;

} GsPrim;


typedef struct {
  //ps2_giftag giftag;
  //__u64 prim;
  //__u64 prim_addr;
  GsPrim primData[4];

  int x;
} GsSpritePacket;


//ps2 依存関係内の libps2.h からもってきた
typedef struct {

  GsSpritePacket* gs_packet;
  unsigned char r, g, b, a;
  unsigned short cx, cy;
  unsigned short x, y, w, h;
  unsigned short tex_x, tex_y, tex_w, tex_h;
  unsigned long priority;
  float scale;
  float rot;

} SPRITE;


/*
  構造体 PolygonInfo が見当たらないので自作
  作りは適当
*/
typedef struct popygon {
  int siz;
  FVECTOR pnts; // pointer'sかな
} PolygonInfo;

int malloc_align16(void *head, void *aligned, int size);

#endif