Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation

This commit is contained in:
Shoghi Cervantes
2014-10-27 15:39:20 +01:00
parent be948f99cc
commit 7abf52e615
39 changed files with 273 additions and 223 deletions

View File

@ -53,14 +53,11 @@ abstract class Door extends Transparent{
}
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}
$f = 0.1875;
$damage = $this->getFullDamage();
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -76,7 +73,7 @@ abstract class Door extends Transparent{
if($j === 0){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -85,7 +82,7 @@ abstract class Door extends Transparent{
$this->z + $f
);
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -95,7 +92,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -107,7 +104,7 @@ abstract class Door extends Transparent{
}elseif($j === 1){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -116,7 +113,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -126,7 +123,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -138,7 +135,7 @@ abstract class Door extends Transparent{
}elseif($j === 2){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -147,7 +144,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -157,7 +154,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -169,7 +166,7 @@ abstract class Door extends Transparent{
}elseif($j === 3){
if($flag){
if(!$flag1){
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -178,7 +175,7 @@ abstract class Door extends Transparent{
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -188,7 +185,7 @@ abstract class Door extends Transparent{
);
}
}else{
$bb = new AxisAlignedBB(
$bb = AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -199,7 +196,7 @@ abstract class Door extends Transparent{
}
}
return $this->boundingBox = $bb;
return $bb;
}
public function onUpdate($type){