speed cubemap

This commit is contained in:
RandomityGuy 2023-07-21 21:11:30 +05:30
parent 95d9a2601a
commit 58201b2745

View file

@ -197,6 +197,7 @@ class MarbleWorld extends Scheduler {
var _loadingLength:Int = 0; var _loadingLength:Int = 0;
var _resourcesLoaded:Int = 0; var _resourcesLoaded:Int = 0;
var _cubemapNeedsUpdate:Bool = true;
var textureResources:Array<Resource<h3d.mat.Texture>> = []; var textureResources:Array<Resource<h3d.mat.Texture>> = [];
var soundResources:Array<Resource<Sound>> = []; var soundResources:Array<Resource<Sound>> = [];
@ -1139,6 +1140,8 @@ class MarbleWorld extends Scheduler {
if (!this.rewinding && Settings.optionsSettings.rewindEnabled) if (!this.rewinding && Settings.optionsSettings.rewindEnabled)
this.rewindManager.recordFrame(); this.rewindManager.recordFrame();
_cubemapNeedsUpdate = true;
this.updateTexts(); this.updateTexts();
} }
@ -1147,7 +1150,8 @@ class MarbleWorld extends Scheduler {
asyncLoadResources(); asyncLoadResources();
if (this.playGui != null && _ready) if (this.playGui != null && _ready)
this.playGui.render(e); this.playGui.render(e);
if (this.marble != null && this.marble.cubemapRenderer != null && _ready) { if (this.marble != null && this.marble.cubemapRenderer != null && _cubemapNeedsUpdate && _ready) {
_cubemapNeedsUpdate = false;
this.marble.cubemapRenderer.position.load(this.marble.getAbsPos().getPosition()); this.marble.cubemapRenderer.position.load(this.marble.getAbsPos().getPosition());
this.marble.cubemapRenderer.render(e, 0.002); this.marble.cubemapRenderer.render(e, 0.002);
} }