export/import multiple meshes

This commit is contained in:
ABelliqueux 2020-12-30 11:23:36 +01:00
parent abee299c1a
commit fe4f6b2b99
6 changed files with 341 additions and 127 deletions

View File

@ -1,9 +1,10 @@
TARGET = primdrawGT
TARGET = primdrawGT-db-abs
TYPE = ps-exe
SRCS = primdrawGT.c \
SRCS = primdrawGT-db-abs.c \
../common/crt0/crt0.s \
TIM/cube.tim \
TIM/bousai.tim \
CPPFLAGS += -I../psyq/include
LDFLAGS += -L../psyq/lib

BIN
TIM/bousai.tim Normal file

Binary file not shown.

235
cube.c
View File

@ -1,3 +1,10 @@
typedef struct {
TMESH * tmesh;
TIM_IMAGE * tim;
int * index;
u_long * tim_data;
} MESH;
SVECTOR modelCube_mesh[] = {
{20.0,19.999998807907104,-20.0},
{20.0,-20.0,-20.0},
@ -25,42 +32,42 @@ SVECTOR modelCube_normal[] = {
};
SVECTOR modelCube_uv[] = {
83.71398162841797,83.71389770507812, 0, 0,
125.03179168701172,42.396141052246094, 0, 0,
83.71398162841797,42.396141052246094, 0, 0,
125.03179168701172,83.71392059326172, 0, 0,
83.71398162841797,125.03166770935059, 0, 0,
125.03179168701172,125.03169059753418, 0, 0,
1.0784510374069214,83.71392059326172, 0, 0,
42.39619445800781,125.03169059753418, 0, 0,
42.39621353149414,83.71392440795898, 0, 0,
42.39621353149414,125.03166770935059, 0, 0,
83.71398162841797,83.71392440795898, 0, 0,
42.39621353149414,83.71390151977539, 0, 0,
42.39619445800781,1.0783309936523438, 0, 0,
1.0784281492233276,42.39611053466797, 0, 0,
42.39619445800781,42.39612579345703, 0, 0,
42.39619064331055,83.71392059326172, 0, 0,
1.0784281492233276,42.396141052246094, 0, 0,
1.0784281492233276,83.71392059326172, 0, 0,
83.71398162841797,83.71389770507812, 0, 0,
125.03179168701172,83.71390151977539, 0, 0,
125.03179168701172,42.396141052246094, 0, 0,
125.03179168701172,83.71392059326172, 0, 0,
83.71399688720703,83.71392440795898, 0, 0,
83.71398162841797,125.03166770935059, 0, 0,
1.0784510374069214,83.71392059326172, 0, 0,
1.0784281492233276,125.03169059753418, 0, 0,
42.39619445800781,125.03169059753418, 0, 0,
42.39621353149414,125.03166770935059, 0, 0,
83.71398162841797,125.03169059753418, 0, 0,
83.71398162841797,83.71392440795898, 0, 0,
42.39619445800781,1.0783309936523438, 0, 0,
1.0784281492233276,1.0783309936523438, 0, 0,
1.0784281492233276,42.39611053466797, 0, 0,
42.39619064331055,83.71392059326172, 0, 0,
42.39619445800781,42.396141052246094, 0, 0,
1.0784281492233276,42.396141052246094, 0, 0
83.96831512451172,83.97151947021484, 0, 0,
125.9500732421875,41.989776611328125, 0, 0,
83.96831512451172,41.989776611328125, 0, 0,
125.9500732421875,83.9715347290039, 0, 0,
83.96831512451172,125.95329284667969, 0, 0,
125.9500732421875,125.95330047607422, 0, 0,
0.004807233810424805,83.97154235839844, 0, 0,
41.98655319213867,125.95330047607422, 0, 0,
41.98656463623047,83.97154998779297, 0, 0,
41.9865608215332,125.95328521728516, 0, 0,
83.96831512451172,83.97154998779297, 0, 0,
41.98656463623047,83.9715347290039, 0, 0,
41.98655319213867,0.008026123046875, 0, 0,
0.004795968532562256,41.989768981933594, 0, 0,
41.98655319213867,41.989776611328125, 0, 0,
41.986549377441406,83.9715347290039, 0, 0,
0.0047997236251831055,41.989776611328125, 0, 0,
0.004795968532562256,83.97154235839844, 0, 0,
83.96831512451172,83.97151947021484, 0, 0,
125.9500732421875,83.9715347290039, 0, 0,
125.9500732421875,41.989776611328125, 0, 0,
125.9500732421875,83.9715347290039, 0, 0,
83.96832275390625,83.97154998779297, 0, 0,
83.96831512451172,125.95329284667969, 0, 0,
0.004807233810424805,83.97154235839844, 0, 0,
0.004795968532562256,125.95330047607422, 0, 0,
41.98655319213867,125.95330047607422, 0, 0,
41.9865608215332,125.95328521728516, 0, 0,
83.96830749511719,125.95330047607422, 0, 0,
83.96831512451172,83.97154998779297, 0, 0,
41.98655319213867,0.008026123046875, 0, 0,
0.004800975322723389,0.008026123046875, 0, 0,
0.004795968532562256,41.989768981933594, 0, 0,
41.986549377441406,83.9715347290039, 0, 0,
41.98655319213867,41.98979187011719, 0, 0,
0.0047997236251831055,41.989776611328125, 0, 0
};
CVECTOR modelCube_color[] = {
@ -118,10 +125,10 @@ int modelCube_index[] = {
};
TMESH modelCube = {
modelCube_mesh,
modelCube_mesh,
modelCube_normal,
modelCube_uv,
modelCube_color,
modelCube_color,
12
};
@ -130,3 +137,155 @@ extern unsigned long _binary_TIM_cube_tim_end[];
extern unsigned long _binary_TIM_cube_tim_length;
TIM_IMAGE tim_cube;
MESH meshCube = {
&modelCube,
&tim_cube,
modelCube_index,
_binary_TIM_cube_tim_start
};
SVECTOR modelCube1_mesh[] = {
{20.0,20.0,-80.0},
{20.0,-20.0,-80.0},
{-20.00000238418579,-19.999995231628418,-80.0},
{-19.999992847442627,20.000009536743164,-80.0},
{20.000009536743164,19.999990463256836,-40.0},
{19.99998688697815,-20.000011920928955,-40.0},
{-20.000007152557373,-19.999990463256836,-40.0},
{-19.999998807907104,20.0,-40.0}
};
SVECTOR modelCube1_normal[] = {
0.0,-0.0,-1.0,0,
0.0,0.0,1.0,0,
1.0,0.0,-2.384185791015625e-07,0,
-1.1920928955078125e-07,-1.0,-2.9802325229866256e-07,0,
-1.0,2.3841855067985307e-07,-1.4901156930591242e-07,0,
2.3841852225814364e-07,1.0,2.3841852225814364e-07,0,
0.0,0.0,-1.0,0,
0.0,-0.0,1.0,0,
1.0,-5.662441253662109e-07,3.2782537573439186e-07,0,
-5.364418598219345e-07,-1.0,1.1920922560193503e-07,0,
-1.0,2.0861631355728605e-07,-1.1920931797249068e-07,0,
2.3841863594498136e-07,1.0,2.3841863594498136e-07,0
};
SVECTOR modelCube1_uv[] = {
83.31231266260147,83.31549197435379, 0, 0,
124.96608829498291,41.661731481552124, 0, 0,
83.31231266260147,41.661731481552124, 0, 0,
124.96608829498291,83.31550711393356, 0, 0,
83.31231266260147,124.969282746315, 0, 0,
124.96608829498291,124.96929031610489, 0, 0,
0.004769677296280861,83.31551468372345, 0, 0,
41.65853324532509,124.96929031610489, 0, 0,
41.65854460000992,83.31552225351334, 0, 0,
41.658540815114975,124.96927517652512, 0, 0,
83.31231266260147,83.31552225351334, 0, 0,
41.65854460000992,83.31550711393356, 0, 0,
41.65853324532509,0.007963418960571289, 0, 0,
0.004758500028401613,41.66172391176224, 0, 0,
41.65853324532509,41.661731481552124, 0, 0,
41.658529460430145,83.31550711393356, 0, 0,
0.0047622257843613625,41.661731481552124, 0, 0,
0.004758500028401613,83.31551468372345, 0, 0,
83.31231266260147,83.31549197435379, 0, 0,
124.96608829498291,83.31550711393356, 0, 0,
124.96608829498291,41.661731481552124, 0, 0,
124.96608829498291,83.31550711393356, 0, 0,
83.31232023239136,83.31552225351334, 0, 0,
83.31231266260147,124.969282746315, 0, 0,
0.004769677296280861,83.31551468372345, 0, 0,
0.004758500028401613,124.96929031610489, 0, 0,
41.65853324532509,124.96929031610489, 0, 0,
41.658540815114975,124.96927517652512, 0, 0,
83.31230509281158,124.96929031610489, 0, 0,
83.31231266260147,83.31552225351334, 0, 0,
41.65853324532509,0.007963418960571289, 0, 0,
0.004763467703014612,0.007963418960571289, 0, 0,
0.004758500028401613,41.66172391176224, 0, 0,
41.658529460430145,83.31550711393356, 0, 0,
41.65853324532509,41.6617466211319, 0, 0,
0.0047622257843613625,41.661731481552124, 0, 0
};
CVECTOR modelCube1_color[] = {
255,255,255, 0,
255,255,255, 0,
255,0,251, 0,
255,255,255, 0,
255,5,7, 0,
255,255,255, 0,
255,255,255, 0,
255,255,255, 0,
4,18,255, 0,
255,5,7, 0,
255,255,255, 0,
255,255,255, 0,
254,255,23, 0,
122,255,107, 0,
255,255,255, 0,
255,255,255, 0,
255,255,255, 0,
254,255,94, 0,
255,255,255, 0,
35,255,11, 0,
255,255,255, 0,
255,255,255, 0,
255,255,255, 0,
255,5,7, 0,
255,255,255, 0,
255,5,7, 0,
255,255,255, 0,
255,5,7, 0,
255,255,255, 0,
255,255,255, 0,
254,255,23, 0,
255,255,255, 0,
122,255,107, 0,
255,255,255, 0,
54,65,255, 0,
255,255,255, 0
};
int modelCube1_index[] = {
0,2,3,
7,5,4,
4,1,0,
5,2,1,
2,7,3,
0,7,4,
0,1,2,
7,6,5,
4,5,1,
5,6,2,
2,6,7,
0,3,7
};
TMESH modelCube1 = {
modelCube1_mesh,
modelCube1_normal,
modelCube1_uv,
modelCube1_color,
12
};
extern unsigned long _binary_TIM_bousai_tim_start[];
extern unsigned long _binary_TIM_bousai_tim_end[];
extern unsigned long _binary_TIM_bousai_tim_length;
TIM_IMAGE tim_bousai;
MESH meshCube1 = {
&modelCube1,
&tim_bousai,
modelCube1_index,
_binary_TIM_bousai_tim_start
};
MESH * meshes[2] = {
&meshCube,
&meshCube1
};

Binary file not shown.

View File

@ -27,6 +27,15 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
scale = 20
f = open(os.path.normpath(self.filepath),"w+")
# write typedef struct
f.write("typedef struct { \n"+
"\tTMESH * tmesh;\n" +
"\tTIM_IMAGE * tim; \n" +
"\tint * index;\n" +
"\tu_long * tim_data;\n"
"\t} MESH;\n\n")
for m in bpy.data.meshes:
# Write vertices vectors
@ -51,7 +60,8 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
f.write("\n")
f.write("};\n\n")
# Write UVs vectors
# Write UVs vectors if a texture exists
# get name of texture image https://docs.blender.org/api/2.79b/bpy.types.Image.html#bpy.types.Image
# bpy.context.active_object.data.uv_textures.active.data[0].image.name
# bpy.context.active_object.data.uv_textures.active.data[0].image.filepath
@ -60,21 +70,22 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
# get image size x, y
# print(bpy.data.meshes[0].uv_textures[0].data[0].image.size[0]) # x
# print(bpy.data.meshes[0].uv_textures[0].data[0].image.size[1]) # y
f.write("SVECTOR "+"model"+m.name+"_uv[] = {\n")
texture_image = m.uv_textures[0].data[0].image
tex_width = texture_image.size[0]
tex_height = texture_image.size[1]
uv_layer = m.uv_layers[0].data
for i in range(len(uv_layer)):
u = uv_layer[i].uv
# psx UV coordinates are Top Left, while Blender is Bottom Left
f.write("\t"+str(u.x * tex_width)+","+str(tex_height - u.y * tex_height)+", 0, 0")
if i != len(uv_layer) - 1:
f.write(",")
f.write("\n")
f.write("};\n\n")
if len(m.uv_textures) != 0:
f.write("SVECTOR "+"model"+m.name+"_uv[] = {\n")
texture_image = m.uv_textures[l].data[0].image
tex_width = texture_image.size[0]
tex_height = texture_image.size[1]
uv_layer = m.uv_layers[0].data
for i in range(len(uv_layer)):
u = uv_layer[i].uv
ux = u.x * tex_width
uy = u.y * tex_height
f.write("\t"+str(ux)+","+str(tex_height - uy)+", 0, 0")
if i != len(uv_layer) - 1:
f.write(",")
f.write("\n")
f.write("};\n\n")
# Write vertex colors vectors
f.write("CVECTOR "+"model"+m.name+"_color[] = {\n")
@ -90,9 +101,9 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
else:
for i in range(len(m.polygons) * 3):
if i % 3 == 0:
f.write("\t200,200,200,0") # Let's add a bit more relief with a shade of grey
f.write("\t80,80,80,0") # Let's add a bit more relief with a shade of grey
else:
f.write("\t255,255,255,0")
f.write("\t128,128,128,0")
if i != (len(m.polygons) * 3) - 1:
f.write(",")
f.write("\n")
@ -110,10 +121,13 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
# Write TMESH struct
f.write("TMESH "+"model"+m.name+" = {\n")
f.write("\t"+"model"+m.name+"_mesh,\n")
f.write("\t"+"model"+m.name+"_mesh, \n")
f.write("\t"+"model"+m.name+"_normal,\n")
f.write("\t"+"model"+m.name+"_uv,\n")
f.write("\t"+"model"+m.name+"_color,\n")
if len(m.uv_textures) != 0:
f.write("\t"+"model"+m.name+"_uv,\n")
else:
f.write("\t0,\n")
f.write("\t"+"model"+m.name+"_color, \n")
# According to libgte.h, TMESH.len should be # of vertices. Meh...
f.write("\t"+str(len(m.polygons))+"\n")
@ -121,13 +135,28 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
# write texture binary name and declare TIM_IMAGE
# by default, load the file from the TIM folder
tex_name = texture_image.name
prefix = str.partition(tex_name, ".")[0]
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_start[];\n")
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_end[];\n")
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_length;\n\n")
f.write("TIM_IMAGE tim_" + prefix + ";\n")
if len(m.uv_textures) != 0:
tex_name = texture_image.name
prefix = str.partition(tex_name, ".")[0]
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_start[];\n")
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_end[];\n")
f.write("extern unsigned long "+"_binary_TIM_" + prefix + "_tim_length;\n\n")
f.write("TIM_IMAGE tim_" + prefix + ";\n\n")
f.write("MESH mesh"+m.name+" = {\n")
f.write("\t&model"+ m.name +",\n")
f.write("\t&tim_"+ prefix + ",\n")
f.write("\tmodel" + m.name + "_index,\n")
f.write("\t_binary_TIM_" + prefix + "_tim_start\n")
f.write("};\n\n")
f.write("MESH * meshes[" + str(len(bpy.data.meshes)) + "] = {\n")
for k in range(len(bpy.data.meshes)):
f.write("\t&mesh" + bpy.data.meshes[k].name)
if k != len(bpy.data.meshes) - 1:
f.write(",\n")
f.write("\n}; \n")
f.close()
return {'FINISHED'};

View File

@ -1,7 +1,6 @@
/* primdrawG.c, by Schnappy, 12-2020
- Draw a gouraud shaded mesh exported as a TMESH by the blender <= 2.79b plugin io_export_psx_tmesh.py
- Draw a gouraud shaded, UV textured mesh exported by the blender <= 2.79b plugin io_export_psx_tmesh.py
based on primdraw.c by Lameguy64 (http://www.psxdev.net/forum/viewtopic.php?f=64&t=537)
2014 Meido-Tek Productions.
@ -39,7 +38,8 @@
// Sample vector model
#include "cube.c"
#define VMODE 0
#define VMODE 1
#define HAS_TEX 0
#define SCREENXRES 320
#define SCREENYRES 240
@ -48,7 +48,7 @@
#define CENTERY SCREENYRES/2
#define OTLEN 2048 // Maximum number of OT entries
#define PRIMBUFFLEN 32768 // Maximum number of POLY_GT3 primitives
#define PRIMBUFFLEN 1024 * sizeof(POLY_GT3) // Maximum number of POLY_GT3 primitives
// Display and draw environments, double buffered
DISPENV disp[2];
@ -61,8 +61,9 @@ char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
char * nextpri = primbuff[0]; // Primitive counter
short db = 0; // Current buffer counter
char db = 0; // Current buffer counter
short vs;
//~ RECT ClearRect ={0,0,320,240};
//~ extern unsigned long _binary_TIM_bousai_tim_start[];
@ -71,6 +72,7 @@ short db = 0; // Current buffer counter
//~ TIM_IMAGE bousai;
//~ static int frame = 0;
// Prototypes
void init(void);
@ -101,8 +103,8 @@ void init(){
disp[1].screen.y += 8;
}
setRGB0(&draw[0], 0, 0, 255);
setRGB0(&draw[1], 0, 0, 255);
setRGB0(&draw[0], 80, 80, 255);
setRGB0(&draw[1], 80, 80, 255);
draw[0].isbg = 1;
draw[1].isbg = 1;
@ -119,7 +121,7 @@ void init(){
void display(void){
DrawSync(0);
VSync(0);
vs = VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
@ -175,10 +177,13 @@ int main() {
init();
LoadTexture(_binary_TIM_cube_tim_start, &tim_cube);
for (int k = 0; k < sizeof(meshes)/sizeof(TMESH *); k++){
LoadTexture(meshes[k]->tim_data, meshes[k]->tim);
}
// Main loop
while (1) {
//~ while ((VSync(-1) - frame) < 1){
// Read pad status
PadStatus = PadRead(0);
@ -192,8 +197,8 @@ int main() {
if (PadStatus & PADLup) Rotate.vx -= 8;
if (PadStatus & PADLdown) Rotate.vx += 8;
if (PadStatus & PADLleft) Rotate.vy -= 8;
if (PadStatus & PADLright) Rotate.vy += 8;
if (PadStatus & PADLleft) Rotate.vy -= 14;
if (PadStatus & PADLright) Rotate.vy += 14;
if (PadStatus & PADRup) Trans.vy -= 2;
if (PadStatus & PADRdown) Trans.vy += 2;
@ -240,58 +245,73 @@ int main() {
SetRotMatrix(&Matrix);
SetTransMatrix(&Matrix);
// Render the sample vector model
t=0;
for (int k = 0; k < sizeof(meshes)/sizeof(TMESH *); k++){
// modelCube is a TMESH, len member == # vertices, but here it's # of triangle... So, for each tri * 3 vertices ...
for (i = 0; i < (modelCube.len*3); i += 3) {
poly = (POLY_GT3 *)nextpri;
// Initialize the primitive and set its color values
SetPolyGT3(poly);
((POLY_GT3 *)poly)->tpage = getTPage(tim_cube.mode&0x3, 0,
tim_cube.prect->x,
tim_cube.prect->y
);
setRGB0(poly, modelCube.c[i].r , modelCube.c[i].g , modelCube.c[i].b);
setRGB1(poly, modelCube.c[i+1].r, modelCube.c[i+1].g, modelCube.c[i+1].b);
setRGB2(poly, modelCube.c[i+2].r, modelCube.c[i+2].g, modelCube.c[i+2].b);
setUV3(poly, modelCube.u[i].vx, modelCube.u[i].vy,
modelCube.u[i+1].vx, modelCube.u[i+1].vy,
modelCube.u[i+2].vx, modelCube.u[i+2].vy);
// Rotate, translate, and project the vectors and output the results into a primitive
OTz = RotTransPers(&modelCube_mesh[modelCube_index[t]] , (long*)&poly->x0, &p, &Flag);
OTz += RotTransPers(&modelCube_mesh[modelCube_index[t+1]], (long*)&poly->x1, &p, &Flag);
OTz += RotTransPers(&modelCube_mesh[modelCube_index[t+2]], (long*)&poly->x2, &p, &Flag);
// Sort the primitive into the OT
OTz /= 3;
if ((OTz > 0) && (OTz < OTLEN))
AddPrim(&ot[db][OTz-2], poly);
nextpri += sizeof(POLY_GT3);
// Render the sample vector model
t=0;
t+=3;
}
// modelCube is a TMESH, len member == # vertices, but here it's # of triangle... So, for each tri * 3 vertices ...
for (i = 0; i < (meshes[0]->tmesh->len * 3); i += 3) {
poly = (POLY_GT3 *)nextpri;
// Initialize the primitive and set its color values
SetPolyGT3(poly);
setRGB0(poly, meshes[k]->tmesh->c[i].r , meshes[k]->tmesh->c[i].g , meshes[k]->tmesh->c[i].b);
setRGB1(poly, meshes[k]->tmesh->c[i+1].r, meshes[k]->tmesh->c[i+1].g, meshes[k]->tmesh->c[i+1].b);
setRGB2(poly, meshes[k]->tmesh->c[i+2].r, meshes[k]->tmesh->c[i+2].g, meshes[k]->tmesh->c[i+2].b);
((POLY_GT3 *)poly)->tpage = getTPage(meshes[k]->tim->mode&0x3, 0,
meshes[k]->tim->prect->x,
meshes[k]->tim->prect->y
);
// The TIMs are loaded in vram vertically on the same TPAGE; eg. Tim1 640,0, Tim1 640, 128
// We then add tim_image.prect.y to the y coord of the uvs to use the correct texture.
setUV3(poly, meshes[k]->tmesh->u[i].vx , meshes[k]->tmesh->u[i].vy + meshes[k]->tim->prect->y,
meshes[k]->tmesh->u[i+1].vx, meshes[k]->tmesh->u[i+1].vy + meshes[k]->tim->prect->y,
meshes[k]->tmesh->u[i+2].vx, meshes[k]->tmesh->u[i+2].vy + meshes[k]->tim->prect->y);
// Rotate, translate, and project the vectors and output the results into a primitive
OTz = RotTransPers(&meshes[k]->tmesh->v[meshes[k]->index[t]] , (long*)&poly->x0, &p, &Flag);
OTz += RotTransPers(&meshes[k]->tmesh->v[meshes[k]->index[t+1]], (long*)&poly->x1, &p, &Flag);
OTz += RotTransPers(&meshes[k]->tmesh->v[meshes[k]->index[t+2]], (long*)&poly->x2, &p, &Flag);
// Using RotTransPers3 is a bit faster (-31ms/frame), but you loose precision for Z-ordering
//~ OTz = RotTransPers3(
//~ &meshes[k]->tmesh->v[meshes[k]->index[t]],
//~ &meshes[k]->tmesh->v[meshes[k]->index[t+1]],
//~ &meshes[k]->tmesh->v[meshes[k]->index[t+2]],
//~ (long*)&poly->x0, (long*)&poly->x1, (long*)&poly->x2,
//~ &p,
//~ &Flag
//~ );
// Sort the primitive into the OT
OTz /= 3;
if ((OTz > 0) && (OTz < OTLEN))
AddPrim(&ot[db][OTz-2], poly);
nextpri += sizeof(POLY_GT3);
t+=3;
}
}
dr_mode = (DR_MODE *)nextpri;
setDrawMode(dr_mode,1,0, getTPage(tim_cube.mode&0x3, 0,
tim_cube.prect->x,
tim_cube.prect->y), &tws); //set texture window
//~ dr_mode = (DR_MODE *)nextpri;
AddPrim(&ot[db], dr_mode);
nextpri += sizeof(DR_MODE);
//~ setDrawMode(dr_mode,1,0, getTPage(tim_cube.mode&0x3, 0,
//~ tim_cube.prect->x,
//~ tim_cube.prect->y), &tws); //set texture window
//~ AddPrim(&ot[db], dr_mode);
//~ nextpri += sizeof(DR_MODE);
// Render the banner (FntPrint is always on top because it is not part of the OT)
//~ #if HI_RES
@ -300,12 +320,17 @@ int main() {
//~ FntPrint("\n\nGOURAUD SHADED TMESH EXAMPLE\n");
//~ FntPrint("SCHNAPPY, 2020 \n");
//~ FntPrint("BASED ON PRIMDRAW BY LAMEGUY64, 2014 \n");
FntPrint("# tris :%d \n", modelCube.len);
FntPrint("Vsync :%d \n", vs);
FntPrint("%d ", sizeof(meshes)/sizeof(TMESH *));
FntPrint("%d ", meshes[0]->tim->prect->y);
FntFlush(-1);
display();
//~ frame = VSync(-1);
}
return 0;
}