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

@ -44,14 +44,11 @@ class Ladder extends Transparent{
}
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}
$f = 0.125;
if($this->meta === 2){
return $this->boundingBox = new AxisAlignedBB(
return AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -60,7 +57,7 @@ class Ladder extends Transparent{
$this->z + 1
);
}elseif($this->meta === 3){
return $this->boundingBox = new AxisAlignedBB(
return AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,
@ -69,7 +66,7 @@ class Ladder extends Transparent{
$this->z + $f
);
}elseif($this->meta === 4){
return $this->boundingBox = new AxisAlignedBB(
return AxisAlignedBB::getBoundingBoxFromPool(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -78,7 +75,7 @@ class Ladder extends Transparent{
$this->z + 1
);
}elseif($this->meta === 5){
return $this->boundingBox = new AxisAlignedBB(
return AxisAlignedBB::getBoundingBoxFromPool(
$this->x,
$this->y,
$this->z,