World to screen menu

User Tag List

Results 1 to 8 of 8
  1. #1
    uncledolan's Avatar Member
    Reputation
    10
    Join Date
    Apr 2012
    Posts
    97
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    World to screen

    Hello all,

    I'm currently working on x64 and I'm internal, I'm having a hell of a time finding the function responsible for transforming 3D coordinates x,y,z into 2D coordinates x,y. I've been through all the threads I could find upside down and backwards a few times over. Apologies if this is easy mode, I'm relatively new. Could anyone point me in the right direction?

    World to screen
  2. #2
    WiNiFiX's Avatar Banned
    Reputation
    242
    Join Date
    Jun 2008
    Posts
    447
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This was literally posted last week in 1.12.1 dump thread

    PHP Code:
    using System;
    using SlimDX;

    #pragma warning disable 649
    #pragma warning disable 169

    namespace VanillaMagic
    {
        public static class 
    Camera
        
    {
            
    internal static IntPtr BaseAddress
            
    {
                
    get
                
    {
                    var 
    ptr WoW.hook.Memory.Read<IntPtr>(Offsets.Camera.CameraPtrtrue);
                    return 
    WoW.hook.Memory.Read<IntPtr>(ptr Offsets.Camera.CameraPtrOffset);
                }
            }

            private static 
    Offsets.CGCamera cam => WoW.hook.Memory.Read<Offsets.CGCamera>(BaseAddress);
            
            public static 
    float X => cam.Position.X;
            public static 
    float Y => cam.Position.Y;
            public static 
    float Z => cam.Position.Z;
            public static 
    float FOV => cam.FieldOfView;
            public static 
    float NearClip => cam.NearClip;
            public static 
    float FarClip => cam.FarClip;
            public static 
    float Aspect => cam.Aspect;

            private static 
    Matrix Matrix
            
    {
                
    get
                
    {
                    var 
    bCamera WoW.hook.Memory.ReadBytes(BaseAddress Offsets.Camera.CameraMatrix36);
                    var 
    = new Matrix();
                    
    m[00] = BitConverter.ToSingle(bCamera0);
                    
    m[01] = BitConverter.ToSingle(bCamera4);
                    
    m[02] = BitConverter.ToSingle(bCamera8);
                    
    m[10] = BitConverter.ToSingle(bCamera12);
                    
    m[11] = BitConverter.ToSingle(bCamera16);
                    
    m[12] = BitConverter.ToSingle(bCamera20);
                    
    m[20] = BitConverter.ToSingle(bCamera24);
                    
    m[21] = BitConverter.ToSingle(bCamera28);
                    
    m[22] = BitConverter.ToSingle(bCamera32);

                    return 
    m;
                }
            }

            public static 
    Vector2 WorldToScreen(float xfloat yfloat z)
            {
                var 
    Projection Matrix.PerspectiveFovRH(FOV 0.5fAspectNearClipFarClip);

                var 
    eye = new Vector3(XYZ);
                var 
    lookAt = new Vector3(Matrix[00], Matrix[01], Matrix[02]);
                var 
    up = new Vector3(0f0f1f);

                var 
    View Matrix.LookAtRH(eyelookAtup);
                var 
    World Matrix.Identity;

                var 
    WorldPosition = new Vector3(xyz);

                var 
    ScreenPosition Vector3.Project(WorldPosition0f0fWindowHelper.WindowWidthWindowHelper.WindowHeightNearClipFarClipWorld*View*Projection);
                return new 
    Vector2(ScreenPosition.XScreenPosition.Y-20f);
            }
        }


  3. #3
    uncledolan's Avatar Member
    Reputation
    10
    Join Date
    Apr 2012
    Posts
    97
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty intent on using Blizzard's function since I wasn't able to figure it out and want to learn, I was able to get something working using KcDan's example but I would like to understand the other way as well. Thanks though.

  4. #4
    tutrakan's Avatar Contributor
    Reputation
    134
    Join Date
    Feb 2013
    Posts
    175
    Thanks G/R
    124/52
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ..........
    Last edited by tutrakan; 12-02-2016 at 12:13 PM.

  5. #5
    lolp1's Avatar Site Donator CoreCoins Purchaser
    Reputation
    190
    Join Date
    Feb 2013
    Posts
    210
    Thanks G/R
    43/77
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From a notepad I saved, credits to jadd, you can find his post about it in his history if you want to look.

    Take a look at these, sorry I do not have their offsets currently.
    Code:
    CGWorldFrame::GetScreenCoordinates
    DDCToNDC
    Jadds example:

    Code:
    public static bool GetScreenPosition(Vector3 position, out Vector2 result) {
        var outputRef = new[] { Vector3.Zero };
        var onScreen = (bool) Memory.Thread.Invoke(CGWorldFrame__GetScreenCoordinates,
            CurrentWorldFrame, new[] { position }, outputRef, IntPtr.Zero, IntPtr.Zero);
    
        var output = outputRef[0];
    
        Rectangle clientRect;
        WinAPI.GetClientRect(Window.Handle, out clientRect);
    
        var height = clientRect.Bottom - clientRect.Top;
        var width = clientRect.Right - clientRect.Left;
    
        float x, y;
        DDCToNDC(output.X, output.Y, out x, out y);
    
        x = clientRect.Left + (x * width);
        y = height - (clientRect.Top + (y * height));
    
        result = new Vector2(x, y);
        return onScreen;
    }

  6. #6
    uncledolan's Avatar Member
    Reputation
    10
    Join Date
    Apr 2012
    Posts
    97
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lolp1, I came across these, these are the exact ones I am having trouble finding.

  7. #7
    lolp1's Avatar Site Donator CoreCoins Purchaser
    Reputation
    190
    Join Date
    Feb 2013
    Posts
    210
    Thanks G/R
    43/77
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think these were also from Jadd, but the notepad file I have them in was saved no november 11th and they are for x32. I suggest downloading the client from november 11th, opening it in IDA, and finding xrefs to these. Then follow that up in x64 live and you should be set.

    Code:
    0x0047202D CGWorldFrame::GetScreenCoordinates
    0x000FF362 DDCToNDC

  8. Thanks uncledolan (1 members gave Thanks to lolp1 for this useful post)
  9. #8
    danwins's Avatar Contributor
    Reputation
    189
    Join Date
    Mar 2013
    Posts
    143
    Thanks G/R
    6/62
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    7.1.0.22996 (not rebased)
    Code:
    0087202D                         CGWorldFrame__GetScreenCoordinates
    Not sure where DDCToNDC is, but i'm fairly sure the offsets it references should be these:

    Code:
    00FF33D4                         s_x
    00FF33D8                         s_y

  10. Thanks lolp1, uncledolan (2 members gave Thanks to danwins for this useful post)

Similar Threads

  1. [Tool] World to Screen
    By WiNiFiX in forum WoW Memory Editing
    Replies: 9
    Last Post: 09-27-2015, 02:08 AM
  2. World To Screen transformation
    By newbiehacker in forum WoW Memory Editing
    Replies: 2
    Last Post: 01-19-2013, 04:01 PM
  3. direct3d for world to screen
    By mnbvc in forum WoW Memory Editing
    Replies: 11
    Last Post: 12-29-2011, 01:54 AM
  4. world to screen
    By mnbvc in forum WoW Memory Editing
    Replies: 16
    Last Post: 01-29-2010, 08:08 AM
  5. [Version Independent] World to Screen
    By ramey in forum WoW Memory Editing
    Replies: 1
    Last Post: 09-13-2009, 04:17 PM
All times are GMT -5. The time now is 12:27 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