• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等


Commit MetaInfo

Revisióna4fe713bf30da995e89ceb76cb9053e975a6fd49 (tree)
Tiempo2019-08-28 07:06:19
Autoryoshy <yoshy@user...>
Commiteryoshy

Log Message

[UPDATE] カメラ視線方向によるキーボード描画順の変更を実装

Cambiar Resumen

Diferencia incremental

--- a/MIDITrail/MTPianoKeyboardMod.cpp
+++ b/MIDITrail/MTPianoKeyboardMod.cpp
@@ -106,16 +106,32 @@ int MTPianoKeyboardMod::Draw(
106106 pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
107107 pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
108108
109- //正順側キーボードの描画
110- if (m_noteNoLow != -1) {
111- result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pTexture, m_BufInfo[m_noteNoLow].indexTotal / 3);
112- if (result != 0) goto EXIT;
109+ //視線方向による描画順の変更
110+ if (m_camDir == -1) {
111+ //正順側キーボードの描画
112+ if (m_noteNoLow != -1) {
113+ result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pTexture, m_BufInfo[m_noteNoLow].indexTotal / 3);
114+ if (result != 0) goto EXIT;
115+ }
116+
117+ //逆順側キーボードの描画
118+ if (m_noteNoHigh != -1) {
119+ result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pRevIndexBuffer, m_pTexture, m_BufInfo[m_noteNoHigh].revIndexTotal / 3);
120+ if (result != 0) goto EXIT;
121+ }
113122 }
123+ else {
124+ //逆順側キーボードの描画
125+ if (m_noteNoHigh != -1) {
126+ result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pRevIndexBuffer, m_pTexture, m_BufInfo[m_noteNoHigh].revIndexTotal / 3);
127+ if (result != 0) goto EXIT;
128+ }
114129
115- //逆順側キーボードの描画
116- if (m_noteNoHigh != -1) {
117- result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pRevIndexBuffer, m_pTexture, m_BufInfo[m_noteNoHigh].revIndexTotal / 3);
118- if (result != 0) goto EXIT;
130+ //正順側キーボードの描画
131+ if (m_noteNoLow != -1) {
132+ result = m_PrimitiveKeyboard.Draw(pD3DDevice, m_pTexture, m_BufInfo[m_noteNoLow].indexTotal / 3);
133+ if (result != 0) goto EXIT;
134+ }
119135 }
120136
121137 EXIT:;
@@ -238,15 +254,21 @@ int MTPianoKeyboardMod::_MakeRenderingOrder(
238254 D3DXVECTOR3 lookVector
239255 )
240256 {
257+ //ピッチベンド幅を含んだキーボード原点
241258 float origin = basePosVector.x;
242259
260+ //カメラ位置
243261 float camPos = -camVector.z;
244262
263+ //カメラ視線方向
264+ float camDir = -lookVector.z;
265+
245266 m_noteNoLow = (int)::floor((camPos - origin) / m_KeyboardDesignMod.GetNoteStep());
246267 m_noteNoHigh = m_noteNoLow + 1;
247268
248269 //char buf[256];
249- //::sprintf(buf, "O:%f, P:%f, L:%d, H:%d\n", origin, camPos, m_noteNoLow, m_noteNoHigh);
270+ ////::sprintf(buf, "O:%f, P:%f, L:%d, H:%d\n", origin, camPos, m_noteNoLow, m_noteNoHigh);
271+ //::sprintf(buf, "D:%f\n", camDir);
250272 //::OutputDebugStringA(buf);
251273
252274 if (m_noteNoLow < 0) {
@@ -266,6 +288,8 @@ int MTPianoKeyboardMod::_MakeRenderingOrder(
266288 m_noteNoHigh = -1;
267289 }
268290
291+ m_camDir = camDir < 0 ? -1 : 1;
292+
269293 return 0;
270294 }
271295
--- a/MIDITrail/MTPianoKeyboardMod.h
+++ b/MIDITrail/MTPianoKeyboardMod.h
@@ -119,6 +119,7 @@ private:
119119 //キーボード描画範囲
120120 int m_noteNoLow;
121121 int m_noteNoHigh;
122+ int m_camDir;
122123 };
123124
124125