Class WorldLoader
Namespace: ValveResourceFormat.Renderer.World
Assembly: Renderer.dll
Loads and manages Source 2 world data including entities, lighting, and geometry.
public class WorldLoaderInheritance
Constructors
WorldLoader(World, Scene)
Initializes a new for the given world resource. Call to begin loading world components into the scene.
public WorldLoader(World world, Scene scene)Parameters
world World
The world data block to load.
scene Scene
The scene to load the world into.
Properties
CameraMatrices
Transform matrices corresponding to each entry in .
public List<Matrix4x4> CameraMatrices { get; }Property Value
CameraNames
Names of info_camera_link entities found in the world.
public List<string> CameraNames { get; }Property Value
DefaultEnabledLayers
Layer names that should be visible by default, populated during loading.
public HashSet<string> DefaultEnabledLayers { get; }Property Value
Entities
All entities parsed from the world's entity lumps.
public List<EntityLump.Entity> Entities { get; }Property Value
MainWorldNode
The first world node encountered during loading.
public WorldNode? MainWorldNode { get; }Property Value
MapName
The directory path of the map, e.g. maps/de_dust2.
public string MapName { get; }Property Value
NavMesh
The loaded navigation mesh, populated by .
public NavMeshFile? NavMesh { get; set; }Property Value
Skybox2D
The 2D skybox, if one was found during entity loading.
public SceneSkybox2D? Skybox2D { get; set; }Property Value
SkyboxScene
The 3D skybox scene, if one was found during entity loading.
public Scene? SkyboxScene { get; set; }Property Value
World
The world resource being loaded.
public World World { get; }Property Value
WorldOffset
Translation offset applied to the world, used when compositing multiple maps.
public Vector3 WorldOffset { get; set; }Property Value
WorldScale
Uniform scale applied to the world.
public float WorldScale { get; set; }Property Value
Methods
GetWorldNameFromMap(string)
Returns the path to the world resource (.vwrld_c) for a given map name.
public static string GetWorldNameFromMap(string mapName)Parameters
mapName string
Path to the map, with or without the compiled file suffix.
Returns
Load(ResourceExtRefList?)
Loads all world components: lighting, entities, world nodes, physics, and navigation mesh. Navigation mesh loading is parallelized with resource preloading when references are provided.
public void Load(ResourceExtRefList? mapResourceReferences = null)Parameters
mapResourceReferences ResourceExtRefList?
Optional external reference list from the map resource, used to preload assets in parallel.
LoadEntities()
Loads all entities from the world's entity lumps into the scene.
public void LoadEntities()LoadMap(string, Scene)
Loads a map by name, performing a full load of all world components.
public static WorldLoader LoadMap(string mapResourceName, Scene scene)Parameters
mapResourceName string
Path to the .vmap or .vmap_c resource.
scene Scene
The scene to load the world into.
Returns
LoadNavigationMesh()
Loads the navigation mesh for this world. Populates . Skips loading if is already set.
public void LoadNavigationMesh()LoadWorldLightingInfo()
Loads lightmap and lighting information from the world into the scene.
public void LoadWorldLightingInfo()LoadWorldNodes()
Loads all world nodes (.vwnod_c) referenced by the world into the scene.
public void LoadWorldNodes()LoadWorldPhysics()
Loads world physics collision geometry into the scene.
public void LoadWorldPhysics()ParallelPreloadResources(ResourceExtRefList?)
Preloads referenced resources in parallel using the map's external reference list. This is called automatically by and does not need to be called manually.
public void ParallelPreloadResources(ResourceExtRefList? mapResourceReferences = null)Parameters
mapResourceReferences ResourceExtRefList?
External reference list from the map resource, used to preload models and entity icons.

