|
1
|
|
|
<?php |
|
2
|
|
|
/** @formatter:off |
|
3
|
|
|
* ****************************************************************** |
|
4
|
|
|
* Created by Marko Kungla on Jul 7, 2016 - 10:51:16 PM |
|
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 Cursor.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\Core\Helpers\MeshAttributes; |
|
28
|
|
|
use \AframeVR\Interfaces\PrimitiveInterface; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* <a-cursor> |
|
32
|
|
|
* |
|
33
|
|
|
* The cursor primitive places a reticle or crosshair to add clicking and interactivity with the scene. It is an entity |
|
34
|
|
|
* that prescribes the cursor component and a default ring-shaped geometry. The cursor is usually placed as a child of |
|
35
|
|
|
* the camera. |
|
36
|
|
|
*/ |
|
37
|
|
|
final class Cursor extends Entity implements PrimitiveInterface |
|
38
|
|
|
{ |
|
39
|
|
|
|
|
40
|
|
|
use MeshAttributes; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Selector to obj |
|
44
|
|
|
* |
|
45
|
|
|
* Selector to an <a-asset-item> pointing to a .OBJ file or an inline path to a .OBJ file. |
|
46
|
|
|
* |
|
47
|
|
|
* @return ObjModelPrimitiveIF |
|
|
|
|
|
|
48
|
|
|
*/ |
|
49
|
1 |
|
public function init() |
|
50
|
|
|
{ |
|
51
|
1 |
|
$this->component('Geometry')->primitive('ring'); |
|
52
|
1 |
|
$this->component('Geometry')->radiusOuter(0.016); |
|
53
|
1 |
|
$this->component('Geometry')->radiusInner(0.01); |
|
54
|
1 |
|
$this->component('Geometry')->segmentsTheta(64); |
|
55
|
|
|
|
|
56
|
1 |
|
$this->component('Material')->shader('flat'); |
|
57
|
1 |
|
$this->color('#000'); |
|
58
|
1 |
|
$this->component('Material')->opacity(0.8); |
|
59
|
|
|
|
|
60
|
1 |
|
$this->position(0, 0, -1); |
|
61
|
|
|
|
|
62
|
1 |
|
$this->component('Cursor')->fuse(true); |
|
63
|
1 |
|
$this->component('Raycaster')->far(1000); |
|
64
|
1 |
|
$this->component('Cursor')->fuseTimeout(1500); |
|
65
|
1 |
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
} |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.