Skip to content

Commit

Permalink
Merge pull request #2342 from assimp/isue_305
Browse files Browse the repository at this point in the history
Isue 305
  • Loading branch information
kimkulling committed Feb 19, 2019
2 parents fadfaf8 + ebf9deb commit ef35acc
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -15,8 +15,8 @@ matrix:

image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017
# - Visual Studio 2015
# - Visual Studio 2017

platform:
- Win32
Expand Down
3 changes: 1 addition & 2 deletions code/FBXConverter.cpp
Expand Up @@ -1291,8 +1291,7 @@ namespace Assimp {
unsigned int cursor = 0, in_cursor = 0;

itf = faces.begin();
for (MatIndexArray::const_iterator it = mindices.begin(),
end = mindices.end(); it != end; ++it, ++itf)
for (MatIndexArray::const_iterator it = mindices.begin(), end = mindices.end(); it != end; ++it, ++itf)
{
const unsigned int pcount = *itf;
if ((*it) != index) {
Expand Down
13 changes: 8 additions & 5 deletions code/FBXImporter.cpp
Expand Up @@ -60,18 +60,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h>

namespace Assimp {
template<> const char* LogFunctions<FBXImporter>::Prefix()
{
static auto prefix = "FBX: ";
return prefix;
}

template<>
const char* LogFunctions<FBXImporter>::Prefix() {
static auto prefix = "FBX: ";
return prefix;
}

}

using namespace Assimp;
using namespace Assimp::Formatter;
using namespace Assimp::FBX;

namespace {

static const aiImporterDesc desc = {
"Autodesk FBX Importer",
"",
Expand Down
17 changes: 17 additions & 0 deletions test/models/PLY/points.ply
@@ -0,0 +1,17 @@
ply
format ascii 1.0
element vertex 4
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
end_header
0.0 0.0 0.0 255 255 255 0.0 1.0 0.0
0.0 0.0 1.0 255 0 255 0.0 0.0 1.0
0.0 1.0 0.0 255 255 0 1.0 0.0 0.0
0.0 1.0 1.0 0 255 255 1.0 1.0 0.0
23 changes: 16 additions & 7 deletions tools/assimp_view/assimp_view.cpp
Expand Up @@ -508,19 +508,28 @@ int CreateAssetData()
unsigned int nidx;
switch (mesh->mPrimitiveTypes) {
case aiPrimitiveType_POINT:
nidx = 1;break;
nidx = 1;
break;
case aiPrimitiveType_LINE:
nidx = 2;break;
nidx = 2;
break;
case aiPrimitiveType_TRIANGLE:
nidx = 3;break;
default: ai_assert(false);
nidx = 3;
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
if (mesh->mNumFaces * 3 >= 65536) {
if (numIndices >= 65536) {
// create 32 bit index buffer
if(FAILED( g_piDevice->CreateIndexBuffer( 4 *
mesh->mNumFaces * nidx,
numIndices,
D3DUSAGE_WRITEONLY | dwUsage,
D3DFMT_INDEX32,
D3DPOOL_DEFAULT,
Expand All @@ -546,7 +555,7 @@ int CreateAssetData()
else {
// create 16 bit index buffer
if(FAILED( g_piDevice->CreateIndexBuffer( 2 *
mesh->mNumFaces * nidx,
numIndices,
D3DUSAGE_WRITEONLY | dwUsage,
D3DFMT_INDEX16,
D3DPOOL_DEFAULT,
Expand Down

0 comments on commit ef35acc

Please sign in to comment.