Created File struture (markdown)

Schnappy 2021-06-22 18:02:03 +02:00
parent 3f741f2ac7
commit 88244c31c9

65
File-struture.md Normal file

@ -0,0 +1,65 @@
# File structure
**TODO: Update this info**
It generates a C file containing for each mesh in the scene:
* an array of SVECTOR containing the vertices coordinates
* an array of SVECTOR containing the normals
* an array of SVECTOR containing the UV coordinates of the texture
* an array of CVECTOR containing the color of each vertex
* an array of int that describe the relation between the tri meshes
* a TMESH struct to ease access to those arrays
* declarations of the binary in memory
* a TIM_IMAGE struct ready to host the image data
A few usefull stuff for manipulating the mesh :
* a MATRIX that will hold the mesh tranformations
* a VECTOR holding the object's location in world coordinates
* a SVECTOR holding the object's rotation in PSX angle units (1 == 4096)
* a flag isPrism for a pseudo-refraction effect. If 1, texture is the framebuffer draw area ( __WIP__ )
* a long holding p, the depth-cueing interpolation value used by the PSX
For easy access to those, a MESH struct is defined as :
```c
typedef struct MESH {
TMESH * tmesh;
PRIM * index;
TIM_IMAGE * tim;
unsigned long * tim_data;
MATRIX * mat;
VECTOR * pos;
SVECTOR * rot;
short * isRigidBody;
short * isStaticBody;
short * isPrism;
short * isAnim;
short * isActor;
short * isLevel;
short * isBG;
short * isSprite;
long * p;
long * OTz;
BODY * body;
VANIM * anim;
struct NODE * node;
VECTOR pos2D;
} MESH;
```
## TMESH struct :
From `libgte.h` :
```c
typedef struct {
SVECTOR *v; /*shared vertices*/
SVECTOR *n; /*shared normals*/
SVECTOR *u; /*shared texture addresses*/
CVECTOR *c; /*shared colors*/
u_long len; /*mesh length(=#vertex)*/
} TMESH;
```