Kim Kulling 2019-02-18 21:43:45 +01:00
parent fadfaf88db
commit ae41ae3211
3 changed files with 25 additions and 14 deletions

View File

@ -1291,8 +1291,7 @@ namespace Assimp {
unsigned int cursor = 0, in_cursor = 0; unsigned int cursor = 0, in_cursor = 0;
itf = faces.begin(); itf = faces.begin();
for (MatIndexArray::const_iterator it = mindices.begin(), for (MatIndexArray::const_iterator it = mindices.begin(), end = mindices.end(); it != end; ++it, ++itf)
end = mindices.end(); it != end; ++it, ++itf)
{ {
const unsigned int pcount = *itf; const unsigned int pcount = *itf;
if ((*it) != index) { if ((*it) != index) {

View File

@ -60,11 +60,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
namespace Assimp { namespace Assimp {
template<> const char* LogFunctions<FBXImporter>::Prefix()
{ template<>
static auto prefix = "FBX: "; const char* LogFunctions<FBXImporter>::Prefix() {
return prefix; static auto prefix = "FBX: ";
} return prefix;
}
} }
using namespace Assimp; using namespace Assimp;
@ -72,6 +74,7 @@ using namespace Assimp::Formatter;
using namespace Assimp::FBX; using namespace Assimp::FBX;
namespace { namespace {
static const aiImporterDesc desc = { static const aiImporterDesc desc = {
"Autodesk FBX Importer", "Autodesk FBX Importer",
"", "",

View File

@ -508,19 +508,28 @@ int CreateAssetData()
unsigned int nidx; unsigned int nidx;
switch (mesh->mPrimitiveTypes) { switch (mesh->mPrimitiveTypes) {
case aiPrimitiveType_POINT: case aiPrimitiveType_POINT:
nidx = 1;break; nidx = 1;
break;
case aiPrimitiveType_LINE: case aiPrimitiveType_LINE:
nidx = 2;break; nidx = 2;
break;
case aiPrimitiveType_TRIANGLE: case aiPrimitiveType_TRIANGLE:
nidx = 3;break; nidx = 3;
default: ai_assert(false); break;
default:
ai_assert(false);
break;
}; };
unsigned int numIndices = mesh->mNumFaces * 3;
if (0 == numIndices && nidx == 1) {
numIndices = mesh->mNumVertices;
}
// check whether we can use 16 bit indices // check whether we can use 16 bit indices
if (mesh->mNumFaces * 3 >= 65536) { if (numIndices >= 65536) {
// create 32 bit index buffer // create 32 bit index buffer
if(FAILED( g_piDevice->CreateIndexBuffer( 4 * if(FAILED( g_piDevice->CreateIndexBuffer( 4 *
mesh->mNumFaces * nidx, numIndices,
D3DUSAGE_WRITEONLY | dwUsage, D3DUSAGE_WRITEONLY | dwUsage,
D3DFMT_INDEX32, D3DFMT_INDEX32,
D3DPOOL_DEFAULT, D3DPOOL_DEFAULT,
@ -546,7 +555,7 @@ int CreateAssetData()
else { else {
// create 16 bit index buffer // create 16 bit index buffer
if(FAILED( g_piDevice->CreateIndexBuffer( 2 * if(FAILED( g_piDevice->CreateIndexBuffer( 2 *
mesh->mNumFaces * nidx, numIndices,
D3DUSAGE_WRITEONLY | dwUsage, D3DUSAGE_WRITEONLY | dwUsage,
D3DFMT_INDEX16, D3DFMT_INDEX16,
D3DPOOL_DEFAULT, D3DPOOL_DEFAULT,