Jump to content


Photo

Issue with P3DC


  • Please log in to reply
9 replies to this topic

#1 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 12 March 2012 - 02:09 PM

// load_model(fname,scale)
global.stg_tex[global.STG_ind,e]=background_get_texture(argument[2+e])
global.stg_mod[global.STG_ind,e]=d3d_model_create()
d3d_model_primitive_begin(global.stg_mod[global.STG_ind,e],pr_trianglelist)
for(i=0;i<nb_verts[e];i+=3)
{
vx1=GMBINReadFloat(re)*argument1;
vy1=GMBINReadFloat(re)*argument1;;
vz1=GMBINReadFloat(re)*argument1;;
nx1=(GMBINReadUByte(re)-127)/100
ny1=(GMBINReadUByte(re)-127)/100
nz1=(GMBINReadUByte(re)-127)/100
tx1=GMBINReadFloat(re)/10
ty1=GMBINReadFloat(re)/10
d3d_model_vertex_normal_texture(global.stg_mod[global.STG_ind,e],vx1,vy1,vz1,nx1,ny1,nz1,tx1,ty1)
vx2=GMBINReadFloat(re)*argument1;;
vy2=GMBINReadFloat(re)*argument1;;
vz2=GMBINReadFloat(re)*argument1;;
nx2=(GMBINReadUByte(re)-127)/100
ny2=(GMBINReadUByte(re)-127)/100
nz2=(GMBINReadUByte(re)-127)/100
tx2=GMBINReadFloat(re)/10
ty2=GMBINReadFloat(re)/10
d3d_model_vertex_normal_texture(global.stg_mod[global.STG_ind,e],vx2,vy2,vz2,nx2,ny2,nz2,tx2,ty2)
vx3=GMBINReadFloat(re)*argument1;;
vy3=GMBINReadFloat(re)*argument1;;
vz3=GMBINReadFloat(re)*argument1;;
nx3=(GMBINReadUByte(re)-127)/100
ny3=(GMBINReadUByte(re)-127)/100
nz3=(GMBINReadUByte(re)-127)/100
tx3=GMBINReadFloat(re)/10
ty3=GMBINReadFloat(re)/10
d3d_model_vertex_normal_texture(global.stg_mod[global.STG_ind,e],vx3,vy3,vz3,nx3,ny3,nz3,tx3,ty3)
p3dc_add_triangle(vx1,vy1,vz1,vx2,vy2,vz2,vx3,vy3,vz3)
}
d3d_model_primitive_end(global.stg_mod[global.STG_ind,e])

NOTE : 'e' is the model index!
This is my own file format, wich handles multiples models :)

Problem : 'UNEXPECTED ERROR OCCURS WHEN RUNNING THE GAME' this is driving me crazy :sick:

Ok, the model is 2300*2300 large (a stage actually)
for some resons it show that error !! !WHY ??? (any ideas)

Edited by The Scorpion, 12 March 2012 - 02:10 PM.

  • 0

#2 hit172

hit172

    GMC Member

  • New Member
  • 189 posts
  • Version:GM8

Posted 12 March 2012 - 03:09 PM

can you post an example of a model file (like a cube).
oh and make sure that the model is triangulated.
  • 0

#3 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 12 March 2012 - 03:19 PM

can you post an example of a model file (like a cube).
oh and make sure that the model is triangulated.


I deleted the p3dc codes. and the models appear just fine! The issue is in p3dc !! Does it have limited triangles ???
  • 0

#4 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 14 March 2012 - 05:02 PM

Ok people GUESS WHAT ! p3dc v6 does not support more than 475 triangles :blink:

Yup! I followed the error, and th latest triangle created before the error is 478 to be accurate !

I had to switch to p3dc v2! and bum! NO ERRORS :smile:

No idea why, but I think Brett should do something about that :unsure:
  • 0

#5 brett14

brett14

    GMC Member

  • GMC Member
  • 1150 posts
  • Version:GM8

Posted 15 March 2012 - 05:49 AM

No idea what could be causing that problem. There is no limit on triangles. There are errors in P3DC though, and I made it open source (no longer supported, busy with other projects such as GDS). Does a primitive end/begin there? Is there a space in the model format? Is it a triangle list/strip? I've used it with more than 478 triangles before without error.
  • 0

#6 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 16 March 2012 - 06:47 PM

I'm having a very wild guess :whistle: :

I think there is a problem in Normals! If it calculates each triangle at adding triagnles point, I may have a some verts in the same pos (of corse linked, I mean a triangle wich verts share the same coords :tongue: )


It's a VERY wild gess : :whistle:
  • 0

#7 brett14

brett14

    GMC Member

  • GMC Member
  • 1150 posts
  • Version:GM8

Posted 16 March 2012 - 07:31 PM

That is probably a very correct guess (not reasoning though). P3DC calculates the normals with:
<SOME RANDOM CODE>
m = sqrt(normalx*normalx+normaly*normaly+normalz*normalz);
normalx /= m;
normaly /= m;
normalz /= m;
<MORE RANDOM CODE>

As you can see, it does not check if m==0. If it does, then crash. I'll fix that, then re-upload.

[EDIT]
Fixed that. See if it works now, V6.1 can be downloaded from the P3DC thread.
[/EDIT]


Cheers
~~Brett14;

Edited by brett14, 16 March 2012 - 07:48 PM.

  • 0

#8 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 16 March 2012 - 07:57 PM

That is probably a very correct guess (not reasoning though). P3DC calculates the normals with:

<SOME RANDOM CODE>
m = sqrt(normalx*normalx+normaly*normaly+normalz*normalz);
normalx /= m;
normaly /= m;
normalz /= m;
<MORE RANDOM CODE>

As you can see, it does not check if m==0. If it does, then crash. I'll fix that, then re-upload.

[EDIT]
Fixed that. See if it works now, V6.1 can be downloaded from the P3DC thread.
[/EDIT]


Cheers
~~Brett14;



Amazing !!! :biggrin: :biggrin: :biggrin: :wub: :wub: :wub: :kiss: :kiss: :kiss: :woot: :woot: :woot:

I must be the Lord of a Very Large Guessing :wub:
  • 0

#9 brett14

brett14

    GMC Member

  • GMC Member
  • 1150 posts
  • Version:GM8

Posted 16 March 2012 - 08:30 PM

Does it work now though?
  • 0

#10 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 posts
  • Version:GM8

Posted 16 March 2012 - 08:47 PM

Does it work now though?

Yup it does ! :biggrin:
But I'm keeping with Version 2, as it's more efficient the way I'm handling data !

I almost forgot another problem with version 6, ray_split report an error (so I use the normal ray function)
and if I try to overcome it with
p3dc_ray(p3dc_get_splitid(stage),..) 
// not sure about the functions name ==> You got the idea

it also report an error !

Edited by The Scorpion, 16 March 2012 - 08:48 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users