SuperTuxKart
Loading...
Searching...
No Matches
scriptvec3.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2014-2015 SuperTuxKart Team
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_SCRIPTVEC3_HPP
20#define HEADER_SCRIPTVEC3_HPP
21
22#include <angelscript.h>
23
24namespace Scripting
25{
26 void RegisterVec3(asIScriptEngine *engine);
27
29 {
30 float x;
31 float y;
32 float z;
33
34 float getX() const { return x; }
35 float getY() const { return y; }
36 float getZ() const { return z; }
37
38 float getLength() const
39 {
40 return sqrt(x*x + y*y + z*z);
41 }
42
43 SimpleVec3() : x(0), y(0), z(0) { }
44 SimpleVec3(float p_x, float p_y, float p_z) : x(p_x), y(p_y), z(p_z) { }
45 SimpleVec3(const SimpleVec3& other) : x(other.x), y(other.y), z(other.z) { }
46 ~SimpleVec3() { }
47 };
48}
49#endif
Definition: scriptvec3.hpp:29