Skip to content

Instantly share code, notes, and snippets.

@baobao
Created November 15, 2018 03:30
Show Gist options
  • Save baobao/589629688448792f1da5c2c55c3e3248 to your computer and use it in GitHub Desktop.
Save baobao/589629688448792f1da5c2c55c3e3248 to your computer and use it in GitHub Desktop.
// ビュー変換行列
var vMatrix = Matrix.LookAtRH(
new Vector3(0, 0, 1.3f),
new Vector3(0, 0, 0),
new Vector3(0, 1f, 0)
);
// プロジェクション変換行列
var pMatrix = Matrix.PerspectiveFovRH(
(float)System.Math.PI / 2,
(float)ClientSize.Width / (float)ClientSize.Height,
// マイナス値ダメ!!
0f,
100f
);
// シェーダへVPMatrixを渡す
var vpMatrix = vMatrix * pMatrix;
effect.GetVariableByName("VPMatrix").AsMatrix().SetMatrix(vpMatrix);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment