Mercurial > LightClone
annotate LightClone/Source/Bot.cpp @ 65:41980ff0607d
Added shader and textures for bot
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Wed, 05 Oct 2011 12:55:46 -0700 |
parents | 3507bd831c7f |
children | f7095bce01cf |
rev | line source |
---|---|
0 | 1 /* |
2 * Bot | |
3 */ | |
4 | |
5 #include "Bot.h" | |
6 #include "Clock.h" | |
9 | 7 #include "VertexTypes.h" |
0 | 8 |
9 /* | |
10 * DirectionAngle | |
37
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
11 * Angles for the different directions the bot could be facing |
0 | 12 */ |
13 const float DirectionAngle[] = {-1.0f * D3DX_PI / 2.0f, -4.0f * D3DX_PI / 2.0f, -3.0f * D3DX_PI / 2.0f, -2.0f * D3DX_PI / 2.0f}; | |
14 | |
15 /* | |
16 * Bot | |
17 */ | |
18 Bot::Bot() | |
19 { | |
20 pEnvironment = 0; | |
21 nState = BotState_Idle; | |
22 kSize = D3DXVECTOR3(0.55f, 1.00f, 0.55f); | |
9 | 23 |
24 pEffect = NULL; | |
25 pVertexBuffer = NULL; | |
26 pTexture = NULL; | |
0 | 27 } |
28 | |
29 /* | |
30 * Initialize | |
31 */ | |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
32 ErrorCode Bot::Initialize(ServiceProvider* pServiceProvider) |
9 | 33 { |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
34 ResourceManager* pResourceManager = NULL; |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
35 |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
36 ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager); |
9 | 37 if(eCode == Error_Success) |
38 { | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
39 eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\Bot.fx", &pEffect); |
9 | 40 if(eCode == Error_Success) |
41 { | |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
42 eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\Bot.tga", &pTexture); |
9 | 43 if(eCode == Error_Success) |
44 { | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
45 eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\BotMask.tga", &pMask); |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
46 if(eCode == Error_Success) |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
47 { |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
48 eCode = pResourceManager->CreateVertexBuffer(VerticesPerBlock * sizeof(Vertex::Block), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer); |
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
49 if(eCode == Error_Success) |
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
50 { |
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
51 eCode = SetupVertexBuffer(); |
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
52 } |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
53 } |
9 | 54 } |
55 } | |
56 } | |
57 | |
58 return eCode; | |
59 } | |
60 | |
61 /* | |
62 * Terminate | |
63 */ | |
64 void Bot::Terminate() | |
65 { | |
66 if(pVertexBuffer) | |
67 { | |
68 pVertexBuffer->Release(); | |
69 pVertexBuffer = NULL; | |
70 } | |
71 } | |
72 | |
73 /* | |
74 * Setup | |
75 */ | |
76 void Bot::Setup(Environment* pInstance) | |
0 | 77 { |
78 pEnvironment = pInstance; | |
79 nState = BotState_Idle; | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
80 nColor = D3DCOLOR_XRGB(192, 0, 0); |
0 | 81 } |
82 | |
83 /* | |
84 * Reset | |
85 */ | |
86 void Bot::Reset() | |
87 { | |
88 nState = BotState_Idle; | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
89 nColor = D3DCOLOR_XRGB(192, 0, 0); |
0 | 90 |
91 kMachine.Reset(); | |
92 } | |
93 | |
37
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
94 /* |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
95 * SetPosition |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
96 */ |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
97 void Bot::SetPosition(const Position& kValue) |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
98 { |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
99 kPosition = kValue; |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
100 } |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
101 |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
102 /* |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
103 * SetDirection |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
104 */ |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
105 void Bot::SetDirection(uint32 nValue) |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
106 { |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
107 kDirection = nValue; |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
108 } |
58a16d529d95
Refactoring code and adding events for drag and drop
koryspansel <koryspansel@bendbroadband.com>
parents:
27
diff
changeset
|
109 |
0 | 110 /* |
111 * GetWorldPosition | |
112 */ | |
113 const D3DXVECTOR3 Bot::GetWorldPosition() const | |
114 { | |
115 const D3DXVECTOR3& kScale = pEnvironment->GetScale(); | |
116 | |
117 D3DXVECTOR3 kWorldPosition; | |
118 kWorldPosition.x = kScale.x * kPosition.X; | |
119 kWorldPosition.y = kScale.y * pEnvironment->GetAltitude(kPosition.X, kPosition.Y); | |
120 kWorldPosition.z = kScale.z * kPosition.Y; | |
121 | |
122 if(nState == BotState_Animate) | |
123 { | |
124 if(kSequencer.nSequence == BotSequence_Forward) | |
125 { | |
126 kWorldPosition.x = kScale.x * ((int32)kPosition.X + kSequencer.fTimer * ((int32)kSequencer.kPosition.X - (int32)kPosition.X)); | |
127 kWorldPosition.z = kScale.z * ((int32)kPosition.Y + kSequencer.fTimer * ((int32)kSequencer.kPosition.Y - (int32)kPosition.Y)); | |
128 } | |
129 else | |
130 | |
131 if(kSequencer.nSequence == BotSequence_Jump) | |
132 { | |
133 const uint32 nHeightA = pEnvironment->GetAltitude(kPosition.X, kPosition.Y); | |
134 const uint32 nHeightB = pEnvironment->GetAltitude(kSequencer.kPosition.X, kSequencer.kPosition.Y); | |
135 | |
136 const float fDistanceX = kScale.x; | |
137 const float fDistanceY = kScale.y * ((float)nHeightB - (float)nHeightA); | |
138 const float fHeight = nHeightB > nHeightA ? 2.0f * kScale.y : kScale.y; | |
139 | |
140 const float fB = (fHeight - 0.25f * fDistanceY) / (-0.25f * fDistanceX + 0.5f * fDistanceX); | |
141 const float fA = (fDistanceY - fB * fDistanceX) / (fDistanceX * fDistanceX); | |
142 const float fX = kSequencer.fTimer * fDistanceX; | |
143 | |
144 kWorldPosition.x = kScale.x * ((int32)kPosition.X + kSequencer.fTimer * ((int32)kSequencer.kPosition.X - (int32)kPosition.X)); | |
145 kWorldPosition.y = nHeightA * kScale.y + fX * (fA * fX + fB); | |
146 kWorldPosition.z = kScale.z * ((int32)kPosition.Y + kSequencer.fTimer * ((int32)kSequencer.kPosition.Y - (int32)kPosition.Y)); | |
147 } | |
148 } | |
149 | |
150 return kWorldPosition; | |
151 } | |
152 | |
153 /* | |
154 * GetWorldOrientation | |
155 */ | |
156 const D3DXVECTOR3 Bot::GetWorldOrientation() const | |
157 { | |
158 D3DXVECTOR3 kWorldOrientation; | |
159 kWorldOrientation.x = 0.0f; | |
160 kWorldOrientation.y = DirectionAngle[kDirection]; | |
161 kWorldOrientation.z = 0.0f; | |
162 | |
163 if(nState == BotState_Animate) | |
164 { | |
165 if(kSequencer.nSequence == BotSequence_RotateCW || kSequencer.nSequence == BotSequence_RotateCCW) | |
166 { | |
167 kWorldOrientation.y = InterpolateDirection(kDirection, kSequencer.kDirection, kSequencer.fTimer); | |
168 } | |
169 } | |
170 | |
171 return kWorldOrientation; | |
172 } | |
173 | |
174 /* | |
175 * Upload | |
176 */ | |
38 | 177 ErrorCode Bot::Upload(const Program& kProgram) |
0 | 178 { |
38 | 179 ErrorCode eCode = kProgram.Upload(kMachine); |
4 | 180 if(eCode == Error_Success) |
181 { | |
182 nState = BotState_Evaluate; | |
183 } | |
0 | 184 |
185 return eCode; | |
186 } | |
187 | |
188 /* | |
189 * Update | |
190 */ | |
3 | 191 bool Bot::Update(float fElapsed) |
0 | 192 { |
193 if(nState == BotState_Evaluate) | |
194 { | |
195 bool bHandled = false; | |
196 | |
197 kClock.Reset(); | |
198 | |
199 while(!bHandled && kClock.GetElapsed(false) < fElapsed) | |
200 { | |
201 uint32 nAction = kMachine.Step(); | |
202 | |
203 if(Action_Forward <= nAction && nAction <= Action_Light) | |
204 { | |
205 if(nAction == Action_Forward) | |
206 { | |
207 if(pEnvironment->IsMovementValid(nAction, kPosition.X, kPosition.Y, kDirection)) | |
208 { | |
60 | 209 kSequencer.kPosition.X = (int32)kPosition.X + GetOffsetFromDirectionX(kDirection); |
210 kSequencer.kPosition.Y = (int32)kPosition.Y + GetOffsetFromDirectionY(kDirection); | |
0 | 211 kSequencer.nSequence = BotSequence_Forward; |
212 kSequencer.fTimer = 0.0f; | |
213 kSequencer.fSpeed = 1.5f; | |
214 nState = BotState_Animate; | |
215 } | |
216 } | |
217 else | |
218 | |
219 if(nAction == Action_RotateCW) | |
220 { | |
221 kSequencer.kDirection = (kDirection + 1) % Direction_Count; | |
222 kSequencer.nSequence = BotSequence_RotateCW; | |
223 kSequencer.fTimer = 0.0f; | |
224 kSequencer.fSpeed = 1.5f; | |
225 nState = BotState_Animate; | |
226 } | |
227 else | |
228 | |
229 if(nAction == Action_RotateCCW) | |
230 { | |
231 nState = BotState_Animate; | |
232 kSequencer.kDirection = (kDirection - 1 + Direction_Count) % Direction_Count; | |
233 kSequencer.nSequence = BotSequence_RotateCCW; | |
234 kSequencer.fTimer = 0.0f; | |
235 kSequencer.fSpeed = 1.5f; | |
236 } | |
237 else | |
238 | |
239 if(nAction == Action_Jump) | |
240 { | |
241 if(pEnvironment->IsMovementValid(nAction, kPosition.X, kPosition.Y, kDirection)) | |
242 { | |
60 | 243 kSequencer.kPosition.X = (int32)kPosition.X + GetOffsetFromDirectionX(kDirection); |
244 kSequencer.kPosition.Y = (int32)kPosition.Y + GetOffsetFromDirectionY(kDirection); | |
0 | 245 } |
246 else | |
247 { | |
248 kSequencer.kPosition.X = kPosition.X; | |
249 kSequencer.kPosition.Y = kPosition.Y; | |
250 } | |
251 | |
252 nState = BotState_Animate; | |
253 kSequencer.nSequence = BotSequence_Jump; | |
254 kSequencer.fTimer = 0.0f; | |
255 kSequencer.fSpeed = 1.5f; | |
256 } | |
257 else | |
258 | |
259 if(nAction == Action_Light) | |
260 { | |
261 nState = BotState_Animate; | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
262 nColor = D3DCOLOR_XRGB(0, 0, 192); |
0 | 263 kSequencer.nSequence = BotSequence_Light; |
264 kSequencer.fTimer = 0.0f; | |
265 kSequencer.fSpeed = 3.0f; | |
266 } | |
267 | |
268 bHandled = true; | |
269 } | |
270 } | |
271 } | |
272 else | |
273 | |
274 if(nState == BotState_Animate) | |
275 { | |
276 kSequencer.fTimer += kSequencer.fSpeed * fElapsed; | |
277 if(kSequencer.fTimer >= 1.0f) | |
278 { | |
279 if(kSequencer.nSequence == BotSequence_Forward) | |
280 { | |
281 nState = BotState_Pause; | |
282 kPosition = kSequencer.kPosition; | |
283 kSequencer.fTimer = 0.4f; | |
284 } | |
285 else | |
286 | |
287 if(kSequencer.nSequence == BotSequence_RotateCW) | |
288 { | |
289 nState = BotState_Pause; | |
290 kDirection = kSequencer.kDirection; | |
291 kSequencer.fTimer = 0.4f; | |
292 } | |
293 else | |
294 | |
295 if(kSequencer.nSequence == BotSequence_RotateCCW) | |
296 { | |
297 nState = BotState_Pause; | |
298 kDirection = kSequencer.kDirection; | |
299 kSequencer.fTimer = 0.4f; | |
300 } | |
301 else | |
302 | |
303 if(kSequencer.nSequence == BotSequence_Jump) | |
304 { | |
305 nState = BotState_Pause; | |
306 kPosition = kSequencer.kPosition; | |
307 kSequencer.fTimer = 0.4f; | |
308 } | |
309 else | |
310 | |
311 if(kSequencer.nSequence == BotSequence_Light) | |
312 { | |
313 pEnvironment->NotifyAction(kPosition.X, kPosition.Y); | |
314 | |
315 nState = BotState_Pause; | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
316 nColor = D3DCOLOR_XRGB(192, 0, 0); |
0 | 317 kSequencer.fTimer = 0.4f; |
318 } | |
319 } | |
320 } | |
321 else | |
322 | |
323 if(nState == BotState_Pause) | |
324 { | |
325 kSequencer.fTimer -= fElapsed; | |
326 if(kSequencer.fTimer <= 0.0f) | |
327 { | |
328 nState = BotState_Evaluate; | |
3 | 329 return true; |
0 | 330 } |
331 } | |
3 | 332 |
333 return false; | |
0 | 334 } |
9 | 335 |
336 /* | |
337 * Render | |
338 */ | |
339 void Bot::Render(RenderContext& kContext, Camera& kCamera) | |
340 { | |
341 const D3DXVECTOR3& kPosition = GetWorldPosition(); | |
342 const D3DXVECTOR3& kOrientation = GetWorldOrientation(); | |
343 | |
38 | 344 const float fOffsetX = -0.5f * (pEnvironment->GetWidth() * pEnvironment->GetScale().x) + 0.5f * pEnvironment->GetScale().x; |
345 const float fOffsetZ = -0.5f * (pEnvironment->GetHeight() * pEnvironment->GetScale().z) + 0.5f * pEnvironment->GetScale().z; | |
9 | 346 |
347 uint32 nPasses = 0; | |
348 | |
10
292e534f00c2
Moved rendering into Bot/Environment; Started work on Gui system
koryspansel <koryspansel@bendbroadband.com>
parents:
9
diff
changeset
|
349 kContext.ApplyCameraToEffect(kCamera, pEffect); |
9 | 350 |
351 pEffect->SetTechnique(pEffect->GetTechnique(0)); | |
352 pEffect->Begin(&nPasses, 0); | |
353 pEffect->BeginPass(0); | |
354 | |
355 D3DXMATRIX kScale; | |
356 D3DXMatrixScaling(&kScale, kSize.x, kSize.y, kSize.z); | |
357 | |
358 D3DXMATRIX kTranslate; | |
359 D3DXMatrixTranslation(&kTranslate, fOffsetX + kPosition.x, kPosition.y, fOffsetZ + kPosition.z); | |
360 | |
361 D3DXMATRIX kRotate; | |
362 D3DXMatrixRotationY(&kRotate, kOrientation.y); | |
363 | |
364 D3DXMATRIX kTempMatrix; | |
365 D3DXMATRIX kWorldMatrix; | |
366 D3DXMatrixMultiply(&kWorldMatrix, D3DXMatrixMultiply(&kTempMatrix, &kScale, &kRotate), &kTranslate); | |
367 | |
368 const float fAlpha = ((nColor >> 24) & 0xFF) / 255.0f; | |
369 const float fRed = ((nColor >> 16) & 0xFF) / 255.0f; | |
370 const float fGreen = ((nColor >> 8 ) & 0xFF) / 255.0f; | |
371 const float fBlue = ((nColor >> 0 ) & 0xFF) / 255.0f; | |
372 | |
373 const D3DXVECTOR4 kColorVector(fRed, fGreen, fBlue, fAlpha); | |
374 | |
375 pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix); | |
376 pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector); | |
377 pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pTexture); | |
65
41980ff0607d
Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
64
diff
changeset
|
378 pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTextureMask"), pMask); |
9 | 379 pEffect->CommitChanges(); |
380 | |
381 kContext.DrawTriangles(Vertex::Block::Declaration, pVertexBuffer, sizeof(Vertex::Block), FacesPerCube * TrianglesPerFace); | |
382 | |
383 pEffect->EndPass(); | |
384 pEffect->End(); | |
385 } | |
386 | |
387 /* | |
388 * SetupVertexBuffer | |
389 */ | |
390 ErrorCode Bot::SetupVertexBuffer() | |
391 { | |
392 Vertex::Block* pVertices = NULL; | |
393 | |
394 HRESULT hResult = pVertexBuffer->Lock(0, 0, (void**)&pVertices, D3DLOCK_DISCARD); | |
395 if(FAILED(hResult)) | |
396 { | |
397 return Error_Fail; | |
398 } | |
399 | |
400 const float fU1 = 0.66f; | |
401 const float fV1 = 0.66f; | |
402 | |
60 | 403 const float fScaleU = 64.0f / 320.0f; |
404 const float fScaleV = 128.0f / 128.0f; | |
405 | |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
406 // right |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
407 pVertices[0] = Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
408 pVertices[1] = Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
409 pVertices[2] = Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
410 pVertices[3] = Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
411 pVertices[4] = Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
412 pVertices[5] = Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
413 // left |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
414 pVertices[6] = Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
415 pVertices[7] = Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
416 pVertices[8] = Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
417 pVertices[9] = Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
418 pVertices[10] = Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
419 pVertices[11] = Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 1 * fScaleV); |
60 | 420 // back |
64
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
421 pVertices[12] = Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
422 pVertices[13] = Vertex::Block(-0.5f, 1.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
423 pVertices[14] = Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
424 pVertices[15] = Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
425 pVertices[16] = Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
426 pVertices[17] = Vertex::Block(-0.5f, 0.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
427 // front |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
428 pVertices[18] = Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
429 pVertices[19] = Vertex::Block(+0.5f, 1.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
430 pVertices[20] = Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
431 pVertices[21] = Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
432 pVertices[22] = Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV); |
3507bd831c7f
Hook up ServiceProvider
koryspansel <koryspansel@bendbroadband.com>
parents:
60
diff
changeset
|
433 pVertices[23] = Vertex::Block(+0.5f, 0.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 1 * fScaleV); |
60 | 434 // top |
435 pVertices[24] = Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 0 * fScaleU, 0.0f * fScaleV + 0.5f * fScaleV); | |
436 pVertices[25] = Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 0 * fScaleU, 0.0f * fScaleV + 0.0f * fScaleV); | |
437 pVertices[26] = Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 1 * fScaleU, 0.0f * fScaleV + 0.0f * fScaleV); | |
438 pVertices[27] = Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 0 * fScaleU, 0.0f * fScaleV + 0.5f * fScaleV); | |
439 pVertices[28] = Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 1 * fScaleU, 0.0f * fScaleV + 0.0f * fScaleV); | |
440 pVertices[29] = Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 1 * fScaleU, 0.0f * fScaleV + 0.5f * fScaleV); | |
441 // bottom | |
442 pVertices[30] = Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 0 * fScaleU, 0.5f * fScaleV + 0.5f * fScaleV); | |
443 pVertices[31] = Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 0 * fScaleU, 0.5f * fScaleV + 0.0f * fScaleV); | |
444 pVertices[32] = Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 1 * fScaleU, 0.5f * fScaleV + 0.0f * fScaleV); | |
445 pVertices[33] = Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 0 * fScaleU, 0.5f * fScaleV + 0.5f * fScaleV); | |
446 pVertices[34] = Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 1 * fScaleU, 0.5f * fScaleV + 0.0f * fScaleV); | |
447 pVertices[35] = Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 1 * fScaleU, 0.5f * fScaleV + 0.5f * fScaleV); | |
448 | |
9 | 449 pVertexBuffer->Unlock(); |
450 | |
451 return Error_Success; | |
452 } |