Sims 3:0x01D10F34

From SimsWiki
Jump to: navigation, search
Modding Reference by Category

Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference 

Object Model - MLOD
TypeID:0x01D10F34
Game Version:The Sims 3



Contents

Overview

This is an RCOL chunk. LOD means Level of detail. This chunk is found in both MLOD and MODL files, and it is the key that maps each mesh group to the appropriate parts of VRTF, VBUF, IBUF, SKIN and MATD chunks. It is the one ring to rule them all.

Format

DWORD  Tag                  // 'MLOD'
DWORD  Version              // 0x00000201
DWORD                       // group_count
repeat group_count times:
	DWORD                // subset_bytes  number of bytes after here in this repetition
	DWORD NameHash       // FNV32 of the group name
	DWORD Material       // MATD or MTST Private index
	DWORD VertexFormat   // VRTF Private index
	DWORD VertexBuffer   // VBUF Private index
	DWORD IndexBuffer    // IBUF Private index
	DWORD Flags          // PrimitiveType | (MeshFlags << 8)
	DWORD StreamOffset   // VBUF offset in bytes
	DWORD StartVertex    // 0
	DWORD StartIndex     // IBUF index
	DWORD MinVertexIndex // 0
	DWORD VertexCount    // 
	DWORD PrimitiveCount // 
	FLOAT[6] BoundingBox // MinX/MinY/MinZ/MaxX/MaxY/MaxZ for this group
	DWORD SkinController // SKIN Private index
	DWORD    // bone_count
	repeat bone_count times:
		DWORD    // bone hash name
    	DWORD    // MATD Private index //Special MATD that only has UVScale/UVOffset/PosScale/PosOffset and no ShaderName
    	DWORD    // geo_st_count
    	repeat geo_st_count times:
    	     	DWORD    // geo_st name hash
    	     	DWORD    // VBUF starting index    index of the first vertex of the geo_st
    	     	DWORD    // (IBUF starting index) * 3          index of the first polygon face of the geo_st
    	     	DWORD    // VBUF count                   number of vertices in the geo_st
    	     	DWORD    // IBUF count                   number of polygon faces in the geo_st
	if(version > 0x00000201)
		DWORD ParentNameHash  // FNV32 of the ParentName, always 0
		FLOAT[3] MirrorPlaneNormal //  3d normal vector specifying the direction of a mirror's reflection
		FLOAT MirrorPlaneOffset   //offset along the normal vector	

Primitive Types

Id Type
0x00000000 PointList
0x00000001 LineList
0x00000002 LineStrip
0x00000003 TriangleList
0x00000004 TriangleFan
0x00000005 TriangleStrip
0x00000006 QuadList
0x00000007 DisplayList

Mesh Flags

Flag Type
0x00000001 BasinInterior
0x00000002 HDExteriorLit
0x00000004 PortalSide
0x00000008 DropShadow
0x00000010 ShadowCaster
0x00000020 Foundation
0x00000040 Pickable


Geometry States

Geometry states are basically a way to make part of an object's mesh visible while the rest of it becomes invisible. The polygons and vertices that are visible in the geometry state are determined by the state's poly and vertex offsets and counts.

The purpose of geometry states is to sub-divide the mesh of a given group, allowing the model's visibility to be dynamically changed by the game through the function:

   ScriptCore.World.ObjectSetGeometryVisibilityState(ObjectGuid objId, string geometryVisibilityState);

For most objects with geometry states, this function is commonly accessed through this function:

   Sims3.Gameplay.Abstracts.GameObject.SetGeometryState(string state);

For some objects, the string argument is fnv32 hashed and matched to the corresponding geo_st name hash. However, in some cases, such as for the musicalInstrumentGuitar, it is unknown how some geometry states are located for the game. In the case of the guitar, two geometry states are given in the MLOD block:

   0x4A9A1FD1 "guitarOnly"
   0x019C3651 "standOnly"

However, the guitar's code uses the string "guitarAndStand" to combine the two states and get the complete mesh. How this is done is still unknown.

UPDATE:

  • The current theory is that when the hash of a geometry state name does not explicitly match any of the geometry states in the mesh's model, the entire model becomes visible.
  • Also, the geometry state only effects the group that it is in. All other groups remain completely visible despite the current geometry state of one of the group.
  • By creating what can be called a "zero" geometry state, with offset and count values all equal to zero, the group that the geometry state is an can be hidden in the game when that state is entered.
  • An example is the garden sprinkler, which has two groups, one of which contains the sprinkler and the "dome" that you see in build/buy mode, and the other containing only the dome itself.
  • The group that contains only the dome has a single geometry state, "domeOff", which is a zero geometry state. When this state is entered, the dome disappears, and the scripts enter it whenever Live Mode is entered.
  • When Build or Buy Mode is entered, the scripts enter the "domeOn" geometry state. Since this state is not explicitly defined in the model, entering this state causes the entire model, including the dome, to become visible.
  • Based on contributions from karybdis, atavera and ChaosMageX
Modding Reference by Category

Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference 

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox