そこで、XNAアプリケーションをセットアップしました。カメラは一人称モードであり、ユーザーはキーボードを使用して動き回ったり、マウスでカメラターゲットの位置を変更したりできます。3Dモデルをうまくロードできましたが、画面に問題なく表示されます。プリミティブ(テクスチャ化されているかどうかに関係なく)を描画しようとすると、カメラをどのように配置しても、画面のどこにも表示されません。
Initialize()には、次のものがあります。
quad = new Quad(Vector3.Zero, Vector3.UnitZ, Vector3.Up, 2, 2);
quadVertexDecl = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements);
LoadContent()には、次のものがあります。
quadTexture = Content.Load<Texture2D>(@"Textures\brickWall");
quadEffect = new BasicEffect(this.GraphicsDevice, null);
quadEffect.AmbientLightColor = new Vector3(0.8f, 0.8f, 0.8f);
quadEffect.LightingEnabled = true;
quadEffect.World = Matrix.Identity;
quadEffect.View = Matrix.CreateLookAt(cameraPosition, cameraTarget, Vector3.Up);
quadEffect.Projection = this.Projection;
quadEffect.TextureEnabled = true;
quadEffect.Texture = quadTexture;
そしてDraw()で私は持っています:
this.GraphicsDevice.VertexDeclaration = quadVertexDecl;
quadEffect.Begin();
foreach (EffectPass pass in quadEffect.CurrentTechnique.Passes)
{
pass.Begin();
GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(
PrimitiveType.TriangleList,
quad.Vertices, 0, 4,
quad.Indexes, 0, 2);
pass.End();
}
quadEffect.End();
quadEffectプロパティで何か問題が発生していると思いますが、何が原因かよくわかりません。