私の地形は次のような奇妙な色になります:
http://tinypic.com/view.php?pic=307w421&s=7
ここで何がうまくいかないのか誰かが知っていますか?コードのどの領域で(概念的に)これをデバッグする必要がありますか?
アップデート:
これは、私の学校のチュートリアルに基づいています:http: //www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Starting_a_project.php
BasicEffectシェーダーを使用し、カメラ、高さマップから派生した3D頂点テレイン、基本的なライティング、基本的なソフト法線、最適化のためのバッファーなど、エンジンのさまざまな部分を作成しました。
VertexPositionColorNormal構造体:
public struct VertexPositionColorNormal : IVertexType
{
#region Field
public Vector3 Position, Normal;
public Color Color;
#endregion
#region Constructor
public VertexPositionColorNormal(Vector3 position, Color color, Vector3 normal)
{
Position = position;
Color = color;
Normal = normal;
}
#endregion
#region properties
public static VertexElement[] VertexElements =
{
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(sizeof(float) * 3, VertexElementFormat.Color, VertexElementUsage.Color, 0),
new VertexElement(sizeof(float)*3+4,VertexElementFormat.Vector3, VertexElementUsage.Normal,0),
};
public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration(VertexElements);
VertexDeclaration IVertexType.VertexDeclaration
{
get { return VertexDeclaration; }
}
#endregion