|
1
|
|
|
<?php |
|
2
|
|
|
/** @formatter:off |
|
3
|
|
|
* ****************************************************************** |
|
4
|
|
|
* Created by Marko Kungla on Jul 7, 2016 - 5:36:48 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 Video.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\VideoPrimitiveIF; |
|
27
|
|
|
use \AframeVR\Core\Entity; |
|
28
|
|
|
use \AframeVR\Core\Helpers\MeshAttributes; |
|
29
|
|
|
|
|
30
|
|
|
class Video extends Entity implements VideoPrimitiveIF |
|
31
|
|
|
{ |
|
32
|
|
|
use MeshAttributes; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Init <a-sphere> |
|
36
|
|
|
* |
|
37
|
|
|
* The sphere primitive creates a spherical or polyhedron shapes. |
|
38
|
|
|
* It wraps an entity that prescribes the geometry component with its geometric primitive set to sphere. |
|
39
|
|
|
* |
|
40
|
|
|
* {@inheritdoc} |
|
41
|
|
|
* |
|
42
|
|
|
* @return void |
|
43
|
|
|
*/ |
|
44
|
3 |
|
public function init() |
|
45
|
|
|
{ |
|
46
|
|
|
/* Load defaults */ |
|
47
|
3 |
|
$this->defaults(); |
|
48
|
3 |
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Set defaults |
|
52
|
|
|
* |
|
53
|
|
|
* {@inheritdoc} |
|
54
|
|
|
* |
|
55
|
|
|
* @return void |
|
56
|
|
|
*/ |
|
57
|
3 |
|
public function defaults() |
|
58
|
|
|
{ |
|
59
|
3 |
|
$this->component('Material')->shader('flat'); |
|
60
|
3 |
|
$this->color('#FFF'); |
|
61
|
3 |
|
$this->component('Material')->side('double'); |
|
62
|
3 |
|
$this->component('Material')->transparent(true); |
|
63
|
|
|
|
|
64
|
3 |
|
$this->component('Geometry')->primitive('plane'); |
|
65
|
3 |
|
$this->height(1.75); |
|
66
|
3 |
|
$this->width(3); |
|
67
|
|
|
|
|
68
|
3 |
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* geometry.height |
|
72
|
|
|
* |
|
73
|
|
|
* {@inheritdoc} |
|
74
|
|
|
* |
|
75
|
|
|
* @param int|float $height |
|
|
|
|
|
|
76
|
|
|
* @return VideoPrimitiveIF |
|
77
|
|
|
*/ |
|
78
|
3 |
|
public function height(float $height = 1.75): VideoPrimitiveIF |
|
79
|
|
|
{ |
|
80
|
3 |
|
$this->component('Geometry')->height($height); |
|
81
|
3 |
|
return $this; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* geometry.width |
|
86
|
|
|
* |
|
87
|
|
|
* {@inheritdoc} |
|
88
|
|
|
* |
|
89
|
|
|
* @param int|float $width |
|
90
|
|
|
* @return VideoPrimitiveIF |
|
91
|
|
|
*/ |
|
92
|
3 |
|
public function width(float $width = 3): VideoPrimitiveIF |
|
93
|
|
|
{ |
|
94
|
3 |
|
$this->component('Geometry')->width($width); |
|
95
|
3 |
|
return $this; |
|
96
|
|
|
} |
|
97
|
|
|
} |