Difference between revisions of "RpGeometry"

From GTAMods Wiki
Jump to navigation Jump to search
m (Changing RW pages to be less stream-oriented)
(Cleaned up a bit)
Line 1: Line 1:
  
  
'''RpGeometry''' is a RenderWare structure that stores geometric data. It can be streamed out, usually as the child of a Geometry List.
+
'''RpGeometry''' is a [[RenderWare]] structure that stores geometric data.  
  
 
== Stream structure ==
 
== Stream structure ==
  
 
{{RW Section|Geometry|0x000F}}
 
{{RW Section|Geometry|0x000F}}
 +
 +
When streamed in/out it is usually the child of a [[Geometry List (RW_Section)|Geometry List]] chunk and the parent of a [[Struct (RW Section)|Struct]], [[Material List (RW_Section)|Material List]] and [[Extension (RW Section)|Extension]] chunk.
  
 
The format of the Geometry's Struct chunk is as follows:
 
The format of the Geometry's Struct chunk is as follows:
  
  int32        format (see [[Geometry (RW Section)#Format|below]])
+
  int32        format (see [[RpGeometry#Format|below]])
 
  int32        number of triangles (numTriangles)
 
  int32        number of triangles (numTriangles)
 
  int32        number of vertices (numVertices)
 
  int32        number of vertices (numVertices)
Line 65: Line 67:
 
|0x00000010||rpGEOMETRYNORMALS||Store normals
 
|0x00000010||rpGEOMETRYNORMALS||Store normals
 
|-
 
|-
|0x00000020||rpGEOMETRYLIGHT||Dynamic vertex lightning ''(?)''
+
|0x00000020||rpGEOMETRYLIGHT||Geometry is lit (dynamic and static)
 
|-
 
|-
 
|0x00000040||rpGEOMETRYMODULATEMATERIALCOLOR||Modulate material color
 
|0x00000040||rpGEOMETRYMODULATEMATERIALCOLOR||Modulate material color
Line 78: Line 80:
  
 
If rpGEOMETRYNATIVE is set, the platform dependent geometry data is to be found in the [[Native Data PLG (RW Section)|Native Data]] chunk.
 
If rpGEOMETRYNATIVE is set, the platform dependent geometry data is to be found in the [[Native Data PLG (RW Section)|Native Data]] chunk.
 
== Child sections ==
 
 
* [[Material List (RW Section)|Material List]]
 
  
 
=== Extension ===
 
=== Extension ===
  
The [[Extension (RW Section)|extension]] of an geometry usually holds the following sections in the order they are listed in here:
+
The [[Extension (RW Section)|extension]] of an geometry can hold the following chunks in GTA:
  
 
* [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]]
 
* [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]]
Line 94: Line 92:
 
* [[Morph PLG (RW Section)|Morph PLG]]
 
* [[Morph PLG (RW Section)|Morph PLG]]
 
* [[2d Effect (RW Section)|2d Effect]]
 
* [[2d Effect (RW Section)|2d Effect]]
 
== See also ==
 
* [[Geometry List (RW Section)|Geometry List]]
 
* [[RenderWare_binary_stream_file|RW file format specification]]
 
 
== References ==
 
{{Note|1}} * http://msdn.microsoft.com/en-us/library/bb172518%28VS.85%29.aspx<br>
 
{{Note|2}} * http://msdn.microsoft.com/en-us/library/bb172559%28VS.85%29.aspx
 
  
 
{{N|SA|VC}}
 
{{N|SA|VC}}
 
[[Category:GTA_3]]
 
[[Category:GTA_3]]

Revision as of 17:29, 7 June 2016


RpGeometry is a RenderWare structure that stores geometric data.

Stream structure

{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

When streamed in/out it is usually the child of a Geometry List chunk and the parent of a Struct, Material List and Extension chunk.

The format of the Geometry's Struct chunk is as follows:

int32        format (see below)
int32        number of triangles (numTriangles)
int32        number of vertices (numVertices)
int32        number of morph targets (numMorphTargets) (morphing is not used in GTA series, so this is always 1)
#if version < 0x34000
  surface properties:
    float32  ambient
    float32  specular
    float32  diffuse
#endif

#if (format & rpGEOMETRYNATIVE) == 0
    #if (format & rpGEOMETRYPRELIT)
        RwRGBA   prelitcolor[numVertices] (RwRGBA: uint8 r, g, b, a)
    #endif

    #if format & (rpGEOMETRYTEXTURED | rpGEOMETRYTEXTURED2)
        #repeat numTexSets (see below)
            RwTexCoords    texCoords[numVertices]  (RwTexCoords: float32 u, v)
        #endrepeat
    #endif
   
    RpTriangle   triangles[numTriangles]  (RpTriangle: uint16 vertex2, vertex1, materialId, vertex3)
#endif

#repeat numMorphTargets
    RwSphere    boundingSphere    (RwSphere: float32 x, y, z, radius)
    bool32      has vertices
    bool32      has normals
    #if has vertices
        RwV3d   vertices[numVertices] (RwV3d: float32 x, y, z)
    #endif
    #if has normals
        RwV3d   normals[numVertices]
    #endif
#endrepeat

Format

The following flags describe the behaviour of the mesh during the rendering progress. Some of the flags indicate the existence of data inside the following file format.

Flag Name Description
0x00000001 rpGEOMETRYTRISTRIP Is triangle strip (if disabled it will be an triangle list)
0x00000002 rpGEOMETRYPOSITIONS Vertex translation
0x00000004 rpGEOMETRYTEXTURED Texture coordinates
0x00000008 rpGEOMETRYPRELIT Vertex colors
0x00000010 rpGEOMETRYNORMALS Store normals
0x00000020 rpGEOMETRYLIGHT Geometry is lit (dynamic and static)
0x00000040 rpGEOMETRYMODULATEMATERIALCOLOR Modulate material color
0x00000080 rpGEOMETRYTEXTURED2 Texture coordinates 2
0x01000000 rpGEOMETRYNATIVE Native Geometry

Bits 16-23 (mask 0x00FF0000) in the format description give the number of texture coordinate sets (numTexSets). If the value in the file is zero, rpGEOMETRYTEXTURED means there is one set of texture coordinates, rpGEOMETRYTEXTURED2 means there are two.

If rpGEOMETRYNATIVE is set, the platform dependent geometry data is to be found in the Native Data chunk.

Extension

The extension of an geometry can hold the following chunks in GTA: