fix coord system

main
Dominik Madarász 2024-09-03 15:18:39 +02:00
parent 9bfb5b47fd
commit 55bb9d26c7
29 changed files with 47369 additions and 47327 deletions

View File

@ -33,7 +33,7 @@ int main() {
for(int z = 0, i = 0; z < 128; ++z) { for(int z = 0, i = 0; z < 128; ++z) {
for(int x = 0; x < 128; ++x, ++i) { for(int x = 0; x < 128; ++x, ++i) {
vec3 pos = vec3(-x*3,0,-z*3); vec3 pos = vec3(-x*3,0,-z*3);
vec3 rot = vec3(0,-90,0); // kgirl: 0,0,0 vec3 rot = vec3(0,0,-180); // kgirl: 0,0,0
vec3 sca = vec3(1,1,1); // kgirl: 2,2,2 vec3 sca = vec3(1,1,1); // kgirl: 2,2,2
compose44(M[i], pos, eulerq(rot), sca); compose44(M[i], pos, eulerq(rot), sca);
} }
@ -98,7 +98,7 @@ int main() {
} }
if( do_showgizmo ) { if( do_showgizmo ) {
static vec3 p = {0,0,0}, r = {0,-90,0}, s = {1,1,1}; static vec3 p = {0,0,0}, r = {0,0,0}, s = {1,1,1};
gizmo(&p, &r, &s); gizmo(&p, &r, &s);
compose44(mdl.pivot, p, eulerq(r), s); compose44(mdl.pivot, p, eulerq(r), s);
} }

View File

@ -25,11 +25,11 @@ int main() {
float brain[4]; // AI float brain[4]; // AI
} player[3] = { } player[3] = {
{ "PLAYER-1", model("kgirls01.fbx", 0), loop(0,60,0.25,0), loop(66,85,0.25,0), // idle anim [0..60], run anim [66..85] { "PLAYER-1", model("kgirls01.fbx", 0), loop(0,60,0.25,0), loop(66,85,0.25,0), // idle anim [0..60], run anim [66..85]
{KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT}, 2, {0.90,0.80}, {-100}, {3, 0.30, 30}, {0}, {1} }, {KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT}, 2, {0.90,0.80}, {0,90}, {3, 0.30, 30}, {0}, {1} },
{ "PLAYER-2", model("george.fbx", 0), loop(0,100,0.25,0), loop(372,396,0.25,0), // idle anim [0..100], run anim [372..396] { "PLAYER-2", model("george.fbx", 0), loop(0,100,0.25,0), loop(372,396,0.25,0), // idle anim [0..100], run anim [372..396]
{KEY_I,KEY_K,KEY_J,KEY_L}, 1, {0.95,0.90}, {-90,-90}, {1.75, 0.25, 24}, {-5}, {1} }, {KEY_I,KEY_K,KEY_J,KEY_L}, 1, {0.95,0.90}, {90,-180}, {1.75, 0.25, 24}, {-5}, {1} },
{ "PLAYER-3", model("alien.fbx", 0), loop(110,208,0.25,0), loop(360,380,0.25,0), // idle anim [110..208], run anim [360..380] { "PLAYER-3", model("alien.fbx", 0), loop(110,208,0.25,0), loop(360,380,0.25,0), // idle anim [110..208], run anim [360..380]
{KEY_W,KEY_S,KEY_A,KEY_D}, 0.85, {0.85,0.75}, {-90,-90}, {3.5, 0.35, 60}, {5}, {1} } {KEY_W,KEY_S,KEY_A,KEY_D}, 0.85, {0.85,0.75}, {90,-180}, {3.5, 0.35, 60}, {5}, {1} }
}; };
// camera that points to origin, skybox, and a background tune // camera that points to origin, skybox, and a background tune

View File

@ -61,7 +61,6 @@ int main() {
object_diffuse(obj1, t1); object_diffuse(obj1, t1);
object_scale(obj1, vec3(3,3,3)); object_scale(obj1, vec3(3,3,3));
object_move(obj1, vec3(-10+5*0,0,-10)); object_move(obj1, vec3(-10+5*0,0,-10));
object_pivot(obj1, vec3(0,90,0));
// spawn object2 (matcap) // spawn object2 (matcap)
object_t* obj2 = scene_spawn(); object_t* obj2 = scene_spawn();
@ -69,7 +68,6 @@ int main() {
object_diffuse(obj2, t2); object_diffuse(obj2, t2);
object_scale(obj2, vec3(3,3,3)); object_scale(obj2, vec3(3,3,3));
object_move(obj2, vec3(-10+5*2,0,-10)); object_move(obj2, vec3(-10+5*2,0,-10));
object_pivot(obj2, vec3(0,90,0));
// spawn object3 (video) // spawn object3 (video)
object_t* obj3 = scene_spawn(); object_t* obj3 = scene_spawn();
@ -77,15 +75,13 @@ int main() {
object_diffuse(obj3, video_textures(v)[0]); object_diffuse(obj3, video_textures(v)[0]);
object_scale(obj3, vec3(3,3,3)); object_scale(obj3, vec3(3,3,3));
object_move(obj3, vec3(-10+5*1,0,-10)); object_move(obj3, vec3(-10+5*1,0,-10));
object_pivot(obj3, vec3(0,90,0));
// spawn object4 (pbr) // spawn object4 (pbr)
object_t* obj4 = scene_spawn(); object_t* obj4 = scene_spawn();
object_model(obj4, m3); object_model(obj4, m3);
object_scale(obj4, vec3(3,3,3)); object_scale(obj4, vec3(3,3,3));
object_move(obj4, vec3(-10+6*3,0,-10)); object_move(obj4, vec3(-10+6*3,0,-10));
// object_pivot(obj4, vec3(0,0,90)); object_pivot(obj4, vec3(0,0,180));
object_pivot(obj4, vec3(0,90,0));
// spawn object5 (shadertoy) // spawn object5 (shadertoy)
object_t* obj5 = scene_spawn(); object_t* obj5 = scene_spawn();
@ -93,7 +89,6 @@ int main() {
object_diffuse(obj5, sh.tx); object_diffuse(obj5, sh.tx);
object_scale(obj5, vec3(3,3,3)); object_scale(obj5, vec3(3,3,3));
object_move(obj5, vec3(-10+8*3,0,-10)); object_move(obj5, vec3(-10+8*3,0,-10));
object_pivot(obj5, vec3(0,90,0));
// create point light // create point light
// scene_spawn_light(); // sun // scene_spawn_light(); // sun

View File

@ -24,7 +24,7 @@ int main() {
}, },
{ {
position:[-5.0,-2.0,2.0], position:[-5.0,-2.0,2.0],
rotation: [90.0,0.0,180.0], rotation: [0.0,0.0,0.0],
scale:0.20, scale:0.20,
//anchor/pivot:[], //anchor/pivot:[],
// vertex:'p3 t2', // vertex:'p3 t2',

View File

@ -62,7 +62,6 @@ int main() {
object_diffuse(obj1, t1); object_diffuse(obj1, t1);
object_scale(obj1, vec3(3,3,3)); object_scale(obj1, vec3(3,3,3));
object_move(obj1, vec3(-10+5*0,0,-10)); object_move(obj1, vec3(-10+5*0,0,-10));
object_pivot(obj1, vec3(0,90,0));
// spawn object2 (matcap) // spawn object2 (matcap)
object_t* obj2 = scene_spawn(); object_t* obj2 = scene_spawn();
@ -70,7 +69,6 @@ int main() {
object_diffuse(obj2, t2); object_diffuse(obj2, t2);
object_scale(obj2, vec3(3,3,3)); object_scale(obj2, vec3(3,3,3));
object_move(obj2, vec3(-10+5*2,0,-10)); object_move(obj2, vec3(-10+5*2,0,-10));
object_pivot(obj2, vec3(0,90,0));
// spawn object3 (video) // spawn object3 (video)
object_t* obj3 = scene_spawn(); object_t* obj3 = scene_spawn();
@ -78,15 +76,13 @@ int main() {
object_diffuse(obj3, video_textures(v)[0]); object_diffuse(obj3, video_textures(v)[0]);
object_scale(obj3, vec3(3,3,3)); object_scale(obj3, vec3(3,3,3));
object_move(obj3, vec3(-10+5*1,0,-10)); object_move(obj3, vec3(-10+5*1,0,-10));
object_pivot(obj3, vec3(0,90,0));
// spawn object4 (pbr) // spawn object4 (pbr)
object_t* obj4 = scene_spawn(); object_t* obj4 = scene_spawn();
object_model(obj4, m3); object_model(obj4, m3);
object_scale(obj4, vec3(3,3,3)); object_scale(obj4, vec3(3,3,3));
object_move(obj4, vec3(-10+6*3,0,-10)); object_move(obj4, vec3(-10+6*3,0,-10));
// object_pivot(obj4, vec3(0,0,90)); object_pivot(obj4, vec3(0,0,180));
object_pivot(obj4, vec3(0,90,0));
// spawn object5 (shadertoy) // spawn object5 (shadertoy)
object_t* obj5 = scene_spawn(); object_t* obj5 = scene_spawn();
@ -94,7 +90,6 @@ int main() {
object_diffuse(obj5, sh.tx); object_diffuse(obj5, sh.tx);
object_scale(obj5, vec3(3,3,3)); object_scale(obj5, vec3(3,3,3));
object_move(obj5, vec3(-10+8*3,0,-10)); object_move(obj5, vec3(-10+8*3,0,-10));
object_pivot(obj5, vec3(0,90,0));
// spawn object6 // spawn object6
object_t* obj6 = scene_spawn(); object_t* obj6 = scene_spawn();

View File

@ -25,7 +25,7 @@ int main() {
// config 3d model #2 // config 3d model #2
model_t girl = model("kgirl/kgirls01.fbx", 0); model_t girl = model("kgirl/kgirls01.fbx", 0);
mat44 girl_pivot; vec3 girl_p = {0,0,0}, girl_r = {270,0,0}, girl_s = {2,2,2}; mat44 girl_pivot; vec3 girl_p = {0,0,0}, girl_r = {0,90,0}, girl_s = {2,2,2};
// skybox // skybox
skybox_t sky = skybox("cubemaps/stardust", 0); skybox_t sky = skybox("cubemaps/stardust", 0);
@ -182,10 +182,10 @@ int main() {
// apply rotation // apply rotation
{ {
girl_r.x -= 170; girl_r.y -= 90;
quat q = eulerq(girl_r); quat q = eulerq(girl_r);
vec3 fwdg = rotate3q(vec3(0,0,1), q); vec3 fwdg = rotate3q(vec3(0,0,1), q);
girl_r.x += 170; girl_r.y += 90;
//float cosAngle = dot3(dir,fwdg); //float cosAngle = dot3(dir,fwdg);
//float angle = acos(cosAngle) * TO_DEG; //float angle = acos(cosAngle) * TO_DEG;

View File

@ -31,7 +31,7 @@ int main()
mat44 lp; scaling44(lp, 0.3, 0.3, 0.3); translate44(lp, 8,4,0); mat44 lp; scaling44(lp, 0.3, 0.3, 0.3); translate44(lp, 8,4,0);
copy44(litm.pivot, lp); copy44(litm.pivot, lp);
} }
rotate44(mdl.pivot, -90, 1, 0, 0); // rotate44(mdl.pivot, 0, 1, 0, 0);
scale44(mdl.pivot, 4,4,4); scale44(mdl.pivot, 4,4,4);
shader_bind(mdl.program); shader_bind(mdl.program);
shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh); shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh);

View File

@ -17,7 +17,7 @@ int main() {
model_t sponza; model_t sponza;
sponza = model(option("--model","sponza.obj"), 0); // MODEL_NO_TEXTURES); sponza = model(option("--model","sponza.obj"), 0); // MODEL_NO_TEXTURES);
translation44(sponza.pivot, 0,-1,0); translation44(sponza.pivot, 0,-1,0);
rotate44(sponza.pivot, -90,1,0,0); // rotate44(sponza.pivot, -90,1,0,0);
scale44(sponza.pivot, 10,10,10); scale44(sponza.pivot, 10,10,10);
// camera // camera

View File

@ -21,7 +21,7 @@ Ni 1.000000
d 1.000000 d 1.000000
illum 1 illum 1
newmtl floor newmtl floor.001
Ns 10.000005 Ns 10.000005
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.725000 0.710000 0.680000 Kd 0.725000 0.710000 0.680000
@ -61,7 +61,7 @@ Ni 1.000000
d 1.000000 d 1.000000
illum 1 illum 1
newmtl shortBox newmtl shortBox.001
Ns 10.000005 Ns 10.000005
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.725000 0.710000 0.680000 Kd 0.725000 0.710000 0.680000
@ -71,7 +71,7 @@ Ni 1.000000
d 1.000000 d 1.000000
illum 1 illum 1
newmtl tallBox newmtl tallBox.001
Ns 10.000005 Ns 10.000005
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.725000 0.710000 0.680000 Kd 0.725000 0.710000 0.680000

File diff suppressed because it is too large Load Diff

View File

@ -21,16 +21,6 @@ illum 2
map_Kd fence_PNG28.png map_Kd fence_PNG28.png
map_d fence_PNG28.png map_d fence_PNG28.png
newmtl Material.002
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 0.266667
illum 9
map_Kd Transparent glass seamless texture 1.png
newmtl floor newmtl floor
Ns 10.000005 Ns 10.000005
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,7 @@
# Blender 4.2.1 LTS MTL File: 'None' # Blender 4.2.1 LTS MTL File: 'None'
# www.blender.org # www.blender.org
newmtl Material newmtl Material.003
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd E:/v4games/v4k/demos/art/matcaps/test_steel.jpg
newmtl Material.001
Ns 250.000000 Ns 250.000000
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000 Ks 0.500000 0.500000 0.500000
@ -21,7 +11,17 @@ d 1.000000
illum 2 illum 2
map_Kd E:/v4games/v4k/demos/art/matcaps/material3.jpg map_Kd E:/v4games/v4k/demos/art/matcaps/material3.jpg
newmtl Material.002 newmtl Material.004
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd E:/v4games/v4k/demos/art/matcaps/test_steel.jpg
newmtl Material.005
Ns 250.000000 Ns 250.000000
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.059941 0.801453 0.027650 Kd 0.059941 0.801453 0.027650
@ -31,17 +31,7 @@ Ni 1.500000
d 0.228070 d 0.228070
illum 9 illum 9
newmtl Material.003 newmtl Material.006
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800063 0.776954 0.209224
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 0.480702
illum 9
newmtl Material.004
Ns 250.000000 Ns 250.000000
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.015818 0.013069 0.801024 Kd 0.015818 0.013069 0.801024
@ -50,3 +40,13 @@ Ke 0.000000 0.000000 0.000000
Ni 1.500000 Ni 1.500000
d 0.294737 d 0.294737
illum 9 illum 9
newmtl Material.007
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800063 0.776954 0.209224
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 0.480702
illum 9

View File

@ -2,82 +2,82 @@
# www.blender.org # www.blender.org
mtllib sorting_test.mtl mtllib sorting_test.mtl
o Cube.001 o Cube.001
v -8.122441 2.199780 2.665483 v 8.122441 -2.665482 -2.199780
v -8.122441 2.199780 -2.665483 v 8.122441 2.665484 -2.199778
v 8.122441 2.199780 2.665483 v -8.122441 -2.665482 -2.199782
v 8.122441 2.199780 -2.665483 v -8.122441 2.665484 -2.199780
v -8.122441 7.530746 2.665483 v 8.122442 -2.665481 -7.530746
v -8.122441 7.530746 -2.665483 v 8.122442 2.665485 -7.530744
v 8.122441 7.530746 2.665483 v -8.122440 -2.665481 -7.530748
v 8.122441 7.530746 -2.665483 v -8.122440 2.665485 -7.530746
v 15.783228 15.783226 -13.899874 v -15.783226 13.899879 -15.783223
v 17.600002 17.600000 2.199389 v -17.600000 -2.199383 -17.600002
v -15.783228 15.783226 -13.899874 v 15.783230 13.899879 -15.783219
v -17.600002 17.600000 2.199389 v 17.600004 -2.199383 -17.599998
v 15.783228 -15.783228 -13.899874 v -15.783230 13.899869 15.783231
v 17.600002 -17.600002 2.199389 v -17.600004 -2.199395 17.600000
v -15.783228 -15.783228 -13.899874 v 15.783226 13.899869 15.783235
v -17.600002 -17.600002 2.199389 v 17.600000 -2.199395 17.600004
v -17.600002 17.600000 -13.800612 v 17.600004 13.800618 -17.599995
v -17.600002 -17.600002 -13.800612 v 17.600000 13.800607 17.600008
v 17.600002 17.600000 -13.800612 v -17.600000 13.800618 -17.599998
v 17.600002 -17.600002 -13.800612 v -17.600004 13.800607 17.600004
v -15.783228 15.783226 0.175428 v 15.783230 -0.175423 -15.783224
v -15.783228 -15.783228 0.175428 v 15.783226 -0.175433 15.783230
v 15.783228 15.783226 0.175428 v -15.783226 -0.175423 -15.783228
v 15.783228 -15.783228 0.175428 v -15.783230 -0.175433 15.783226
v -6.691334 2.669416 -2.804010 v 6.691334 2.804011 -2.669414
v -6.691334 2.669416 -7.195704 v 6.691334 7.195705 -2.669413
v 6.691334 2.669416 -2.804010 v -6.691333 2.804011 -2.669416
v 6.691334 2.669416 -7.195704 v -6.691333 7.195705 -2.669415
v -6.691334 7.061110 -2.804010 v 6.691335 2.804012 -7.061108
v -6.691334 7.061110 -7.195704 v 6.691335 7.195706 -7.061107
v 6.691334 7.061110 -2.804010 v -6.691333 2.804012 -7.061110
v 6.691334 7.061110 -7.195704 v -6.691333 7.195706 -7.061109
v -8.122442 -7.045201 2.665483 v 8.122441 -2.665485 7.045201
v -8.122442 -7.045201 -2.665483 v 8.122441 2.665481 7.045203
v 8.122442 -7.045201 2.665483 v -8.122443 -2.665485 7.045198
v 8.122442 -7.045201 -2.665483 v -8.122443 2.665481 7.045200
v -8.122442 -1.714234 2.665483 v 8.122442 -2.665483 1.714234
v -8.122442 -1.714234 -2.665483 v 8.122442 2.665483 1.714236
v 8.122442 -1.714234 2.665483 v -8.122442 -2.665483 1.714232
v 8.122442 -1.714234 -2.665483 v -8.122442 2.665483 1.714234
v -6.691334 -6.575565 -2.804010 v 6.691333 2.804008 6.575567
v -6.691334 -6.575565 -7.195704 v 6.691333 7.195702 6.575568
v 6.691334 -6.575565 -2.804010 v -6.691335 2.804008 6.575565
v 6.691334 -6.575565 -7.195704 v -6.691335 7.195702 6.575566
v -6.691334 -2.183871 -2.804010 v 6.691333 2.804009 2.183873
v -6.691334 -2.183871 -7.195704 v 6.691333 7.195704 2.183874
v 6.691334 -2.183871 -2.804010 v -6.691334 2.804009 2.183871
v 6.691334 -2.183871 -7.195704 v -6.691334 7.195704 2.183872
v -8.122442 -15.615585 2.665483 v 8.122440 -2.665488 15.615585
v -8.122442 -15.615585 -2.665483 v 8.122440 2.665478 15.615587
v 8.122442 -15.615585 2.665483 v -8.122444 -2.665488 15.615583
v 8.122442 -15.615585 -2.665483 v -8.122444 2.665478 15.615585
v -8.122442 -10.284618 2.665483 v 8.122440 -2.665486 10.284618
v -8.122442 -10.284618 -2.665483 v 8.122440 2.665480 10.284620
v 8.122442 -10.284618 2.665483 v -8.122444 -2.665486 10.284616
v 8.122442 -10.284618 -2.665483 v -8.122444 2.665480 10.284618
v -6.691334 -15.145948 -2.804010 v 6.691331 2.804005 15.145950
v -6.691334 -15.145948 -7.195704 v 6.691331 7.195699 15.145951
v 6.691334 -15.145948 -2.804010 v -6.691336 2.804005 15.145948
v 6.691334 -15.145948 -7.195704 v -6.691336 7.195699 15.145949
v -6.691334 -10.754253 -2.804010 v 6.691332 2.804006 10.754255
v -6.691334 -10.754253 -7.195704 v 6.691332 7.195701 10.754256
v 6.691334 -10.754253 -2.804010 v -6.691335 2.804006 10.754253
v 6.691334 -10.754253 -7.195704 v -6.691335 7.195701 10.754254
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000 vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000 vn -0.0000 -0.0000 -1.0000
vn -0.0000 0.7442 -0.6680 vn 1.0000 -0.0000 -0.0000
vn -0.0546 -0.0000 -0.9985 vn -0.0000 -1.0000 -0.0000
vn 0.7071 0.7071 -0.0000 vn -0.0000 1.0000 -0.0000
vn -0.0000 -0.0546 -0.9985 vn -0.0000 0.6680 -0.7442
vn 0.0546 -0.0000 -0.9985 vn 0.0546 0.9985 -0.0000
vn -0.7071 0.7071 -0.0000 vn -0.7071 -0.0000 -0.7071
vn -0.0000 0.9985 0.0546
vn -0.0546 0.9985 -0.0000
vn 0.7071 -0.0000 -0.7071
vt 0.375000 0.000000 vt 0.375000 0.000000
vt 0.625000 0.000000 vt 0.625000 0.000000
vt 0.625000 0.250000 vt 0.625000 0.250000
@ -113,7 +113,7 @@ vt 0.086685 0.728059
vt 0.589978 0.500567 vt 0.589978 0.500567
vt 0.066389 0.553695 vt 0.066389 0.553695
s 0 s 0
usemtl Material.001 usemtl Material.003
f 1/1/1 2/2/1 4/3/1 3/4/1 f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2 f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3 f 7/6/3 8/5/3 6/7/3 5/8/3
@ -132,7 +132,7 @@ f 55/6/3 56/5/3 54/7/3 53/8/3
f 53/8/4 54/7/4 50/9/4 49/10/4 f 53/8/4 54/7/4 50/9/4 49/10/4
f 51/11/5 55/6/5 53/8/5 49/12/5 f 51/11/5 55/6/5 53/8/5 49/12/5
f 56/5/6 52/13/6 50/14/6 54/7/6 f 56/5/6 52/13/6 50/14/6 54/7/6
usemtl Material usemtl Material.004
f 13/15/3 15/16/3 22/17/3 24/18/3 f 13/15/3 15/16/3 22/17/3 24/18/3
f 12/19/4 17/20/4 18/21/4 16/22/4 f 12/19/4 17/20/4 18/21/4 16/22/4
f 16/23/1 18/24/1 20/25/1 14/26/1 f 16/23/1 18/24/1 20/25/1 14/26/1
@ -150,21 +150,21 @@ f 21/28/9 11/31/9 12/19/9
f 10/27/7 23/29/7 12/19/7 f 10/27/7 23/29/7 12/19/7
f 23/29/12 10/27/12 9/33/12 f 23/29/12 10/27/12 9/33/12
f 10/27/12 19/30/12 9/33/12 f 10/27/12 19/30/12 9/33/12
usemtl Material.002 usemtl Material.005
f 25/1/1 26/2/1 28/3/1 27/4/1 f 25/1/1 26/2/1 28/3/1 27/4/1
f 27/4/2 28/3/2 32/5/2 31/6/2 f 27/4/2 28/3/2 32/5/2 31/6/2
f 31/6/3 32/5/3 30/7/3 29/8/3 f 31/6/3 32/5/3 30/7/3 29/8/3
f 29/8/4 30/7/4 26/9/4 25/10/4 f 29/8/4 30/7/4 26/9/4 25/10/4
f 27/11/5 31/6/5 29/8/5 25/12/5 f 27/11/5 31/6/5 29/8/5 25/12/5
f 32/5/6 28/13/6 26/14/6 30/7/6 f 32/5/6 28/13/6 26/14/6 30/7/6
usemtl Material.004 usemtl Material.006
f 41/1/1 42/2/1 44/3/1 43/4/1 f 41/1/1 42/2/1 44/3/1 43/4/1
f 43/4/2 44/3/2 48/5/2 47/6/2 f 43/4/2 44/3/2 48/5/2 47/6/2
f 47/6/3 48/5/3 46/7/3 45/8/3 f 47/6/3 48/5/3 46/7/3 45/8/3
f 45/8/4 46/7/4 42/9/4 41/10/4 f 45/8/4 46/7/4 42/9/4 41/10/4
f 43/11/5 47/6/5 45/8/5 41/12/5 f 43/11/5 47/6/5 45/8/5 41/12/5
f 48/5/6 44/13/6 42/14/6 46/7/6 f 48/5/6 44/13/6 42/14/6 46/7/6
usemtl Material.003 usemtl Material.007
f 57/1/1 58/2/1 60/3/1 59/4/1 f 57/1/1 58/2/1 60/3/1 59/4/1
f 59/4/2 60/3/2 64/5/2 63/6/2 f 59/4/2 60/3/2 64/5/2 63/6/2
f 63/6/3 64/5/3 62/7/3 61/8/3 f 63/6/3 64/5/3 62/7/3 61/8/3

View File

@ -1,26 +1,6 @@
# Blender 4.2.1 LTS MTL File: 'None' # Blender 4.2.1 LTS MTL File: 'None'
# www.blender.org # www.blender.org
newmtl Material.006
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd E:/v4games/v4k/demos/art/matcaps/material3.jpg
newmtl Material.007
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd E:/v4games/v4k/demos/art/matcaps/test_steel.jpg
newmtl Material.008 newmtl Material.008
Ns 250.000000 Ns 250.000000
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000

View File

@ -2,36 +2,36 @@
# www.blender.org # www.blender.org
mtllib sorting_test2.mtl mtllib sorting_test2.mtl
o Cube.001 o Cube.001
v 6.691334 -10.979122 -7.520660 v -6.691335 7.520656 10.979124
v 6.691334 -10.979120 -11.912354 v -6.691335 11.912351 10.979123
v -6.691334 -10.979122 -7.520660 v 6.691332 7.520656 10.979126
v -6.691334 -10.979120 -11.912354 v 6.691332 11.912351 10.979125
v 6.691333 -15.370816 -7.520660 v -6.691335 7.520655 15.370818
v 6.691333 -15.370816 -11.912354 v -6.691335 11.912350 15.370819
v -6.691335 -15.370814 -7.520660 v 6.691333 7.520655 15.370818
v -6.691335 -15.370814 -11.912354 v 6.691333 11.912350 15.370819
v 6.691334 -1.734141 -7.520659 v -6.691334 7.520658 1.734143
v 6.691334 -1.734141 -11.912354 v -6.691334 11.912354 1.734144
v -6.691334 -1.734140 -7.520659 v 6.691333 7.520658 1.734143
v -6.691334 -1.734140 -11.912354 v 6.691333 11.912354 1.734145
v 6.691334 -6.125834 -7.520660 v -6.691335 7.520658 6.125835
v 6.691334 -6.125834 -11.912353 v -6.691335 11.912351 6.125837
v -6.691333 -6.125834 -7.520660 v 6.691332 7.520658 6.125837
v -6.691333 -6.125834 -11.912353 v 6.691332 11.912351 6.125839
v 6.691335 6.836245 -7.520658 v -6.691334 7.520660 -6.836244
v 6.691335 6.836244 -11.912353 v -6.691334 11.912354 -6.836241
v -6.691332 6.836244 -7.520658 v 6.691333 7.520660 -6.836241
v -6.691332 6.836243 -11.912353 v 6.691333 11.912354 -6.836238
v 6.691335 2.444547 -7.520658 v -6.691335 7.520659 -2.444546
v 6.691335 2.444549 -11.912353 v -6.691335 11.912354 -2.444546
v -6.691333 2.444548 -7.520658 v 6.691333 7.520659 -2.444545
v -6.691333 2.444550 -11.912353 v 6.691333 11.912354 -2.444545
vn -0.0000 1.0000 -0.0000 vn -0.0000 -0.0000 -1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000 vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000 vn -0.0000 -0.0000 1.0000
vn -0.0000 -0.0000 -1.0000 vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.375000 0.000000 vt 0.375000 0.000000
vt 0.625000 0.000000 vt 0.625000 0.000000
vt 0.625000 0.250000 vt 0.625000 0.250000

2
depot

@ -1 +1 @@
Subproject commit 9d9b137bf427e9144c6a47de017058d884636a27 Subproject commit 25f79cb67011ce1848ae2de45a010a07cddc00dd

View File

@ -1,7 +1,7 @@
# Blender 3.6.2 MTL File: 'None' # Blender 4.2.1 LTS MTL File: 'None'
# www.blender.org # www.blender.org
newmtl Material.001 newmtl Material.002
Ns 0.000000 Ns 0.000000
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000 Kd 0.800000 0.800000 0.800000

View File

@ -1,49 +1,38 @@
# Blender 3.6.2 # Blender 4.2.1 LTS
# www.blender.org # www.blender.org
mtllib cube.mtl mtllib cube.mtl
o Cube o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000 v -1.000000 1.000000 -1.000000
vn -0.0000 -1.0000 -0.0000 v -1.000000 -1.000000 -1.000000
vn -0.0000 1.0000 -0.0000 v -1.000000 -1.000000 1.000000
vn 1.0000 -0.0000 -0.0000 v -1.000000 1.000000 1.000000
vn -0.0000 -0.0000 1.0000 v 1.000000 0.999999 -1.000000
v 1.000000 -1.000001 -0.999999
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
vn -1.0000 -0.0000 -0.0000 vn -1.0000 -0.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000 vn -0.0000 -0.0000 -1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -0.0000 1.0000 -0.0000
vt 1.000000 0.000000 vt 1.000000 0.000000
vt 1.000000 1.000000 vt 1.000000 1.000000
vt 0.000000 1.000000 vt 0.000000 1.000000
vt 1.000000 0.000001 vt 1.000000 0.000001
vt 0.000000 0.000000 vt 0.000000 0.000000
vt 0.999999 1.000000 vt 0.999999 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000001
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.999999 1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
s 0 s 0
usemtl Material.001 usemtl Material.002
f 1/1/1 2/2/1 3/3/1 f 1/1/1 2/2/1 3/3/1
f 5/4/2 8/5/2 6/6/2 f 5/4/2 8/5/2 6/6/2
f 1/7/3 5/8/3 2/9/3 f 1/5/3 5/4/3 2/3/3
f 2/10/4 6/11/4 3/12/4 f 2/1/4 6/6/4 3/5/4
f 3/9/5 7/13/5 8/14/5 f 3/3/5 7/2/5 8/1/5
f 5/15/6 1/10/6 4/12/6 f 5/2/6 1/1/6 4/5/6
f 4/5/1 1/1/1 3/3/1 f 4/5/1 1/1/1 3/3/1
f 8/5/2 7/3/2 6/6/2 f 8/5/2 7/3/2 6/6/2
f 5/8/3 6/16/3 2/9/3 f 5/4/3 6/2/3 2/3/3
f 6/11/4 7/17/4 3/12/4 f 6/6/4 7/3/4 3/5/4
f 4/7/5 3/9/5 8/14/5 f 4/5/5 3/3/5 8/1/5
f 8/17/6 5/15/6 4/12/6 f 8/3/6 5/2/6 4/5/6

View File

@ -0,0 +1,2 @@
# Blender 4.2.1 LTS MTL File: 'None'
# www.blender.org

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
# Blender 4.2.1 LTS MTL File: 'None'
# www.blender.org
newmtl Material_ray.png
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1

File diff suppressed because it is too large Load Diff

View File

@ -387170,7 +387170,7 @@ void model_clear_frustum(model_t *m) {
m->frustum_enabled = 0; m->frustum_enabled = 0;
} }
#define GLOBAL_FRUSTUM_ENABLED 1 #define GLOBAL_FRUSTUM_ENABLED 0
#define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f #define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f
static frustum global_frustum; static frustum global_frustum;
static mat44 global_frustum_stored_mat_proj; static mat44 global_frustum_stored_mat_proj;

View File

@ -5346,7 +5346,7 @@ void model_clear_frustum(model_t *m) {
m->frustum_enabled = 0; m->frustum_enabled = 0;
} }
#define GLOBAL_FRUSTUM_ENABLED 1 #define GLOBAL_FRUSTUM_ENABLED 0
#define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f #define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f
static frustum global_frustum; static frustum global_frustum;
static mat44 global_frustum_stored_mat_proj; static mat44 global_frustum_stored_mat_proj;

View File

@ -22200,7 +22200,7 @@ void model_clear_frustum(model_t *m) {
m->frustum_enabled = 0; m->frustum_enabled = 0;
} }
#define GLOBAL_FRUSTUM_ENABLED 1 #define GLOBAL_FRUSTUM_ENABLED 0
#define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f #define GLOBAL_FRUSTUM_FOV_MULTIPLIER 1.5f
static frustum global_frustum; static frustum global_frustum;
static mat44 global_frustum_stored_mat_proj; static mat44 global_frustum_stored_mat_proj;

View File

@ -36,6 +36,8 @@ int dobone = 0; // export skeleton
int doflip = 1; // export flipped (quake-style clockwise winding) triangles int doflip = 1; // export flipped (quake-style clockwise winding) triangles
int doflipUV = 0; // export flipped UVs int doflipUV = 0; // export flipped UVs
int doanimlist = 0; // generate list of animations with properties int doanimlist = 0; // generate list of animations with properties
int dolights = 0; // export lights only
int dofixaxis = 0; // fix axis from Y up to Z up
int doaxis = 0; // flip bone axis from X to Y to match blender int doaxis = 0; // flip bone axis from X to Y to match blender
int dounscale = 0; // remove scaling from bind pose int dounscale = 0; // remove scaling from bind pose
@ -76,6 +78,13 @@ static struct aiMatrix4x4 yup_to_zup = {
0, 0, 0, 1 0, 0, 0, 1
}; };
static struct aiMatrix4x4 flip_z_forward = {
-1, 0, 0, 0,
0, 1, 0, 0,
0, 0, -1, 0,
0, 0, 0, 1
};
static struct aiMatrix4x4 axis_x_to_y = { static struct aiMatrix4x4 axis_x_to_y = {
0, 1, 0, 0, 0, 1, 0, 0,
-1, 0, 0, 0, -1, 0, 0, 0,
@ -1289,6 +1298,66 @@ void export_position_list(const struct aiScene *scene)
} }
} }
static inline
const struct aiNode* light_find_node(const struct aiNode* node, const char* lightName) {
unsigned int i;
const struct aiNode* foundNode;
if (strcmp(node->mName.data, lightName) == 0) {
return node;
}
for (i = 0; i < node->mNumChildren; i++) {
foundNode = light_find_node(node->mChildren[i], lightName);
if (foundNode) {
return foundNode;
}
}
return NULL;
}
static inline
void get_node_xform(const struct aiNode* node, struct aiMatrix4x4* transform) {
const struct aiNode* currentNode = node;
*transform = node->mTransformation;
while (currentNode->mParent) {
struct aiMatrix4x4 parentTransform = currentNode->mParent->mTransformation;
aiMultiplyMatrix4(transform, &parentTransform);
currentNode = currentNode->mParent;
}
}
void export_lights(FILE *out, const struct aiScene *scene)
{
for (int i = 0; i < scene->mNumLights; i++) {
const struct aiLight* light = scene->mLights[i];
// const struct aiNode* lightNode = FindNodeForLight(scene->mRootNode, light->mName.data);
// struct aiMatrix4x4 transform;
// struct aiVector3D position, scaling;
// struct aiQuaternion rotation;
// printf("Light %u:\n", i);
// printf(" Name: %s\n", light->mName.data);
// printf(" Type: %d\n", light->mType);
// if (lightNode) {
// GetNodeTransform(lightNode, &transform);
// aiMatrix4x4_Decompose(&transform, &scaling, &rotation, &position);
// printf(" Position (in scene): %f, %f, %f\n", position.x, position.y, position.z);
// } else {
// printf(" Position (local): %f, %f, %f\n", light->mPosition.x, light->mPosition.y, light->mPosition.z);
// }
// printf(" Direction: %f, %f, %f\n", light->mDirection.x, light->mDirection.y, light->mDirection.z);
// printf(" Color: %f, %f, %f\n", light->mColorDiffuse.r, light->mColorDiffuse.g, light->mColorDiffuse.b);
}
}
void usage() void usage()
{ {
fprintf(stderr, "usage: assiqe [options] [-o out.iqe] input.dae [tags ...]\n"); fprintf(stderr, "usage: assiqe [options] [-o out.iqe] input.dae [tags ...]\n");
@ -1307,9 +1376,11 @@ void usage()
fprintf(stderr, "\t-f -- export counter-clockwise winding triangles\n"); fprintf(stderr, "\t-f -- export counter-clockwise winding triangles\n");
fprintf(stderr, "\t-r -- export rigid nodes too (experimental)\n"); fprintf(stderr, "\t-r -- export rigid nodes too (experimental)\n");
fprintf(stderr, "\t-l -- low precision mode (for smaller animation files)\n"); fprintf(stderr, "\t-l -- low precision mode (for smaller animation files)\n");
fprintf(stderr, "\t-I -- export lights only\n");
fprintf(stderr, "\t-x -- flip bone orientation from x to y\n"); fprintf(stderr, "\t-x -- flip bone orientation from x to y\n");
fprintf(stderr, "\t-s -- remove scaling from bind pose\n"); fprintf(stderr, "\t-s -- remove scaling from bind pose\n");
fprintf(stderr, "\t-u -- unmark bone (force it to be excluded)\n"); fprintf(stderr, "\t-u -- unmark bone (force it to be excluded)\n");
fprintf(stderr, "\t-X -- flip axis from Y up to Z up\n");
fprintf(stderr, "\t-o filename -- save output to file\n"); fprintf(stderr, "\t-o filename -- save output to file\n");
exit(1); exit(1);
} }
@ -1370,8 +1441,10 @@ case 'U': doflipUV = 1; puts("using flipUV"); break;
case 'r': dorigid = 1; break; case 'r': dorigid = 1; break;
case 'l': dolowprec = 1; break; case 'l': dolowprec = 1; break;
case 'L': doanimlist = 1; break; case 'L': doanimlist = 1; break;
case 'I': dolights = 1; break;
case 'v': verbose++; break; case 'v': verbose++; break;
case 'x': doaxis = 1; break; case 'x': doaxis = 1; break;
case 'X': dofixaxis = 1; break;
case 's': dounscale = 1; break; case 's': dounscale = 1; break;
case 'u': untaglist[numuntags++] = optarg++; break; case 'u': untaglist[numuntags++] = optarg++; break;
default: usage(); break; default: usage(); break;
@ -1505,10 +1578,26 @@ flags |= (doflipUV ? aiProcess_FlipUVs : 0);
return 0; return 0;
} }
if (dolights) {
fprintf(stderr, "exporting lights for %s ...\n", basename);
file = fopen(output, "w");
if (!file) {
fprintf(stderr, "cannot open output file: '%s'\n", output);
exit(1);
}
export_lights(file, scene);
return 0;
}
if (getenv("DOANIM")) doanim = 1; if (getenv("DOANIM")) doanim = 1;
// Convert to Z-UP coordinate system if (dofixaxis) {
aiMultiplyMatrix4(&scene->mRootNode->mTransformation, &yup_to_zup); // Convert to Z-UP coordinate system
aiMultiplyMatrix4(&scene->mRootNode->mTransformation, &yup_to_zup);
} else {
// Convert to the engine's coordinate system
aiMultiplyMatrix4(&scene->mRootNode->mTransformation, &flip_z_forward);
}
// Build a list of bones and compute the bind pose matrices. // Build a list of bones and compute the bind pose matrices.
if (build_bone_list(scene) > 0) if (build_bone_list(scene) > 0)
@ -1551,19 +1640,6 @@ flags |= (doflipUV ? aiProcess_FlipUVs : 0);
file = stdout; file = stdout;
} }
// Iterate through lights
for (int i = 0; i < scene->mNumLights; i++) {
const struct aiLight* light = scene->mLights[i];
printf("Light %u:\n", i);
printf(" Name: %s\n", light->mName.data);
printf(" Type: %d\n", light->mType);
printf(" Position: %f, %f, %f\n", light->mPosition.x, light->mPosition.y, light->mPosition.z);
printf(" Direction: %f, %f, %f\n", light->mDirection.x, light->mDirection.y, light->mDirection.z);
printf(" Color: %f, %f, %f\n", light->mColorDiffuse.r, light->mColorDiffuse.g, light->mColorDiffuse.b);
// Add more properties as needed
}
fprintf(file, "# Inter-Quake Export\n"); fprintf(file, "# Inter-Quake Export\n");
if (dobone) { if (dobone) {

Binary file not shown.

Binary file not shown.