pioj
New Member
Posts: 6
|
Post by pioj on Sept 16, 2008 15:47:14 GMT
Hi, ppl! I'm finishing a .B3D file format -> SQL database conversion, which I think it can help in some situations, like MMO's stuff, or whatever online conversor we'll eventually do.. Anyway, I believe it's a great idea... I've done all by porting the bb code from B3DFILE and DUMPB3D samples from the community, to PHP scripts... It's almost done, and it seems to work properly, but It fails at reading the B3dFloats... I've been reading and testing a lot with IEEE754 format, which seems the solution to convert the .b3d data to a readable Float, but when I test with models, it returns wrong values. Why? I use some online conversors to make the test.. f.ex.: www.h-schmidt.net/FloatApplet/IEEE754.htmlFor example, Running B3dViewer 3.0 (by Filax), I get, that one of the NODEs, 'base' has an Zpos coord of 0,285991371. Ok, so I load the .b3d file in an Hex Editor, locate the "base" value, their 4byte data from it's supposed float, which is 766D923E... The problem? 766D923E turned to 32bit or 64 float, returns really 1.2046294e33, and of course, it is not the same value I got in the B3DViewer... ____________________________ I came out of ideas to solve this.. Do you guys know anything related to this? or, maybe Have your try to read a Float data from a b3d file, in php? I've tried already in C++, and it works perefctly... Jedive gave me some points about how to do it.. Thx for the support!
|
|
pioj
New Member
Posts: 6
|
Post by pioj on Sept 16, 2008 23:11:37 GMT
ok. I solved part of the problem.. Hex number need to be reversed, due Endianness thing...
Sorting the hex number, starting by the last hex gives me the correct float number, at the online converter..
Now, the next problem lies on the exponent.. 11101010 to dec -> 234, but in the online converter appears to be 122 instead, so I must know where the hell came that 122...
Doing basic maths gives no clue, so I'm stuck again.. (¬_¬ I hate floats... )
any idea?
|
|