Completed
Push — master ( 44e5f7...e8b22d )
by Marko
9s
created

Curvedimage::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
dl 0
loc 18
ccs 14
cts 14
cp 1
rs 9.4285
c 2
b 0
f 1
cc 1
eloc 14
nc 1
nop 0
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 7, 2016 - 9:46:02 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         Curvedimage.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\CurvedimagePrimitiveIF;
27
use \AframeVR\Core\Entity;
28
use \AframeVR\Core\Helpers\MeshAttributes;
29
30
/**
31
 * <a-curvedimage>
32
 *
33
 * he curved image primitive creates images that bend around the user. Curved images arranged around the camera can be
34
 * pleasing for legibility since each pixel sits at the same distance from the user. They can be a better choice than
35
 * angled flat planes for complex layouts because they ensure a smooth surface rather than a series of awkward seams
36
 * between planes. It is an entity that prescribes a double-sided open-ended cylinder with the geometry component and
37
 * rendering textures on the inside of the cylinder with the material component.
38
 */
39
final class Curvedimage extends Entity implements CurvedimagePrimitiveIF
40
{
41
    
42
    use MeshAttributes;
43
44
    /**
45
     * Selector to obj
46
     *
47
     * Selector to an <a-asset-item> pointing to a .OBJ file or an inline path to a .OBJ file.
48
     *
49
     * @return ObjModelPrimitiveIF
0 ignored issues
show
Documentation introduced by
Should the return type not be Curvedimage?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
50
     */
51 4
    public function init()
52
    {
53 4
        $this->component('Geometry')->primitive('cylinder');
54 4
        $this->component('Geometry')->height(1);
55 4
        $this->component('Geometry')->radius(2);
56 4
        $this->component('Geometry')->segmentsRadial(48);
57 4
        $this->component('Geometry')->thetaLength(270);
58 4
        $this->component('Geometry')->openEnded(true);
59 4
        $this->component('Geometry')->thetaStart(0);
60
        
61 4
        $this->component('Material')->shader('flat');
62 4
        $this->color('#fff');
63 4
        $this->component('Material')->side('double');
64 4
        $this->component('Material')->transparent(true);
65
        
66 4
        $this->component('Material')->shader()->repeat(- 1, 1);
67 4
        return $this;
68
    }
69
}