speed up a little and fix camera bug

This commit is contained in:
RandomityGuy 2022-08-15 22:27:33 +05:30
parent 947aee6937
commit 9d040c371c
3 changed files with 14 additions and 3 deletions

View file

@ -893,11 +893,11 @@ class DtsObject extends GameObject {
if (mountPoint < 32) {
var ni = mountPointNodes[mountPoint];
if (ni != -1) {
var mtransform = this.graphNodes[ni].getAbsPos().clone();
var mtransform = this.graphNodes[ni].getAbsPos();
return mtransform;
}
}
return this.getTransform().clone();
return this.getTransform();
}
public function setOpacity(opacity:Float) {

View file

@ -288,6 +288,8 @@ class MarbleWorld extends Scheduler {
this.marble.camera.init(cast this);
this.marble.camera.CameraYaw = euler.z + Math.PI / 2;
this.marble.camera.CameraPitch = 0.45;
this.marble.camera.nextCameraPitch = 0.45;
this.marble.camera.nextCameraYaw = euler.z + Math.PI / 2;
this.marble.camera.oob = false;
this.marble.camera.finish = false;
this.marble.mode = Start;
@ -693,6 +695,7 @@ class MarbleWorld extends Scheduler {
this.forceObjects.push(cast obj);
}
obj.init(cast this);
obj.update(this.timeState);
if (obj.useInstancing) {
this.instanceManager.addObject(obj);
} else

View file

@ -13,7 +13,8 @@ class Octree {
/** A map of each object in the octree to the node that it's in. This accelerates removal drastically, as the lookup step can be skipped. */
public var objectToNode:Map<IOctreeObject, OctreeNode>;
public var tempBox = new Bounds();
var prevBoundSearch:Bounds;
var boundSearchCache:Array<IOctreeElement>;
public function new() {
this.root = new OctreeNode(this, 0);
@ -140,7 +141,14 @@ class Octree {
public function boundingSearch(bounds:Bounds) {
var intersections = [];
if (this.prevBoundSearch != null) {
if (this.prevBoundSearch.containsBounds(bounds)) {
return boundSearchCache;
}
}
this.root.boundingSearch(bounds, intersections);
prevBoundSearch = bounds;
boundSearchCache = intersections;
return intersections;
}