1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jun 21, 2016 - 11:58:54 AM |
5
|
|
|
* Contact [email protected] |
6
|
|
|
* @copyright 2016 Marko Kungla - https://github.com/mkungla |
7
|
|
|
* @license The MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* @category AframeVR |
10
|
|
|
* @package aframe-php |
11
|
|
|
* |
12
|
|
|
* Lang PHP (php version >= 7) |
13
|
|
|
* Encoding UTF-8 |
14
|
|
|
* File Box.php |
15
|
|
|
* Code format PSR-2 and 12 |
16
|
|
|
* @link https://github.com/mkungla/aframe-php |
17
|
|
|
* @issues https://github.com/mkungla/aframe-php/issues |
18
|
|
|
* ******************************************************************** |
19
|
|
|
* Contributors: |
20
|
|
|
* @author Marko Kungla <[email protected]> |
21
|
|
|
* ******************************************************************** |
22
|
|
|
* Comments: |
23
|
|
|
* @formatter:on */ |
24
|
|
|
namespace AframeVR\Extras\Primitives; |
25
|
|
|
|
26
|
|
|
use \AframeVR\Core\Entity; |
27
|
|
|
use \AframeVR\Interfaces\EntityInterface; |
28
|
|
|
|
29
|
|
|
class Box extends Entity implements EntityInterface |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Init <a-box> |
34
|
|
|
* |
35
|
|
|
* The box primitive, formerly called <a-cube>, creates shapes such as boxes, cubes, or walls. It is an entity that |
36
|
|
|
* prescribes the geometry with its geometric primitive set to box. |
37
|
|
|
* |
38
|
|
|
* @return void |
39
|
|
|
*/ |
40
|
5 |
|
public function reset() |
41
|
|
|
{ |
42
|
5 |
|
parent::reset(); |
43
|
5 |
|
$this->component('Geometry')->primitive('box'); |
44
|
5 |
|
$this->depth(1); |
45
|
5 |
|
$this->height(1); |
46
|
5 |
|
$this->width(1); |
47
|
5 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* geometry.depth |
51
|
|
|
* |
52
|
|
|
* @param float $depth |
53
|
|
|
* @return self |
|
|
|
|
54
|
|
|
*/ |
55
|
5 |
|
public function depth(float $depth): self |
56
|
|
|
{ |
57
|
5 |
|
$this->component('Geometry')->depth($depth); |
58
|
5 |
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* geometry.height |
63
|
|
|
* |
64
|
|
|
* @param float $height |
65
|
|
|
* @return self |
|
|
|
|
66
|
|
|
*/ |
67
|
5 |
|
public function height(float $height): self |
68
|
|
|
{ |
69
|
5 |
|
$this->component('Geometry')->height($height); |
70
|
5 |
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* geometry.width |
75
|
|
|
* |
76
|
|
|
* @param float $height |
|
|
|
|
77
|
|
|
* @return self |
|
|
|
|
78
|
|
|
*/ |
79
|
5 |
|
public function width(float $width): self |
80
|
|
|
{ |
81
|
5 |
|
$this->component('Geometry')->width($width); |
82
|
5 |
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Optional: geometry.segmentsHeight |
87
|
|
|
* |
88
|
|
|
* @param int $height |
89
|
|
|
* @return self |
|
|
|
|
90
|
|
|
*/ |
91
|
|
|
public function segmentsHeight(int $height): self |
92
|
|
|
{ |
93
|
|
|
$this->component('Geometry')->segmentsHeight($height); |
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Optional: geometry.segmentsWidth |
99
|
|
|
* |
100
|
|
|
* @param int $width |
101
|
|
|
* @return self |
|
|
|
|
102
|
|
|
*/ |
103
|
|
|
public function segmentsWidth(int $width): self |
104
|
|
|
{ |
105
|
|
|
$this->component('Geometry')->segmentsWidth($width); |
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Optional: geometry.segmentsDepth |
111
|
|
|
* |
112
|
|
|
* @param int $depth |
113
|
|
|
* @return self |
|
|
|
|
114
|
|
|
*/ |
115
|
|
|
public function segmentsDepth(int $depth): self |
116
|
|
|
{ |
117
|
|
|
$this->component('Geometry')->segmentsDepth($depth); |
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.