[C#]3D-PerlinNoise , extreme FPS-Brüche...

  • C#

Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von NGE'o.

    [C#]3D-PerlinNoise , extreme FPS-Brüche...

    Guten Abend, habe begonnen mich in XNA einzuarbeiten, ist nun zu einem 3D-TileMap-Engine "mutiert".
    Es prüft, ob in einem 2D Bild, einen bestimmten RGB-Wert vorhanden ist => True, Objekt setzen:
    Ich habe eine 1:

    VB.NET-Quellcode

    1. public int mapWidth, mapHeight;
    2. public Texture2D mapTex;
    3. public Color[,] RGBOf;
    4. public List<Entity> EntityList_ = new List<Entity>();
    5. public Level(string levelName)
    6. {
    7. floor = new Floor(50,50);
    8. mapText = Basic.content.Load<Texture2D>("Levels" + levelName);
    9. mapWidth = mapTex.Width;
    10. mapHeight = mapTex.Height;
    11. RGBOf= textureToColor(mapTex);
    12. floor = new Floor(mapWidth, mapHeight);
    13. ceiling = new Ceiling(mapWidth, mapHeight);
    14. Install();
    15. }
    16. float x_ = 20;
    17. private void Install()
    18. {
    19. EntityList_.Add(new Object_1(x_,0,0));
    20. for (int x = 0; x < mapWidth; x++)
    21. {
    22. for (int y = 0; y < mapHeight; y++)
    23. {
    24. if (RGBOf[x, y] == Color.White)
    25. {
    26. EntityList_.Add(new Object1(x, 0, y));
    27. }
    28. }
    29. }
    30. Basic.CountOfEntities = EntityList_.Count.ToString();
    31. }


    RGBOf-Function

    VB.NET-Quellcode

    1. public Color[,] textureToColor(Texture2D tex)
    2. {
    3. Color[] color1d = new Color[tex.Width*tex.Height];
    4. tex.GetData(color1d);
    5. Color[,] data = new Color[tex.Width,tex.Height];
    6. for(int i = 0;i < tex.Width;i++)
    7. {
    8. for (int j = 0; j < tex.Height; j++)
    9. {
    10. data[i, j] = color1d[i + j * tex.Width];
    11. }
    12. }
    13. return data;
    14. }

    Ich hab mir ein 2D-PerlinNoise(BlackWhite)-Gebilde aus dem Internet gesucht,(ANHANG).

    Nunja, es laggt sehr arg, liegt es an der Methode des TileMapping, welche Art von -Dateityp empfehlt ihr mir für solche Konstruktionen?
    Bilder
    • XNA_.png

      739,79 kB, 883×521, 152 mal angesehen

    Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „NGE'o“ ()