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\Interfaces\EntityInterface; |
28
|
|
|
|
29
|
|
|
final class Cursor extends Entity implements EntityInterface |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* <a-cursor> |
34
|
|
|
* |
35
|
|
|
* The cursor primitive places a reticle or crosshair to add clicking and interactivity with the scene. It is an |
36
|
|
|
* entity that prescribes the cursor component and a default ring-shaped geometry. The cursor is usually placed as |
37
|
|
|
* a child of the camera. |
38
|
|
|
* |
39
|
|
|
* @return void |
40
|
|
|
*/ |
41
|
2 |
|
public function reset() |
42
|
|
|
{ |
43
|
2 |
|
parent::reset(); |
44
|
2 |
|
$this->component('Geometry')->primitive('ring'); |
45
|
2 |
|
$this->component('Geometry')->radiusOuter(0.016); |
46
|
2 |
|
$this->component('Geometry')->radiusInner(0.01); |
47
|
2 |
|
$this->component('Geometry')->segmentsTheta(64); |
48
|
|
|
|
49
|
2 |
|
$this->component('Material')->shader('flat'); |
50
|
2 |
|
$this->color('#000'); |
51
|
2 |
|
$this->component('Material')->opacity(0.8); |
52
|
|
|
|
53
|
2 |
|
$this->position(0, 0, - 1); |
54
|
|
|
|
55
|
2 |
|
$this->component('Cursor')->fuse(true); |
56
|
2 |
|
$this->component('Raycaster')->far(1000); |
57
|
2 |
|
$this->component('Cursor')->fuseTimeout(1500); |
58
|
|
|
} |
59
|
|
|
} |