World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Шаблон структуры Vec3< T >

#include <VectorTypes.h>

+ Граф наследования:Vec3< T >:
+ Граф связей класса Vec3< T >:

Открытые члены

 Vec3 (T a=0, T b=0, T c=0)
 
template<class U >
uint32_t GetDistanceTo (Vec3< U > &o)
 
void Normalize_float ()
 
- Открытые члены унаследованные от Vec2< T >
 Vec2 (T a=0, T b=0)
 

Открытые статические члены

static void Rotate (T sDepth, T sRotY, T sRotX, Vec3< T > v, T *outx, T *outy, T *outz)
 
static void Normalize (T *x, T *y, T *z)
 

Открытые атрибуты

z
 
- Открытые атрибуты унаследованные от Vec2< T >
x
 
y
 

Подробное описание

template<class T>
struct Vec3< T >

См. определение в файле VectorTypes.h строка 26

Конструктор(ы)

◆ Vec3()

template<class T >
Vec3< T >::Vec3 ( a = 0,
b = 0,
c = 0 
)
inlineexplicit

См. определение в файле VectorTypes.h строка 29

29 : Vec2<T>(a, b), z(c) {}

Методы

◆ GetDistanceTo()

template<class T >
template<class U >
uint32_t Vec3< T >::GetDistanceTo ( Vec3< U > &  o)
inline

См. определение в файле VectorTypes.h строка 32

32  {
33  return int_get_vector_length(abs(this->x - o.x), abs(this->y - o.y),
34  abs(this->z - o.z));
35  }

◆ Rotate()

template<class T >
static void Vec3< T >::Rotate ( sDepth,
sRotY,
sRotX,
Vec3< T >  v,
T *  outx,
T *  outy,
T *  outz 
)
inlinestatic

См. определение в файле VectorTypes.h строка 37

37  {
38  float cosf_x = cos(pi * sRotX / 1024.0f);
39  float sinf_x = sin(pi * sRotX / 1024.0f);
40  float cosf_y = cos(pi * sRotY / 1024.0f);
41  float sinf_y = sin(pi * sRotY / 1024.0f);
42 
43  *outx = v.x + (int)(sinf_y * cosf_x * (float)(sDepth >> 16));
44  *outy = v.y + (int)(cosf_y * cosf_x * (float)(sDepth >> 16));
45  *outz = v.z + (int)(sinf_x * (float)(sDepth >> 16));
46  }

◆ Normalize()

template<class T >
static void Vec3< T >::Normalize ( T *  x,
T *  y,
T *  z 
)
inlinestatic

См. определение в файле VectorTypes.h строка 48

48  {
49  extern int integer_sqrt(int val);
50  int denom = *y * *y + *z * *z + *x * *x;
51  int mult = 65536 / (integer_sqrt(denom) | 1);
52  *x *= mult;
53  *y *= mult;
54  *z *= mult;
55  }

◆ Normalize_float()

template<class T >
void Vec3< T >::Normalize_float ( )
inline

См. определение в файле VectorTypes.h строка 57

57  {
58  double x = this->x;
59  double y = this->y;
60  double z = this->z;
61  double s = sqrt(x * x + y * y + z * z);
62 
63  this->x = bankersRounding(x / s);
64  this->y = bankersRounding(y / s);
65  this->z = bankersRounding(z / s);
66  }

Данные класса

◆ z


Объявления и описания членов структуры находятся в файле:
s
GLdouble s
Definition: SDL_opengl.h:2063
v
const GLdouble * v
Definition: SDL_opengl.h:2064
Vec2::x
T x
Definition: VectorTypes.h:12
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
Vec2::y
T y
Definition: VectorTypes.h:13
bankersRounding
int bankersRounding(const FloatType &value)
Definition: OurMath.h:98
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
int_get_vector_length
uint32_t int_get_vector_length(int32_t x, int32_t y, int32_t z)
Definition: VectorTypes.cpp:8
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
pi
const float pi
Definition: VectorTypes.h:22
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
integer_sqrt
int integer_sqrt(int val)
Definition: OurMath.cpp:164
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
Vec3::z
T z
Definition: VectorTypes.h:27
Vec2
Definition: VectorTypes.h:11