PictureManager

Source file: prog/engine/lib3d/picMgr.cpp

Picture Sources

Pictures can be files, resources, http resources, base64 encoded or dynamically rendered characters.

Full image path can be with or without path to PictureAtlas (see below) [atlasPath#]<image path string>.

If image path string starts with http or https - it is treated as url and image would be requested from this url. If image path string doesn’t have slashes and endswith * - it is treated as game built resource and would be loaded from .dxp.bin files. If image path string starts with b64:// it is supposed to be base64 encoded string file (usually svg). if image path string starts with render string - it is supposed to be datablock string, that allow to render in atlas or separately dynamic render objects, like characters. In other cases image path string should be path to image path (usually png, svg or jpg).

Picture Atlases

Dagor allow to make dynamic atlases for images. Such atlases improve rendering performance, cause allow to render several UI objects with one drawprimitive.

To create atlas you need specify it’s parameters in configuration file in datablock format.

Picture atlas configuration format:

tex{
  dynAtlas:b=yes
  rtTex:b=yes
  name:t="myatlas" //for debugging? and for static (obsolete) atlases
  size:ip2=512,512 //size in pixels

  maxAllowedPicSz:ip2=320,320 //max allowed picture size to rasterize.
                              //Will raise a logerr on attempt to rasterize bigger image.
  premultiplyAlpha:b=yes
  margin:i=1 //margin around pictures
  picSrcFolder:t="/ui/uiskin/"
  picReserve:i=128
  refHRes:i=1080 //reference size of vertcal resoultion.
                 //Atlas will proportionally scale on bigger resolutions,
                 //as we usually need pixel perfect rasterization of icons
}

To specify usage of picture atlas:

//   "tex/mytex.tga"        - real texture name
//   "tex/myatlas#mytex" - picture "mytex" in tex/myatlas.blk