| world - a ready world loaded by LoadWorldAsync or LoadWorldDocumentAsync |
|
Returns how much data a world's objects draw with, and how much of it a streaming start would load, as JSON. A world that loads everything at the start loads all of it; a world that streams starts with what its start view needs and loads the rest as cameras come near. This command measures both from a ready world, whether or not it streams, for example {"total":1717986918,"start":220200960,"models":40,"textures":7}: total is the bytes of geometry and textures in all, start the bytes a streaming start would load, and models and textures how many different ones there are. Copies that share data count once, and the sizes are memory, as the streaming budget counts them. The start counts what the world's start view needs on a 1,920-pixel view, what is kept loaded, and everything that cannot stream: primitives, and models the world needs whole, such as those with physics. A model without a summary counts as it would once the World Editor has written its summary. The World Editor's Loading section shows these sizes, and says when streaming would help. See also: WorldAssetSummary, SetWorldStreaming, EntityLoadState, LoadWorldAsync. |
; WorldLoadingSummary Example
; ---------------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
; A road of avocados and boom boxes, loaded whole
world=LoadWorldAsync("../../../samples/worlds/help-streaming.world",WORLD_LOAD_NO_STREAMING)
While Not WorldReady(world)
If WorldLoadState(world)=WORLD_LOAD_FAILED Then RuntimeError WorldLoadError(world)
Cls
Text 0,0,"Loading the whole road..."
Flip
Wend
SetWorld world
camera=FindWorldEntity(world,"camera")
; What the world draws with, and what a streaming start would load
summary$=WorldLoadingSummary(world)
; Its sizes, read from the JSON, in megabytes
info=ParseJson(summary)
total_bytes=JsonObjectGet(info,"total")
start_bytes=JsonObjectGet(info,"start")
total#=JsonInteger(total_bytes)/1048576.0
start#=JsonInteger(start_bytes)/1048576.0
FreeJson total_bytes
FreeJson start_bytes
FreeJson info
While Not KeyDown(1)
; The camera drives along the road by itself, back to the start at its end
MoveEntity camera,0,0,0.3
If EntityZ(camera)>1100 Then PositionEntity camera,0,1.6,0
; Arrow keys move the camera (bigger steps suit the road's length)
If KeyDown(200) Then MoveEntity camera,0,0,0.5
If KeyDown(208) Then MoveEntity camera,0,0,-0.5
If KeyDown(203) Then TurnEntity camera,0,1,0
If KeyDown(205) Then TurnEntity camera,0,-1,0
RenderWorld
Text 0,0,"Arrow keys: drive along the road Esc: exit"
Text 0,20,"WorldLoadingSummary(world) = "+summary
Text 0,40,"Loaded whole, the road takes "+Int(total)+" MB"
Text 0,60,"Streaming, it would start with about "+Int(start)+" MB"
Flip
Wend
End