我真的不明白“相机”如何与 D3D9 一起工作
首先,我如何设置我的相机:
public Camera()
{
this.eye = new Vector3(0.0f, 0.0f, 0.0f);
this.lookAt = new Vector3(0.0f, 0.0f, 1.0f);
this.up = new Vector3(0.0f, 1.0f, 0.0f);
viewMatrix = Matrix.LookAtLH(eye, lookAt, up);
projectionMatrix = Matrix.OrthoLH(1 * zoomLevel, 1 * zoomLevel, 0.0f, 1.0f);
}
我的顶点:
vertices = new VertexTexture[]
{
new VertexTexture()
{
Position = new Vector4(0.0f, 0.0f, 0.0f, 1.0f),
TextureCoord = new Vector2(0.0f, 1.0f)
},
new VertexTexture()
{
Position = new Vector4(0.0f, model.Height, 0.0f, 1.0f),
TextureCoord = new Vector2(0.0f, 0.0f)
},
new VertexTexture()
{
Position = new Vector4(model.Width, model.Height, 0.0f, 1.0f),
TextureCoord = new Vector2(1.0f, 0.0f)
},
new VertexTexture()
{
Position = new Vector4(model.Width, 0.0f, 0.0f, 1.0f),
TextureCoord = new Vector2(1.0f, 1.0f)
}
};
有用。我可以移动相机,变焦等。
但是相机属性对我来说似乎很奇怪!我认为它会是这样的:
public Camera()
{
this.eye = new Vector3(0.0f, 0.0f, 1.0f);
this.lookAt = new Vector3(0.0f, 0.0f, 0.0f);
this.up = new Vector3(0.0f, 1.0f, 0.0f);
viewMatrix = Matrix.LookAtLH(eye, lookAt, up);
projectionMatrix = Matrix.OrthoLH(1 * zoomLevel, 1 * zoomLevel, 0.1f, 100.0f);
}
但是使用该参数它不起作用。如果我为我的计划更改 Z 坐标也是一样的(需要设置为 0 才能工作)。
现在,我尝试渲染其他对象。我为一个球体生成顶点(它在 D3D 10 上工作正常,在 (0;0;0) 周围生成一个半径为 1 的球体),但屏幕上什么也没有出现
我玩过眼睛和观察参数,但我可以弄清楚如何让它工作,那么,我做错了什么?