Merge branch 'master' into simple_skin_test
commit
16080ba60c
|
@ -15,8 +15,8 @@ matrix:
|
||||||
|
|
||||||
image:
|
image:
|
||||||
- Visual Studio 2013
|
- Visual Studio 2013
|
||||||
- Visual Studio 2015
|
# - Visual Studio 2015
|
||||||
- Visual Studio 2017
|
# - Visual Studio 2017
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- Win32
|
- Win32
|
||||||
|
|
|
@ -249,13 +249,14 @@ void Discreet3DSImporter::ApplyMasterScale(aiScene* pScene)
|
||||||
// Reads a new chunk from the file
|
// Reads a new chunk from the file
|
||||||
void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut)
|
void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut)
|
||||||
{
|
{
|
||||||
ai_assert(pcOut != NULL);
|
ai_assert(pcOut != nullptr);
|
||||||
|
|
||||||
pcOut->Flag = stream->GetI2();
|
pcOut->Flag = stream->GetI2();
|
||||||
pcOut->Size = stream->GetI4();
|
pcOut->Size = stream->GetI4();
|
||||||
|
|
||||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize())
|
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) {
|
||||||
throw DeadlyImportError("Chunk is too large");
|
throw DeadlyImportError("Chunk is too large");
|
||||||
|
}
|
||||||
|
|
||||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) {
|
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) {
|
||||||
ASSIMP_LOG_ERROR("3DS: Chunk overflow");
|
ASSIMP_LOG_ERROR("3DS: Chunk overflow");
|
||||||
|
@ -1343,15 +1344,16 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Read a percentage chunk
|
// Read a percentage chunk
|
||||||
ai_real Discreet3DSImporter::ParsePercentageChunk()
|
ai_real Discreet3DSImporter::ParsePercentageChunk() {
|
||||||
{
|
|
||||||
Discreet3DS::Chunk chunk;
|
Discreet3DS::Chunk chunk;
|
||||||
ReadChunk(&chunk);
|
ReadChunk(&chunk);
|
||||||
|
|
||||||
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag)
|
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag) {
|
||||||
return stream->GetF4();
|
return stream->GetF4() * ai_real(100) / ai_real(0xFFFF);
|
||||||
else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag)
|
} else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) {
|
||||||
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
|
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
return get_qnan();
|
return get_qnan();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
cmake_minimum_required( VERSION 2.6 )
|
cmake_minimum_required( VERSION 2.6 )
|
||||||
SET( HEADER_PATH ../include/assimp )
|
SET( HEADER_PATH ../include/assimp )
|
||||||
|
|
||||||
|
if(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
|
message(WARNING "Requesting Android JNI I/O-System in non-Android toolchain. Resetting ASSIMP_ANDROID_JNIIOSYSTEM to OFF.")
|
||||||
|
set(ASSIMP_ANDROID_JNIIOSYSTEM OFF)
|
||||||
|
endif(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
|
|
||||||
SET( COMPILER_HEADERS
|
SET( COMPILER_HEADERS
|
||||||
${HEADER_PATH}/Compiler/pushpack1.h
|
${HEADER_PATH}/Compiler/pushpack1.h
|
||||||
${HEADER_PATH}/Compiler/poppack1.h
|
${HEADER_PATH}/Compiler/poppack1.h
|
||||||
|
@ -932,11 +937,11 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
||||||
|
|
||||||
if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
if(ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
|
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
|
||||||
add_subdirectory(../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/ ../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/)
|
add_subdirectory(../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/ ../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/)
|
||||||
target_link_libraries(assimp android_jniiosystem)
|
target_link_libraries(assimp android_jniiosystem)
|
||||||
endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
endif(ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
|
|
||||||
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||||
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})
|
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})
|
||||||
|
|
|
@ -109,13 +109,13 @@ ColladaLoader::~ColladaLoader() {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
|
||||||
{
|
|
||||||
// check file extension
|
// check file extension
|
||||||
std::string extension = GetExtension(pFile);
|
std::string extension = GetExtension(pFile);
|
||||||
|
|
||||||
if( extension == "dae")
|
if (extension == "dae") {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// XML - too generic, we need to open the file and search for typical keywords
|
// XML - too generic, we need to open the file and search for typical keywords
|
||||||
if( extension == "xml" || !extension.length() || checkSig) {
|
if( extension == "xml" || !extension.length() || checkSig) {
|
||||||
|
@ -123,10 +123,13 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo
|
||||||
* support a specific file extension in general pIOHandler
|
* support a specific file extension in general pIOHandler
|
||||||
* might be NULL and it's our duty to return true here.
|
* might be NULL and it's our duty to return true here.
|
||||||
*/
|
*/
|
||||||
if (!pIOHandler)return true;
|
if (!pIOHandler) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const char* tokens[] = {"<collada"};
|
const char* tokens[] = {"<collada"};
|
||||||
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
|
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +150,7 @@ const aiImporterDesc* ColladaLoader::GetInfo () const
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Imports the given file into the given scene structure.
|
// Imports the given file into the given scene structure.
|
||||||
void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
|
||||||
{
|
|
||||||
mFileName = pFile;
|
mFileName = pFile;
|
||||||
|
|
||||||
// clean all member arrays - just for safety, it should work even if we did not
|
// clean all member arrays - just for safety, it should work even if we did not
|
||||||
|
@ -184,7 +186,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
|
||||||
// ... then fill the materials with the now adjusted settings
|
// ... then fill the materials with the now adjusted settings
|
||||||
FillMaterials(parser, pScene);
|
FillMaterials(parser, pScene);
|
||||||
|
|
||||||
// Apply unitsize scale calculation
|
// Apply unit-size scale calculation
|
||||||
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0,
|
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0,
|
||||||
0, parser.mUnitSize, 0, 0,
|
0, parser.mUnitSize, 0, 0,
|
||||||
0, 0, parser.mUnitSize, 0,
|
0, 0, parser.mUnitSize, 0,
|
||||||
|
|
|
@ -390,9 +390,18 @@ namespace Assimp {
|
||||||
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
|
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
|
||||||
|
|
||||||
//cameras are defined along positive x direction
|
//cameras are defined along positive x direction
|
||||||
out_camera->mPosition = cam.Position();
|
/*out_camera->mPosition = cam.Position();
|
||||||
out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize();
|
out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize();
|
||||||
out_camera->mUp = cam.UpVector();
|
out_camera->mUp = cam.UpVector();*/
|
||||||
|
|
||||||
|
out_camera->mPosition = aiVector3D(0.0f);
|
||||||
|
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
|
||||||
|
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
|
||||||
|
|
||||||
|
out_camera->mClipPlaneNear = cam.NearPlane();
|
||||||
|
out_camera->mClipPlaneFar = cam.FarPlane();
|
||||||
|
|
||||||
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
|
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
|
||||||
out_camera->mClipPlaneNear = cam.NearPlane();
|
out_camera->mClipPlaneNear = cam.NearPlane();
|
||||||
|
@ -1291,8 +1300,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) {
|
||||||
|
|
|
@ -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",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -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
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue