mynameisnafe

Members
  • Content count

    119
  • Joined

  • Last visited

Community Reputation

258 Neutral

About mynameisnafe

  • Rank
    Member
  1. Ugly, can this be done easier?

    class Menu { static const char* items[NUM_MENU_ITEMS]; // .. public: const char* ItemString (const int nID); };
  2. How to do 3D feature detection?

    Cadjunkie sounds knowledgeable.. Made me remember that the two guys behind me are the feature recognition guys.. I just paint and intersect triangles lol
  3. How to do 3D feature detection?

    Have a look at Seimen's Parasolid. it's an industry standard CAD kernel used in most of the 3D applications you've heard of.. its licensed by the company I work for, for example. You can do things like feature recognition, healing, simplification. have a Google for 'Parasolid Jumpstart Kit'. Bear in mind it probably costs a shitload..
  4. OpenGL glm/opengl orbital camera C++

    Okay! It kind of works!   I'm now suffering from a kind of 'bad handling', where i get some interference and then a big camera jump.. it's not exactly smooth..   Here's my messy work in progress :   Get mouse position: case WM_MOUSEMOVE: { POINT p; GetCursorPos(&p); // move into rect/window space p.x -= rWindow.left; p.y -= rWindow.top; // relative to rect/window centre //p.x -= (rWindow.right - rWindow.left)/2; //p.y -= (rWindow.bottom-rWindow.top)/2; OnMouseMove(MouseMove(p)); } Then update the camera: if( pMouse->bRight == true ) { POINT mPos = pMouse->pos; // pixels mPos.x -= pMouse->prev.x; mPos.y -= pMouse->prev.y; if(mPos.x != 0 || mPos.y != 0) { float hMag = _radians(millisElapsed * m_mouseSpeed * mPos.x); float vMag = _radians(millisElapsed * m_mouseSpeed * mPos.y); if( fabs(hMag) > _pi || fabs(vMag) > _pi) return; m_horizontalAngle -= hMag; m_verticalAngle -= vMag; } } //to rotate using quaternions euler angles as input. glm::mat4 R = glm::yawPitchRoll(m_horizontalAngle, m_verticalAngle, 0.0f); //Then you could do the following to Update() a camera transformation: glm::vec3 T = glm::vec3(0, 0, -dist); position = glm::vec3(R * glm::vec4(T, 0.0f)); m_direction = origin;// glm::normalize(position); m_up = glm::vec3(R * glm::vec4(m_real_up, 0.0f)); m_right = glm::cross(m_direction, m_up); m_viewMatrix = glm::lookAt(position, m_direction, m_up); Any suggestions?
  5. OpenGL glm/opengl orbital camera C++

    PS I <3 GLM.
  6. OpenGL glm/opengl orbital camera C++

    Okay, I broke my collarbone, apologies for the lack of input. I shall have a read then edit this post (..surface of a sphere please).. Steven Katic right on! That analogy is exactly what was in my head. Would you believe I'm a graphics programmer by day as well? Hahaha terrible! Indeed a target is just a translation of the origin; I haven't got a mesh hierarchy or the right matrix from assimp yet, so just one matrix/position to spin the camera around at the moment. I got my FPS camera from opengl-tutorials.com. also I bought the blue book instead of the red one and I'm regretting it now. [keeps reading]
  7. OpenGL glm/opengl orbital camera C++

    Hi, thanks for replying.   Y is my real up, and my existing camera is using glm::lookAt(position, position + direction, up)   This is a cool idea, I'll try this tomorrow:   I guess orbit is the wrong word, my bad; what I'm looking for is a kind of 3D editor camera - so the models at 0,0,0 but I can 'spin it around on it's origin'.   So what I need is glm::lookAt(position, origin, up), and I use the mouse to update something like this? dx = mouse.dx; // change in dy = mouse.dy; //rotate on y axis rotY += dx; position = (cos(rotY), 0, sin(rotY)); //rotate on x axis ?? rotX += dy; // ? // position.x += cos(rotX); // ? // position.y = sin(rotX) // ? // position.z += cos(rotX);
  8. Hi there,   I have a gl project with a first person camera that uses glm to do it's math. My question is thus and I'm sorry for it's quite poor construction:  Do I need to use/do glm::quat things or do I need rotX, rotY, rotZ, for some code where the camera spins around on a sphere centred on the model? So, the end goal is that moving the mouse makes it look like the model is spinning, when actually the camera is spinning? And how would I do that? For example, how different would this class declaration be? I'd like to throw a 'orbit-cam' in there, then extract a base class, etc. class GLCamera { protected: float   _mx, _my; float   m_frameTime, // how much time has passed m_moveSpeed, // how many units to move per second m_mouseSpeed; // how many degrees to rotate per second of glm::vec3 m_real_up; glm::vec3 m_origin; float m_horizontalAngle, m_verticalAngle, m_initFoV; glm::vec3 position; glm::vec3 m_direction; glm::vec3 m_right; glm::vec3 m_up; glm::mat4 m_viewMatrix;
  9. L. Spiro replies to my thread? Honoured! I shall give it a try in 5 mins and let you guys know what happened..
  10. Okay..   Everything seems to be working with the lambda. The reason I have half the file formats visible in the dialog is to do with the OPENFILENAME and the GetOpenFileName() function   http://msdn.microsoft.com/en-gb/library/windows/desktop/ms646829(v=vs.85).aspx#open_file   I think I need a name for each format.. "Model" will do. Hello people above std::string seems to work fine - I think (it appears) Assimp provides an overload - pretty sure I've seen it documented. std::string GLFactory::GetAssimpExtsList() { std::string exts; Assimp::Importer importer; importer.GetExtensionList(exts); return exts; }       Indeed. I'm happy to assume Assimp don't bother with language packs. PS That all sounds like a lot of effort - have you seen that lambda?!
  11. I bailed on my split fn, all that CString jazz.. now I have this beautiful code: std::string App::DoOpenFileDialog(std::string extsAccepted) { std::string fName; OPENFILENAME ofn; // common dialog box structure char szFile[260]; // buffer for file name std::wstring wextsList; std::transform(extsAccepted.begin(), extsAccepted.end(), back_inserter(wextsList), [](char t)->wchar_t { return t==';' ? '\0' : t; }); // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = m_hWnd; ofn.lpstrFile = (LPWSTR)szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = (LPCWSTR)wextsList.c_str(); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; // Display the Open dialog box. if( GetOpenFileName(&ofn) == TRUE ) { ..Problem is, it's missing every other file format - this is something I saw before while straying through the realms of doing it a char at a time in a for loop, and also while using a CString.. PS: D'oh! I've got Unicode set in my project settings (VS 2012), so that should make things easier? PPS: I just saw your reply - I've used lambdas before, just appreciating the sly-as-hell widening, just implicit. Must use lambdas much more.Loving that one, using it, thank you Crap - I just added the extra null terminator.  
  12. What is this lambda magic?   [](char t)->wchar_t Is that it? It's not the replacing that I'm struggling with, it's the char ->wchar_t.. and there is the char->wchar_t I'm going to try basically an empty lambda, meanwhile, whats with the extra push_back(0)'s? are those important (i.e. the real null terminator of the returned exts wstring?  
  13. HI all,   I'm having some trouble figuring out how to do this one. Assimp gives me a string, containing all the file extensions it can handle. I found some code to tokenize strings on SO and wrapped it in a function. The format of the string that is used to initialise the accepted extensions list for the OPENFILENAME structure is as follows:   L"All\0*.*\0Text\*.txt\0" And so I'm trying to recreate that programatically. Which is a nightmare, as I'm trying to stick '\0' in the middle of a string. // Get a vector of extensions supported by Assimp ( assimp exts string, tokenise by ';' ) std::vector<std::string> exts = Scatterbrain::Split(extsAccepted.c_str(), ';'); //create a string with a bunch of '\0' s in it, if possible std::string extsList=""; for(size_t i = 0; i < exts.size(); i++) extsList.append(exts[i] + '\0'); // contains the first extension. CString pwszExts(extsList.c_str()); // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(ofn)); ofn.lpstrFilter = (LPCWSTR)pwszExts; // This one ... // Display the Open dialog box. if( GetOpenFileName(&ofn) == TRUE ) { ... Okay - I see one bug already: the dialog is going to say 'extension_a extension_b', instead of 'ext_name_a ext_a', but I'm happy to add blank spaces for names. how is the generation of a string  L"Hello\0World\0How\0Are\0You\0'  done? Thanks in advance  
  14. Asset file format

    I only throw my tuppence in here as I'm currently undertaking a similar task: Assimp does this.. a 'aiScene' is loaded which contains meshes, materials, animations - materials contain raw bits of textures, and colour information.  Assimp does a fairly good job of this for many formats - in fact I came this ' ' close to ripping of their code for my dissertation* Project 1 (An 'editor'):  - I'm using Assimp to load models with all their materials into MyMesh class, then writing out MyMesh to a binary file optimized for reading into memory quickly (think memcpy over for(i = 0;...) when loading this file) - include geometry, anim, materials etc in the one file. Project 2 (A 'game engine'/renderer): - Load the 'optimized' custom format, use it.   On the other hand, there are some compressed binary model file formats out there - I've heard good things about OpenCTM, for example. (Google if curious). *of course I mean properly referencing, and simply using Assimp instead of writing my own. If anyone can find documentation for the animation chunks in the .3ds file I will give them cookies.  
  15. Indeed! It's a long story - basically having gotten fed up of MFC while trying to create an anything-to-myformat application, I'm rolling Win32 basics and like building a framework on that. I just copied that thing from MSDN and didn't touch it, just adding stuff (......below the line of the code that was causing the problem......) to try and make it work. Face-to-the-palm! I had a cube a minute ago, I've lost it now, but I'm now back in my comfort zone at least. Thanks again :)