タイトル通りですがコンストラクタで法線を初期設定するときでライトを有効にしているとき最初はどう設定すればいいのでしょうか?.normです
適当に0,0,-1;と設定したら画面に表示されたのでとりえずこの値なのですが。
知っていることとしてまずそもそもライト計算に使うとありますが頂点法線は面法線を算出した後に頂点法線を算出するということも調べましたがDXライブラリが自動でやってるのでしょうか?(0,0,0)ではカメラに映りません
class Game{ pivate: VERTEX3D Vertex[8]; VERTEX3D Ground_Vertex[4]; pubilc: Game(); }
TextureMode = true; Color_Control = false; SetColor_flag = false; cameraPos.x = 0.0f; cameraPos.y = 20.0f; cameraPos.z = -40.0f; // = Game::SetColor; targetV.x = 0; targetV.y = 5; // targetV.z = 220.5; targetV.z = 12.5; modelHandle = MV1LoadModel("assets/resource/model.mv1"); SetUseLighting(true); // 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 /*地面 ポリゴン*/ 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; }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/04/23 03:49
退会済みユーザー
2020/04/23 04:16
2020/04/23 04:22 編集
2020/04/23 04:36
退会済みユーザー
2020/04/23 08:48
2020/04/23 09:30
退会済みユーザー
2020/05/01 06:05 編集