| 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\Core\Entity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use \AframeVR\Interfaces\EntityInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | final class Curvedimage extends Entity implements EntityInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * <a-curvedimage> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * he curved image primitive creates images that bend around the user. Curved images arranged around the camera can | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * be pleasing for legibility since each pixel sits at the same distance from the user. They can be a better choice | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * than angled flat planes for complex layouts because they ensure a smooth surface rather than a series of awkward | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * seams between planes. It is an entity that prescribes a double-sided open-ended cylinder with the geometry | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * component and rendering textures on the inside of the cylinder with the material component. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 3 |  |     public function reset() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 3 |  |         parent::reset(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 3 |  |         $this->attr('Material')->shader('flat'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 3 |  |         $this->attr('Material')->side('double'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 | 3 |  |         $this->color('#FFF'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 3 |  |         $this->transparent(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 3 |  |         $this->repeat(-1, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 3 |  |         $this->attr('Geometry')->primitive('cylinder'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 3 |  |         $this->height(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 3 |  |         $this->radius(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 3 |  |         $this->segmentsRadial(48); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 3 |  |         $this->thetaLength(270); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 3 |  |         $this->thetaStart(0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 3 |  |         $this->openEnded(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 3 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * geometry.height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * @param float $height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 3 |  |     public function height(float $height) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 3 |  |         $this->attr('Geometry')->height($height); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * geometry.radius | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * @param float $radius | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * @return self | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 78 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 79 | 3 |  |     public function radius(float $radius) | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 81 | 3 |  |         $this->attr('Geometry')->radius($radius); | 
            
                                                                        
                            
            
                                    
            
            
                | 82 | 3 |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * geometry.segmentsRadial | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @param int $segmentsRadial | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 3 |  |     public function segmentsRadial(int $segmentsRadial) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 | 3 |  |         $this->attr('Geometry')->segmentsRadial($segmentsRadial); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * geometry.thetaLength | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @param int $thetaLength | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 3 |  |     public function thetaLength(int $thetaLength) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 | 3 |  |         $this->attr('Geometry')->thetaLength($thetaLength); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * geometry.thetaStart | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * @param int $thetaStart | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 | 3 |  |     public function thetaStart(int $thetaStart) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 3 |  |         $this->attr('Geometry')->thetaStart($thetaStart); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * geometry.openEnded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |      * @param bool $openEnded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 | 3 |  |     public function openEnded(bool $openEnded = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 | 3 |  |         $this->attr('Geometry')->openEnded($openEnded); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 | 3 |  |         return $this; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 131 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 132 |  |  | } |