-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzglVertex.cpp
executable file
·98 lines (83 loc) · 2.22 KB
/
zglVertex.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright (C) 2010 ZiiLABS Pte Ltd
* All Rights Reserved.
*
* This software and its associated documentation may contain some
* proprietary, confidential and trade secret information of
* ZiiLABS Pte Ltd and except as provided by written agreement with
* ZiiLABS Pte Ltd
*
* a) no part may be disclosed, distributed, reproduced, transmitted,
* transcribed, stored in a retrieval system, adapted or translated
* in any form or by any means electronic, mechanical, magnetic,
* optical, chemical, manual or otherwise,
*
* and
*
* b) the recipient is not entitled to discover through reverse
* engineering or reverse compiling or other such techniques or
* processes the trade secrets contained therein or in the
* documentation.
*/
#include "zglVertex.h"
zglVertex::zglVertex()
{
this->r = 0xff;
this->g = 0xff;
this->b = 0xff;
this->a = 0xff;
}
void zglVertex::init(float x, float y, float z, float u, float v,
unsigned int color)
{
this->x = x;
this->y = y;
this->z = z;
this->u = u;
this->v = v;
this->r = (unsigned char) ((color >> 24) & 0xff);
this->g = (unsigned char) ((color >> 16) & 0xff);
this->b = (unsigned char) ((color >> 8) & 0xff);
this->a = (unsigned char) ((color >> 0) & 0xff);
}
void zglVertex::init(float x, float y, float z, unsigned int color)
{
this->x = x;
this->y = y;
this->z = z;
this->r = (unsigned char) ((color >> 24) & 0xff);
this->g = (unsigned char) ((color >> 16) & 0xff);
this->b = (unsigned char) ((color >> 8) & 0xff);
this->a = (unsigned char) ((color >> 0) & 0xff);
}
void zglVertex::setPos(float x, float y, float z)
{
this->x = x;
this->y = y;
this->z = z;
}
void zglVertex::setColor(unsigned int color)
{
r = (unsigned char) ((color >> 24) & 0xff);
g = (unsigned char) ((color >> 16) & 0xff);
b = (unsigned char) ((color >> 8) & 0xff);
a = (unsigned char) ((color >> 0) & 0xff);
}
void zglVertex::setUV(float u, float v)
{
this->u = u;
this->v = v;
}
//!< --------------------------------------------------------------------------
zglVertexEx::zglVertexEx()
{
this->nx = 0.0f;
this->ny = 0.0f;
this->nz = -1.0f;
}
void zglVertexEx::setNormal(float nx, float ny, float nz)
{
this->nx = nx;
this->ny = ny;
this->nz = nz;
}