Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

164 Neutral

About Joeydenhaag

  • Rank

Personal Information

  1.   I haven't found it yet, but I don't think it should be too hard to do it manually. For this quick fix I just checked the option "Split Per-Vertex Normals" for the model in 3dsMax when exporting.
  2. Again, thanks for pointing me in the right direction! I indeed had to split the vertices!  
  3.   Thanks for your reply!   Could you give an example on how to do this? I mean, I assume the FBX SDK has a function to do this automatically.
  4. Update: I was just playing with the code and adding the extra if in the loop to sort of check if the uv's were unitialized fixed the eyes.. but ruined the arms..   for (int j = 0; j < nbPolygons; j++) { for (int k = 0; k < 3; k++) { int vertexIndex = pFbxMesh->GetPolygonVertex(j, k); Vector2 uv; _readUV(pFbxMesh, vertexIndex, pFbxMesh->GetTextureUVIndex(j, k), uv); if (pVertices[vertexIndex].uv.x == 0.0f && pVertices[vertexIndex].uv.y == 0.0f) { pVertices[vertexIndex].uv.x = uv.x; pVertices[vertexIndex].uv.y = 1.0 - uv.y; } vertexCounter++; } }
  5. Hello everyone!   I am using the "2016.1.1" autodesk FBX Importer SDK, but whatever I do, I am unable to get the uvs right. Some parts are textured properly while others are not.   I am using Direct3D9 and Direct3D11 (same result in both).   Image:   360 image: https://i.gyazo.com/5a2e5f6e127521915508c9c300eb03e5.mp4     The model uses a single texture and a single material shared among 4 meshes.   Is there someone who sees immediately what the problem could be? Or is there someone who can replicate the issue for me and figure out what I am missing?   FBX Test File: http://www.4shared.com/rar/o_WG0Crpce/Peach64FBX.html   My UV reading method: int vertexCounter = 0; for (int j = 0; j < nbPolygons; j++) {      for (int k = 0; k < 3; k++) { int vertexIndex = pFbxMesh->GetPolygonVertex(j, k);          Vector2 uv;     _readUV(pFbxMesh, vertexIndex, pFbxMesh->GetTextureUVIndex(j, k), uv);          pVertices[vertexIndex].uv.x = uv.x;     pVertices[vertexIndex].uv.y = 1.0 - uv.y;         vertexCounter++;     } }     void _readUV(fbxsdk::FbxMesh* pFbxMesh, int vertexIndex, int uvIndex, Vector2& uv) {      fbxsdk::FbxLayerElementUV *pFbxLayerElementUV = pFbxMesh->GetLayer(0)->GetUVs();          if (pFbxLayerElementUV == nullptr) {     return;     }          switch (pFbxLayerElementUV->GetMappingMode()) {          case FbxLayerElementUV::eByControlPoint:     {     switch (pFbxLayerElementUV->GetReferenceMode()) {          case FbxLayerElementUV::eDirect:     {     fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(vertexIndex);          uv.x = fbxUv.mData[0];     uv.y = fbxUv.mData[1];          break;     }          case FbxLayerElementUV::eIndexToDirect:     {     int id = pFbxLayerElementUV->GetIndexArray().GetAt(vertexIndex);     fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(id);          uv.x = fbxUv.mData[0];     uv.y = fbxUv.mData[1];          break;     }     }          break;     }                       case FbxLayerElementUV::eByPolygonVertex:     {                           switch (pFbxLayerElementUV->GetReferenceMode()) {                                // Always enters this part for the example model     case FbxLayerElementUV::eDirect:     case FbxLayerElementUV::eIndexToDirect:     {          uv.x = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[0];     uv.y = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[1];          break;     }     }          break;     } } }     I am doing V = 1.0 - uv.y because I am using Direct3D11.   NOTE: the MappingMode is always eByPolygonVertex and ReferenceMode is always eIndexToDirect   Rendering Info: - Rendered as a Triangle List - Uv wrapping mode: Wrap (Repeat) - Culling: None     For more code or info please ask! I've been trying to fix this frustrating issue for a few days now..   ^_^
  6. Joeydenhaag

    Clean OOP programming question

    Thank you everyone for the very useful answers!   I agree with the Hungarian notation being a bad thing. I was using it very often until recently because I just had too many variable prefixes to deal with at some point. The project this question was about was a hobbyist game engine and I have rewritten the UI several times because I just didnt like the way how variables were so globally accessible in different classes. I will try to use the information provided by you guys to achieve the desired results.
  7. Hi,   I have a class like: class CApplication { private: CProjectWizardWindow* _pProjectWizardWindow; CMainWindow* _pMainWindow; public: CApplication(); ~CApplication(); bool initialize(); }; In the CProjectWizardWindow window class I receive user events for example if the user selects a project and presses 'ok'. In that case I want to send a message to _pMainWindow that this event has occured.   I know there is no 'best' way to do this because there are more options available and might be personal preferences but what is your opinion on the best way to achieve this?   I could use a pointer to _pMainWindow in _pProjectWizardWindow but that just doesn't feel right.. And a pointer to the CApplication instance in _pProjectWizardWindow doesnt feel right either.. 
  8. Hey,   I have an abstract class like:   Class BaseWindow { private: virtual unsigned int _eventHandler(unsigned long baseControlAddress, unsigned int evt, WPARAM wParam, LPARAM lParam) = 0; public: BaseWindow(); ~BaseWindow(); friend friendFunction(foo); } And class: class Window : public BaseWindow { private: unsigned int _eventHandler(unsigned long baseControlAddress, unsigned int evt, WPARAM wParam, LPARAM lParam); public: Window(); ~Window(); };   And this function: friendFunction(foo) { WindowBase* pWindowBase = (pWindowBase*)GetWindowLongPtr(hWnd, GWLP_USERDATA); pWindowBase->_eventHandler(foo, foo, foo, foo); } My question is, does the line: pWindowBase->_eventHandler(foo, foo, foo, foo); call the base class its _eventHandler or will it call the overridden version _eventHandler from Window?   I ask this because my app keeps crashing at this line.     [EDIT]   I found that it will actually call the Window class its version so my problem must be caused by something else.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!