Home | History | Annotate | Download | only in Example
      1 <?php
      2 // automatically generated by the FlatBuffers compiler, do not modify
      3 
      4 namespace MyGame\Example;
      5 
      6 use \Google\FlatBuffers\Struct;
      7 use \Google\FlatBuffers\Table;
      8 use \Google\FlatBuffers\ByteBuffer;
      9 use \Google\FlatBuffers\FlatBufferBuilder;
     10 
     11 class Vec3 extends Struct
     12 {
     13     /**
     14      * @param int $_i offset
     15      * @param ByteBuffer $_bb
     16      * @return Vec3
     17      **/
     18     public function init($_i, ByteBuffer $_bb)
     19     {
     20         $this->bb_pos = $_i;
     21         $this->bb = $_bb;
     22         return $this;
     23     }
     24 
     25     /**
     26      * @return float
     27      */
     28     public function GetX()
     29     {
     30         return $this->bb->getFloat($this->bb_pos + 0);
     31     }
     32 
     33     /**
     34      * @return float
     35      */
     36     public function GetY()
     37     {
     38         return $this->bb->getFloat($this->bb_pos + 4);
     39     }
     40 
     41     /**
     42      * @return float
     43      */
     44     public function GetZ()
     45     {
     46         return $this->bb->getFloat($this->bb_pos + 8);
     47     }
     48 
     49     /**
     50      * @return double
     51      */
     52     public function GetTest1()
     53     {
     54         return $this->bb->getDouble($this->bb_pos + 16);
     55     }
     56 
     57     /**
     58      * @return sbyte
     59      */
     60     public function GetTest2()
     61     {
     62         return $this->bb->getSbyte($this->bb_pos + 24);
     63     }
     64 
     65     /**
     66      * @return Test
     67      */
     68     public function getTest3()
     69     {
     70         $obj = new Test();
     71         $obj->init($this->bb_pos + 26, $this->bb);
     72         return $obj;
     73     }
     74 
     75 
     76     /**
     77      * @return int offset
     78      */
     79     public static function createVec3(FlatBufferBuilder $builder, $x, $y, $z, $test1, $test2, $test3_a, $test3_b)
     80     {
     81         $builder->prep(16, 32);
     82         $builder->pad(2);
     83         $builder->prep(2, 4);
     84         $builder->pad(1);
     85         $builder->putSbyte($test3_b);
     86         $builder->putShort($test3_a);
     87         $builder->pad(1);
     88         $builder->putSbyte($test2);
     89         $builder->putDouble($test1);
     90         $builder->pad(4);
     91         $builder->putFloat($z);
     92         $builder->putFloat($y);
     93         $builder->putFloat($x);
     94         return $builder->offset();
     95     }
     96 }
     97