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\Core\Entity; |
27
|
|
|
use \AframeVR\Interfaces\EntityInterface; |
28
|
|
|
|
29
|
|
|
class ColladaModel extends Entity implements EntityInterface |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Init <a-collada-model> |
34
|
|
|
* |
35
|
|
|
* The COLLADA model primitive displays a 3D COLLADA model created from a 3D modeling program or downloaded from |
36
|
|
|
* the web. It is an entity that maps the src attribute to the collada-model component. |
37
|
|
|
* |
38
|
|
|
* @return void |
39
|
|
|
*/ |
40
|
3 |
|
public function reset() |
41
|
|
|
{ |
42
|
3 |
|
parent::reset(); |
43
|
3 |
|
$this->el()->entity()->attr('ColladaModel'); |
|
|
|
|
44
|
3 |
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Rotation component |
48
|
|
|
* |
49
|
|
|
* Apply rotation on el instead |
50
|
|
|
* |
51
|
|
|
* @param int|float $roll |
52
|
|
|
* @param int|float $pitch |
53
|
|
|
* @param int|float $yaw |
54
|
|
|
* @return EntityInterface |
55
|
|
|
*/ |
56
|
2 |
|
public function rotation(float $roll = 0, float $pitch = 0, float $yaw = 0): EntityInterface |
57
|
|
|
{ |
58
|
2 |
|
$this->el()->entity()->rotation($roll, $pitch, $yaw); |
|
|
|
|
59
|
2 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Scale component |
64
|
|
|
* |
65
|
|
|
* Apply scale on el intead |
66
|
|
|
* |
67
|
|
|
* @param int|float $scale_x |
68
|
|
|
* @param int|float $scale_y |
69
|
|
|
* @param int|float $scale_z |
70
|
|
|
* @return EntityInterface |
71
|
|
|
*/ |
72
|
2 |
|
public function scale(float $scale_x = 1, float $scale_y = 1, float $scale_z = 1): EntityInterface |
73
|
|
|
{ |
74
|
2 |
|
$this->el()->entity()->scale($scale_x, $scale_y, $scale_z); |
|
|
|
|
75
|
2 |
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* ColladaModel.src |
80
|
|
|
* |
81
|
|
|
* @param null|string $src |
82
|
|
|
* @return EntityInterface |
83
|
|
|
*/ |
84
|
2 |
|
public function src(string $src = null): EntityInterface |
85
|
|
|
{ |
86
|
2 |
|
$this->el() |
|
|
|
|
87
|
2 |
|
->entity() |
88
|
2 |
|
->attr('ColladaModel') |
89
|
2 |
|
->src($src); |
90
|
2 |
|
return $this; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
This check looks for function calls that miss required arguments.