Reading terrain from ADT files menu

User Tag List

Results 1 to 12 of 12
  1. #1
    vetanix's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading terrain from ADT files

    Long time reader, first time poster.

    I am trying to create a basic terrain mesh from the ADT files. There are 16x16 map tiles in each ADT, which I think I read correctly, but I can't figure out the relative height between the tiles. The first vertex of each tile is at height 0 and the rest are relative to this vertex, which means that there must be a variable that shows the "real" height of the entire tile.

    I tried to adjust the tiles according to the closest ones, but of course it doesn't quite work as you can see (the rows are way off):


    Reading terrain from ADT files
  2. #2
    Flowerew's Avatar Master Sergeant
    Reputation
    72
    Join Date
    Oct 2009
    Posts
    134
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ADT/v18 - WoW.Dev Wiki

    There's no need to adjust heights, if you use the position from the mcnk chunk.

    Reading heightmap: mcvtchunk_s.h - wowmapper - Project Hosting on Google Code
    Merging tiles: adt_c.cpp - wowmapper - Project Hosting on Google Code (Adt_c::BuildTerrain, starting from line: 40)

    edit:
    #define TU 100.0f / (3.0f * 16.0f) // Tile Units
    Last edited by Flowerew; 05-26-2010 at 06:02 AM.

  3. #3
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by vetanix View Post
    which means that there must be a variable that shows the "real" height of the entire tile.
    Yes, mcnk->position[2].

    ps: as said by Flowerew u_u
    Last edited by eLaps; 05-26-2010 at 06:20 AM. Reason: Flowerew just said it

  4. #4
    andy012345's Avatar Active Member
    Reputation
    59
    Join Date
    Oct 2007
    Posts
    124
    Thanks G/R
    0/7
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heres some code I used a while back for making triangles with the adt: void LoadADTData(int mapid, in - Anonymous - t6ypi0XJ - Pastebin.com

  5. #5
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    public static class Constants
    {
        public const float TileSize = 533.33333333333333333333333333333333333333333333f;
        public const float ChunkSize = TileSize / 16.0f;
    }
    .. in my mapchunk handler ..
    Code:
    OuterPositions = new Vector3[9,9];
    int heightCount = 0;
    
    // Outer heights
    const float seperator = Constants.ChunkSize / 8.0f;
    for (int y = 0; y < 9; y++)
    {
        for (int x = 0; x < 9; x++)
        {
            OuterPositions[x, y] = new Vector3(
                Information.Position.X - y * seperator,
                Information.Position.Y - x * seperator,
                Information.Position.Z + HeightChunk.Heights[heightCount++]);
        }
    
        heightCount += 8;
    }
    
    heightCount = 9;
    // Inner heights
    MiddlePositions = new Vector3[8,8];
    for (int y = 0; y < 8; y++)
    {
        for (int x = 0; x < 8; x++)
        {
            MiddlePositions[x, y] = new Vector3(
                Information.Position.X - seperator / 2 - y * seperator,
                Information.Position.Y - seperator / 2 - x * seperator,
                Information.Position.Z + HeightChunk.Heights[heightCount++]);
        }
    
        heightCount += 9;
    }
    Information is the read struct.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  6. #6
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    Code:
    public const float TileSize = 533.33333333333333333333333333333333333333333333f;
    Even if it still wouldn't be enough, maybe you should consider doubles twocents

  7. #7
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by eLaps View Post
    Even if it still wouldn't be enough, maybe you should consider doubles twocents
    It's not a problem using a float, I just ensure I use the max capacity of the float.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  8. #8
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you could be as precise as the compiler lets you and do

    Code:
    public const float TileSize = 533f + (1f/3f);

  9. #9
    Flowerew's Avatar Master Sergeant
    Reputation
    72
    Join Date
    Oct 2009
    Posts
    134
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    Or you could be as precise as the compiler lets you and do

    Code:
    public const float TileSize = 533f + (1f/3f);
    no! this is madness!

  10. #10
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Madness????
    THIS IS REALFRACTION!!!!!
    I hacked 127.0.0.1

  11. #11
    asbest0s's Avatar Active Member CoreCoins Purchaser
    Reputation
    34
    Join Date
    Jan 2008
    Posts
    372
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    Or you could be as precise as the compiler lets you and do

    Code:
    public const float TileSize = 533f + (1f/3f);
    or just 1600f/3f to make it look even cleaner

  12. #12
    danielrhodea's Avatar Master Sergeant
    Reputation
    11
    Join Date
    Apr 2010
    Posts
    107
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    How would I use the wow classes mentioned in this thread to dump adt to raw vertex model (.obj or similar) data with textures correctly mapped?

Similar Threads

  1. Read Bytes from File
    By Master674 in forum Programming
    Replies: 3
    Last Post: 02-06-2012, 04:52 PM
  2. [Client] [Error] - Immediate help wanted: Failed to read adt file - V 4.0.6.13623
    By Vorreth in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 01-21-2012, 07:33 PM
  3. StormDLL? Reading data from MPQ files?
    By Tanaris4 in forum WoW Memory Editing
    Replies: 4
    Last Post: 10-06-2009, 09:53 AM
  4. Reading multiple strings from another file?
    By Ryoushi. in forum Programming
    Replies: 0
    Last Post: 06-08-2009, 12:08 PM
  5. .adt file corrupt? (Read in topic, 3 rep for who can help me)
    By T@rget in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 06-03-2009, 12:48 PM
All times are GMT -5. The time now is 07:26 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search