モデルをXNAにロードしようとしています。このモデルはロードされていますが、テクスチャが正しくロードされていません。画像:
2 枚の壁は正しいですが、3 枚目は縞模様です。理由はわかりません。3dsMax では、すべての壁が適切に (編集モードで、レンダリング時に) これは Draw() での私の関数です。
Matrix[] transforms = new Matrix[capitol.Bones.Count];
capitol.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in capitol.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.Alpha = 1.0f;
effect.DiffuseColor = new Vector3(1.0f, 1.0f, 1.0f);
effect.SpecularColor = new Vector3(0.75f, 0.75f, 0.75f);
effect.SpecularPower = 5.0f;
effect.AmbientLightColor = new Vector3(0.5f, 0.5f, 0.5f);
effect.DirectionalLight0.Enabled = true;
effect.DirectionalLight0.DiffuseColor = Vector3.One;
effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1.0f, -1.0f, -1.0f));
effect.DirectionalLight0.SpecularColor = Vector3.One;
effect.DirectionalLight1.Enabled = true;
effect.DirectionalLight1.DiffuseColor = new Vector3(0.5f, 0.5f, 0.5f);
effect.DirectionalLight1.Direction = Vector3.Normalize(new Vector3(-1.0f, -1.0f, 1.0f));
effect.DirectionalLight1.SpecularColor = new Vector3(0.5f, 0.5f, 0.5f);
effect.LightingEnabled = true;
//effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index]
* Matrix.CreateRotationY(90f)
* Matrix.CreateTranslation(modelPosition);
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(20.0f), aspectRatio, 1.0f, 50.0f);
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
モデルをロード:
brick = Content.Load<Model>("models\\brick_model");