• Advertisement

Doug Rogers

  • Content count

  • Joined

  • Last visited

Community Reputation

253 Neutral

About Doug Rogers

  • Rank
  1. I posted an FBX parser and viewer a while ago.   You can see how I did it here:  https://code.google.com/p/fbxviewer/
  2. Smoothing me some normals.

    // set all normals to zero for each vertex normal (n) n = 0,0,0 // add in each face normal to each vertex normal for each face fn = calculate face normal for each vertex normal in face (vn) vn += fn // normalize normals for each vertex normal (n) normalize(n)
  3. How about this? offset adjusts the world position forward or backward relative to the camera and is probably not necessary for what you need. float4 WorldToScreen(const float4& v, float offset, float4x4 &orientation, float4x4 &modelView, float4x4 &projection, float width, float height, float _near, float _far) { float4 result = modelView * (orientation * v); result.z -= offset; result = projection * result; // Homogeneous divide const double rhw = 1 / result.w; return float4( (1 + result.x * rhw) * width / 2, (1 + result.y * rhw) * height / 2, // or (1 - result.y * rhw) * height / 2, (result.z * rhw) * (_far - _near) + _near, rhw); }
  4. File format for 3D Meshes and Animations

    I agree with L. Spiro.   Export FBX from your art tool and convert that to your own internal format using the FBX SDK in a separate tool.  There are some things that do not convert well from FBX, but those are rare.  You also will not have to create your own exporter this way, just a conversion tool.   The issue with using FBX files directly is that the FBX format is not well suited to real time rendering.  It needs some processing that can be done offline.  Creating your own conversion tool frees you from having to use the FBX runtime in your app.
  5. checking if point is inside traingle doesn't work

    In 3D, think of the dot product as the projection of one vector onto another:   Like this: http://www.c-jump.com/bcc/common/Talk3/Math/Vectors/const_images/v06_dot.png   Projecting u onto v results in a positive dot product if there is less than 90 degrees between them.  The dot product is zero if they are 90 degrees.     In your code, the angle is less than 90 degrees for each side, so each dot product is returning positive.     You can calculate the barycentric coordinates, then check the values.   http://gamedev.stackexchange.com/questions/23743/whats-the-most-efficient-way-to-find-barycentric-coordinates   https://msdn.microsoft.com/en-us/library/bb195068.aspx
  6. Maya Rotations

    Don't just negate the Z, apply a left handed conversion matrix at the top of the hierarchy.  You can keep the rotations from Maya as they are. float4x4 leftHandedConversion( float4(1, 0, 0, 0), float4(0, 1, 0, 0), float4(0, 0, -1, 0), float4(0, 0, 0, 1));
  7. [SFML] [C++] vector subscript out of range

      Interesting.  I have never heard that index access bad either bad for nor dangerous.  I use both, depending on the structure.  For flat lists, I use indicies like above.  In debugging with indices, I get an bad index value (out of range usually).  A bad operator usually does not give much info.    Both should be about the same perf wise.  I agree that using iterators usually makes it easier to switch container types.  Occasionally, using iterators make it harder to switch, though.   I haven't made the leap to using auto yet.  We didn't use them on my last job, but they look very useful and cleaner.     I learned something here.   Thanks.
  8. [SFML] [C++] vector subscript out of range

      Yes, I did miss that.  I was suggesting a way to debug it, that is all. I don't think I did.  I just suggested a way to track it down.     Here is a way to keep the counters: for (size_t collideCounter = 0; collideCounter < projArray.size(); collideCounter++) { for (size_t collideCounter2 = 0; collideCounter2 < enemy.enemyArray.size(); collideCounter2++) { if (projArray[collideCounter].rect.getGlobalBounds().intersects(enemy.enemyArray[collideCounter2].enemySprite.getGlobalBounds())) { std::cout << "COLLIDE" << std::endl; } } }
  9. [SFML] [C++] vector subscript out of range

        It would have fired and shown that collideCounter2 was out of bounds.  I like SmkViper's suggestion, but a simple fix is to replace for (iter3 = projArray.begin(); iter3 != projArray.end(); iter3++){ with  for (iter3 = enemy.enemyArray.begin(); iter3 != enemy.enemyArray.end(); iter3++){
  10. [SFML] [C++] vector subscript out of range

    collideCounter = 0; for (iter2 = projArray.begin(); iter2 != projArray.end(); iter2++) { collideCounter2 = 0; for (iter3 = projArray.begin(); iter3 != projArray.end(); iter3++) { assert(collideCounter2 < enemy.enemyArray.size()); if (projArray[collideCounter].rect.getGlobalBounds().intersects(enemy.enemyArray[collideCounter2].enemySprite.getGlobalBounds())) { std::cout << "COLLIDE" << std::endl; } collideCounter2++; } collideCounter++; } Try adding this assert against the size to see if it fires. collideCounter must be within bounds, but you should use the iterator to get projArray[collideCounter] and remove the collideCounter variable.   It is also recommended that you use ++iter, not iter++
  11. DirectX uses a left handed coordinate system.  
  12. fast way of Checking hlsl code

    In Visual Studio, you can associate the fxc compiler with your hlsl code so that when you hit build, hlsl code will compile just like your other other code. In the output window, you can then go to the error lines.
  13. Point To Polygon

    [quote name='heh65532' timestamp='1346973329' post='4977411'] can anyone recommend math book or game programming book that teaches these things? thanks. or answer to this post will do as well [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [/quote] Well, it depends on how you want them connected. Does it matter?
  14. Point inside (or outside) 3d object

    If you decompose the arbitrary object into convex hulls which approximates the original model, then checking inside/outside of hulls is much simpler.
  15. DX11 DX11 FBX Animtion System

    Try posting here: http://area.autodesk.com/forum/autodesk-fbx/fbx-sdk/
  • Advertisement