Rot/slant and float data meaning in 4VWR

WrpTool island creator utility

Moderators: Lone Wolf, Snake Man

Post Reply
vektorboson
Recruit
Posts: 17
Joined: 2005-08-09 04:12:23

Rot/slant and float data meaning in 4VWR

Post by vektorboson » 2005-08-08 23:41:46

Hi,

I'm currently working on a personal project where I want to generate WRP-files automatically. According to A-Lone-Wolf's doc on the WRP-format for objects there are twelve floating point values named rotation/slant, X, Z, Y, slant/rotation, X, Z, Y, normal position, X, Z, Y. The names seem to be misleading, unless I don't get it!
I'll call them f[0] to f[11];

(a)

f[9 .. 11] specify the position on the map, f[10] seems to depend on the scale.
As I see, all values from f[0] to f[8] are multiplied with the scale value. But what meaning do all those values have?

f[4] seems to be the scale.
Then I think: (f[0]^2 + f[2]^2) / f[4] ^2 == 1
Seems as if one is the sin(angle) and one is the cos(angle) multiplied with the scale.

And last: f[6] == - f[2] and f[8] == f[0]
So the sixth value seems to always be the negative of the second value.

Are my thoughts correct?

(b)

Do I need any informations from the models when they are placed on the map? Like "keep height" or always on/above/under ground. Or even the height of the object (since f[10] depends on the scale)? (So I'd need a ODOL-reader or convert all models to MLOD :-/ )

Snake_Man

Re: Rot/slant and float data meaning in 4VWR

Post by Snake_Man » 2005-08-09 04:33:11

I'll try to get Dschulle to explain some of these things for you. Remind me if you wont hear anything from us in a while.

Dschulle
Captain
Posts: 162
Joined: 2003-05-18 02:00:14
Contact:

Re: Rot/slant and float data meaning in 4VWR

Post by Dschulle » 2005-08-16 12:05:45

hi vektor,
sorry for replying late.

ad a)

The 12 float values are part of a 4x4 transformation matrix, where the last column is allways [0,0,0,1] and therefore not stored.

See:
http://msdn.microsoft.com/library/defau ... sforms.asp

you can also check the "rtm" doc from opf-internals on ofpec:
http://www.ofpec.com/editors/browse.php?browsewhat=1

ad b)
you need some info from the models, otherwise some of them resultin beeing burried partly.

What project are you working on? Maybe we can have a chat on skype/ icq?
Last edited by Dschulle on 1970-01-01 00:00:00, edited 1 time in total.

vektorboson
Recruit
Posts: 17
Joined: 2005-08-09 04:12:23

Re: Rot/slant and float data meaning in 4VWR

Post by vektorboson » 2005-08-16 14:04:15

No prob,

a)
That makes much more sense than A-Lone-Wolf's documentation! Should've figured that out myself, shame on me!
Thank you!

b)
Figured that out, as WrpTool was complaining as I added some models to objects.ini


Regarding chatting, my ICQ number is 259686789. I lost my old account because of some "hacker".

My project is some sort of automatic island- and mission-generation; I should release soon my first tool (with source), an automatic road-model-generator.

vektorboson
Recruit
Posts: 17
Joined: 2005-08-09 04:12:23

Re: Rot/slant and float data meaning in 4VWR

Post by vektorboson » 2005-09-05 19:19:09

Just another question:

When trying to view the elevations I realized, that the elevations aren't integer(short) values as A-Lone-Wolfs doc implies.

After watching some hex-values, I found some formulas, that should reflect the values right.

w_e: elevations as in 4WVR wrp file
f_e: elevations with floating point value

When I create some elevations and want them to convert to Wrp-elevations I'm using the following formula:

w_e = (short) ((f_e / 0.05) * 1.1111)


Ok, when I want to convert them back, what is the right formula? I am using something like this:

f_e = floor( w_e / 22222.0f ) * 1000 +
floor( (w_e mod 22222.0f) / 2222.2f ) * 100 +
floor( (w_e mod 2222.2f) / 222.22f ) * 10 + a.s.o.

Is this formula right? What formula are you guys using?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest