mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-28 05:31:37 +00:00
speed up a little and fix camera bug
This commit is contained in:
parent
947aee6937
commit
9d040c371c
3 changed files with 14 additions and 3 deletions
|
|
@ -893,11 +893,11 @@ class DtsObject extends GameObject {
|
||||||
if (mountPoint < 32) {
|
if (mountPoint < 32) {
|
||||||
var ni = mountPointNodes[mountPoint];
|
var ni = mountPointNodes[mountPoint];
|
||||||
if (ni != -1) {
|
if (ni != -1) {
|
||||||
var mtransform = this.graphNodes[ni].getAbsPos().clone();
|
var mtransform = this.graphNodes[ni].getAbsPos();
|
||||||
return mtransform;
|
return mtransform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.getTransform().clone();
|
return this.getTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOpacity(opacity:Float) {
|
public function setOpacity(opacity:Float) {
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,8 @@ class MarbleWorld extends Scheduler {
|
||||||
this.marble.camera.init(cast this);
|
this.marble.camera.init(cast this);
|
||||||
this.marble.camera.CameraYaw = euler.z + Math.PI / 2;
|
this.marble.camera.CameraYaw = euler.z + Math.PI / 2;
|
||||||
this.marble.camera.CameraPitch = 0.45;
|
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.oob = false;
|
||||||
this.marble.camera.finish = false;
|
this.marble.camera.finish = false;
|
||||||
this.marble.mode = Start;
|
this.marble.mode = Start;
|
||||||
|
|
@ -693,6 +695,7 @@ class MarbleWorld extends Scheduler {
|
||||||
this.forceObjects.push(cast obj);
|
this.forceObjects.push(cast obj);
|
||||||
}
|
}
|
||||||
obj.init(cast this);
|
obj.init(cast this);
|
||||||
|
obj.update(this.timeState);
|
||||||
if (obj.useInstancing) {
|
if (obj.useInstancing) {
|
||||||
this.instanceManager.addObject(obj);
|
this.instanceManager.addObject(obj);
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
|
|
@ -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. */
|
/** 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 objectToNode:Map<IOctreeObject, OctreeNode>;
|
||||||
|
|
||||||
public var tempBox = new Bounds();
|
var prevBoundSearch:Bounds;
|
||||||
|
var boundSearchCache:Array<IOctreeElement>;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
this.root = new OctreeNode(this, 0);
|
this.root = new OctreeNode(this, 0);
|
||||||
|
|
@ -140,7 +141,14 @@ class Octree {
|
||||||
|
|
||||||
public function boundingSearch(bounds:Bounds) {
|
public function boundingSearch(bounds:Bounds) {
|
||||||
var intersections = [];
|
var intersections = [];
|
||||||
|
if (this.prevBoundSearch != null) {
|
||||||
|
if (this.prevBoundSearch.containsBounds(bounds)) {
|
||||||
|
return boundSearchCache;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.root.boundingSearch(bounds, intersections);
|
this.root.boundingSearch(bounds, intersections);
|
||||||
|
prevBoundSearch = bounds;
|
||||||
|
boundSearchCache = intersections;
|
||||||
return intersections;
|
return intersections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue