initLayer method
(en)Reconfigure the drawing order according to the layerNum set for each Sp3dObj. You will also need to call this again if you edited the Sp3dObj list or layerNum.
(ja)各Sp3dObjに設定されたlayerNumに従って描画順を再構成します。 Sp3dObjのリストやlayerNumを編集した場合にもこれを再度呼びだす必要があります。
Return: This object.
Implementation
Sp3dWorld initLayer() {
layers.clear();
if (objs.isNotEmpty) {
objs.sort((a, b) => a.layerNum.compareTo(b.layerNum));
int? nowLayerNum;
for (Sp3dObj i in objs) {
if (nowLayerNum == null) {
nowLayerNum = i.layerNum;
layers.add([i]);
} else {
if (nowLayerNum == i.layerNum) {
layers.last.add(i);
} else {
nowLayerNum = i.layerNum;
layers.add([i]);
}
}
}
}
return this;
}