<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.axiodl.com/index.php?action=history&amp;feed=atom&amp;title=AROT_%28MREA_Section%29</id>
	<title>AROT (MREA Section) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.axiodl.com/index.php?action=history&amp;feed=atom&amp;title=AROT_%28MREA_Section%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.axiodl.com/index.php?title=AROT_(MREA_Section)&amp;action=history"/>
	<updated>2026-04-30T07:33:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://wiki.axiodl.com/index.php?title=AROT_(MREA_Section)&amp;diff=2780&amp;oldid=prev</id>
		<title>imported&gt;Jackoalan at 05:59, 19 October 2018</title>
		<link rel="alternate" type="text/html" href="https://wiki.axiodl.com/index.php?title=AROT_(MREA_Section)&amp;diff=2780&amp;oldid=prev"/>
		<updated>2018-10-19T05:59:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:Octree2.svg|thumb|right|400px|Left: Recursive subdivision of a cube into [[wikipedia:octant (solid geometry)|octant]]s. Right: The corresponding octree.]]&lt;br /&gt;
&lt;br /&gt;
Within [[MREA (File Format)|MREA]] resources, the &amp;#039;&amp;#039;&amp;#039;AROT section&amp;#039;&amp;#039;&amp;#039; stores an [[wikipedia:Octree|octree]] which&lt;br /&gt;
is used to accelerate rendering of areas in back-to-front order. &lt;br /&gt;
&lt;br /&gt;
Octrees are a form of [[wikipedia:Binary Space Partitioning|BSP tree]] that subdivide an area in 3-dimensions.&lt;br /&gt;
They are structured recursively, starting with a &amp;#039;&amp;#039;root&amp;#039;&amp;#039; node and traversing their way to individual &amp;#039;&amp;#039;leaf&amp;#039;&amp;#039; nodes.&lt;br /&gt;
A full-branch octant will split sub-octants across 3-tiers, one for each dimension of euclidean space.&lt;br /&gt;
Retro uses a Z-major convention with (up to) 8 child-nodes subdivided as: 2 nodes along Z, 4 nodes along Y,&lt;br /&gt;
and 8 nodes along X. A set of three bit-flags in each node determines which dimensions are subdivided. &lt;br /&gt;
Nodes that do not subdivide all 3 dimensions will parent less child nodes as a result. &lt;br /&gt;
&lt;br /&gt;
Within each octant is an index to a [[wikipedia:Bit array|bitmap]] relating that AABB-volume to a set of meshes within the MREA; they&lt;br /&gt;
are sorted and frustum-culled accordingly. Actors, particle effects, and other visual entities are also sorted and&lt;br /&gt;
frustum-culled according to which octant(s) they intersect.&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type&lt;br /&gt;
! Element Count&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[#Header|Header]]&lt;br /&gt;
| 1&lt;br /&gt;
| Octree Header&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| round_up(bitmap_bit_count / 32) * bitmap_count&lt;br /&gt;
| Mesh Bitmap Array&lt;br /&gt;
| An array of word-packed bitmaps relating octant nodes to sets of MREA meshes&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| node_count&lt;br /&gt;
| Node Indirection Table&lt;br /&gt;
| Since nodes use variable-length-encoding, there is an indirection table with byte-offsets (relative to first node)&lt;br /&gt;
|-&lt;br /&gt;
| [[#Node Entry|Node Entry]]&lt;br /&gt;
| node_count&lt;br /&gt;
| Node Entry Table&lt;br /&gt;
| Tightly-packed blob of nodes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Data Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| Magic&lt;br /&gt;
| &amp;lt;code&amp;gt;AROT&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| Version&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| Mesh-Bitmap Count&lt;br /&gt;
| Count of mesh-bitmaps&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| Mesh-Bitmap Bit-Count&lt;br /&gt;
| Count of bits in each mesh-bitmap (matches MREA&amp;#039;s mesh count)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| Node Count&lt;br /&gt;
| Number of octant nodes&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 24&lt;br /&gt;
| float2x3&lt;br /&gt;
| AABB&lt;br /&gt;
| AABB that fully-encloses area and serves as the octree&amp;#039;s root-shape&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 20&lt;br /&gt;
|&lt;br /&gt;
| Alignment Padding&lt;br /&gt;
| Allows the following bitmaps to be data-cached with guaranteed 32-byte alignment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Node Entry ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Data Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 2&lt;br /&gt;
| short&lt;br /&gt;
| Bitmap Index&lt;br /&gt;
| Index of the mesh bitmap defining a set of MREA meshes for this octant node&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 2&lt;br /&gt;
| short&lt;br /&gt;
| Dimensional Flags&lt;br /&gt;
| If non-zero, this half-word contains 3-bits specifying which dimensions are subdivided using the children specified (using Z-major convention)&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;0x4 — Z subdivided&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;0x2 — Y subdivided&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;0x1 — X subdivided&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;If zero, this node-entry ends here&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Varies&lt;br /&gt;
| short[]&lt;br /&gt;
| Node Child Indices&lt;br /&gt;
| Variable-length array of node-entry indices that are children of this node-entry (Z-major layout)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>imported&gt;Jackoalan</name></author>
	</entry>
</feed>