質問編集履歴
1
提示画像を追加しました。提示コードを編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,24 +2,24 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
やったこと
|
6
|
+
|
7
|
+
背景を追加して隙間なのかどうかを判定 違いました。
|
8
|
+
|
9
|
+
ボタンでテクスチャを付け消ししました 違いました。
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
|
6
14
|
|
7
15
|
|
8
16
|
|
9
17
|
![イメージ説明](4910cec04704af628f8b2af8a05967d4.png)
|
10
18
|
|
19
|
+
![イメージ説明](bba0044abdd4cea547685e529c3c53f4.png)
|
20
|
+
|
11
21
|
```ここに言語を入力
|
12
22
|
|
13
|
-
#include "DxLib.h"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#include "Game.hpp"
|
18
|
-
|
19
|
-
#include "Input.hpp"
|
20
|
-
|
21
|
-
#include "Frame.hpp"
|
22
|
-
|
23
23
|
|
24
24
|
|
25
25
|
|
@@ -30,8 +30,12 @@
|
|
30
30
|
|
31
31
|
{
|
32
32
|
|
33
|
+
|
34
|
+
|
33
35
|
SetUseLighting(true);
|
34
36
|
|
37
|
+
|
38
|
+
|
35
39
|
SetUseZBuffer3D(true);
|
36
40
|
|
37
41
|
SetWriteZBuffer3D(true);
|
@@ -44,9 +48,9 @@
|
|
44
48
|
|
45
49
|
Vertex[0].norm = VGet(0.0f, 0.0f, -1.0f);
|
46
50
|
|
47
|
-
Vertex[0].dif =
|
51
|
+
Vertex[0].dif = color_dif;
|
48
|
-
|
52
|
+
|
49
|
-
Vertex[0].spc =
|
53
|
+
Vertex[0].spc = color_spc;
|
50
54
|
|
51
55
|
Vertex[0].u = 0.0f;
|
52
56
|
|
@@ -62,9 +66,9 @@
|
|
62
66
|
|
63
67
|
Vertex[1].norm = VGet(0.0f, 0.0f, -1.0f);
|
64
68
|
|
65
|
-
Vertex[1].dif =
|
69
|
+
Vertex[1].dif = color_dif;
|
66
|
-
|
70
|
+
|
67
|
-
Vertex[1].spc =
|
71
|
+
Vertex[1].spc = color_spc;
|
68
72
|
|
69
73
|
Vertex[1].u = 1.0f;
|
70
74
|
|
@@ -80,9 +84,9 @@
|
|
80
84
|
|
81
85
|
Vertex[2].norm = VGet(0.0f, 0.0f, -1.0f);
|
82
86
|
|
83
|
-
Vertex[2].dif =
|
87
|
+
Vertex[2].dif = color_dif;
|
84
|
-
|
88
|
+
|
85
|
-
Vertex[2].spc =
|
89
|
+
Vertex[2].spc = color_spc;
|
86
90
|
|
87
91
|
Vertex[2].u = 0.0f;
|
88
92
|
|
@@ -98,9 +102,9 @@
|
|
98
102
|
|
99
103
|
Vertex[3].norm = VGet(0.0f, 0.0f, -1.0f);
|
100
104
|
|
101
|
-
Vertex[3].dif =
|
105
|
+
Vertex[3].dif = color_dif;
|
102
|
-
|
106
|
+
|
103
|
-
Vertex[3].spc =
|
107
|
+
Vertex[3].spc = color_spc;
|
104
108
|
|
105
109
|
Vertex[3].u = 1.0f;
|
106
110
|
|
@@ -118,9 +122,9 @@
|
|
118
122
|
|
119
123
|
Vertex[4].norm = VGet(0.0f, 0.0f, -1.0f);
|
120
124
|
|
121
|
-
Vertex[4].dif =
|
125
|
+
Vertex[4].dif = color_dif;
|
122
|
-
|
126
|
+
|
123
|
-
Vertex[4].spc =
|
127
|
+
Vertex[4].spc = color_spc;
|
124
128
|
|
125
129
|
Vertex[4].u = 0.0f;
|
126
130
|
|
@@ -136,9 +140,9 @@
|
|
136
140
|
|
137
141
|
Vertex[5].norm = VGet(0.0f, 0.0f, -1.0f);
|
138
142
|
|
139
|
-
Vertex[5].dif =
|
143
|
+
Vertex[5].dif = color_dif;
|
140
|
-
|
144
|
+
|
141
|
-
Vertex[5].spc =
|
145
|
+
Vertex[5].spc = color_spc;
|
142
146
|
|
143
147
|
Vertex[5].u = 1.0f;
|
144
148
|
|
@@ -154,9 +158,9 @@
|
|
154
158
|
|
155
159
|
Vertex[6].norm = VGet(0.0f, 0.0f, -1.0f);
|
156
160
|
|
157
|
-
Vertex[6].dif =
|
161
|
+
Vertex[6].dif = color_dif;
|
158
|
-
|
162
|
+
|
159
|
-
Vertex[6].spc =
|
163
|
+
Vertex[6].spc = color_spc;
|
160
164
|
|
161
165
|
Vertex[6].u = 0.0f;
|
162
166
|
|
@@ -172,9 +176,9 @@
|
|
172
176
|
|
173
177
|
Vertex[7].norm = VGet(0.0f, 0.0f, -1.0f);
|
174
178
|
|
175
|
-
Vertex[7].dif =
|
179
|
+
Vertex[7].dif = color_dif;
|
176
|
-
|
180
|
+
|
177
|
-
Vertex[7].spc =
|
181
|
+
Vertex[7].spc = color_spc;
|
178
182
|
|
179
183
|
Vertex[7].u = 1.0f;
|
180
184
|
|
@@ -184,6 +188,16 @@
|
|
184
188
|
|
185
189
|
Vertex[7].sv = 0.0f;
|
186
190
|
|
191
|
+
#define GROUND_Z 200
|
192
|
+
|
193
|
+
#define GROUND_X 200
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
/*地面 ポリゴン 地面インデックスを割愛*/
|
198
|
+
|
199
|
+
|
200
|
+
|
187
201
|
|
188
202
|
|
189
203
|
|
@@ -246,390 +260,728 @@
|
|
246
260
|
|
247
261
|
|
248
262
|
|
263
|
+
/*右*/
|
264
|
+
|
265
|
+
Index[3][0] = 1;
|
266
|
+
|
267
|
+
Index[3][1] = 5;
|
268
|
+
|
269
|
+
Index[3][2] = 7;
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
Index[3][3] = 1;
|
274
|
+
|
275
|
+
Index[3][4] = 3;
|
276
|
+
|
277
|
+
Index[3][5] = 7;
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
/*上*/
|
288
|
+
|
289
|
+
Index[4][0] = 0;
|
290
|
+
|
291
|
+
Index[4][1] = 4;
|
292
|
+
|
293
|
+
Index[4][2] = 5;
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
Index[4][3] = 0;
|
298
|
+
|
299
|
+
Index[4][4] = 1;
|
300
|
+
|
301
|
+
Index[4][5] = 5;
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
/*下*/
|
308
|
+
|
309
|
+
Index[5][0] = 6;
|
310
|
+
|
311
|
+
Index[5][1] = 7;
|
312
|
+
|
313
|
+
Index[5][2] = 2;
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
Index[5][3] = 3;
|
318
|
+
|
319
|
+
Index[5][4] = 7;
|
320
|
+
|
321
|
+
Index[5][5] = 2;
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
/* (x,y)の点を(mx,my)を中心にang角回転する */
|
334
|
+
|
335
|
+
void rotate(float* x, float* y, const float ang, const float mx, const float my)
|
336
|
+
|
337
|
+
{
|
338
|
+
|
249
339
|
|
250
340
|
|
251
|
-
|
341
|
+
const float ox = *x - mx, oy = *y - my;
|
342
|
+
|
252
|
-
|
343
|
+
*x = (ox * cos(ang)) + (oy * sin(ang));
|
344
|
+
|
253
|
-
|
345
|
+
*y = (-ox * sin(ang)) + (oy * cos(ang));
|
346
|
+
|
347
|
+
|
348
|
+
|
254
|
-
|
349
|
+
*x += mx;
|
350
|
+
|
255
|
-
|
351
|
+
*y += my;
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
262
356
|
|
263
357
|
}
|
264
358
|
|
265
359
|
|
266
360
|
|
267
|
-
|
268
|
-
|
269
|
-
/*
|
361
|
+
/*X軸回転*/
|
270
|
-
|
362
|
+
|
271
|
-
void rotate(float*
|
363
|
+
void rotate_X(float *y,float *z,const float ang,const float my,const float mz)
|
272
364
|
|
273
365
|
{
|
274
366
|
|
367
|
+
const float oy = *y - my;
|
368
|
+
|
369
|
+
const float oz = *z - mz;
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
*y = (oy * cos(ang)) + (oz * sin(ang));
|
374
|
+
|
375
|
+
*z = (-oy * sin(ang)) + (oz * cos(ang));
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
*y += my;
|
380
|
+
|
381
|
+
*z += mz;
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
void Game::Update()
|
392
|
+
|
393
|
+
{
|
394
|
+
|
395
|
+
/*カメラ回転*/
|
396
|
+
|
397
|
+
if (Input::keyboard(KEY_INPUT_LEFT) > 0)
|
398
|
+
|
399
|
+
{
|
400
|
+
|
401
|
+
rotate(&cameraX, &cameraZ, +ROTATE_SPEED, targetX, targetZ);
|
402
|
+
|
403
|
+
}
|
404
|
+
|
405
|
+
else if (Input::keyboard(KEY_INPUT_RIGHT) > 0)
|
406
|
+
|
407
|
+
{
|
408
|
+
|
409
|
+
rotate(&cameraX, &cameraZ, -ROTATE_SPEED, targetX, targetZ);
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
else if (Input::keyboard(KEY_INPUT_UP) > 0)
|
414
|
+
|
415
|
+
{
|
416
|
+
|
417
|
+
rotate_X(&cameraY, &cameraZ, -ROTATE_SPEED, targetY, targetZ);
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
else if (Input::keyboard(KEY_INPUT_DOWN) > 0)
|
422
|
+
|
423
|
+
{
|
424
|
+
|
425
|
+
rotate_X(&cameraY, &cameraZ, +ROTATE_SPEED, targetY, targetZ);
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
if (Input::keyboard(KEY_INPUT_W) > 0)
|
430
|
+
|
431
|
+
{
|
432
|
+
|
433
|
+
cameraZ += -4;
|
434
|
+
|
435
|
+
}
|
436
|
+
|
437
|
+
else if (Input::keyboard(KEY_INPUT_S) > 0)
|
438
|
+
|
439
|
+
{
|
440
|
+
|
441
|
+
y -= 2;
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
/*色 変更*/
|
450
|
+
|
451
|
+
if(Input::keyboard(KEY_INPUT_SPACE) == 1)
|
452
|
+
|
453
|
+
{
|
454
|
+
|
455
|
+
ModeChange = !ModeChange;
|
456
|
+
|
457
|
+
}
|
458
|
+
|
459
|
+
/* false spcカラーを変更*/
|
460
|
+
|
461
|
+
if (Input::keyboard(KEY_INPUT_Z) > 0 && ModeChange == false)
|
462
|
+
|
463
|
+
{
|
464
|
+
|
465
|
+
color_spc.r += -1;
|
466
|
+
|
467
|
+
color_spc.g += -1;
|
468
|
+
|
469
|
+
color_spc.b += -1;
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
else if (Input::keyboard(KEY_INPUT_X) > 0 && ModeChange == false)
|
476
|
+
|
477
|
+
{
|
478
|
+
|
479
|
+
color_spc.r += 1;
|
480
|
+
|
481
|
+
color_spc.g += 1;
|
482
|
+
|
483
|
+
color_spc.b += 1;
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
/*true difカラー変更*/
|
488
|
+
|
489
|
+
}else if (Input::keyboard(KEY_INPUT_Z) > 0 && ModeChange == true)
|
490
|
+
|
491
|
+
{
|
492
|
+
|
493
|
+
color_dif.r += -1;
|
494
|
+
|
495
|
+
color_dif.g += -1;
|
496
|
+
|
497
|
+
color_dif.b += -1;
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
}
|
502
|
+
|
503
|
+
else if (Input::keyboard(KEY_INPUT_X) > 0 && ModeChange == true)
|
504
|
+
|
505
|
+
{
|
506
|
+
|
507
|
+
color_dif.r += 1;
|
508
|
+
|
509
|
+
color_dif.g += 1;
|
510
|
+
|
511
|
+
color_dif.b += 1;
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
}
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
if (Input::keyboard(KEY_INPUT_F1) == 1)
|
520
|
+
|
521
|
+
{
|
522
|
+
|
523
|
+
TextureMode = !TextureMode;
|
524
|
+
|
525
|
+
}
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
const int num = 4;
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
}
|
544
|
+
|
545
|
+
VECTOR v;
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
//45,48
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
void Game::DrawUpdate()
|
558
|
+
|
559
|
+
{
|
560
|
+
|
561
|
+
SetCameraPositionAndTarget_UpVecY(VGet(cameraX, cameraY, cameraZ), VGet(targetX, targetY, targetZ));
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
for(int i = 0; i< 8; i++)
|
570
|
+
|
571
|
+
{
|
572
|
+
|
573
|
+
Vertex[i].dif = color_dif;
|
574
|
+
|
575
|
+
Vertex[i].spc = color_spc;
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
}
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
int handle = LoadGraph("assets/resource/texturePos.png",false);
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
for(int i =0 ;i < 6; i++){
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
switch( i )
|
596
|
+
|
597
|
+
{
|
598
|
+
|
599
|
+
case 0:
|
600
|
+
|
601
|
+
{
|
602
|
+
|
603
|
+
Vertex[ 0 ].u = 0.0f;
|
604
|
+
|
605
|
+
Vertex[ 0 ].v = 0.0f;
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
Vertex[ 1 ].u = 1.0f;
|
610
|
+
|
611
|
+
Vertex[ 1 ].v = 0.0f;
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
Vertex[ 2 ].u = 0.0f;
|
616
|
+
|
617
|
+
Vertex[ 2 ].v = 1.0f;
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
Vertex[ 3 ].u = 1.0f;
|
622
|
+
|
623
|
+
Vertex[ 3 ].v = 1.0f;
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
Vertex[ 4 ].u = 1.0f;
|
628
|
+
|
629
|
+
Vertex[ 4 ].v = 1.0f;
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
Vertex[ 5 ].u = 0.0f;
|
634
|
+
|
635
|
+
Vertex[ 5 ].v = 0.0f;
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
Vertex[ 6 ].u = 0.0f;
|
640
|
+
|
641
|
+
Vertex[ 6 ].v = 0.0f;
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
Vertex[ 7 ].u = 0.0f;
|
646
|
+
|
647
|
+
Vertex[ 7 ].v = 0.0f;
|
648
|
+
|
649
|
+
}
|
650
|
+
|
651
|
+
break;
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
case 1:
|
658
|
+
|
659
|
+
{
|
660
|
+
|
661
|
+
Vertex[0].u = 0.0f;
|
662
|
+
|
663
|
+
Vertex[0].v = 0.0f;
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
Vertex[1].u = 1.0f;
|
668
|
+
|
669
|
+
Vertex[1].v = 0.0f;
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
Vertex[2].u = 0.0f;
|
674
|
+
|
675
|
+
Vertex[2].v = 1.0f;
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
Vertex[3].u = 0.0f;
|
680
|
+
|
681
|
+
Vertex[3].v = 0.0f;
|
682
|
+
|
275
683
|
|
276
684
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
685
|
+
Vertex[4].u = 0.0f;
|
686
|
+
|
687
|
+
Vertex[4].v = 0.0f;
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
Vertex[5].u = 1.0f;
|
692
|
+
|
693
|
+
Vertex[5].v = 0.0f;
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
Vertex[6].u = 0.0f;
|
698
|
+
|
699
|
+
Vertex[6].v = 1.0f;
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
Vertex[7].u = 1.0f;
|
704
|
+
|
705
|
+
Vertex[7].v = 1.0f;
|
706
|
+
|
707
|
+
|
708
|
+
|
709
|
+
}
|
710
|
+
|
711
|
+
break;
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
case 2:
|
718
|
+
|
719
|
+
{
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
Vertex[0].u = 1.0f;
|
724
|
+
|
725
|
+
Vertex[0].v = 0.0f;
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
Vertex[1].u = 1.0f;
|
730
|
+
|
731
|
+
Vertex[1].v = 0.0f;
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
Vertex[2].u = 1.0f;
|
736
|
+
|
737
|
+
Vertex[2].v = 1.0f;
|
738
|
+
|
739
|
+
|
740
|
+
|
741
|
+
Vertex[3].u = 0.0f;
|
742
|
+
|
743
|
+
Vertex[3].v = 0.0f;
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
Vertex[4].u = 0.0f;
|
752
|
+
|
753
|
+
Vertex[4].v = 0.0f;
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
Vertex[5].u = 0.0f;
|
758
|
+
|
759
|
+
Vertex[5].v = 1.0f;
|
760
|
+
|
761
|
+
|
762
|
+
|
763
|
+
Vertex[6].u = 0.0f;
|
764
|
+
|
765
|
+
Vertex[6].v = 1.0f;
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
Vertex[7].u = 1.0f;
|
770
|
+
|
771
|
+
Vertex[7].v = 1.0f;
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
}
|
776
|
+
|
777
|
+
break;
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
/*右*/
|
782
|
+
|
783
|
+
case 3:
|
784
|
+
|
785
|
+
{
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
|
791
|
+
|
792
|
+
|
793
|
+
Vertex[1].u = 0.0f;
|
794
|
+
|
795
|
+
Vertex[1].v = 0.0f;
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
Vertex[3].u = 0.0f;
|
804
|
+
|
805
|
+
Vertex[3].v = 1.0f;
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
Vertex[4].u = 0.0f;
|
814
|
+
|
815
|
+
Vertex[4].v = 0.0f;
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
Vertex[5].u = 1.0f;
|
820
|
+
|
821
|
+
Vertex[5].v = 0.0f;
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
Vertex[6].u = 0.0f;
|
826
|
+
|
827
|
+
Vertex[6].v = 1.0f;
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
Vertex[7].u = 1.0f;
|
832
|
+
|
833
|
+
Vertex[7].v = 1.0f;
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
}
|
838
|
+
|
839
|
+
break;
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
|
844
|
+
|
845
|
+
/*上*/
|
846
|
+
|
847
|
+
case 4:
|
848
|
+
|
849
|
+
{
|
850
|
+
|
851
|
+
|
852
|
+
|
853
|
+
Vertex[0].u = 0.0f;
|
854
|
+
|
855
|
+
Vertex[0].v = 0.0f;
|
856
|
+
|
857
|
+
|
858
|
+
|
859
|
+
Vertex[1].u = 0.0f;
|
860
|
+
|
861
|
+
Vertex[1].v = 1.0f;
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
Vertex[4].u = 1.0f;
|
866
|
+
|
867
|
+
Vertex[4].v = 0.0f;
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
Vertex[5].u = 1.0f;
|
872
|
+
|
873
|
+
Vertex[5].v = 1.0f;
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
}
|
878
|
+
|
879
|
+
break;
|
880
|
+
|
881
|
+
|
882
|
+
|
883
|
+
|
884
|
+
|
885
|
+
/*下*/
|
886
|
+
|
887
|
+
case 5:
|
888
|
+
|
889
|
+
{
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
Vertex[2].u = 0.0f;
|
894
|
+
|
895
|
+
Vertex[2].v = 1.0f;
|
896
|
+
|
897
|
+
|
898
|
+
|
899
|
+
Vertex[3].u = 1.0f;
|
900
|
+
|
901
|
+
Vertex[3].v = 1.0f;
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
Vertex[6].u = 0.0f;
|
906
|
+
|
907
|
+
Vertex[6].v = 0.0f;
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
Vertex[7].u = 1.0f;
|
912
|
+
|
913
|
+
Vertex[7].v = 0.0f;
|
914
|
+
|
915
|
+
}
|
916
|
+
|
917
|
+
break;
|
918
|
+
|
919
|
+
}
|
920
|
+
|
921
|
+
if(TextureMode == true){
|
922
|
+
|
923
|
+
DrawPolygonIndexed3D(Vertex, 8, Index[i], 2, handle, false);
|
924
|
+
|
925
|
+
}else{
|
926
|
+
|
927
|
+
DrawPolygonIndexed3D(Vertex, 8, Index[i], 2, DX_NONE_GRAPH, false);
|
928
|
+
|
929
|
+
}
|
930
|
+
|
931
|
+
}
|
932
|
+
|
933
|
+
|
934
|
+
|
935
|
+
DrawPolygonIndexed3D(Ground_Vertex,4,Ground_Index,6,handle,false);
|
936
|
+
|
937
|
+
|
938
|
+
|
939
|
+
// cameraY += -1;
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
DrawFormatString(0, 0, GetColor(255, 255, 255), "カメラ座標 x: %.2f , y: %.2f , z:%.2f ", cameraX,cameraY,cameraZ);
|
946
|
+
|
947
|
+
// DrawFormatString(0, 40, Get color;(255, 255, 255), " test x: %.2f z: %.2f", xx, zz);
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
if(ModeChange == false){
|
952
|
+
|
953
|
+
DrawFormatString(0, 32 * 5, GetColor(255, 255, 255), "Mode: spc ");
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
DrawFormatString(0, 32 * 1, GetColor(255, 255, 255), "color_spc.r: %d", color_spc.r);
|
958
|
+
|
959
|
+
DrawFormatString(0, 32 * 2, GetColor(255, 255, 255), "color_spc.g: %d", color_spc.g);
|
960
|
+
|
961
|
+
DrawFormatString(0, 32 * 3, GetColor(255, 255, 255), "color_spc.b: %d", color_spc.b);
|
962
|
+
|
963
|
+
}else
|
964
|
+
|
965
|
+
{
|
966
|
+
|
967
|
+
DrawFormatString(0, 32 * 5, GetColor(255, 255, 255), "Mode: dif ");
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
DrawFormatString(0, 32 * 1, GetColor(255, 255, 255), "color_dif.r: %d", color_dif.r);
|
972
|
+
|
973
|
+
DrawFormatString(0, 32 * 2, GetColor(255, 255, 255), "color_dif.g: %d", color_dif.g);
|
974
|
+
|
975
|
+
DrawFormatString(0, 32 * 3, GetColor(255, 255, 255), "color_dif.b: %d", color_dif.b);
|
976
|
+
|
977
|
+
|
978
|
+
|
979
|
+
}
|
980
|
+
|
981
|
+
|
982
|
+
|
983
|
+
|
292
984
|
|
293
985
|
}
|
294
986
|
|
295
|
-
|
296
|
-
|
297
|
-
void Game::Update()
|
298
|
-
|
299
|
-
{
|
300
|
-
|
301
|
-
if (Input::keyboard(KEY_INPUT_LEFT) > 0)
|
302
|
-
|
303
|
-
{
|
304
|
-
|
305
|
-
rotate(&cameraX, &cameraZ, +ROTATE_SPEED, targetX, targetZ);
|
306
|
-
|
307
|
-
}
|
308
|
-
|
309
|
-
else if (Input::keyboard(KEY_INPUT_RIGHT) > 0)
|
310
|
-
|
311
|
-
{
|
312
|
-
|
313
|
-
rotate(&cameraX, &cameraZ, -ROTATE_SPEED, targetX, targetZ);
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
else if (Input::keyboard(KEY_INPUT_UP) > 0)
|
318
|
-
|
319
|
-
{
|
320
|
-
|
321
|
-
cameraY += ROTATE_SPEED;
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
else if (Input::keyboard(KEY_INPUT_DOWN) > 0)
|
326
|
-
|
327
|
-
{
|
328
|
-
|
329
|
-
cameraY += -ROTATE_SPEED;
|
330
|
-
|
331
|
-
}
|
332
|
-
|
333
|
-
if (Input::keyboard(KEY_INPUT_W) > 0)
|
334
|
-
|
335
|
-
{
|
336
|
-
|
337
|
-
cameraZ += -4;
|
338
|
-
|
339
|
-
}
|
340
|
-
|
341
|
-
else if (Input::keyboard(KEY_INPUT_S) > 0)
|
342
|
-
|
343
|
-
{
|
344
|
-
|
345
|
-
y -= 2;
|
346
|
-
|
347
|
-
}
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
const int num = 4;
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
}
|
360
|
-
|
361
|
-
VECTOR v;
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
//45,48
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
void Game::DrawUpdate()
|
374
|
-
|
375
|
-
{
|
376
|
-
|
377
|
-
SetCameraPositionAndTarget_UpVecY(VGet(cameraX, 0, cameraZ), VGet(targetX, 0, targetZ));
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
int handle = LoadGraph("assets/resource/texturePos.png",false);
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
for(int i =0 ;i < 6; i++){
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
switch( i )
|
400
|
-
|
401
|
-
{
|
402
|
-
|
403
|
-
case 0:
|
404
|
-
|
405
|
-
{
|
406
|
-
|
407
|
-
Vertex[ 0 ].u = 0.0f;
|
408
|
-
|
409
|
-
Vertex[ 0 ].v = 0.0f;
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
Vertex[ 1 ].u = 1.0f;
|
414
|
-
|
415
|
-
Vertex[ 1 ].v = 0.0f;
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
Vertex[ 2 ].u = 0.0f;
|
420
|
-
|
421
|
-
Vertex[ 2 ].v = 1.0f;
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
Vertex[ 3 ].u = 0.0f;
|
426
|
-
|
427
|
-
Vertex[ 3 ].v = 0.0f;
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
Vertex[ 4 ].u = 1.0f;
|
432
|
-
|
433
|
-
Vertex[ 4 ].v = 1.0f;
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
Vertex[ 5 ].u = 0.0f;
|
438
|
-
|
439
|
-
Vertex[ 5 ].v = 0.0f;
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
Vertex[ 6 ].u = 0.0f;
|
444
|
-
|
445
|
-
Vertex[ 6 ].v = 0.0f;
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
Vertex[ 7 ].u = 0.0f;
|
450
|
-
|
451
|
-
Vertex[ 7 ].v = 0.0f;
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
DrawPolygonIndexed3D(Vertex, 8, Index[i], 2, handle, false);
|
462
|
-
|
463
|
-
}
|
464
|
-
|
465
|
-
break;
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
case 1:
|
472
|
-
|
473
|
-
{
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
Vertex[0].u = 0.0f;
|
478
|
-
|
479
|
-
Vertex[0].v = 0.0f;
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
Vertex[1].u = 1.0f;
|
484
|
-
|
485
|
-
Vertex[1].v = 0.0f;
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
Vertex[2].u = 0.0f;
|
490
|
-
|
491
|
-
Vertex[2].v = 1.0f;
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
Vertex[3].u = 0.0f;
|
496
|
-
|
497
|
-
Vertex[3].v = 0.0f;
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
Vertex[4].u = 0.0f;
|
506
|
-
|
507
|
-
Vertex[4].v = 0.0f;
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
Vertex[5].u = 1.0f;
|
512
|
-
|
513
|
-
Vertex[5].v = 0.0f;
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
Vertex[6].u = 0.0f;
|
518
|
-
|
519
|
-
Vertex[6].v = 1.0f;
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
Vertex[7].u = 1.0f;
|
524
|
-
|
525
|
-
Vertex[7].v = 1.0f;
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
DrawPolygonIndexed3D(Vertex, 8, Index[i], 2, handle, false);
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
}
|
534
|
-
|
535
|
-
break;
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
case 2:
|
542
|
-
|
543
|
-
{
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
Vertex[0].u = 1.0f;
|
548
|
-
|
549
|
-
Vertex[0].v = 0.0f;
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
Vertex[1].u = 1.0f;
|
554
|
-
|
555
|
-
Vertex[1].v = 0.0f;
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
Vertex[2].u = 1.0f;
|
560
|
-
|
561
|
-
Vertex[2].v = 1.0f;
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
Vertex[3].u = 0.0f;
|
566
|
-
|
567
|
-
Vertex[3].v = 0.0f;
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
Vertex[4].u = 0.0f;
|
576
|
-
|
577
|
-
Vertex[4].v = 0.0f;
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
Vertex[5].u = 0.0f;
|
582
|
-
|
583
|
-
Vertex[5].v = 1.0f;
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
Vertex[6].u = 0.0f;
|
588
|
-
|
589
|
-
Vertex[6].v = 1.0f;
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
Vertex[7].u = 1.0f;
|
594
|
-
|
595
|
-
Vertex[7].v = 1.0f;
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
DrawPolygonIndexed3D(Vertex, 8, Index[i], 2, handle, false);
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
}
|
604
|
-
|
605
|
-
break;
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
}
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
}
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
DrawFormatString(0, 0, GetColor(255, 255, 255), "x: %.2f z: %.2f", cameraX, cameraZ);
|
630
|
-
|
631
|
-
// DrawFormatString(0, 40, GetColor(255, 255, 255), " test x: %.2f z: %.2f", xx, zz);
|
632
|
-
|
633
|
-
}
|
634
|
-
|
635
987
|
```
|