OpenGL ES SDK for Android
ARM Developer Center
Home
Pages
Namespaces
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
VectorTypes.h
Go to the documentation of this file.
1
/* Copyright (c) 2012-2017, ARM Limited and Contributors
2
*
3
* SPDX-License-Identifier: MIT
4
*
5
* Permission is hereby granted, free of charge,
6
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
7
* to deal in the Software without restriction, including without limitation the rights to
8
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
*
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
*/
20
21
#ifndef VECTORTYPES_H
22
#define VECTORTYPES_H
23
24
#include <cmath>
25
31
namespace
MaliSDK
32
{
38
class
Vec2
39
{
40
public
:
41
int
x
,
y
;
42
};
43
49
class
Vec3
50
{
51
public
:
52
int
x
,
y
,
z
;
53
};
54
60
class
Vec4
61
{
62
public
:
63
int
x
,
y
,
z
,
w
;
64
};
65
66
72
class
Vec2f
73
{
74
public
:
75
float
x
,
y
;
76
};
77
83
class
Vec3f
84
{
85
public
:
86
float
x
,
y
,
z
;
87
91
void
normalize
(
void
)
92
{
93
float
length
= sqrt(
x
*
x
+
y
*
y
+
z
*
z
);
94
95
x
/=
length
;
96
y
/=
length
;
97
z /=
length
;
98
}
99
108
static
Vec3f
cross
(
const
Vec3f
& vector1,
const
Vec3f
& vector2)
109
{
110
/* Floating point vector to be returned. */
111
Vec3f
crossProduct;
112
113
crossProduct.x = (vector1.y * vector2.z) - (vector1.z * vector2.y);
114
crossProduct.y = (vector1.z * vector2.x) - (vector1.x * vector2.z);
115
crossProduct.z = (vector1.x * vector2.y) - (vector1.y * vector2.x);
116
117
return
crossProduct;
118
}
119
};
120
121
127
class
Vec4f
128
{
129
public
:
130
float
x
,
y
,
z
,
w
;
131
135
void
normalize
(
void
)
136
{
137
float
length
= sqrt(
x
*
x
+
y
*
y
+
z
*
z
+
w
*
w
);
138
139
x
/=
length
;
140
y
/=
length
;
141
z
/=
length
;
142
w /=
length
;
143
}
144
};
145
}
146
#endif
/* VECTORTYPES_H */
147
MaliSDK::Vec3f::y
float y
Definition:
VectorTypes.h:86
MaliSDK::Vec3::y
int y
Definition:
VectorTypes.h:52
MaliSDK::Vec4f::w
float w
Definition:
VectorTypes.h:130
AstcTextures::Vec2
struct AstcTextures::Vec2 Vec2
Type representing texture coordinates.
MaliSDK::Vec4::z
int z
Definition:
VectorTypes.h:63
MaliSDK::Vec4f::y
float y
Definition:
VectorTypes.h:130
MaliSDK::Vec3f::cross
static Vec3f cross(const Vec3f &vector1, const Vec3f &vector2)
Calculate cross product between two 3D floating point vectors.
Definition:
VectorTypes.h:108
MaliSDK::Vec4::y
int y
Definition:
VectorTypes.h:63
MaliSDK::Vec4f::z
float z
Definition:
VectorTypes.h:130
MaliSDK::Vec3f
A 3D floating point vector.
Definition:
VectorTypes.h:83
MaliSDK::Vec2f::x
float x
Definition:
VectorTypes.h:75
MaliSDK::Vec3f::z
float z
Definition:
VectorTypes.h:86
w
GLfloat GLfloat GLfloat w
Definition:
gl2ext.h:2701
MaliSDK::Vec4::w
int w
Definition:
VectorTypes.h:63
MaliSDK::Vec3f::x
float x
Definition:
VectorTypes.h:86
MaliSDK::Vec3::x
int x
Definition:
VectorTypes.h:52
MaliSDK::Vec4f::normalize
void normalize(void)
Normalize 4D floating point vector.
Definition:
VectorTypes.h:135
MaliSDK::Vec4::x
int x
Definition:
VectorTypes.h:63
MaliSDK::Vec2::y
int y
Definition:
VectorTypes.h:41
x
GLint GLint GLint GLint GLint x
Definition:
gl2ext.h:574
length
GLenum GLuint GLenum GLsizei length
Definition:
gl2ext.h:134
MaliSDK::Vec2f::y
float y
Definition:
VectorTypes.h:75
MaliSDK::Vec2::x
int x
Definition:
VectorTypes.h:41
y
GLint y
Definition:
gl2ext.h:179
MaliSDK::Vec3f::normalize
void normalize(void)
Normalize 3D floating point vector.
Definition:
VectorTypes.h:91
MaliSDK::Vec4f::x
float x
Definition:
VectorTypes.h:130
MaliSDK::Vec3::z
int z
Definition:
VectorTypes.h:52
samples
tutorials
InstancedTessellation
jni
VectorTypes.h
(C) ARM Ltd. 2017