XNAで無限回のグランドモデルを繰り返すことはとにかくあります。たとえば、このサンプルではhttp://create.msdn.com/en-US/education/catalog/sample/chasecamera?xnaモデルのリピート
0
A
答えて
0
簡単な答えはノーです。無限の数のポリゴンを描画しようとすると、メモリが使い果たされ、プログラムがクラッシュするだけでなく、ハードウェアがシーンをレンダリングするのに無限の時間がかかります。
これを回避するために、ゲーム開発者は空のようなトリックや到達不能な地形を使用して、プレイヤーに世界が無限であると考えるようにします。だから、もしあなたが繰り返して地面のテクスチャを持つ有限の世界を望むならば、地面のテクスチャをグリッドにたくさん描き、地面の外縁を覆うスカイボックスを置くだけです。
あなたが本当に無限の世界を望むなら、あなたはスカイボックスと地面があなたと共に移動するトリックをすることができます。それで、地面と空の速度を移動しているスプライトの速度に設定してください。
0
このように!それは私のカスタムサンプルです。テクスチャの異なるマトリックスインデックスからモデルを繰り返すことができます
//Draw a ground land
private void draw_groundLand1(int[,,] MatriceWorldCube,Vector3 position_model_origin)
{
int hauteur = MatriceWorldCube.GetLength(0);
int largeur = MatriceWorldCube.GetLength(1);
int longueur = MatriceWorldCube.GetLength(2);
Vector3 pos_reference = position_model_origin;
for (int epaisseur = 0; epaisseur < hauteur; epaisseur++)
{
for (int collone = 0; collone < largeur; collone++)
{
for (int ligne = 0; ligne < longueur ; ligne++)
{
//Vérifie si l'index de la matrice comporte bien un matériaux a placer
if (MatriceWorldCube[epaisseur, collone, ligne] != 0)
{
// Copy any parent transforms.
Matrix[] transforms = new Matrix[model_ground_land1.Bones.Count];
model_ground_land1.CopyAbsoluteBoneTransformsTo(transforms);
// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in model_ground_land1.Meshes)
{
// This is where the mesh orientation is set, as well
// as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(cubeGroundLand1_modelRotation) * Matrix.CreateTranslation(position_model_origin);
effect.View = View;
effect.Projection = Projection;
//Applique la texture en fonction du type de matière définit dans l'indice de la matrice
switch (MatriceWorldCube[epaisseur, collone, ligne])
{
case 1:
effect.Texture = text_ground_land1;
break;
case 2:
effect.Texture = text_ground_land2;
break;
default:
break;
}
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
}
position_model_origin.X = (float)(ligne+1);
}
position_model_origin.X = pos_reference.X;
position_model_origin.Z = (float)(collone+1);
}
position_model_origin.Z = pos_reference.Z;
position_model_origin.Y = (float)(epaisseur+1);
}
position_model_origin.Y = pos_reference.Y;
position_model_origin = pos_reference;
}
関連する問題
- 1. XNAで3Dモデルを回転
- 2. コンテンツパイプラインのないXNAでのモデルのロード
- 3. AngularJs - ngのリピート
- 4. UISlider iOS thumbリピート
- 5. MediaElementリピート再生
- 6. UIStepper連続リピート
- 7. はNGリピート
- 8. NGリピート:選択
- 9. C#とXNA - lerpを使って3Dモデルを別の3Dモデルに従う方法
- 10. KinectのスケルトンデータをXNAの.fbxモデルと照合します
- 11. Pythonリピート文字列
- 12. カスタムUILocalNotificationリピート間隔
- 13. リピート関数X回
- 14. XNA - 3Dゲーム - すべてのモデルに光を当てよう
- 15. XNAの3Dモデルに3Dテキストを書き込む方法C#
- 16. ngのリピートは、ディレクティブが
- 17. NGリピート前と後のマークアップ
- 18. どのようにNGリピート
- 19. モデルがXNAで正しく表示されない
- 20. Motion BuilderでXNAを使用してFBXモデルを作成する
- 21. BasicEffectでXNAでモデルを描画する方法
- 22. Xna全体でモデルを移動するには?
- 23. XNAで3Dモデルを移動するには?
- 24. 静的インスタンス、コンストラクタ、GC、リンス、リピート
- 25. ドラッグ&ドロップ発注ngがリピート
- 26. MS SQL版MySQLリピート機能
- 27. リピート画像x回数
- 28. XNAを使用してXNA
- 29. C#:XNAとXNA(パフォーマンス)の比較
- 30. クラスへのリピート/ループ/リターンの方法