OBD:PLEA: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
 
m (oops)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Main Page]] >> [[OBD:Oni Binary Data|Oni Binary Data]] >> [[OBD:File types|File Types]] >> PLEA File
{{OBD_File_Header | type=PLEA | prev=OTLF | next=PNTA | name=Plane Equation Array | family=Level | align=center}}




<CENTER>[[OBD:OTLF|<==]] <FONT SIZE=5>PLEA File</FONT> [[OBD:PNTA|==>]]<BR>
[[image:plea_a.gif]]
<FONT SIZE=2>Plane Equation Array - Level File</FONT></CENTER>




http://www.fh-eberswalde.de/user/dkriesch/onistuff/images/plea_a.gif
{{Table}}
{{OBDth}}
{{OBDtr| 0x00 | res_id  |FF0000| 01 41 02 00 | 577  | 00577-.PLEA }}
{{OBDtr| 0x04 | lev_id  |FFFF00| 01 00 00 06 | 3    | level 3 }}
{{OBDtr| 0x08 | char[20] |00FF00| AD DE      | dead  | unused }}
{{OBDtr| 0x1C | int32    |00FFFF| 03 00 00 00 | 13554 | array size }}
{{OBDtrBK}}
{{OBDtr| 0x00 | float    |FFC8C8| 00 00 00 00 | 0.000000 | 'a' coefficient of the plane equation (x component of plane's normal) }}
{{OBDtr| 0x04 | float    |FFFFC8| 00 00 00 00 | 0.000000 | 'b' coefficient of the plane equation (y component of plane's normal) }}
{{OBDtr| 0x08 | float    |C8FFC8| 00 00 80 3F | 1.000000 | 'c' coefficient of the plane equation (z component of plane's normal) }}
{{OBDtr| 0x0C | float    |C8FFFF| 00 00 19 44 |612.000000| 'd' coefficient of the plane equation }}
|}




{| BORDER=1 WIDTH=100% CELLPADDING=2 CELLSPACING=0
;Plane equation
|- ALIGN=CENTER BGCOLOR="#FFDDBB"
:The canonical equation for a [https://mathworld.wolfram.com/Plane.html plane] in 3D is
| WIDTH=15% | <B>Hex</B>
::'''a * x + b * y + c * z + d = 0,'''
| WIDTH=15% | <B>Translation</B>
:with (a, b, c, d) being 4 real numbers and (a, b, c) forming a nonzero vector (the plane's "normal").
| WIDTH=70% | <B>Meaning</B>
:*The set of points (x, y, z) verifying '''a * x + b * y + c * z + d = 0''' are said to be in the plane or at the plane.
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
:*The set of points (x, y, z) verifying '''a * x + b * y + c * z + d > 0''' are said to be in front of the plane.
| BGCOLOR="#FF0000" | 01 41 02 00
:*The set of points (x, y, z) verifying '''a * x + b * y + c * z + d < 0''' are said to be behind the plane.
| 577
:'''N.B.''' If a=b=c=0, then the equation is degenerate and applies either to the whole space (if d=0) or to no points at all (if d is non-zero).
| ALIGN=LEFT | 00577-.PLEA
 
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
:As a further convention, if (a,b,c) is normalized at unit length (i.e., '''a*a + b*b + c*c = 1''') then d is the distance from the plane to the world's origin, along the normal vector.
| BGCOLOR="#FFFF00" | 01 00 00 06
:The four floats in each element of a PLEA are exactly the (a, b, c, d) of the above definition.
| 3
:In the above example, the first element defines the plane (0 * x + 0 * y + 1 * z + 612 = 0), i.e., the vertical plane z = -612.
| ALIGN=LEFT | level 3
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#00FF00" | AD DE
| dead
| ALIGN=LEFT | not used
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#00FFFF" | F2 34 00 00
| 13554
| ALIGN=LEFT | 13554 packages follow (one package is edged in black)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#000000"
| COLSPAN=3 | <FONT SIZE=2 COLOR="#FFFFFF">Below follows the first package.</FONT>
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8C8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFFFC8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFC8" | 00 00 80 3F
| 1.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFFF" | 00 00 19 44
| 612.000000
| ALIGN=LEFT | unknown
|}


;What planes are for and how they are referenced
:Planes are used for environment culling, collision detection and [[wikipedia:Binary_space_partitioning|BSP]].
:The plane equations stored in PLEA are referenced from such data as [[ABNA]], [[AKBP]], [[AKBA]] and [[AGQC]] by means of a 32-bit array index.
:However, the high bit of those 32-bit references is not part of the array index, instead it indicates whether the facing of the plane should be flipped.
:*If the high bit is not set, then the 4 values (a, b, c, d) are used as described above.<br />(If referencing the above example without a high bit, then any points with z > - 612 will be in front of the plane, whereas points with z < -612 will be behind the plane.)
:*If the high bit is set, then the plane equation coefficients become (-a, -b, -c, -d).<br />(If referencing the above example with a high bit, then any point with z > - 612 will be behind the plane, whereas points with z < -612 will be in front of the plane.)
:This means that the actual array index is a 31-bit value (i.e., there can "only" be up to 2,147,483,648 distinct planes in a level), but the same array element can be used for two different facing directions.


<HR>
<CENTER>[[OBD:OTLF|<==]] <B>PLEA File</B> [[OBD:PNTA|==>]]</CENTER>
<HR>


{{OBD_File_Footer | type=PLEA | prev=OTLF | next=PNTA | name=Plane Equation Array | family=Level}}


[[Main Page]] >> [[OBD:Oni Binary Data|Oni Binary Data]] >> [[OBD:File types|File Types]] >> PLEA File
{{OBD}}

Latest revision as of 15:02, 24 January 2022

ONI BINARY DATA
OTLF << Other file types >> PNTA
PLEA : Plane Equation Array
switch to XML:PLEA page
Overview @ Oni Stuff
OBD.png


Plea a.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 41 02 00 577 00577-.PLEA
0x04 lev_id 01 00 00 06 3 level 3
0x08 char[20] AD DE dead unused
0x1C int32 03 00 00 00 13554 array size
First element (black outline)
0x00 float 00 00 00 00 0.000000 'a' coefficient of the plane equation (x component of plane's normal)
0x04 float 00 00 00 00 0.000000 'b' coefficient of the plane equation (y component of plane's normal)
0x08 float 00 00 80 3F 1.000000 'c' coefficient of the plane equation (z component of plane's normal)
0x0C float 00 00 19 44 612.000000 'd' coefficient of the plane equation


Plane equation
The canonical equation for a plane in 3D is
a * x + b * y + c * z + d = 0,
with (a, b, c, d) being 4 real numbers and (a, b, c) forming a nonzero vector (the plane's "normal").
  • The set of points (x, y, z) verifying a * x + b * y + c * z + d = 0 are said to be in the plane or at the plane.
  • The set of points (x, y, z) verifying a * x + b * y + c * z + d > 0 are said to be in front of the plane.
  • The set of points (x, y, z) verifying a * x + b * y + c * z + d < 0 are said to be behind the plane.
N.B. If a=b=c=0, then the equation is degenerate and applies either to the whole space (if d=0) or to no points at all (if d is non-zero).
As a further convention, if (a,b,c) is normalized at unit length (i.e., a*a + b*b + c*c = 1) then d is the distance from the plane to the world's origin, along the normal vector.
The four floats in each element of a PLEA are exactly the (a, b, c, d) of the above definition.
In the above example, the first element defines the plane (0 * x + 0 * y + 1 * z + 612 = 0), i.e., the vertical plane z = -612.
What planes are for and how they are referenced
Planes are used for environment culling, collision detection and BSP.
The plane equations stored in PLEA are referenced from such data as ABNA, AKBP, AKBA and AGQC by means of a 32-bit array index.
However, the high bit of those 32-bit references is not part of the array index, instead it indicates whether the facing of the plane should be flipped.
  • If the high bit is not set, then the 4 values (a, b, c, d) are used as described above.
    (If referencing the above example without a high bit, then any points with z > - 612 will be in front of the plane, whereas points with z < -612 will be behind the plane.)
  • If the high bit is set, then the plane equation coefficients become (-a, -b, -c, -d).
    (If referencing the above example with a high bit, then any point with z > - 612 will be behind the plane, whereas points with z < -612 will be in front of the plane.)
This means that the actual array index is a 31-bit value (i.e., there can "only" be up to 2,147,483,648 distinct planes in a level), but the same array element can be used for two different facing directions.


ONI BINARY DATA
OTLF << Other file types >> PNTA
PLEA : Plane Equation Array
Level file