Completed
Push — master ( e8b22d...bec3f6 )
by Marko
11s
created

ColladaModel::reset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 4, 2016 - 4:22:41 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         ColladaModel.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
class ColladaModel extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * Init <a-collada-model>
34
     *
35
     * The COLLADA model primitive displays a 3D COLLADA model created from a 3D modeling program or downloaded from
36
     * the web. It is an entity that maps the src attribute to the collada-model component.
37
     *
38
     * @return void
39
     */
40 3
    public function reset()
41
    {
42 3
        parent::reset();
43 3
        $this->child()->entity()->component('ColladaModel');
44 3
    }
45
46
    /**
47
     * Rotation component
48
     *
49
     * Apply rotation on child instead
50
     *
51
     * @param int|float $roll            
52
     * @param int|float $pitch            
53
     * @param int|float $yaw            
54
     * @return EntityInterface
55
     */
56 2
    public function rotation(float $roll = 0, float $pitch = 0, float $yaw = 0): EntityInterface
57
    {
58 2
        $this->child()->entity()->rotation($roll, $pitch, $yaw);
59 2
        return $this;
60
    }
61
62
    /**
63
     * Scale component
64
     *
65
     * Apply scale on child intead
66
     *
67
     * @param int|float $scale_x            
68
     * @param int|float $scale_y            
69
     * @param int|float $scale_z            
70
     * @return EntityInterface
71
     */
72 2
    public function scale(float $scale_x = 1, float $scale_y = 1, float $scale_z = 1): EntityInterface
73
    {
74 2
        $this->child()->entity()->scale($scale_x, $scale_y, $scale_z);
75 2
        return $this;
76
    }
77
78
    /**
79
     * ColladaModel.src
80
     *
81
     * @param null|string $src            
82
     * @return EntityInterface
83
     */
84 2
    public function src(string $src = null): EntityInterface
85
    {
86 2
        $this->child()
87 2
            ->entity()
88 2
            ->component('ColladaModel')
89 2
            ->src($src);
90 2
        return $this;
91
    }
92
}
93