|
1
|
|
|
<?php |
|
2
|
|
|
/** @formatter:off |
|
3
|
|
|
* ****************************************************************** |
|
4
|
|
|
* Created by Marko Kungla on Jul 4, 2016 - 4:22:41 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 ColladaModel.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\Interfaces\Extras\Primitives\ColladaModelInterface; |
|
27
|
|
|
use \AframeVR\Core\Entity; |
|
28
|
|
|
use \AframeVR\Core\Helpers\MeshAttributes; |
|
29
|
|
|
|
|
30
|
|
|
class ColladaModel extends Entity implements ColladaModelInterface |
|
31
|
|
|
{ |
|
32
|
|
|
use MeshAttributes; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Init <a-box> |
|
36
|
|
|
* |
|
37
|
|
|
* The box primitive, formerly called <a-cube>, creates shapes such as boxes, cubes, or walls. |
|
38
|
|
|
* It is an entity that prescribes the geometry with its geometric primitive set to box. |
|
39
|
|
|
* |
|
40
|
|
|
* {@inheritdoc} |
|
41
|
|
|
* |
|
42
|
|
|
* @return void |
|
43
|
|
|
*/ |
|
44
|
3 |
|
public function init() |
|
45
|
|
|
{ |
|
46
|
3 |
|
$this->entity()->component('ColladaModel'); |
|
47
|
3 |
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Set defaults |
|
51
|
|
|
* |
|
52
|
|
|
* {@inheritdoc} |
|
53
|
|
|
* |
|
54
|
|
|
* @return void |
|
55
|
|
|
*/ |
|
56
|
3 |
|
public function defaults() |
|
57
|
|
|
{ |
|
58
|
|
|
|
|
59
|
3 |
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Rotation component |
|
63
|
|
|
* |
|
64
|
|
|
* {@inheritdoc} |
|
65
|
|
|
* |
|
66
|
|
|
* @param int|float $roll |
|
67
|
|
|
* @param int|float $pitch |
|
68
|
|
|
* @param int|float $yaw |
|
69
|
|
|
* @return Entity |
|
70
|
|
|
*/ |
|
71
|
3 |
|
public function rotation(float $roll = 0, float $pitch = 0, float $yaw = 0): Entity |
|
72
|
|
|
{ |
|
73
|
3 |
|
$this->entity()->rotation($roll, $pitch, $yaw); |
|
74
|
3 |
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Scale component |
|
79
|
|
|
* |
|
80
|
|
|
* {@inheritdoc} |
|
81
|
|
|
* |
|
82
|
|
|
* @param int|float $scale_x |
|
83
|
|
|
* @param int|float $scale_y |
|
84
|
|
|
* @param int|float $scale_z |
|
85
|
|
|
* @return Entity |
|
86
|
|
|
*/ |
|
87
|
3 |
|
public function scale(float $scale_x = 1, float $scale_y = 1, float $scale_z = 1): Entity |
|
88
|
|
|
{ |
|
89
|
3 |
|
$this->entity()->scale($scale_x, $scale_y, $scale_z); |
|
90
|
3 |
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* ColladaModel.src |
|
95
|
|
|
* |
|
96
|
|
|
* @param null|string $src |
|
97
|
|
|
* @return ColladaModelInterface |
|
98
|
|
|
*/ |
|
99
|
3 |
|
public function src(string $src = null): ColladaModelInterface |
|
100
|
|
|
{ |
|
101
|
3 |
|
$this->entity()->component('ColladaModel') |
|
102
|
3 |
|
->src($src); |
|
103
|
3 |
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
} |
|
106
|
|
|
|