• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

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


Commit MetaInfo

Revisioncdfa87d56c1fb507f29da50dd84312f34eb32f76 (tree)
Zeit2018-04-12 08:44:05
Autoryoshy <yoshy@user...>
Commiteryoshy

Log Message

[CLEAN] キーボードデザインクラスで必要なノートデザイン情報を取得するように修正

Ändern Zusammenfassung

Diff

--- a/MIDITrail/MTNoteDesignMod.h
+++ b/MIDITrail/MTNoteDesignMod.h
@@ -74,19 +74,19 @@ protected:
7474
7575 private:
7676
77- //ディケイ時間
77+ //波紋ディケイ時間
7878 int m_RippleDecayDuration;
79- //リリース時間
79+ //波紋リリース時間
8080 int m_RippleReleaseDuration;
8181
82- //描画元(リップル画像)ブレンド指定
82+ //波紋描画元(リップル画像)ブレンド指定
8383 D3DBLEND m_RippleSrcBlend;
84- //描画先(背景画像)ブレンド指定
84+ //波紋描画先(背景画像)ブレンド指定
8585 D3DBLEND m_RippleDestBlend;
8686
87- //上書き回数
87+ //波紋上書き回数
8888 int m_RippleOverwriteTimes;
89- //描画間隔
89+ //波紋描画間隔
9090 float m_RippleSpacing;
9191 };
9292
--- a/MIDITrail/MTPianoKeyboardCtrlMod.cpp
+++ b/MIDITrail/MTPianoKeyboardCtrlMod.cpp
@@ -12,8 +12,6 @@
1212 #include "YNBaseLib.h"
1313 #include "MTPianoKeyboardCtrlMod.h"
1414 #include "MTPianoKeyboardMod.h"
15-#include "MTNoteRippleMod.h"
16-#include "MTNoteLyrics.h"
1715
1816 using namespace YNBaseLib;
1917
@@ -200,14 +198,11 @@ int MTPianoKeyboardCtrlMod::Transform(
200198 &portWindowRD
201199 );
202200
203- float boardHeight = portWindowLU.y - portWindowLD.y;
204- float keyboardWidth = m_KeyboardDesignMod.GetPortOriginX() * -2.0f;
201+ float boardHeight = m_KeyboardDesignMod.GetPlaybackSectionHeight();
202+ float keyboardWidth = m_KeyboardDesignMod.GetKeyboardWidth();
205203
206204 float resizeSacle = boardHeight / keyboardWidth;
207205
208- float rippleSpacing = m_NoteDesignMod.GetRippleSpacing();
209- float rippleMargin = rippleSpacing * (MTNOTELYRICS_MAX_LYRICS_NUM + MTNOTERIPPLE_MAX_RIPPLE_NUM); // * antiResizeScale;
210-
211206 //移動ベクトル:再生面に追従する
212207 playbackPosVector = m_NoteDesignMod.GetWorldMoveVector();
213208 playbackPosVector.x += m_NoteDesignMod.GetPlayPosX(m_CurTickTime);
@@ -234,7 +229,7 @@ int MTPianoKeyboardCtrlMod::Transform(
234229 }
235230
236231 //移動ベクトル:キーボード基準座標
237- transformVector = m_KeyboardDesignMod.GetKeyboardBasePos(keyboardIndex, rippleMargin, boardHeight, rollAngle);
232+ transformVector = m_KeyboardDesignMod.GetKeyboardBasePos(keyboardIndex, rollAngle);
238233
239234 //移動ベクトル:ピッチベンドシフトを反映
240235 transformVector.x += GetMaxPitchBendShift(portNo);
--- a/MIDITrail/MTPianoKeyboardDesignMod.cpp
+++ b/MIDITrail/MTPianoKeyboardDesignMod.cpp
@@ -12,6 +12,8 @@
1212 #include "DXColorUtil.h"
1313 #include "MTConfFile.h"
1414 #include "MTPianoKeyboardDesignMod.h"
15+#include "MTNoteRippleMod.h"
16+#include "MTNoteLyrics.h"
1517
1618
1719 //******************************************************************************
@@ -75,6 +77,37 @@ void MTPianoKeyboardDesignMod::_Initialize()
7577 }
7678
7779 //******************************************************************************
80+// キーボード基準座標取得
81+//******************************************************************************
82+D3DXVECTOR3 MTPianoKeyboardDesignMod::GetKeyboardBasePos(
83+ int keyboardIndex,
84+ float angle
85+ )
86+{
87+ float ox, oy, oz = 0.0f;
88+
89+ //ロール角度によって描画方法を切り替える
90+ angle += angle < 0.0f ? 360.0f : 0.0f;
91+ bool flip = !((angle > 120.0f) && (angle < 300.0f));
92+
93+ float boardHeight = GetPlaybackSectionHeight();
94+ float keyboardWidth = GetKeyboardWidth();
95+
96+ float rippleMargin = GetRippleMargin(); // * antiResizeScale;
97+
98+ //キーボード描画時にリサイズがかかってはならない相対座標用の逆リサイズ比
99+ //対象:ポート間隔、リップルマージン
100+ float antiResizeScale = keyboardWidth / boardHeight;
101+
102+ //ポート単位の原点座標
103+ ox = GetPortOriginX();
104+ oy = GetPortOriginY(keyboardIndex, antiResizeScale, flip);
105+ oz = GetPortOriginZ(keyboardIndex, antiResizeScale, flip);
106+
107+ return D3DXVECTOR3(ox, oy, oz);
108+}
109+
110+//******************************************************************************
78111 // ポート原点X座標取得
79112 //******************************************************************************
80113 float MTPianoKeyboardDesignMod::GetPortOriginX()
@@ -108,7 +141,7 @@ float MTPianoKeyboardDesignMod::GetPortOriginX()
108141 // |
109142 // -z
110143
111- float originX = MTPianoKeyboardDesign::GetPortOriginX(0);
144+ float originX = -GetKeyboardWidth() / 2.0f;
112145
113146 //鍵盤の1/2の幅だけ高音側に移動
114147 return originX + GetWhiteKeyStep() / 2.0f;
@@ -167,7 +200,7 @@ float MTPianoKeyboardDesignMod::GetPortOriginY(
167200 float originY = portWidth * (keyboardDispNum - keyboardIndex - 1);
168201
169202 if (!flip) {
170- originY = -(originY + GetChStep() * 15.0f);
203+ originY = 0; //-(originY + GetChStep() * 15.0f);
171204 }
172205
173206 //キーボードリサイズ後に正しいポート間隔となるよう逆比をかける
@@ -184,7 +217,6 @@ float MTPianoKeyboardDesignMod::GetPortOriginY(
184217 //******************************************************************************
185218 float MTPianoKeyboardDesignMod::GetPortOriginZ(
186219 int keyboardIndex,
187- float rippleMargin,
188220 float antiResizeScale,
189221 bool flip
190222 )
@@ -221,7 +253,7 @@ float MTPianoKeyboardDesignMod::GetPortOriginZ(
221253 float originZ;
222254
223255 //キーボードリサイズ後に正しいリップルマージンとなるよう逆比をかける
224- rippleMargin *= antiResizeScale;
256+ float rippleMargin = GetRippleSpacing() * antiResizeScale;
225257
226258 if (!flip) {
227259 originZ = -(GetWhiteKeyLen() + rippleMargin);
@@ -234,6 +266,30 @@ float MTPianoKeyboardDesignMod::GetPortOriginZ(
234266 }
235267
236268 //******************************************************************************
269+// ノートボックス高さ取得
270+//******************************************************************************
271+float MTPianoKeyboardDesignMod::GetNoteBoxHeight()
272+{
273+ return m_NoteBoxHeight;
274+}
275+
276+//******************************************************************************
277+// ノートボックス幅取得
278+//******************************************************************************
279+float MTPianoKeyboardDesignMod::GetNoteBoxWidth()
280+{
281+ return m_NoteBoxWidth;
282+}
283+
284+//******************************************************************************
285+// ノート間隔取得
286+//******************************************************************************
287+float MTPianoKeyboardDesignMod::GetNoteStep()
288+{
289+ return m_NoteStep;
290+}
291+
292+//******************************************************************************
237293 // チャンネル間隔取得
238294 //******************************************************************************
239295 float MTPianoKeyboardDesignMod::GetChStep()
@@ -242,6 +298,70 @@ float MTPianoKeyboardDesignMod::GetChStep()
242298 }
243299
244300 //******************************************************************************
301+// キーボード高さ取得
302+//******************************************************************************
303+float MTPianoKeyboardDesignMod::GetKeyboardHeight()
304+{
305+ return GetBlackKeyHeight();
306+}
307+
308+//******************************************************************************
309+// キーボード幅取得
310+//******************************************************************************
311+float MTPianoKeyboardDesignMod::GetKeyboardWidth()
312+{
313+ return GetWhiteKeyStep() * (float)(SM_MAX_NOTE_NUM - 53);
314+}
315+
316+//******************************************************************************
317+// グリッド高さ取得
318+//******************************************************************************
319+float MTPianoKeyboardDesignMod::GetGridHeight()
320+{
321+ return GetNoteStep() * 127;
322+}
323+
324+//******************************************************************************
325+// グリッド幅取得
326+//******************************************************************************
327+float MTPianoKeyboardDesignMod::GetGridWidth()
328+{
329+ return GetChStep() * 15;
330+}
331+
332+//******************************************************************************
333+// 再生面高さ取得
334+//******************************************************************************
335+float MTPianoKeyboardDesignMod::GetPlaybackSectionHeight()
336+{
337+ return GetGridHeight() + GetNoteBoxHeight();
338+}
339+
340+//******************************************************************************
341+// 再生面幅取得
342+//******************************************************************************
343+float MTPianoKeyboardDesignMod::GetPlaybackSectionWidth()
344+{
345+ return GetGridWidth() + GetNoteBoxWidth();
346+}
347+
348+//******************************************************************************
349+// 波紋描画間隔取得
350+//******************************************************************************
351+float MTPianoKeyboardDesignMod::GetRippleSpacing()
352+{
353+ return m_RippleSpacing;
354+}
355+
356+//******************************************************************************
357+// 波紋描画マージン取得
358+//******************************************************************************
359+float MTPianoKeyboardDesignMod::GetRippleMargin()
360+{
361+ return GetRippleSpacing() * (MTNOTELYRICS_MAX_LYRICS_NUM + MTNOTERIPPLE_MAX_RIPPLE_NUM);
362+}
363+
364+//******************************************************************************
245365 // 発音中キーカラー取得
246366 //******************************************************************************
247367 D3DXCOLOR MTPianoKeyboardDesignMod::GetActiveKeyColor(
@@ -306,36 +426,6 @@ D3DXCOLOR MTPianoKeyboardDesignMod::GetActiveKeyColor(
306426 }
307427
308428 //******************************************************************************
309-// キーボード基準座標取得
310-//******************************************************************************
311-D3DXVECTOR3 MTPianoKeyboardDesignMod::GetKeyboardBasePos(
312- int keyboardIndex,
313- float rippleMargin,
314- float boardHeight,
315- float angle
316- )
317-{
318- float ox, oy, oz = 0.0f;
319-
320- //ロール角度によって描画方法を切り替える
321- angle += angle < 0.0f ? 360.0f : 0.0f;
322- bool flip = !((angle > 120.0f) && (angle < 300.0f));
323-
324- float keyboardWidth = MTPianoKeyboardDesign::GetPortOriginX(0) * -2.0f;
325-
326- //キーボード描画時にリサイズがかかってはならない相対座標用の逆リサイズ比
327- //対象:ポート間隔、リップルマージン
328- float antiResizeScale = keyboardWidth / boardHeight;
329-
330- //ポート単位の原点座標
331- ox = GetPortOriginX();
332- oy = GetPortOriginY(keyboardIndex, antiResizeScale, flip);
333- oz = GetPortOriginZ(keyboardIndex, rippleMargin, antiResizeScale, flip);
334-
335- return D3DXVECTOR3(ox, oy, oz);
336-}
337-
338-//******************************************************************************
339429 // 設定ファイル読み込み
340430 //******************************************************************************
341431 int MTPianoKeyboardDesignMod::_LoadConfFile(
@@ -361,6 +451,13 @@ int MTPianoKeyboardDesignMod::_LoadConfFile(
361451 //----------------------------------
362452 result = confFile.SetCurSection(_T("Scale"));
363453 if (result != 0) goto EXIT;
454+
455+ result = confFile.GetFloat(_T("NoteBoxHeight"), &m_NoteBoxHeight, 0.1f);
456+ if (result != 0) goto EXIT;
457+ result = confFile.GetFloat(_T("NoteBoxWidth"), &m_NoteBoxWidth, 0.1f);
458+ if (result != 0) goto EXIT;
459+ result = confFile.GetFloat(_T("NoteStep"), &m_NoteStep, 0.1f);
460+ if (result != 0) goto EXIT;
364461 result = confFile.GetFloat(_T("ChStep"), &m_ChStep, 0.5f);
365462 if (result != 0) goto EXIT;
366463
@@ -379,6 +476,16 @@ int MTPianoKeyboardDesignMod::_LoadConfFile(
379476 m_ActiveKeyColorList[i] = DXColorUtil::MakeColorFromHexRGBA(hexColor);
380477 }
381478
479+ //----------------------------------
480+ //波紋情報
481+ //----------------------------------
482+ result = confFile.SetCurSection(_T("Ripple"));
483+ if (result != 0) goto EXIT;
484+
485+ //波紋描画間隔
486+ result = confFile.GetFloat(_T("Spacing"), &m_RippleSpacing, 0.002f);
487+ if (result != 0) goto EXIT;
488+
382489 EXIT:;
383490 return result;
384491 }
--- a/MIDITrail/MTPianoKeyboardDesignMod.h
+++ b/MIDITrail/MTPianoKeyboardDesignMod.h
@@ -27,14 +27,42 @@ public:
2727 //初期化
2828 virtual int Initialize(const TCHAR* pSceneName, SMSeqData* pSeqData);
2929
30+ //キーボード基準座標取得
31+ D3DXVECTOR3 GetKeyboardBasePos(int keyboardIndex, float angle);
32+
3033 //ポート原点座標取得
3134 float GetPortOriginX();
3235 float GetPortOriginY(int keyboardIndex, float antiResizeScale, bool flip);
33- float GetPortOriginZ(int keyboardIndex, float rippleMargin, float antiResizeScale, bool flip);
36+ float GetPortOriginZ(int keyboardIndex, float antiResizeScale, bool flip);
37+
38+ //ノートボックス高さ・幅取得
39+ float GetNoteBoxHeight();
40+ float GetNoteBoxWidth();
41+
42+ //ノート間隔取得
43+ float GetNoteStep();
3444
3545 //チャンネル間隔取得
3646 float GetChStep();
3747
48+ //キーボード高さ・幅取得
49+ float GetKeyboardHeight();
50+ float GetKeyboardWidth();
51+
52+ //グリッド高さ・幅取得
53+ float GetGridHeight();
54+ float GetGridWidth();
55+
56+ //再生面高さ・幅取得
57+ float GetPlaybackSectionHeight();
58+ float GetPlaybackSectionWidth();
59+
60+ //波紋描画間隔取得
61+ float GetRippleSpacing();
62+
63+ //波紋描画マージン取得
64+ float GetRippleMargin();
65+
3866 //発音中キーカラー取得
3967 D3DXCOLOR GetActiveKeyColor(
4068 unsigned char chNo,
@@ -43,9 +71,6 @@ public:
4371 D3DXCOLOR* pNoteColor = NULL
4472 );
4573
46- //キーボード基準座標取得
47- D3DXVECTOR3 GetKeyboardBasePos(int keyboardIndex, float rippleMargin, float boardHeight, float angle);
48-
4974 protected:
5075
5176 virtual void _Initialize();
@@ -53,9 +78,18 @@ protected:
5378
5479 private:
5580
81+ //ノートボックス高さ
82+ float m_NoteBoxHeight;
83+ //ノートボックス幅
84+ float m_NoteBoxWidth;
85+ //ノート間隔
86+ float m_NoteStep;
5687 //チャンネル間隔
5788 float m_ChStep;
5889
90+ //波紋描画間隔
91+ float m_RippleSpacing;
92+
5993 //発音中キー色情報
6094 D3DXCOLOR m_ActiveKeyColorList[16];
6195