# DividedByZero

Member

1405

• #### Days Won

1

DividedByZero had the most liked content!

1256 Excellent

• Rank
Contributor

• Role
3D Artist
• Interests
Art
Audio
Design
Programming

## Recent Profile Visitors

19557 profile views

1. ## Manually calculating z co-ordinates

Good chat. :P
2. ## Manually calculating z co-ordinates

I think I am closer now, with doing the following np0x = ((wvp[12] / wvp[15]) * zero_x) + zero_x; np0y = ((wvp[13] / wvp[15]) * zero_y) + zero_y; It's close, but still looks a bit off.
3. ## 3D Manually calculating z co-ordinates

Hi Guys, I am playing around with making a basic software driven 3D framework for learning purposes only. I know it will not be very performant. Hard one to explain, so hit me up with any questions if it isn't clear. I am manually calculating each point of a triangle, which I am drawing to the screen with lines. In the code snippet below, zero_x and zero_y are the co-ordinates of the centre of the window. So the positions are between -1 and 1 like DirectX etc... The triangle points have already been transformed in to 3D space against a World, View, and Projection matrix. np0x & y are the points in screen co-ordinates. np0x = (wvp[12] * zero_x) + zero_x; np0y = (wvp[13] * zero_y) + zero_y; Looping through each of the points to render a triangle with lines is working great (aspect ratio, position, etc.), however depth isn't working. If I set the camera z distance to any number, the triangle always renders the same size on the screen. I suspect that my calculations require wvp[14] (the z transform coordinate) to be multiplied in there as well to scale the x and y up and down. I have tried all sorts of combinations with wvp[14] value but am unable to get the triangle to render correctly when I do so. Any advice on this would be awesome. Thanks in advance.
4. ## Vector question

Thanks again, guys. Will certainly need to look into all of this. And FWIW, I have previously never used 'goto' in my life - haha! Was just the easy way out at present to get something semi-workable.
5. ## Vector question

I have made some progress (sort of). I can input the name of the parent I want to list the hierarchy for and it does display the children through to the end, which is great. But, if there is more than one child at a given point it will just list the first one and then grab its first child and so on. void Graphics::SceneNodeTreeList(std::string name) { std::string szChild = ""; for (std::vector<SceneNode>::iterator it = sceneNodeVector.begin(); it != sceneNodeVector.end(); ++it) { if (it->name == name) { std::cout << it->name << "\r\n"; label: for (std::vector<std::string>::iterator it2 = it->childVector.begin(); it2 != it->childVector.end(); ++it2) { // loop through immediate children szChild = ""; for (unsigned n = 0; n < it2->size(); ++n) szChild += it2->at(n); std::cout << szChild << "\r\n"; // Does this have child and so on? for (std::vector<SceneNode>::iterator it3 = sceneNodeVector.begin(); it3 != sceneNodeVector.end(); ++it3) { if (it3->name == szChild) { it = it3; goto label; // Nasty, I know. } } // Never makes it here due to goto statement } } } } As I said, works fine if there is only ever once child at any given point, but skips past any subsequent child at that node. Probably more of a logic issue I have here, but if anyone can give any suggestions that would be awesome. Thanks again
6. ## Vector question

@masskonfuzion Yes you are right, I haven't formally studied computer science. I am completely self taught. My formal qualification is in electronics (but that was completed in the mid 90's. Time flies). Thank you for the link. I will take a look right away.
7. ## Vector question

Thanks. Just having a tough time working it out in practise.
8. ## C++ Vector question

Hi Guys, I am in the process of making a basic parenting system and all is going well so far. I have an initial vector of SceneNode's class SceneNode { public: std::string name; std::vector <std::string> childVector; }; And am able to populate a basic tree. So in my test case I have this. Parent Child1 GrandChild Child2 If I query the Parent (like below) for (std::vector<SceneNode>::iterator it = sceneNodeVector.begin(); it != sceneNodeVector.end(); ++it) { if (it->name == name) { std::cout << it->name << "\r\n"; // List immediate children for (std::vector<std::string>::iterator it2 = it->childVector.begin(); it2 != it->childVector.end(); ++it2) { std::cout << "\t"; for (unsigned n = 0; n < it2->size(); ++n) std::cout << it2->at(n); std::cout << "\r\n"; // How do I get the children of the children and so on? } } } It displays this (which is a good start) Parent Child1 Child2 But how would I go about coding this so it will display all children of the children, right down to the last level? Any help would be greatly appreciated. Thanks in advance :)
9. ## MMORPG framework for Unity

Maybe my understanding of what the first 'M' in MMO stands for differs from yours.
10. ## MMORPG framework for Unity

Who pays for the servers, network infrastructure, high speed WAN link, technical staff, and support staff?
11. ## Modeless dialogbox Win32 question

One weird thing I just noticed. Windows 10 seems to be very excited that I have created a pop up window. Every time I trigger the window creation from my parent window I get the 'Select to capture what you just did' Windows 10 notification. Close the pop up and re open the pop up and the message keeps coming back - LOL.
12. ## Modeless dialogbox Win32 question

Will do. I thought I'd post what seemed to be the obvious section to start with, as I don't have much experience when it comes to intermediate window handling. I have always dealt with a single simple window up until today. But now I am feeling adventurous - LOL. Thanks again.
13. ## Modeless dialogbox Win32 question

Strange, even if I manually override the resource file like in the example above, the parent window still not respond unless the dialog box is closed. STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION Just found it! I was doing this in the dialog box procedure DefWindowProc(hWnd, msg, wParam, lParam); I have changed it to... return FALSE; ...and all is happy. Thanks for your help guys!
14. ## Modeless dialogbox Win32 question

It might be something to do with how I am handling my message events. Once the dialog box is open, the main window no longer responds to any events. My main loop is pretty basic; while (bContinue) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); if (msg.message == WM_QUIT) bContinue = false; } } If I click on the main window, the title bar of the dialog box greys out like as if it has lost focus, but the events continue to function as per normal on the dialog box. When I close the dialog box the main window is happily on control again.
15. ## Modeless dialogbox Win32 question

Not much to the call - CreateDialog(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, ToolDlgProc);