• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

224 Neutral

About sebbit

  • Rank
  1. fbx importer bone index?

    Are you using the FBX SDK to import the FBX? If so, you need to loop through every meshes skin deformers and any such deformers clusters. Each cluster is linked to a node and has a list of control points (vertices) it influences and a weight for each control point. So, how to get the bone indices depends on how you store the nodes. If you store the nodes as a list your bone index would be the index of the clusters linked node in that list.
  2. What is this for? (Lit)

    Like the documentation sais: the returned vector contains the light coefficients (intensities) for ambient, diffuse and specular lighting. So, you just multiply your respective colors with those coefficents.
  3. You can provide a custom compare function/functor to an std::map or use the default and implement the "less than" operator (operator <) for your vertex structur. Alternatively you can use a map with an unsigned integer as your key type and compute a hash out of your vertex components. EDIT: small excample for the hash based method: unsigned GetHash(const Vector2& v) { unsigned result = 13; result = result * 32 + *((int*)&v.x); result = result * 32 + *((int*)&v.y); return result; } unsigned GetHash(const Vector3& v) { unsigned result = 13; result = result * 32 + *((int*)&v.x); result = result * 32 + *((int*)&v.y); result = result * 32 + *((int*)&v.z); return result; } unsigned GetVertexHash(const Vector3& vertex, const Vector3& normal, const Vector2& textureCoord) { unsigned result = 13; result = result * 31 + GetHash(vertex); result = result * 31 + GetHash(normal); result = result * 31 + GetHash(textureCoord); return result; }
  4. Aren't the last two parameters of OrthoLH(...) the near and far clip distances? If so, your vertices are outside the view volume and clipped. Your vertices are positioned at z=0 but your view volume ranges from z=1 to z=10.
  5. Thats what I'm currently using to get the positions/normals/texture coordinates of a mesh from the FBX SDK: // Get control points (=vertices for a mesh) KFbxVector4* fbxControlPoints = fbxMesh->GetControlPoints(); // For each polygon in the input mesh for (int iPolygon = 0; iPolygon < fbxMesh->GetPolygonCount(); iPolygon++) { // For each vertex in the polygon for (unsigned iPolygonVertex = 0; iPolygonVertex < 3; iPolygonVertex++) { int fbxCornerIndex = fbxMesh->GetPolygonVertex(iPolygon, iPolygonVertex); // Get vertex position KFbxVector4 fbxVertex = fbxControlPoints[fbxCornerIndex]; // Get normal KFbxVector4 fbxNormal; fbxMesh->GetPolygonVertexNormal(iPolygon, iPolygonVertex, fbxNormal); fbxNormal.Normalize(); // Get texture coordinate KFbxVector2 fbxUV = KFbxVector2(0.0, 0.0); KFbxLayerElementUV* fbxLayerUV = fbxMesh->GetLayer(0)->GetUVs(); if (fbxLayerUV) { int iUVIndex = 0; switch (fbxLayerUV->GetMappingMode()) { case KFbxLayerElement::eBY_CONTROL_POINT: iUVIndex = fbxCornerIndex; break; case KFbxLayerElement::eBY_POLYGON_VERTEX: iUVIndex = fbxMesh->GetTextureUVIndex(iPolygon, iPolygonVertex, KFbxLayerElement::eDIFFUSE_TEXTURES); break; } fbxUV = fbxLayerUV->GetDirectArray().GetAt(iUVIndex); } } (To get those code boxes use [ source lang="cpp"] and [ /source], without the spaces of course)
  6. Have you tried KFbxMesh->GetPolygonVertexNormal() for getting the normals? Haven't tested it too mutch, but seems to work so far. If the mesh doesn't have normals you could try KFbxMesh->InitNormals() and KFbxMesh->ComputeNormals() and let the SDK generate them or just compute them yourself once the mesh is fully loaded. For texture coordinates things are a little bit more complicated, as there is no other way then extracting them from the layers and work out the mapping/reference modes. It's the same as for normals in Gumgos example. As for other examples of working with the FBX SDK, the best I've found so far is the ContentExporter sample that comes with the latest DirectX SDK. Seems to be quite complete when it comes to extracting the relevant information thats needed for realtime rendering.
  7. Autodesk3ds Max

    Well, yes you can use models made with Max in your game. But to do that, you well need "your" game first. Then, export your model from Max in a format your game understands and load it. If all you want to do is display your model in a "game like" environment using a ready made game engine like unity is the best you can get for now. And, as has been said already, OpenGL is NOT an engine. It's just a library/tool that allows you to talk to the graphics card when programming your own engine.
  8. Looks like you are using CLI/C++, not pure unmanaged C++. Your code defines a managed (.NET) struct and .NET doesn't allow for globals. So, either put that global into a managed class or use an unmanaged struct. Which to take depends on if you want to expose that global to .NET for interop or just use it for internal purposes.
  9. DirectX and Blender 3D

    As the .x file format only stores meshes and skinning information by default, there is no direct way to store other scene information except than what you describe. Two other possibilities could be: The .x file format is extensible. So you could define your own templates for your additional information. That would be the "clean" way. Haven't done that myself so I can't comment on how complicated that would be, but it would require you to change the exporter as well. Use a separate file for your camera path. Looks like the simpler and most likely easier approach. That way you wouldn't have to define a dummy material for non renderable stuff and it would make it alot easier to change, add, remove camera paths to your map.
  10. Game Development with Directx 10

    That start menu folder only contains support tools. Header files and libraries for C++ are at the main installation folder of the DirectX SDK (folders include/ and lib/). So, to aktually use them you also need Visual Studio (you can get the free express editons here). All thats left is to find some tutorials or books and start coding. You do already know C++, don't you?
  11. Flood fill doesn't have anything to do with using pointers or not. Whats important here is what you want to compare. If you say puyo0 == puyo1 than you are comparing puyos and not their color. So, like Buckeye suggested you should compare the puyos color and not the puyos themselfs (so puyo0.color == puyo1.color is what you'd want to do). But, as you use null as a special value for "empty cells" you have to be extra carefull. As null isn't a valid object and you can't access fields or methods on null. So, to save you from that NullPointerException you have to test for null first (both puyos, the ones from your puyolist and the ones passed to your checkConPuyos method). As null means "empty" you can just return from checkConPuyos I think (you don't want to find "connected empty cells", right?).
  12. Stop stretch on window resize

    Are you using Managed DirectX? If so, (don't know if thats the best way, haven't used it for a while) you could override Resizing and SizeChanged of your Form and reset the device there. I think thats what overrides the default behavior of Managed DirectX of just stretching the viewport. Also, as reseting the device can take quite some time once you have a lot of objects to recreate it might be better to just make the back buffer the same size as the desktop. Then you only have to reset the vieport on resize. Don't want to confuse you here but it might also be better to switch to something like SlimDX as Managed DirectX is officially dead an not updated/supported by MS anymore.
  13. Quote:Original post by Buckeye Shouldn't this line: if(puyolist[x][y] != color) return; // comparing pointers, not colors be if( puyolist[x][y].color != color.color ) return; It appears you're comparing pointers and not colors. Seems like he is using java so no, no pointers there. But while we are at it: how do you create your puyos? If you create them something like: for (int i=0; i < width; i++) { for(int j=0; j < height; j++) { puyolist[i][j] = new Puyo(); } } e.g. you create a new puyo for each entry in your puyolist your compare will always return false (in java at least) because a == b on object references compares for reference equality. So, it only returns true, if a and b are the same object.
  14. Bullet btTriangleIndexVertexArray Help

    Don't know about bullet but from the look of it, it expects a list of indexes as well as a list of vertices. Just like you would use when drawing with glDrawElements and the like. The index list just tells OpenGL/Bullet what 3 vertices make up a triangle. Indexed triangle lists let you reuse vertices for more than one triangle. For a triangle mesh that doesn't share vertices between triangles (or you already duplicated the vertices), all you need is a list of ints that goes from 0 to numVertices-1.
  15. And again: What do you need the unique ID for? Why not just use a pointer to the object in question? Or if an entity owns other, why not have the owner keep a list of entities it owns? The only two cases that occure to me here where an entity should be allowed to change the state of another one is: 1. That entity owns somehow the entity/ies it wants to alter 2. The entity to be changed/notified of a change matches some criteria, i.e. it's been hit by a projectile and it's health needs to be changed In either case, just use pointers to objects. And again, if you use indices into a vector as uniqe IDs they are ... well not realy unique. As everytime you remove an entity from the vector all entities after get a new ID as the vector is compacted. Not to mention that quite some heavy copying is involved whenever you remove an object from the middle of a vector.
  • Advertisement