Skip to content

Commit b66d5b6

Browse files
committed
環境によってカーブの描画がカクつくことがある問題を修正
1 parent 07157d1 commit b66d5b6

File tree

6 files changed

+72
-27
lines changed

6 files changed

+72
-27
lines changed

curve_editor/cve_curve_bounce.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,25 @@
1414
void cve::Curve_Bounce::initialize()
1515
{
1616

17-
}
17+
}
18+
19+
20+
21+
double func1(double t, double e)
22+
{
23+
return std::floor(std::log((e - 1) * t + 1)/std::log(e));
24+
}
25+
26+
27+
28+
double func2(double t)
29+
{
30+
31+
}
32+
33+
34+
35+
//double cve::Curve_Bounce::func_bounce()
36+
//{
37+
//
38+
//}

curve_editor/cve_curve_elastic.cpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,17 @@ double cve::Curve_Elastic::pt_to_param(int pt_graph_val, int idx_param)
106106
//---------------------------------------------------------------------
107107
void cve::Curve_Elastic::param_to_pt(POINT* pt_graph, int idx_pt)
108108
{
109-
109+
if (idx_pt <= 1) {
110+
if (idx_pt == 0)
111+
pt_graph->x = 0;
112+
else
113+
pt_graph->x = CVE_GRAPH_RESOLUTION;
114+
pt_graph->y = (int)(CVE_GRAPH_RESOLUTION * 0.5 * (ampl + 1.0));
115+
}
116+
else if (idx_pt == 2) {
117+
pt_graph->x = (int)(2.0 * CVE_GRAPH_RESOLUTION / freq);
118+
pt_graph->y = -(int)((std::exp(-(dec - 1.0) * 0.1) - 1.0) * CVE_GRAPH_RESOLUTION * 0.5);
119+
}
110120
}
111121

112122

@@ -184,6 +194,7 @@ void cve::Curve_Elastic::draw_curve(Bitmap_Buffer* bitmap_buffer, const RECT& re
184194
{
185195
COLORREF handle_color;
186196
COLORREF curve_color;
197+
POINT pt_graph;
187198

188199
if (drawing_mode == CVE_DRAW_CURVE_REGULAR) {
189200
handle_color = g_theme[g_config.theme].handle;
@@ -230,19 +241,23 @@ void cve::Curve_Elastic::draw_curve(Bitmap_Buffer* bitmap_buffer, const RECT& re
230241
if (g_config.show_handle) {
231242
bitmap_buffer->brush->SetColor(D2D1::ColorF(TO_BGR(handle_color)));
232243

244+
param_to_pt(&pt_graph, 0);
245+
233246
// 振幅を調整するハンドル
234247
draw_handle(
235248
bitmap_buffer,
236-
to_client(0, (int)(CVE_GRAPH_RESOLUTION * 0.5 * (ampl + 1.0))),
237-
to_client(CVE_GRAPH_RESOLUTION, (int)(CVE_GRAPH_RESOLUTION * 0.5 * (ampl + 1.0))),
249+
to_client(pt_graph),
250+
to_client(CVE_GRAPH_RESOLUTION, pt_graph.y),
238251
drawing_mode, CVE_DRAW_HANDLE_ONLY
239252
);
240253

254+
param_to_pt(&pt_graph, 2);
255+
241256
// 振動数・減衰を調整するハンドル
242257
draw_handle(
243258
bitmap_buffer,
244-
to_client((int)(2.0 * CVE_GRAPH_RESOLUTION / freq), (int)(CVE_GRAPH_RESOLUTION * 0.5)),
245-
to_client((int)(2.0 * CVE_GRAPH_RESOLUTION / freq), -(int)((std::exp(-(dec - 1.0) * 0.1) - 1.0) * CVE_GRAPH_RESOLUTION * 0.5)),
259+
to_client(pt_graph.x, (int)(CVE_GRAPH_RESOLUTION * 0.5)),
260+
to_client(pt_graph),
246261
drawing_mode, NULL
247262
);
248263

@@ -274,7 +289,7 @@ int cve::Curve_Elastic::create_number()
274289
int f = (int)(2000 / freq);
275290
int a = (int)(100 * ampl);
276291
int k = -(int)(100 * (std::exp(-(dec - 1.0) * 0.1) - 1.0));
277-
result = 1 + a + k * 101 + f * 101 * 1001;
292+
result = 1 + a + k * 101 + f * 101 * 101;
278293
if (reverse)
279294
result *= -1;
280295
return result;
@@ -304,9 +319,9 @@ bool cve::Curve_Elastic::read_number(int number, double* f, double* k, double* a
304319
num = number - 1;
305320
}
306321
else return false;
307-
*f = std::floor(num / (101 * 1001));
308-
*k = std::floor((num - *f * 101 * 1001) / 101);
309-
*a = std::floor(num - *f * 101 * 1001 - *k * 101);
322+
*f = std::floor(num / (101 * 101));
323+
*k = std::floor((num - *f * 101 * 101) / 101);
324+
*a = std::floor(num - *f * 101 * 101 - *k * 101);
310325
*f = 2.0 / MIN_LIMIT(*f * 0.001, 0.001);
311326
*k = -10.0 * std::log(-*k * 0.01 + 1.0) + 1.0;
312327
*a = MINMAX_LIMIT(*a, 0, 100) * 0.01;

curve_editor/cve_func_filter.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ void ini_load_configs(FILTER* fp)
163163
g_curve_normal.ctpts[0].pt_right.y = fp->exfunc->ini_load_int(fp, "y1", (int)(CVE_GRAPH_RESOLUTION * CVE_POINT_DEFAULT_1));
164164
g_curve_normal.ctpts[1].pt_left.x = MINMAX_LIMIT(fp->exfunc->ini_load_int(fp, "x2", (int)(CVE_GRAPH_RESOLUTION * CVE_POINT_DEFAULT_2)), 0, CVE_GRAPH_RESOLUTION);
165165
g_curve_normal.ctpts[1].pt_left.y = fp->exfunc->ini_load_int(fp, "y2", (int)(CVE_GRAPH_RESOLUTION * CVE_POINT_DEFAULT_2));
166-
166+
g_curve_elastic.ampl = g_curve_elastic.pt_to_param(fp->exfunc->ini_load_int(fp, "amp", CVE_GRAPH_RESOLUTION), 0);
167+
g_curve_elastic.freq = g_curve_elastic.pt_to_param(fp->exfunc->ini_load_int(fp, "freq", (int)(CVE_GRAPH_RESOLUTION * 0.25)), 1);
168+
g_curve_elastic.dec = g_curve_elastic.pt_to_param(fp->exfunc->ini_load_int(fp, "decay", (int)(CVE_GRAPH_RESOLUTION * 0.1875)), 2);
167169
g_config.separator = fp->exfunc->ini_load_int(fp, "separator", CVE_SEPARATOR_WIDTH);
168170
g_config.edit_mode = (cve::Edit_Mode)fp->exfunc->ini_load_int(fp, "edit_mode", cve::Mode_Bezier);
169171
g_config.layout_mode = (cve::Config::Layout_Mode)fp->exfunc->ini_load_int(fp, "layout_mode", cve::Config::Vertical);
@@ -182,6 +184,7 @@ void ini_load_configs(FILTER* fp)
182184
//---------------------------------------------------------------------
183185
void ini_write_configs(FILTER* fp)
184186
{
187+
POINT pt_graph;
185188
fp->exfunc->ini_save_int(fp, "x1", g_curve_normal.ctpts[0].pt_right.x);
186189
fp->exfunc->ini_save_int(fp, "y1", g_curve_normal.ctpts[0].pt_right.y);
187190
fp->exfunc->ini_save_int(fp, "x2", g_curve_normal.ctpts[1].pt_left.x);
@@ -191,6 +194,12 @@ void ini_write_configs(FILTER* fp)
191194
fp->exfunc->ini_save_int(fp, "layout_mode", g_config.layout_mode);
192195
fp->exfunc->ini_save_int(fp, "align_handle", g_config.align_handle);
193196
fp->exfunc->ini_save_int(fp, "show_handle", g_config.show_handle);
197+
198+
g_curve_elastic.param_to_pt(&pt_graph, 0);
199+
fp->exfunc->ini_save_int(fp, "amp", pt_graph.y);
200+
g_curve_elastic.param_to_pt(&pt_graph, 2);
201+
fp->exfunc->ini_save_int(fp, "freq", pt_graph.x);
202+
fp->exfunc->ini_save_int(fp, "decay", pt_graph.y);
194203
}
195204

196205

curve_editor/cve_macro.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
#define CVE_SUBTRACT_LENGTH_2 8.0f
5555
#define CVE_CURVE_VALUE_MIN_Y -2.73f
5656
#define CVE_CURVE_VALUE_MAX_Y 3.73f
57-
#define CVE_POINT_DEFAULT_1 0.4f
58-
#define CVE_POINT_DEFAULT_2 0.6f
57+
#define CVE_POINT_DEFAULT_1 0.3f
58+
#define CVE_POINT_DEFAULT_2 0.7f
5959

6060
// カーブ描画
6161
#define CVE_DRAW_CURVE_REGULAR 0
@@ -66,7 +66,7 @@
6666

6767
#define CVE_DRAW_GRAPH_INCREASEMENT 1.0f
6868

69-
#define CVE_CURVE_COLOR_DEFAULT RGB(103, 103, 241)
69+
#define CVE_CURVE_COLOR_DEFAULT RGB(148, 158, 197)
7070

7171

7272
//フラグ
@@ -206,7 +206,7 @@
206206
#define CVE_STR_WARNING_DELETE "編集中のカーブを初期化します。よろしいですか?"
207207
#define CVE_STR_WARNING_DELETE_ALL "すべてのカーブを初期化します。よろしいですか?"
208208
#define CVE_STR_WARNING_DATA_INVALID "互換性のないバージョンでカーブが読み込まれたか、データが破損しています。\nすべてのカーブを初期化しますか?"
209-
#define CVE_STR_ABOUT CVE_PLUGIN_NAME " " CVE_PLUGIN_VERSION "\n" "Copyright : (C) " CVE_PLUGIN_YEAR " " CVE_PLUGIN_DEVELOPER
209+
#define CVE_STR_ABOUT CVE_PLUGIN_NAME " " CVE_PLUGIN_VERSION "\n(" CVE_PLUGIN_YEAR " " CVE_PLUGIN_DEVELOPER ")"
210210
#define CVE_STR_ERROR_OUTOFRANGE "値が範囲外です。"
211211
#define CVE_STR_ERROR_INPUT_INVALID "無効な入力値です。"
212212
#define CVE_STR_ERROR_EXEDIT_NOT_FOUND "拡張編集プラグイン(exedit.auf)が見つかりません。"

curve_editor/cve_wndproc_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ LRESULT CALLBACK wndproc_editor(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
639639

640640
// 本プラグインについて
641641
case ID_MENU_ABOUT:
642-
::MessageBox(hwnd, CVE_STR_ABOUT, CVE_PLUGIN_NAME, MB_OK);
642+
::MessageBox(hwnd, CVE_STR_ABOUT, CVE_PLUGIN_NAME, MB_ICONINFORMATION);
643643
return 0;
644644

645645
// 値をコピー

curve_editor/cve_wndproc_main.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ LRESULT CALLBACK wndproc_main(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
6363
bitmap_buffer.init(hwnd);
6464
bitmap_buffer.set_size(rect_wnd);
6565

66-
// ヘッダパネル
67-
g_window_menu.create(
68-
hwnd,
69-
"WINDOW_HEADER",
70-
wndproc_menu,
71-
NULL,
72-
NULL,
73-
rect_header.rect,
74-
NULL
75-
);
76-
7766
// エディタパネル
7867
g_window_editor.create(
7968
hwnd,
@@ -85,6 +74,17 @@ LRESULT CALLBACK wndproc_main(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
8574
NULL
8675
);
8776

77+
// ヘッダパネル
78+
g_window_menu.create(
79+
hwnd,
80+
"WINDOW_HEADER",
81+
wndproc_menu,
82+
NULL,
83+
NULL,
84+
rect_header.rect,
85+
NULL
86+
);
87+
8888
// プリセットパネル
8989
g_window_library.create(
9090
hwnd,

0 commit comments

Comments
 (0)