fix backport pt2

This commit is contained in:
RandomityGuy 2023-02-20 14:11:52 +05:30
parent 5d511d2bd9
commit d7407f19f2
3 changed files with 41 additions and 13 deletions

View file

@ -357,4 +357,21 @@ class ResourceLoader {
}
return names;
}
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 (fileSystem.exists(path))
return path;
if (fileSystem.exists(dirpath + fname))
return dirpath + fname;
return "";
}
}

View file

@ -14,7 +14,6 @@ import h3d.Matrix;
import h3d.col.Bounds;
import src.PathedInterior;
import src.Util;
import src.Debug;
import src.MarbleGame;
class CollisionEntity implements IOctreeObject implements IBVHObject {
@ -104,18 +103,18 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
boundingBox.add(tform);
}
this.boundingBox = boundingBox;
if (Debug.drawBounds) {
if (_dbgEntity == null) {
_dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity);
} else {
_dbgEntity.remove();
_dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity);
}
}
// if (Debug.drawBounds) {
// if (_dbgEntity == null) {
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// } else {
// _dbgEntity.remove();
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
// }
}
public function rayCast(rayOrigin:Vector, rayDirection:Vector):Array<RayIntersectionData> {

View file

@ -0,0 +1,12 @@
package dts;
@:publicFields
class TSDrawPrimitive {
static var Triangles = 0 << 30;
static var Strip = 1 << 30;
static var Fan = 2 << 30;
static var Indexed = 1 << 29;
static var NoMaterial = 1 << 28;
static var MaterialMask = ~(1 << 30 | 2 << 30 | 0 << 30 | 1 << 29 | 1 << 28);
static var TypeMask = (1 << 30 | 2 << 30 | 0 << 30);
}