어쨌든 XNA에서 무한한 시간을 반복하는 것이 궁금합니다. 이 샘플에서 예를 들어 http://create.msdn.com/en-US/education/catalog/sample/chasecamera?xna model repeat
0
A
답변
0
간단한 대답은 없습니다. 무한한 수의 폴리곤을 그리려고하면 메모리가 고갈되고 프로그램이 충돌하지만 하드웨어가 장면을 렌더링하는 데 무한한 시간이 걸릴 것입니다.
이 문제를 해결하기 위해 게임 개발자는 스카이 박스 및 도달 할 수없는 지형과 같은 트릭을 사용하여 플레이어가 세상을 무한하다고 생각하게 만듭니다. 따라서 반복적 인 바탕 질감을 가진 유한 한 세계를 원하면 그리드에서 여러 번 땅 텍스처를 그리고 땅의 바깥 가장자리를 덮는 skybox를 놓으십시오.
정말로 무한한 세계가 원한다면 하늘 상자와 땅이 움직이는 속임수를 쓸 수 있습니다. 따라서 땅과 하늘 상자의 속도를 움직이는 스프라이트의 속도로 설정하십시오.
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. ui : repeat 내에서 Input의 속성을 변경하십시오 : repeat
- 2. ui : DataTable의 selectBooleanCheckbox repeat
- 3. duration and repeat
- 4. css repeat-x rightide
- 5. jQuery animate() repeat 3x
- 6. jquery repeat animation
- 7. C# : XNA 대 XNA (성능)
- 8. h : inputText inside a4j : repeat
- 9. WPF Initial Repeat on RepeatButton
- 10. Xna : Mocking Texture2D
- 11. (XNA 3.1 "Effect.CompileFromFIle") 해당하는 (XNA 4.0) 있습니까?
- 12. 학습 XNA 3.1 대 XNA 4.0
- 13. XNA GameScreens
- 14. XNA ContentLoadException
- 15. XNA Quaternion.createFromAxisAngle
- 16. JSF1.2 : ui : repeat, a4j : repeat 및 t : 데이터 목록 태그의 차이점
- 17. CakePHP에서 model-> alias와 model-> name의 차이점은 무엇입니까?
- 18. WPF의 Model-View-ViewModel
- 19. PHP Orm from model
- 20. navigate ecore model
- 21. Jquery Model Popup
- 22. JavaScript의 Model-View-Controller
- 23. C++에서 .model 파일로드
- 24. jQuery의 Access Model 객체
- 25. Model 클래스에는 무엇이 있습니까?
- 26. Magento Overriding Model
- 27. Magento Rule Model override
- 28. Ruby on Rails : Model
- 29. 차이점 : form_for의 model과 @model?
- 30. Rails Model Association Confusion