MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等
Revision | 107c2733a3de5b3bedbf5350a98a9ab4cdea7710 (tree) |
---|---|
Zeit | 2019-08-28 07:06:19 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
[FIX] キーボード鍵のポリゴン描画順を修正、上面を最後に変更
@@ -23,14 +23,18 @@ using namespace YNBaseLib; | ||
23 | 23 | //****************************************************************************** |
24 | 24 | //各キーの頂点数 |
25 | 25 | #define MTPIANOKEYBOARD_KEY_WHITE_1_VERTEX_NUM (38) |
26 | -#define MTPIANOKEYBOARD_KEY_WHITE_2_VERTEX_NUM (44) | |
26 | +// >>> add 20180412 yossiepon begin | |
27 | +#define MTPIANOKEYBOARD_KEY_WHITE_2_VERTEX_NUM (44 + 4) | |
28 | +// <<< add 20180412 yossiepon end | |
27 | 29 | #define MTPIANOKEYBOARD_KEY_WHITE_3_VERTEX_NUM (38) |
28 | 30 | #define MTPIANOKEYBOARD_KEY_BLACK_VERTEX_NUM (30) |
29 | 31 | #define MTPIANOKEYBOARD_KEY_VERTEX_NUM_MAX MTPIANOKEYBOARD_KEY_WHITE_2_VERTEX_NUM |
30 | 32 | |
31 | 33 | //各キーのインデックス数 |
32 | 34 | #define MTPIANOKEYBOARD_KEY_WHITE_1_INDEX_NUM (60) |
33 | -#define MTPIANOKEYBOARD_KEY_WHITE_2_INDEX_NUM (66) | |
35 | +// >>> add 20180412 yossiepon begin | |
36 | +#define MTPIANOKEYBOARD_KEY_WHITE_2_INDEX_NUM (66 + 6) | |
37 | +// <<< add 20180412 yossiepon end | |
34 | 38 | #define MTPIANOKEYBOARD_KEY_WHITE_3_INDEX_NUM (60) |
35 | 39 | #define MTPIANOKEYBOARD_KEY_BLACK_INDEX_NUM (48) |
36 | 40 | #define MTPIANOKEYBOARD_KEY_INDEX_NUM_MAX MTPIANOKEYBOARD_KEY_WHITE_2_INDEX_NUM |
@@ -87,7 +87,9 @@ public: | ||
87 | 87 | //共有用テクスチャ取得 |
88 | 88 | LPDIRECT3DTEXTURE9 GetTexture(); |
89 | 89 | |
90 | -private: | |
90 | +// >>> modify access level to protected 20180412 yossiepon begin | |
91 | +protected: | |
92 | +// <<< modify 20180412 yossiepon end | |
91 | 93 | |
92 | 94 | //頂点バッファ構造体 |
93 | 95 | struct MTPIANOKEYBOARD_VERTEX { |
@@ -127,10 +129,6 @@ protected: | ||
127 | 129 | //キーボードデザイン |
128 | 130 | MTPianoKeyboardDesign m_KeyboardDesign; |
129 | 131 | |
130 | -// >>> modify access level 20161224 yossiepon begin | |
131 | -private: | |
132 | -// <<< modify 20161224 yossiepon end | |
133 | - | |
134 | 132 | //バッファ情報 |
135 | 133 | MTBufInfo m_BufInfo[SM_MAX_NOTE_NUM]; |
136 | 134 |
@@ -141,30 +139,37 @@ private: | ||
141 | 139 | void _CreateBufInfo(); |
142 | 140 | int _CreateVertexOfKeyboard(LPDIRECT3DDEVICE9 pD3DDevice); |
143 | 141 | int _CreateVertexOfKey(unsigned char noteNo); |
144 | - int _CreateVertexOfKeyWhite1( | |
142 | +// >>> modify function decl to virtual 20180412 yossiepon begin | |
143 | + virtual int _CreateVertexOfKeyWhite1( | |
145 | 144 | unsigned char noteNo, |
146 | 145 | MTPIANOKEYBOARD_VERTEX* pVertex, |
147 | 146 | unsigned long* pIndex, |
148 | 147 | D3DXCOLOR* pColor = NULL |
149 | 148 | ); |
150 | - int _CreateVertexOfKeyWhite2( | |
149 | + virtual int _CreateVertexOfKeyWhite2( | |
151 | 150 | unsigned char noteNo, |
152 | 151 | MTPIANOKEYBOARD_VERTEX* pVertex, |
153 | 152 | unsigned long* pIndex, |
154 | 153 | D3DXCOLOR* pColor = NULL |
155 | 154 | ); |
156 | - int _CreateVertexOfKeyWhite3( | |
155 | + virtual int _CreateVertexOfKeyWhite3( | |
157 | 156 | unsigned char noteNo, |
158 | 157 | MTPIANOKEYBOARD_VERTEX* pVertex, |
159 | 158 | unsigned long* pIndex, |
160 | 159 | D3DXCOLOR* pColor = NULL |
161 | 160 | ); |
162 | - int _CreateVertexOfKeyBlack( | |
161 | + virtual int _CreateVertexOfKeyBlack( | |
163 | 162 | unsigned char noteNo, |
164 | 163 | MTPIANOKEYBOARD_VERTEX* pVertex, |
165 | 164 | unsigned long* pIndex, |
166 | 165 | D3DXCOLOR* pColor = NULL |
167 | 166 | ); |
167 | +// <<< modify function decl to virtual 20180412 yossiepon end | |
168 | + | |
169 | +// >>> modify access level 20180412 yossiepon begin | |
170 | +private: | |
171 | +// <<< modify 20180412 yossiepon end | |
172 | + | |
168 | 173 | int _LoadTexture(LPDIRECT3DDEVICE9 pD3DDevice, const TCHAR* pSceneName); |
169 | 174 | void _MakeMaterial(D3DMATERIAL9* pMaterial); |
170 | 175 |
@@ -174,3 +174,635 @@ EXIT:; | ||
174 | 174 | return result; |
175 | 175 | } |
176 | 176 | |
177 | +//****************************************************************************** | |
178 | +// キーボード頂点生成:白鍵A | |
179 | +//****************************************************************************** | |
180 | +int MTPianoKeyboardMod::_CreateVertexOfKeyWhite1( | |
181 | + unsigned char noteNo, | |
182 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
183 | + unsigned long* pIndex, | |
184 | + D3DXCOLOR* pColor | |
185 | + ) | |
186 | +{ | |
187 | + //基底クラスの頂点生成処理を呼び出す | |
188 | + int result = MTPianoKeyboard::_CreateVertexOfKeyWhite1( | |
189 | + noteNo, | |
190 | + pVertex, | |
191 | + pIndex, | |
192 | + pColor | |
193 | + ); | |
194 | + | |
195 | + // 描画順の修正 | |
196 | + int idx = 0; | |
197 | + | |
198 | + //---------------------------------------------------------------- | |
199 | + //下の面 | |
200 | + //---------------------------------------------------------------- | |
201 | + // 37 6+--+5 36 | |
202 | + // | | | |
203 | + // | | | |
204 | + // | |4 35 | |
205 | + // 34 3+--+--+2 33 | |
206 | + // | | +z | |
207 | + // | | | | |
208 | + // | | | | |
209 | + // 31 0+-----+1 32 +---> +x | |
210 | + // | | |
211 | + // posX | |
212 | + | |
213 | + //下面インデックス | |
214 | + unsigned long indexDW[] = { 31, 32, 33, 31, 33, 34, 34, 35, 36, 34, 36, 37 }; | |
215 | + for (int i = 0; i < 12; i++) { | |
216 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexDW[i]; | |
217 | + } | |
218 | + | |
219 | + //---------------------------------------------------------------- | |
220 | + //側面 0-1 | |
221 | + //---------------------------------------------------------------- | |
222 | + // 0 1 | |
223 | + // 7+----+8 | |
224 | + // | | | |
225 | + // 9+----+10 | |
226 | + | |
227 | + //インデックス | |
228 | + unsigned long index01[] = { 7, 8, 9, 8, 10, 9 }; | |
229 | + for (int i = 0; i < 6; i++) { | |
230 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index01[i]; | |
231 | + } | |
232 | + | |
233 | + //---------------------------------------------------------------- | |
234 | + //側面 1-2 | |
235 | + //---------------------------------------------------------------- | |
236 | + // 2 12+--+14 | |
237 | + // | | | |
238 | + // | | | |
239 | + // 1 11+--+13 | |
240 | + | |
241 | + //インデックス | |
242 | + unsigned long index12[] = { 11, 12, 13, 12, 14, 13 }; | |
243 | + for (int i = 0; i < 6; i++) { | |
244 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index12[i]; | |
245 | + } | |
246 | + | |
247 | + //---------------------------------------------------------------- | |
248 | + //側面 2-4 | |
249 | + //---------------------------------------------------------------- | |
250 | + // 18+--+17 | |
251 | + // | | | |
252 | + // 4 16+--+15 2 | |
253 | + | |
254 | + //インデックス | |
255 | + unsigned long index24[] = { 15, 16, 17, 16, 18, 17 }; | |
256 | + for (int i = 0; i < 6; i++) { | |
257 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index24[i]; | |
258 | + } | |
259 | + | |
260 | + //---------------------------------------------------------------- | |
261 | + //側面 4-5 | |
262 | + //---------------------------------------------------------------- | |
263 | + // 5 20+--+22 | |
264 | + // | | | |
265 | + // | | | |
266 | + // 4 19+--+21 | |
267 | + | |
268 | + //インデックス | |
269 | + unsigned long index45[] = { 19, 20, 21, 20, 22, 21 }; | |
270 | + for (int i = 0; i < 6; i++) { | |
271 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index45[i]; | |
272 | + } | |
273 | + | |
274 | + //---------------------------------------------------------------- | |
275 | + //側面 5-6 | |
276 | + //---------------------------------------------------------------- | |
277 | + // 26+--+25 | |
278 | + // | | | |
279 | + // 6 24+--+23 5 | |
280 | + | |
281 | + //インデックス | |
282 | + unsigned long index56[] = { 23, 24, 25, 24, 26, 25 }; | |
283 | + for (int i = 0; i < 6; i++) { | |
284 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index56[i]; | |
285 | + } | |
286 | + | |
287 | + //---------------------------------------------------------------- | |
288 | + //側面 6-0 | |
289 | + //---------------------------------------------------------------- | |
290 | + // 29+--+27 6 | |
291 | + // | | | |
292 | + // | | | |
293 | + // 30+--+28 0 | |
294 | + | |
295 | + //インデックス | |
296 | + unsigned long index60[] = { 27, 28, 29, 28, 30, 29 }; | |
297 | + for (int i = 0; i < 6; i++) { | |
298 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index60[i]; | |
299 | + } | |
300 | + | |
301 | + //---------------------------------------------------------------- | |
302 | + //上の面 | |
303 | + //---------------------------------------------------------------- | |
304 | + // 6+--+5 | |
305 | + // | | | |
306 | + // | | | |
307 | + // | |4 | |
308 | + // 3+--+--+2 | |
309 | + // | | +z | |
310 | + // | | | | |
311 | + // | | | | |
312 | + // 0+-----+1 +---> +x | |
313 | + // | | |
314 | + // posX | |
315 | + | |
316 | + //インデックス | |
317 | + unsigned long indexUP[] = { 0, 2, 1, 0, 3, 2, 3, 5, 4, 3, 6, 5 }; | |
318 | + for (int i = 0; i < 12; i++) { | |
319 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexUP[i]; | |
320 | + } | |
321 | + | |
322 | + return result; | |
323 | +} | |
324 | + | |
325 | +//****************************************************************************** | |
326 | +// キーボード頂点生成:白鍵B | |
327 | +//****************************************************************************** | |
328 | +int MTPianoKeyboardMod::_CreateVertexOfKeyWhite2( | |
329 | + unsigned char noteNo, | |
330 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
331 | + unsigned long* pIndex, | |
332 | + D3DXCOLOR* pColor | |
333 | + ) | |
334 | +{ | |
335 | + //基底クラスの頂点生成処理を呼び出す | |
336 | + int result = MTPianoKeyboard::_CreateVertexOfKeyWhite2( | |
337 | + noteNo, | |
338 | + pVertex, | |
339 | + pIndex, | |
340 | + pColor | |
341 | + ); | |
342 | + | |
343 | + D3DXCOLOR keyColor; | |
344 | + D3DXVECTOR2 tsc; | |
345 | + | |
346 | + //白鍵カラー | |
347 | + if (pColor == NULL) { | |
348 | + keyColor = m_KeyboardDesign.GetWhiteKeyColor(); | |
349 | + } | |
350 | + else { | |
351 | + keyColor = *pColor; | |
352 | + } | |
353 | + | |
354 | + // 描画順の修正 | |
355 | + int idx = 0; | |
356 | + | |
357 | + //---------------------------------------------------------------- | |
358 | + //下の面 | |
359 | + //---------------------------------------------------------------- | |
360 | + // 42 6+-+5 41 | |
361 | + // | | | |
362 | + // | | | |
363 | + // 43 7| |4 40 | |
364 | + // 39 3+-+-+-+2 38 | |
365 | + // | | +z | |
366 | + // | | | | |
367 | + // | | | | |
368 | + // 36 0+-----+1 37 +---> +x | |
369 | + // | | |
370 | + // posX | |
371 | + | |
372 | + //インデックス | |
373 | + unsigned long indexDW[] = { 36, 37, 38, 36, 38, 39, 43, 40, 41, 43, 41, 42 }; | |
374 | + for (int i = 0; i < 12; i++) { | |
375 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexDW[i]; | |
376 | + } | |
377 | + //---------------------------------------------------------------- | |
378 | + //側面 0-1 | |
379 | + //---------------------------------------------------------------- | |
380 | + // 0 1 | |
381 | + // 8+----+9 | |
382 | + // | | | |
383 | + // 10+----+11 | |
384 | + | |
385 | + //インデックス | |
386 | + unsigned long index01[] = { 8, 9, 10, 9, 11, 10 }; | |
387 | + for (int i = 0; i < 6; i++) { | |
388 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index01[i]; | |
389 | + } | |
390 | + | |
391 | + //---------------------------------------------------------------- | |
392 | + //側面 1-2 | |
393 | + //---------------------------------------------------------------- | |
394 | + // 2 13+--+15 | |
395 | + // | | | |
396 | + // | | | |
397 | + // 1 12+--+14 | |
398 | + | |
399 | + //インデックス | |
400 | + unsigned long index12[] = { 12, 13, 14, 13, 15, 14 }; | |
401 | + for (int i = 0; i < 6; i++) { | |
402 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index12[i]; | |
403 | + } | |
404 | + | |
405 | + //---------------------------------------------------------------- | |
406 | + //側面 2-4 | |
407 | + //---------------------------------------------------------------- | |
408 | + // 19+--+18 | |
409 | + // | | | |
410 | + // 4 17+--+16 2 | |
411 | + | |
412 | + //基底クラスでは2-3で生成しているが、透過すると4-7間が仕切りとして | |
413 | + //見えてしまうため、2-4、7-3に分割する | |
414 | + | |
415 | + //頂点 | |
416 | + pVertex[17].p = pVertex[4].p; | |
417 | + pVertex[19].p = D3DXVECTOR3(pVertex[4].p.x, 0.0f, pVertex[4].p.z); // 4' | |
418 | + | |
419 | + //インデックス | |
420 | + unsigned long index24[] = { 16, 17, 18, 17, 19, 18 }; | |
421 | + for (int i = 0; i < 6; i++) { | |
422 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index24[i]; | |
423 | + } | |
424 | + | |
425 | + //---------------------------------------------------------------- | |
426 | + //側面 4-5 | |
427 | + //---------------------------------------------------------------- | |
428 | + // 5 21+--+23 | |
429 | + // | | | |
430 | + // | | | |
431 | + // 4 20+--+22 | |
432 | + | |
433 | + //インデックス | |
434 | + unsigned long index45[] = { 20, 21, 22, 21, 23, 22 }; | |
435 | + for (int i = 0; i < 6; i++) { | |
436 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index45[i]; | |
437 | + } | |
438 | + | |
439 | + //---------------------------------------------------------------- | |
440 | + //側面 5-6 | |
441 | + //---------------------------------------------------------------- | |
442 | + // 27+--+26 | |
443 | + // | | | |
444 | + // 6 25+--+24 5 | |
445 | + | |
446 | + //インデックス | |
447 | + unsigned long index56[] = { 24, 25, 26, 25, 27, 26 }; | |
448 | + for (int i = 0; i < 6; i++) { | |
449 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index56[i]; | |
450 | + } | |
451 | + | |
452 | + | |
453 | + //---------------------------------------------------------------- | |
454 | + //側面 6-7 | |
455 | + //---------------------------------------------------------------- | |
456 | + // 30+--+28 6 | |
457 | + // | | | |
458 | + // | | | |
459 | + // 31+--+29 7 | |
460 | + | |
461 | + //インデックス | |
462 | + unsigned long index67[] = { 28, 29, 30, 29, 31, 30 }; | |
463 | + for (int i = 0; i < 6; i++) { | |
464 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index67[i]; | |
465 | + } | |
466 | + | |
467 | + //---------------------------------------------------------------- | |
468 | + //側面 7-3 | |
469 | + //---------------------------------------------------------------- | |
470 | + // 47+--+46 | |
471 | + // | | | |
472 | + // 3 45+--+44 7 | |
473 | + | |
474 | + //頂点 | |
475 | + pVertex[44].p = pVertex[7].p; | |
476 | + pVertex[45].p = pVertex[3].p; | |
477 | + pVertex[46].p = D3DXVECTOR3(pVertex[7].p.x, 0.0f, pVertex[7].p.z); // 7' | |
478 | + pVertex[47].p = D3DXVECTOR3(pVertex[3].p.x, 0.0f, pVertex[3].p.z); // 3' | |
479 | + | |
480 | + //法線/色 | |
481 | + for (int i = 44; i < 48; i++) { | |
482 | + pVertex[i].n = D3DXVECTOR3(0.0f, 0.0f, 1.0f); | |
483 | + pVertex[i].c = keyColor; | |
484 | + } | |
485 | + | |
486 | + //インデックス | |
487 | + unsigned long index73[] = { 44, 45, 46, 45, 47, 46 }; | |
488 | + for (int i = 0; i < 6; i++) { | |
489 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index73[i]; | |
490 | + } | |
491 | + | |
492 | + //単一色のテクスチャ座標 | |
493 | + m_KeyboardDesign.GetWhiteKeyTexturePosSingleColor(noteNo, &tsc); | |
494 | + for (int i = 44; i < 48; i++) { | |
495 | + pVertex[i].t = tsc; | |
496 | + } | |
497 | + | |
498 | + //---------------------------------------------------------------- | |
499 | + //側面 3-0 | |
500 | + //---------------------------------------------------------------- | |
501 | + // 34+--+32 3 | |
502 | + // | | | |
503 | + // | | | |
504 | + // 35+--+33 0 | |
505 | + | |
506 | + //インデックス | |
507 | + unsigned long index30[] = { 32, 33, 34, 33, 35, 34 }; | |
508 | + for (int i = 0; i < 6; i++) { | |
509 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index30[i]; | |
510 | + } | |
511 | + | |
512 | + //---------------------------------------------------------------- | |
513 | + //上の面 | |
514 | + //---------------------------------------------------------------- | |
515 | + // 6+-+5 | |
516 | + // | | | |
517 | + // | | | |
518 | + // 7| |4 | |
519 | + // 3+-+-+-+2 | |
520 | + // | | +z | |
521 | + // | | | | |
522 | + // | | | | |
523 | + // 0+-----+1 +---> +x | |
524 | + // | | |
525 | + // posX | |
526 | + | |
527 | + //インデックス | |
528 | + unsigned long indexUP[] = { 0, 2, 1, 0, 3, 2, 7, 5, 4, 7, 6, 5 }; | |
529 | + for (int i = 0; i < 12; i++) { | |
530 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexUP[i]; | |
531 | + } | |
532 | + | |
533 | + return result; | |
534 | +} | |
535 | + | |
536 | +//****************************************************************************** | |
537 | +// キーボード頂点生成:白鍵C | |
538 | +//****************************************************************************** | |
539 | +int MTPianoKeyboardMod::_CreateVertexOfKeyWhite3( | |
540 | + unsigned char noteNo, | |
541 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
542 | + unsigned long* pIndex, | |
543 | + D3DXCOLOR* pColor | |
544 | + ) | |
545 | +{ | |
546 | + //基底クラスの頂点生成処理を呼び出す | |
547 | + int result = MTPianoKeyboard::_CreateVertexOfKeyWhite3( | |
548 | + noteNo, | |
549 | + pVertex, | |
550 | + pIndex, | |
551 | + pColor | |
552 | + ); | |
553 | + | |
554 | + // 描画順の修正 | |
555 | + int idx = 0; | |
556 | + | |
557 | + //---------------------------------------------------------------- | |
558 | + //下の面 | |
559 | + //---------------------------------------------------------------- | |
560 | + // 36 5+--+4 35 | |
561 | + // | | | |
562 | + // | | | |
563 | + // 37 6| | | |
564 | + // 34 3+--+--+2 33 | |
565 | + // | | +z | |
566 | + // | | | | |
567 | + // | | | | |
568 | + // 31 0+-----+1 32 +---> +x | |
569 | + // | | |
570 | + // posX | |
571 | + | |
572 | + //インデックス | |
573 | + unsigned long indexDW[] = { 31, 32, 33, 31, 33, 34, 33, 35, 37, 37, 35, 36 }; | |
574 | + for (int i = 0; i < 12; i++) { | |
575 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexDW[i]; | |
576 | + } | |
577 | + | |
578 | + //---------------------------------------------------------------- | |
579 | + //側面 0-1 | |
580 | + //---------------------------------------------------------------- | |
581 | + // 0 1 | |
582 | + // 7+----+8 | |
583 | + // | | | |
584 | + // 9+----+10 | |
585 | + | |
586 | + //インデックス | |
587 | + unsigned long index01[] = { 7, 8, 9, 8, 10, 9 }; | |
588 | + for (int i = 0; i < 6; i++) { | |
589 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index01[i]; | |
590 | + } | |
591 | + | |
592 | + //---------------------------------------------------------------- | |
593 | + //側面 1-4 | |
594 | + //---------------------------------------------------------------- | |
595 | + // 4 12+--+14 | |
596 | + // | | | |
597 | + // | | | |
598 | + // 1 11+--+13 | |
599 | + | |
600 | + //インデックス | |
601 | + unsigned long index14[] = { 11, 12, 13, 12, 14, 13 }; | |
602 | + for (int i = 0; i < 6; i++) { | |
603 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index14[i]; | |
604 | + } | |
605 | + | |
606 | + //---------------------------------------------------------------- | |
607 | + //側面 4-5 | |
608 | + //---------------------------------------------------------------- | |
609 | + // 18+--+17 | |
610 | + // | | | |
611 | + // 5 16+--+15 4 | |
612 | + | |
613 | + //インデックス | |
614 | + unsigned long index45[] = { 15, 16, 17, 16, 18, 17 }; | |
615 | + for (int i = 0; i < 6; i++) { | |
616 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index45[i]; | |
617 | + } | |
618 | + | |
619 | + //---------------------------------------------------------------- | |
620 | + //側面 5-6 | |
621 | + //---------------------------------------------------------------- | |
622 | + // 21+--+19 5 | |
623 | + // | | | |
624 | + // | | | |
625 | + // 22+--+20 6 | |
626 | + | |
627 | + //インデックス | |
628 | + unsigned long index56[] = { 19, 20, 21, 20, 22, 21 }; | |
629 | + for (int i = 0; i < 6; i++) { | |
630 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index56[i]; | |
631 | + } | |
632 | + | |
633 | + //---------------------------------------------------------------- | |
634 | + //側面 6-3 | |
635 | + //---------------------------------------------------------------- | |
636 | + // 26+--+25 | |
637 | + // | | | |
638 | + // 3 24+--+23 6 | |
639 | + | |
640 | + //インデックス | |
641 | + unsigned long index63[] = { 23, 24, 25, 24, 26, 25 }; | |
642 | + for (int i = 0; i < 6; i++) { | |
643 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index63[i]; | |
644 | + } | |
645 | + | |
646 | + //---------------------------------------------------------------- | |
647 | + //側面 3-0 | |
648 | + //---------------------------------------------------------------- | |
649 | + // 29+--+27 3 | |
650 | + // | | | |
651 | + // | | | |
652 | + // 30+--+28 0 | |
653 | + | |
654 | + //インデックス | |
655 | + unsigned long index30[] = { 27, 28, 29, 28, 30, 29 }; | |
656 | + for (int i = 0; i < 6; i++) { | |
657 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index30[i]; | |
658 | + } | |
659 | + | |
660 | + //---------------------------------------------------------------- | |
661 | + //上の面 | |
662 | + //---------------------------------------------------------------- | |
663 | + // 5+--+4 | |
664 | + // | | | |
665 | + // | | | |
666 | + // 6| | | |
667 | + // 3+--+--+2 | |
668 | + // | | +z | |
669 | + // | | | | |
670 | + // | | | | |
671 | + // 0+-----+1 +---> +x | |
672 | + // | | |
673 | + // posX | |
674 | + | |
675 | + //インデックス | |
676 | + unsigned long indexUP[] = { 0, 2, 1, 0, 3, 2, 2, 6, 4, 6, 5, 4 }; | |
677 | + for (int i = 0; i < 12; i++) { | |
678 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexUP[i]; | |
679 | + } | |
680 | + | |
681 | + return result; | |
682 | +} | |
683 | + | |
684 | +//****************************************************************************** | |
685 | +// キーボード頂点生成:黒鍵 | |
686 | +//****************************************************************************** | |
687 | +int MTPianoKeyboardMod::_CreateVertexOfKeyBlack( | |
688 | + unsigned char noteNo, | |
689 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
690 | + unsigned long* pIndex, | |
691 | + D3DXCOLOR* pColor | |
692 | + ) | |
693 | +{ | |
694 | + //基底クラスの頂点生成処理を呼び出す | |
695 | + int result = MTPianoKeyboard::_CreateVertexOfKeyBlack( | |
696 | + noteNo, | |
697 | + pVertex, | |
698 | + pIndex, | |
699 | + pColor | |
700 | + ); | |
701 | + | |
702 | + // 描画順の修正 | |
703 | + int idx = 0; | |
704 | + | |
705 | + //---------------------------------------------------------------- | |
706 | + //下の面 | |
707 | + //---------------------------------------------------------------- | |
708 | + // 29 6+-+5 28 | |
709 | + // | | | |
710 | + // | | | |
711 | + // | | | |
712 | + // 26 0+-+1 27 | |
713 | + // | +z | |
714 | + // | | | |
715 | + // | | | |
716 | + // --+-- +---> +x | |
717 | + // | | |
718 | + // posX | |
719 | + | |
720 | + //インデックス | |
721 | + unsigned long indexDW[] = { 26, 27, 28, 26, 28, 29 }; | |
722 | + for (int i = 0; i < 6; i++) { | |
723 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexDW[i]; | |
724 | + } | |
725 | + | |
726 | + //---------------------------------------------------------------- | |
727 | + //側面 0-1 | |
728 | + //---------------------------------------------------------------- | |
729 | + // 0 1 | |
730 | + // 8+----+9 | |
731 | + // | | | |
732 | + // 10+----+11 | |
733 | + | |
734 | + //インデックス | |
735 | + unsigned long index01[] = { 8, 9, 10, 9, 11, 10 }; | |
736 | + for (int i = 0; i < 6; i++) { | |
737 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index01[i]; | |
738 | + } | |
739 | + | |
740 | + //---------------------------------------------------------------- | |
741 | + //側面 1-2-5 | |
742 | + //---------------------------------------------------------------- | |
743 | + // 5 14+--+16 | |
744 | + // | | | |
745 | + // | | | |
746 | + // 2 13+ | | |
747 | + // \ | | |
748 | + // 1 12 +-+15 | |
749 | + | |
750 | + //インデックス | |
751 | + unsigned long index125[] = { 12, 13, 15, 13, 16, 15, 13, 14, 16 }; | |
752 | + for (int i = 0; i < 9; i++) { | |
753 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index125[i]; | |
754 | + } | |
755 | + | |
756 | + //---------------------------------------------------------------- | |
757 | + //側面 5-6 | |
758 | + //---------------------------------------------------------------- | |
759 | + // 20+--+19 | |
760 | + // | | | |
761 | + // 6 18+--+17 5 | |
762 | + | |
763 | + //インデックス | |
764 | + unsigned long index56[] = { 17, 18, 19, 18, 20, 19 }; | |
765 | + for (int i = 0; i < 6; i++) { | |
766 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index56[i]; | |
767 | + } | |
768 | + | |
769 | + //---------------------------------------------------------------- | |
770 | + //側面 6-3-0 | |
771 | + //---------------------------------------------------------------- | |
772 | + // 24+--+21 6 | |
773 | + // | | | |
774 | + // | | | |
775 | + // | +22 3 | |
776 | + // | / | |
777 | + // 25+-+23 0 | |
778 | + | |
779 | + //インデックス | |
780 | + unsigned long index630[] = { 21, 22, 24, 22, 25, 24, 22, 23, 25 }; | |
781 | + for (int i = 0; i < 9; i++) { | |
782 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + index630[i]; | |
783 | + } | |
784 | + | |
785 | + //---------------------------------------------------------------- | |
786 | + //上の面 | |
787 | + //---------------------------------------------------------------- | |
788 | + // 6+-+5 | |
789 | + // | | | |
790 | + // | | | |
791 | + // 7 3+-+2 4 | |
792 | + // 0+-+1 | |
793 | + // | +z | |
794 | + // | | | |
795 | + // | | | |
796 | + // --+-- +---> +x | |
797 | + // | | |
798 | + // posX | |
799 | + | |
800 | + //インデックス | |
801 | + unsigned long indexUP[] = { 0, 2, 1, 0, 3, 2, 4, 7, 5, 7, 6, 5 }; | |
802 | + for (int i = 0; i < 12; i++) { | |
803 | + pIndex[idx++] = m_BufInfo[noteNo].vertexPos + indexUP[i]; | |
804 | + } | |
805 | + | |
806 | + return result; | |
807 | +} | |
808 | + |
@@ -52,6 +52,33 @@ public: | ||
52 | 52 | |
53 | 53 | private: |
54 | 54 | |
55 | + virtual int _CreateVertexOfKeyWhite1( | |
56 | + unsigned char noteNo, | |
57 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
58 | + unsigned long* pIndex, | |
59 | + D3DXCOLOR* pColor = NULL | |
60 | + ); | |
61 | + virtual int _CreateVertexOfKeyWhite2( | |
62 | + unsigned char noteNo, | |
63 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
64 | + unsigned long* pIndex, | |
65 | + D3DXCOLOR* pColor = NULL | |
66 | + ); | |
67 | + virtual int _CreateVertexOfKeyWhite3( | |
68 | + unsigned char noteNo, | |
69 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
70 | + unsigned long* pIndex, | |
71 | + D3DXCOLOR* pColor = NULL | |
72 | + ); | |
73 | + virtual int _CreateVertexOfKeyBlack( | |
74 | + unsigned char noteNo, | |
75 | + MTPIANOKEYBOARD_VERTEX* pVertex, | |
76 | + unsigned long* pIndex, | |
77 | + D3DXCOLOR* pColor = NULL | |
78 | + ); | |
79 | + | |
80 | +private: | |
81 | + | |
55 | 82 | //キーボードデザイン |
56 | 83 | MTPianoKeyboardDesignMod m_KeyboardDesignMod; |
57 | 84 |
@@ -46,11 +46,6 @@ int MTScenePianoRoll2DMod::Create( | ||
46 | 46 | { |
47 | 47 | int result = 0; |
48 | 48 | |
49 | - //ピアノロール2Dはライトなし | |
50 | - // ノートボックスの幅をゼロにするので表と裏が同一平面状で重なる | |
51 | - // ライトを有効にすると表と裏の色が異なりZファイティングを誘発する | |
52 | - m_IsEnableLight = FALSE; | |
53 | - | |
54 | 49 | result = MTScenePianoRoll3DMod::Create(hWnd, pD3DDevice, pSeqData); |
55 | 50 | if (result != 0) goto EXIT; |
56 | 51 |
@@ -108,8 +108,8 @@ KeyUpDuration=40 | ||
108 | 108 | KeyboardStepY=0.34 |
109 | 109 | KeyboardStepZ=1.5 |
110 | 110 | KeyboardMaxDispNum=16 |
111 | -WhiteKeyColor=FFFFFFDD | |
112 | -BlackKeyColor=FFFFFFDD | |
111 | +WhiteKeyColor=FFFFFFAA | |
112 | +BlackKeyColor=FFFFFFAA | |
113 | 113 | ActiveKeyColorType=STANDARD |
114 | 114 | ;ActiveKeyColor=FF0000FF |
115 | 115 | Ch-01-ActiveKeyColor=E61A1AEE |
@@ -109,8 +109,8 @@ KeyUpDuration=40 | ||
109 | 109 | KeyboardStepY=0.34 |
110 | 110 | KeyboardStepZ=1.5 |
111 | 111 | KeyboardMaxDispNum=16 |
112 | -WhiteKeyColor=FFFFFFDD | |
113 | -BlackKeyColor=FFFFFFDD | |
112 | +WhiteKeyColor=FFFFFFAA | |
113 | +BlackKeyColor=FFFFFFAA | |
114 | 114 | ActiveKeyColorType=STANDARD |
115 | 115 | ;ActiveKeyColor=FF0000FF |
116 | 116 | Ch-01-ActiveKeyColor=E61A1AEE |