Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
trs:meshes_models [2017/02/02 19:56] – ↷ Page moved from opentomb:trs:meshes_models to trs:meshes_models stohrendorftrs:meshes_models [2021/02/09 16:08] (current) – [Meshes] stohrendorf
Line 1: Line 1:
 +{{indexmenu_n>4}}
 +
 ====== Meshes and Models ====== ====== Meshes and Models ======
  
Line 24: Line 26:
 { {
     tr_vertex Centre;     tr_vertex Centre;
-      int32_t CollRadius;+      int16_t CollRadius; 
 +     uint16_t Flags;                 // 0x01 for Flat Shaded, i.e. Normals should not affect lighting
  
       int16_t NumVertices;           // Number of vertices in this mesh       int16_t NumVertices;           // Number of vertices in this mesh
Line 49: Line 52:
 }; };
 </code> </code>
-''%%Centre%%'' is usually close to the mesh’s centroid, and appears to be the center of a sphere used for certain kinds of collision testing.+''%%Centre%%'' is usually close to the mesh’s centroid, and is the center of a sphere used for certain kinds of collision testing.
  
-''%%CollRadius%%'' appears to be the radius of that aforementioned collisional sphere.+''%%CollRadius%%'' is the radius of that aforementioned collisional sphere.
  
 ''%%NumNormals%%'': If positive, it is a number of normals in this mesh. If negative, it is a number of vertex lighting elements (''%%abs%%'' value). ''%%NumNormals%%'': If positive, it is a number of normals in this mesh. If negative, it is a number of vertex lighting elements (''%%abs%%'' value).
Line 61: Line 64:
 ''%%NumColoredTriangles%%'' and ''%%NumColoredRectangles%%'' are respectively the number of triangular and rectangular faces in this mesh. Corresponding ''%%ColoredTriangles%%'' and ''%%ColoredRectangles%%'' array contain colored triangles and rectangles themselves. ''%%NumColoredTriangles%%'' and ''%%NumColoredRectangles%%'' are respectively the number of triangular and rectangular faces in this mesh. Corresponding ''%%ColoredTriangles%%'' and ''%%ColoredRectangles%%'' array contain colored triangles and rectangles themselves.
  
-As coloured faces feature was removed since TR4, [[opentomb:trs:meshes_models#tr_mesh|[tr_mesh]]] structure was changed, and contain no data for coloured faces anymore:+As coloured faces feature was removed since TR4, [[meshes_models#tr_mesh|[tr_mesh]]] structure was changed, and contain no data for coloured faces anymore:
  
 {{anchor:tr4_mesh}} {{anchor:tr4_mesh}}
Line 117: Line 120:
 ''%%VisibilityBox%%'' and ''%%CollisionBox%%'' boundaries is always stay axis aligned even after applying tr_room_staticmesh::Rotation (always have 90 degrees step). Additionally, the test whether to rotate the box or not relies on the mesh’s rotation being an exact multiple of 0x4000 (aka 90 degrees). If this is not the case, the box is not rotated, which results in wrong collision checks. ''%%VisibilityBox%%'' and ''%%CollisionBox%%'' boundaries is always stay axis aligned even after applying tr_room_staticmesh::Rotation (always have 90 degrees step). Additionally, the test whether to rotate the box or not relies on the mesh’s rotation being an exact multiple of 0x4000 (aka 90 degrees). If this is not the case, the box is not rotated, which results in wrong collision checks.
  
-{{:icons:tr1.png?nolink|TR1 only}}{{:icons:tr2.png?nolink|TR2 only}} ''%%Flags%%'' value is usually 2, and is 3 for static meshes //without collision//, like plants and lying skeletons. Since TR3, value is ignored, and no-collision mode is obtained using degenerate collision box (with all-zero or all-one coordinates).+{{:icons:tr1.png?nolink|TR1 only}}{{:icons:tr2.png?nolink|TR2 only}}{{:icons:tr3.png?nolink|TR3 only}} ''%%Flags%%''
 +  * **Bit 0** (''0x0001''): no collision 
 +  * **Bit 1** (''0x0002''): is visible 
  
 ===== Models ===== ===== Models =====
Line 141: Line 147:
 }; };
 </code> </code>
-{{:icons:tr5.png?nolink|TR5 only}} There is an extra ''%%uint16_t%%'' at the end of [[opentomb:trs:meshes_models#tr_model|[tr_model]]] structure, which is always ''%%0xFFEF%%'' and used for alignment. Consider it while parsing.+{{:icons:tr5.png?nolink|TR5 only}} There is an extra ''%%uint16_t%%'' at the end of [[meshes_models#tr_model|[tr_model]]] structure, which is always ''%%0xFFEF%%'' and used for alignment. Consider it while parsing.
  
 ===== Entities ===== ===== Entities =====
Line 205: Line 211:
 ''%%Angle%%'' is an //Euler Yaw angle// (i.e. “horizontal” rotation) stored in a special manner. To convert it to ordinary degrees, use this formula: ''%%Angle%%'' is an //Euler Yaw angle// (i.e. “horizontal” rotation) stored in a special manner. To convert it to ordinary degrees, use this formula:
  
-$\angle^\circ = (Angle \div 16384\times -90$+$\angle^\circ = \frac{Angle}{16384\cdot -90$
  
 {{:icons:tr1.png?nolink|TR1 only}} ''%%Intensity2%%'' field is missing in this game version, so the structure size is 2 bytes less. {{:icons:tr1.png?nolink|TR1 only}} ''%%Intensity2%%'' field is missing in this game version, so the structure size is 2 bytes less.
Line 224: Line 230:
 In TR4 and TR5, ''%%Intensity2%%'' field was replaced with completely new one, called //Object Code Bit// (or ''%%OCB%%''). OCB allows to alter entity behaviour based on its value, thus providing very basic “script-like” functionality. For example, flame emitter entities have a case switch for OCB value, and each valid OCB value produces different result — flame emttier acts either as a static flame, as a directional flame, as a lightning, and so on. In TR4 and TR5, ''%%Intensity2%%'' field was replaced with completely new one, called //Object Code Bit// (or ''%%OCB%%''). OCB allows to alter entity behaviour based on its value, thus providing very basic “script-like” functionality. For example, flame emitter entities have a case switch for OCB value, and each valid OCB value produces different result — flame emttier acts either as a static flame, as a directional flame, as a lightning, and so on.
  
-More detailed description of OCB is provided in [[opentomb:trs:npc_behaviour|this section]].+More detailed description of OCB is provided in [[trs:npc_behaviour|this section]].
  
 ===== Sprites ===== ===== Sprites =====
Line 234: Line 240:
 struct tr_sprite_texture   // 16 bytes struct tr_sprite_texture   // 16 bytes
 { {
-    uint16_t Tile;+    uint16_t Atlas;
      uint8_t x;      uint8_t x;
      uint8_t y;      uint8_t y;
Line 245: Line 251:
 }; };
 </code> </code>
-{{:icons:tr4.png?nolink|TR4 only}}{{:icons:tr5.png?nolink|TR5 only}} ''%%x%%'' and ''%%y%%'' values //are not used// in this version. Additionally, formula for ''%%Width%%'' and ''%%Height%%'' is changed: now it’s $(\text{ActualWidth} - 1) 256$ and $(\text{ActualHeight} - 1) 256$ respectively.+{{:icons:tr4.png?nolink|TR4 only}}{{:icons:tr5.png?nolink|TR5 only}} ''%%x%%'' and ''%%y%%'' values //are not used// in this version. Additionally, formula for ''%%Width%%'' and ''%%Height%%'' is changed: now it’s $(\text{ActualWidth} - 1) \cdot 256$ and $(\text{ActualHeight} - 1) \cdot 256$ respectively.
  
 ===== Sprite Sequences ===== ===== Sprite Sequences =====
trs/meshes_models.1486065399.txt.gz · Last modified: 2017/02/02 19:56 by stohrendorf
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0