Rendering ADT with DirectX menu

User Tag List

Results 1 to 3 of 3
  1. #1
    ejt's Avatar Contributor
    Reputation
    209
    Join Date
    Mar 2008
    Posts
    166
    Thanks G/R
    3/111
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Rendering ADT with DirectX

    Hello.

    Been stuck with this issue afew days now and I come by here for some guidance.

    I'm trying to extract ADT data and render it with DX11, I've gotten all the data I need to render however I can't come up with a solutions to render it correctly. See picture below to see what I mean.

    Rendering ADT with DirectX-da5q99e-jpg

    How I try to create the vertex buffer:

    Code:
    for (uint32 c = 0; c < adt.m_MapChunks.size(); ++c)
    {
    	for (uint32 x = 0; x < 8; ++x)
    	{
    		for (uint32 y = 0; y < 8; ++y)
    		{
    			float ox = adt.m_MapChunks[c].mcnk.IndexX * 7.0f;
    			float oy = adt.m_MapChunks[c].mcnk.IndexY * 7.0f;
    			float oz = adt.m_MapChunks[c].mcnk.Position[2];
    
    			float L1 = adt.m_MapChunks[c].GetValNoLOD(x, y); // Top left
    			float L2 = adt.m_MapChunks[c].GetValNoLOD(x, y + 1); // Top right
    			float L3 = adt.m_MapChunks[c].GetValNoLOD(x + 1, y); // Bottom Left
    			float L4 = adt.m_MapChunks[c].GetValNoLOD(x + 1, y + 1); // Bottom right
    			float L = adt.m_MapChunks[c].GetValLOD(x, y); // Center
    
    			// Triangle 1 (top)
    			vertices.push_back(D3DXVECTOR3(ox + y, oy + x, oz + L1));
    			vertices.push_back(D3DXVECTOR3(ox + y + 1, oy + x, oz + L2));
    			vertices.push_back(D3DXVECTOR3(ox + y + 0.5f, oy + x + 0.5f, oz + L));
    
    			// Triangle 2 (left)
    			vertices.push_back(D3DXVECTOR3(ox + y, oy + x, oz + L1));
    			vertices.push_back(D3DXVECTOR3(ox + y, oy + x + 1, oz + L3));
    			vertices.push_back(D3DXVECTOR3(ox + y + 0.5f, oy + x + 0.5f, oz + L));
    
    			// Triangle 3 (bottom)
    			vertices.push_back(D3DXVECTOR3(ox + y, oy + x + 1, oz + L3));
    			vertices.push_back(D3DXVECTOR3(ox + y + 1, oy + x + 1, oz + L4));
    			vertices.push_back(D3DXVECTOR3(ox + y + 0.5f, oy + x + 0.5f, oz + L1));
    
    			// Triangle 4 (right)
    			vertices.push_back(D3DXVECTOR3(ox + y + 1, oy + x, oz + L2));
    			vertices.push_back(D3DXVECTOR3(ox + y + 1, oy + x + 1, oz + L4));
    			vertices.push_back(D3DXVECTOR3(ox + y + 0.5f, oy + x + 0.5f, oz + L1));
    		}
    	}
    }
    GetValNoLOD/GetValLOD

    Code:
    std::vector<float> Vertices;
    
    float GetValNoLOD(int32 x, int32 y)
    {
    	int32 add = y * 8;
    	int index = (y * 9 + x + add);
    	return Vertices[index];
    }
    
    float GetValLOD(int32 x, int32 y)
    {
    	int32 add = (y + 1) * 9;
    	return Vertices[(y * 8 + x + add)];
    }
    Extract vertices from ADT

    Code:
    for (uint32 i = 0; i < 145; ++i)
    	mc.Vertices.push_back(m_File.Read<float>(sc.second.GetOffset() + (sizeof(float) * i)));
    I've looked everywhere for a solution, WoWDev, forums and multiple open source projects but haven't gotten it to work.

    Thank you in advance.

    Rendering ADT with DirectX
  2. #2
    ejt's Avatar Contributor
    Reputation
    209
    Join Date
    Mar 2008
    Posts
    166
    Thanks G/R
    3/111
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Got it working by tweaking some stuff but the real problem was the GetValNoLod/GetValLod functions. New functions:

    Code:
    float GetValNoLOD(int32 x, int32 y)
    {
    	int index = ((x * 8) + (x * 9) + y);
    	return Vertices[index];
    }
    
    float GetValLOD(int32 x, int32 y)
    {
    	int32 index = ((x * 9) + 9 + (x * 8) + y);
    	return Vertices[index];
    }
    Rendering ADT with DirectX-tet6ovb-jpg

    Much better

  3. #3
    Wark_dev's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    1
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, are you still awake ?

    I'm trying to achieve more or less the same activities than you do. However my results are poor, the triangles do not fit to each others and the output is terrible. Could you give me more explanation on how you did it ?

    I parsed wowwiki several times already.. My objective is to convert ADT to OBJ format.

    Wark_dev

Similar Threads

  1. Problem with DirectX CreateDevice Hooking
    By rik.chong in forum WoW Memory Editing
    Replies: 4
    Last Post: 11-30-2012, 04:50 AM
  2. [Help Request] Someone with knowledge of ADT file specifically MCVT chunk
    By DJRehab in forum WoW ME Questions and Requests
    Replies: 13
    Last Post: 04-17-2010, 10:33 AM
  3. [RATE] My first Sig with a render ;O
    By freakolivier in forum Art & Graphic Design
    Replies: 6
    Last Post: 07-26-2008, 01:39 AM
  4. [Question] Renders with GIMP
    By Reshnaak in forum Art & Graphic Design
    Replies: 6
    Last Post: 03-22-2008, 01:01 PM
  5. Guide to WoW Signatures (with renders! :O)
    By Minimized in forum Art & Graphic Design
    Replies: 24
    Last Post: 09-30-2007, 11:02 AM
All times are GMT -5. The time now is 09:49 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search