From 48eb7ca02de9f612083643a4a65043f1f4ea7e6f Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Tue, 5 Jan 2021 13:31:01 +0100 Subject: [PATCH] add cube.c --- cube.c | 291 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 cube.c diff --git a/cube.c b/cube.c new file mode 100644 index 0000000..734e432 --- /dev/null +++ b/cube.c @@ -0,0 +1,291 @@ +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}, + {-20.00000238418579,-19.999996423721313,-20.0}, + {-19.999992847442627,20.000007152557373,-20.0}, + {20.000009536743164,19.99998927116394,20.0}, + {19.99998688697815,-20.000011920928955,20.0}, + {-20.000007152557373,-19.999992847442627,20.0}, + {-19.999998807907104,20.0,20.0} +}; + +SVECTOR modelCube_normal[] = { + 0.0,-0.0,-1.0,0, + 0.0,0.0,1.0,0, + 1.0,0.0,-2.384185791015625e-07,0, + -8.940696716308594e-08,-1.0,-2.9802325229866256e-07,0, + -1.0,2.384185791015625e-07,-1.4901158351676713e-07,0, + 2.6822084464583895e-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, + -4.768372150465439e-07,-1.0,8.940690321423972e-08,0, + -1.0,2.0861631355728605e-07,-1.1920931797249068e-07,0, + 2.0861631355728605e-07,1.0,1.7881397695873602e-07,0 +}; + +SVECTOR modelCube_uv[] = { + 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[] = { + 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 modelCube_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 modelCube = { + modelCube_mesh, + modelCube_normal, + modelCube_uv, + modelCube_color, + 12 +}; + +extern unsigned long _binary_TIM_cube_tim_start[]; +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 +};