頂点情報に.normと.difと.spc とありますがマテリアル情報の設定にも同じような項目がると思いますがこれは何が違うのでしょうか?エミッシブはありませんが。
また、頂点一つ一つにありますがこれはどれも同じ値じゃないといけないのでしょうか?
※マテリアルは質感というのは調べました。
参考サイト: https://yttm-work.jp/gmpg/gmpg_0022.html#head_line_03
#include "DxLib.h" #include "Game.hpp" #include "Input.hpp" #include "Frame.hpp" #include "Vector.hpp" const char* filename = "Log.txt"; std::ofstream ofs(filename); Game::Game() { cameraPos.x = 0.0f; cameraPos.y = 20.0f; cameraPos.z = -40.0f; targetV.x = 0; targetV.y = 5; targetV.z = 12.5; SetUseLighting(false); // handle = LoadGraph("resource/texturePos.png", false); handle = LoadGraph("assets/resource/texturePos.png", false); SetUseZBuffer3D(true); SetWriteZBuffer3D(true); /*手前*/ Vertex[0].pos = VGet(-RANGE, RANGE, 10); Vertex[0].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[0].dif = color_dif; Vertex[0].spc = color_spc; Vertex[0].u = 0.0f; Vertex[0].v = 0.0f; Vertex[0].su = 0.0f; Vertex[0].sv = 0.0f; Vertex[1].pos = VGet(RANGE, RANGE, 10); Vertex[1].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[1].dif = color_dif; Vertex[1].spc = color_spc; Vertex[1].u = 1.0f; Vertex[1].v = 0.0f; Vertex[1].su = 0.0f; Vertex[1].sv = 0.0f; Vertex[2].pos = VGet(-RANGE, -RANGE, 10); Vertex[2].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[2].dif = color_dif; Vertex[2].spc = color_spc; Vertex[2].u = 0.0f; Vertex[2].v = 1.0f; Vertex[2].su = 0.0f; Vertex[2].sv = 0.0f; Vertex[3].pos = VGet(RANGE, -RANGE, 10); Vertex[3].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[3].dif = color_dif; Vertex[3].spc = color_spc; Vertex[3].u = 1.0f; Vertex[3].v = 1.0f; Vertex[3].su = 0.0f; Vertex[3].sv = 0.0f; /*奥*/ Vertex[4].pos = VGet(-RANGE, RANGE, 10 + RANGE); Vertex[4].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[4].dif = color_dif; Vertex[4].spc = color_spc; Vertex[4].u = 0.0f; Vertex[4].v = 0.0f; Vertex[4].su = 0.0f; Vertex[4].sv = 0.0f; Vertex[5].pos = VGet(RANGE, RANGE, 10 + RANGE); Vertex[5].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[5].dif = color_dif; Vertex[5].spc = color_spc; Vertex[5].u = 1.0f; Vertex[5].v = 0.0f; Vertex[5].su = 0.0f; Vertex[5].sv = 0.0f; Vertex[6].pos = VGet(-RANGE, -RANGE, 10 + RANGE); Vertex[6].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[6].dif = color_dif; Vertex[6].spc = color_spc; Vertex[6].u = 0.0f; Vertex[6].v = 1.0f; Vertex[6].su = 0.0f; Vertex[6].sv = 0.0f; Vertex[7].pos = VGet(RANGE, -RANGE, 10 + RANGE); Vertex[7].norm = VGet(0.0f, 0.0f, -1.0f); Vertex[7].dif = color_dif; Vertex[7].spc = color_spc; Vertex[7].u = 1.0f; Vertex[7].v = 1.0f; Vertex[7].su = 0.0f; Vertex[7].sv = 0.0f; #define GROUND_Z 200 #define GROUND_X 200 ofs<<"AA"<<std::endl; /*地面 ポリゴン*/ Ground_Vertex[0].pos = VGet( -RANGE * GROUND_X, -RANGE * 2, RANGE * GROUND_Z); Ground_Vertex[0].norm = VGet(0.0f, 0.0f, -1.0f); Ground_Vertex[0].dif = color_dif; Ground_Vertex[0].spc = color_spc; Ground_Vertex[0].u = 0.0f; Ground_Vertex[0].v = 0.0f; Ground_Vertex[1].pos = VGet(RANGE * GROUND_X, -RANGE * 2, RANGE * GROUND_Z); Ground_Vertex[1].norm = VGet(0.0f, 0.0f, -1.0f); Ground_Vertex[1].dif = color_dif; Ground_Vertex[1].spc = color_spc; Ground_Vertex[1].u = 1.0f; Ground_Vertex[1].v = 0.0f; Ground_Vertex[2].pos = VGet(-RANGE * GROUND_X, -RANGE * 2, GROUND_Z * -RANGE); Ground_Vertex[2].norm = VGet(0.0f, 0.0f, -1.0f); Ground_Vertex[2].dif = color_dif; Ground_Vertex[2].spc = color_spc; Ground_Vertex[2].u = 0.0f; Ground_Vertex[2].v = 1.0f; Ground_Vertex[3].pos = VGet(RANGE * GROUND_X, -RANGE * 2, GROUND_Z * -RANGE); Ground_Vertex[3].norm = VGet(0.0f, 0.0f, -1.0f); Ground_Vertex[3].dif = color_dif; Ground_Vertex[3].spc = color_spc; Ground_Vertex[3].u = 1.0f; Ground_Vertex[3].v = 1.0f; /*地面インデックス*/ Ground_Index[0] = 0; Ground_Index[1] = 1; Ground_Index[2] = 2; Ground_Index[3] = 1; Ground_Index[4] = 2; Ground_Index[5] = 3; /*手前*/ Index[0][0] = 0; Index[0][1] = 1; Index[0][2] = 2; Index[0][3] = 1; Index[0][4] = 2; Index[0][5] = 3; /*奥*/ Index[1][0] = 4; Index[1][1] = 5; Index[1][2] = 6; Index[1][3] = 6; Index[1][4] = 5; Index[1][5] = 7; /*左*/ Index[2][0] = 0; Index[2][1] = 4; Index[2][2] = 2; Index[2][3] = 4; Index[2][4] = 2; Index[2][5] = 6; /*右*/ Index[3][0] = 1; Index[3][1] = 5; Index[3][2] = 7; Index[3][3] = 1; Index[3][4] = 3; Index[3][5] = 7; /*上*/ Index[4][0] = 0; Index[4][1] = 4; Index[4][2] = 5; Index[4][3] = 0; Index[4][4] = 1; Index[4][5] = 5; /*下*/ Index[5][0] = 6; Index[5][1] = 7; Index[5][2] = 2; Index[5][3] = 3; Index[5][4] = 7; Index[5][5] = 2; }
void Game::DrawUpdate() { SetCameraPositionAndTarget_UpVecY(VGet(cameraPos.x, cameraPos.y, cameraPos.z), VGet(targetV.x, targetV.y, targetV.z)); for(int i = 0; i< 8; i++) { Vertex[i].dif = color_dif; Vertex[i].spc = color_spc; } for(int i =0 ;i < 6; i++){ switch( i ) { case 0: { Vertex[ 0 ].u = 0.0f; Vertex[ 0 ].v = 0.0f; Vertex[ 1 ].u = 1.0f; Vertex[ 1 ].v = 0.0f; Vertex[ 2 ].u = 0.0f; Vertex[ 2 ].v = 1.0f; Vertex[ 3 ].u = 1.0f; Vertex[ 3 ].v = 1.0f; Vertex[ 4 ].u = 1.0f; Vertex[ 4 ].v = 1.0f; Vertex[ 5 ].u = 0.0f; Vertex[ 5 ].v = 0.0f; Vertex[ 6 ].u = 0.0f; Vertex[ 6 ].v = 0.0f; Vertex[ 7 ].u = 0.0f; Vertex[ 7 ].v = 0.0f; } break; case 1: { Vertex[0].u = 0.0f; Vertex[0].v = 0.0f; Vertex[1].u = 1.0f; Vertex[1].v = 0.0f; Vertex[2].u = 0.0f; Vertex[2].v = 1.0f; Vertex[3].u = 0.0f; Vertex[3].v = 0.0f; Vertex[4].u = 0.0f; Vertex[4].v = 0.0f; Vertex[5].u = 1.0f; Vertex[5].v = 0.0f; Vertex[6].u = 0.0f; Vertex[6].v = 1.0f; Vertex[7].u = 1.0f; Vertex[7].v = 1.0f; } break; case 2: { Vertex[0].u = 1.0f; Vertex[0].v = 0.0f; Vertex[1].u = 1.0f; Vertex[1].v = 0.0f; Vertex[2].u = 1.0f; Vertex[2].v = 1.0f; Vertex[3].u = 0.0f; Vertex[3].v = 0.0f; Vertex[4].u = 0.0f; Vertex[4].v = 0.0f; Vertex[5].u = 0.0f; Vertex[5].v = 1.0f; Vertex[6].u = 0.0f; Vertex[6].v = 1.0f; Vertex[7].u = 1.0f; Vertex[7].v = 1.0f; } break; /*右*/ case 3: { Vertex[0].u = 1.0f; Vertex[0].v = 0.0f; Vertex[1].u = 0.0f; Vertex[1].v = 0.0f; Vertex[2].u = 1.0f; Vertex[2].v = 1.0f; Vertex[3].u = 0.0f; Vertex[3].v = 1.0f; Vertex[4].u = 0.0f; Vertex[4].v = 0.0f; Vertex[5].u = 1.0f; Vertex[5].v = 0.0f; Vertex[6].u = 0.0f; Vertex[6].v = 1.0f; Vertex[7].u = 1.0f; Vertex[7].v = 1.0f; } break; /*上*/ case 4: { Vertex[0].u = 0.0f; Vertex[0].v = 0.0f; Vertex[1].u = 0.0f; Vertex[1].v = 1.0f; Vertex[4].u = 1.0f; Vertex[4].v = 0.0f; Vertex[5].u = 1.0f; Vertex[5].v = 1.0f; } break; /*下*/ case 5: { Vertex[2].u = 0.0f; Vertex[2].v = 1.0f; Vertex[3].u = 1.0f; Vertex[3].v = 1.0f; Vertex[6].u = 0.0f; Vertex[6].v = 0.0f; Vertex[7].u = 1.0f; Vertex[7].v = 0.0f; } break; } } DrawPolygonIndexed3D(Ground_Vertex,4,Ground_Index,6,handle,false); // cameraY += -1; DrawFormatString(0, 0, GetColor(255, 255, 255), "カメラ 座標 x: %.2f , y: %.2f , z:%.2f ", cameraPos.x, cameraPos.y, cameraPos.z); DrawFormatString(0, 32, GetColor(255, 255, 255), "注視点 座標 x: %.2f , y: %.2f , z:%.2f ", targetV.x, targetV.y, targetV.z); }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2020/04/20 13:07
2020/04/20 23:27
退会済みユーザー
2020/04/21 00:07
2020/04/21 00:38
退会済みユーザー
2020/04/21 11:57
2020/04/21 13:08