1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jul 7, 2016 - 3:05:44 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 FogComponent.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\Core\Components\ascene\Fog; |
25
|
|
|
|
26
|
|
|
use \AframeVR\Interfaces\Core\Components\ascene\FogCMPTIF; |
27
|
|
|
use \AframeVR\Core\Helpers\ComponentAbstract; |
28
|
|
|
|
29
|
|
|
class FogComponent extends ComponentAbstract implements FogCMPTIF |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Initialize Component |
34
|
|
|
* |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
* |
37
|
|
|
* @return bool |
38
|
|
|
*/ |
39
|
1 |
|
public function initializeComponent(): bool |
40
|
|
|
{ |
41
|
1 |
|
$this->setDomAttribute('fog'); |
42
|
1 |
|
$this->type(); |
43
|
1 |
|
$this->color(); |
44
|
1 |
|
return true; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Fog type |
49
|
|
|
* |
50
|
|
|
* Type of fog distribution. Can be linear or exponential. |
51
|
|
|
* |
52
|
|
|
* @param string $type |
53
|
|
|
* @return FogCMPTIF |
54
|
|
|
*/ |
55
|
1 |
|
public function type(string $type = 'linear'): FogCMPTIF |
56
|
|
|
{ |
57
|
1 |
|
$this->dom_attributes['type'] = $type; |
58
|
1 |
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Fog color |
63
|
|
|
* |
64
|
|
|
* Color of fog. For example, if set to black, far away objects will be rendered black. |
65
|
|
|
* |
66
|
|
|
* @param string $color |
67
|
|
|
* @return FogCMPTIF |
68
|
|
|
*/ |
69
|
1 |
|
public function color(string $color = '#000'): FogCMPTIF |
70
|
|
|
{ |
71
|
1 |
|
$this->dom_attributes['color'] = $color; |
72
|
1 |
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Fog near |
77
|
|
|
* |
78
|
|
|
* Minimum distance to start applying fog. Objects closer than this won’t be affected by fog. |
79
|
|
|
* |
80
|
|
|
* @param string $near |
|
|
|
|
81
|
|
|
* @return FogCMPTIF |
82
|
|
|
*/ |
83
|
1 |
|
public function near(int $near = 1): FogCMPTIF |
84
|
|
|
{ |
85
|
1 |
|
$this->dom_attributes['near'] = $near; |
86
|
1 |
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Fog far |
91
|
|
|
* |
92
|
|
|
* Maximum distance to stop applying fog. Objects farther than this won’t be affected by fog. |
93
|
|
|
* |
94
|
|
|
* @param int $far |
95
|
|
|
* @return FogCMPTIF |
96
|
|
|
*/ |
97
|
1 |
|
public function far(int $far = 1000): FogCMPTIF |
98
|
|
|
{ |
99
|
1 |
|
$this->dom_attributes['far'] = $far; |
100
|
1 |
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Fog density |
105
|
|
|
* |
106
|
|
|
* How quickly the fog grows dense. |
107
|
|
|
* |
108
|
|
|
* @param float $density |
109
|
|
|
* @return FogCMPTIF |
110
|
|
|
*/ |
111
|
1 |
|
public function density(float $density = 0.00025): FogCMPTIF |
112
|
|
|
{ |
113
|
1 |
|
$this->dom_attributes['density'] = $density; |
114
|
1 |
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
} |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.