skybox and more ui

This commit is contained in:
RandomityGuy 2022-11-12 00:37:36 +05:30
parent c878984ee3
commit ce3e33d5b5
47 changed files with 90 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 B

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -100,6 +100,8 @@ class MarbleWorld extends Scheduler {
var endPadElement:MissionElementStaticShape;
var endPad:EndPad;
var skyElement:MissionElementSky;
public var scene:Scene;
public var scene2d:h2d.Scene;
public var mission:Mission;
@ -172,7 +174,8 @@ class MarbleWorld extends Scheduler {
MissionElementType.Item,
MissionElementType.PathedInterior,
MissionElementType.StaticShape,
MissionElementType.TSStatic
MissionElementType.TSStatic,
MissionElementType.Sky
].contains(element._type)) {
// this.loadingState.total++;
@ -182,6 +185,10 @@ class MarbleWorld extends Scheduler {
if (so.datablock.toLowerCase() == 'endpad')
this.endPadElement = so;
}
if (element._type == Sky) {
this.skyElement = cast element;
}
} else if (element._type == MissionElementType.SimGroup) {
scanMission(cast element);
}
@ -220,8 +227,6 @@ class MarbleWorld extends Scheduler {
this.instanceManager = new InstanceManager(scene);
this.particleManager = new ParticleManager(cast this);
// var skyElement:MissionElementSky = cast this.mission.root.elements.filter((element) -> element._type == MissionElementType.Sky)[0];
var worker = new ResourceLoaderWorker(() -> {
var renderer = cast(this.scene.renderer, h3d.scene.fwd.Renderer);
@ -269,7 +274,7 @@ class MarbleWorld extends Scheduler {
this.sky = new Sky();
sky.dmlPath = "data/skies/sky_day.dml";
sky.dmlPath = ResourceLoader.getProperFilepath(skyElement.materiallist);
worker.addTask(fwd -> sky.init(cast this, fwd));
worker.addTask(fwd -> {
@ -728,6 +733,7 @@ class MarbleWorld extends Scheduler {
} else if (element.datablock == "HelpTrigger") {
trigger = new HelpTrigger(element, cast this);
} else {
onFinish();
return;
}
trigger.init(() -> {
@ -746,7 +752,8 @@ class MarbleWorld extends Scheduler {
var tsShape = new DtsObject();
tsShape.useInstancing = true;
tsShape.dtsPath = shapeName.substring(index + 'data/'.length);
tsShape.dtsPath = 'data/' + shapeName.substring(index + 'data/'.length);
tsShape.identifier = shapeName;
var shapePosition = MisParser.parseVector3(element.position);
shapePosition.x = -shapePosition.x;

View file

@ -95,15 +95,26 @@ class Mission {
}
public function getDifPath(rawElementPath:String) {
if (StringTools.contains(rawElementPath, "$usermods")) {
rawElementPath = rawElementPath.split("@").slice(1).map(x -> {
var a = StringTools.trim(x);
a = a.substr(1, a.length - 2);
return a;
}).join('');
}
var fname = rawElementPath.substring(rawElementPath.lastIndexOf('/') + 1);
rawElementPath = rawElementPath.toLowerCase();
var path = StringTools.replace(rawElementPath.substring(rawElementPath.indexOf('data/')), "\"", "");
if (StringTools.contains(path, 'interiors_mbg/'))
path = StringTools.replace(path, 'interiors_mbg/', 'interiors/');
var dirpath = path.substring(0, path.lastIndexOf('/') + 1);
#if (js || android)
path = StringTools.replace(path, "data/", "");
#end
if (ResourceLoader.fileSystem.exists(path))
return path;
if (ResourceLoader.fileSystem.exists(dirpath + fname))
return dirpath + fname;
return "";
}
}

View file

@ -17,10 +17,11 @@ import hxd.fs.FileSystem;
import hxd.res.Loader;
import src.Resource;
import src.ResourceLoaderWorker;
import fs.TorqueFileSystem;
class ResourceLoader {
#if (hl && !android)
public static var fileSystem:FileSystem = new LocalFileSystem(".", null);
public static var fileSystem:FileSystem = new TorqueFileSystem(".", null);
#end
#if (js || android)
public static var fileSystem:FileSystem = null;
@ -203,6 +204,23 @@ class ResourceLoader {
worker.run();
}
public static function getProperFilepath(rawElementPath:String) {
var fname = rawElementPath.substring(rawElementPath.lastIndexOf('/') + 1);
rawElementPath = rawElementPath.toLowerCase();
var path = StringTools.replace(rawElementPath.substring(rawElementPath.indexOf('data/')), "\"", "");
if (StringTools.contains(path, 'interiors_mbg/'))
path = StringTools.replace(path, 'interiors_mbg/', 'interiors/');
var dirpath = path.substring(0, path.lastIndexOf('/') + 1);
#if (js || android)
path = StringTools.replace(path, "data/", "");
#end
if (ResourceLoader.fileSystem.exists(path))
return path;
if (ResourceLoader.fileSystem.exists(dirpath + fname))
return dirpath + fname;
return "";
}
public static function load(path:String) {
#if hl
if (!StringTools.startsWith(path, "data/"))
@ -232,9 +250,7 @@ class ResourceLoader {
}
public static function loadDts(path:String) {
#if (js || android)
path = StringTools.replace(path, "data/", "");
#end
path = getProperFilepath(path);
if (dtsResources.exists(path))
return dtsResources.get(path);
else {

View file

@ -0,0 +1,47 @@
package fs;
import hxd.fs.LocalFileSystem;
class TorqueFileSystem extends LocalFileSystem {
override function checkPath(path:String) {
// make sure the file is loaded with correct case !
var baseDir = new haxe.io.Path(path).dir;
var c = directoryCache.get(baseDir.toLowerCase());
var isNew = false;
if (c == null) {
isNew = true;
c = new Map();
for (f in try sys.FileSystem.readDirectory(baseDir) catch (e:Dynamic) [])
c.set(f.toLowerCase(), true);
directoryCache.set(baseDir.toLowerCase(), c);
}
if (!c.exists(path.substr(baseDir.length + 1).toLowerCase())) {
// added since then?
if (!isNew) {
directoryCache.remove(baseDir.toLowerCase());
return checkPath(path);
}
return false;
}
return true;
}
override function open(path:String, check = true) {
var r = fileCache.get(path.toLowerCase());
if (r != null)
return r.r;
var e = null;
var f = sys.FileSystem.fullPath(baseDir + path);
if (f == null)
return null;
f = f.split("\\").join("/");
if (!check || (sys.FileSystem.exists(f) && checkPath(f))) {
e = new LocalEntry(this, path.split("/").pop(), path, f);
convert.run(e);
if (e.file == null)
e = null;
}
fileCache.set(path.toLowerCase(), {r: e});
return e;
}
}