OgreAssimpConverter
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
I think I'll add the custumizations - both scene export and custom material generation is useful.
Cloud: could you put up the base material, please?
And I'll be using RapidXML instead of GOOF for the scene export.
Cloud: could you put up the base material, please?
And I'll be using RapidXML instead of GOOF for the scene export.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gremlin
- Posts: 196
- Joined: Tue Aug 08, 2006 6:45 pm
- x 14
Re: OgreAssimpConverter
I can't really post mine as its huge, probably a dozen shader files or more, I've got defferred shading and PSSM in it, as well as differrent base materials for bump mapping instancing and all the rest of it.
An extract of the material with the deffered shading bit cut out.
Really I just put my "loader customisation" as sort of an example. On a sidenote I just use the xml wrapper part of GOOF like its interface.
An extract of the material with the deffered shading bit cut out.
Code: Select all
abstract pass AbstractAmbientPass
{
ambient 1 1 1
diffuse 0 0 0
specular 0 0 0 0
emissive 0 0 0
cull_hardware $cull_hardware_value
vertex_program_ref AmbientVPCG
{
}
fragment_program_ref AmbientFPCG
{
}
texture_unit
{
texture $diffuse_map
}
////////////////////////////////////////////////////////////////////////////////
// Standard material
////////////////////////////////////////////////////////////////////////////////
abstract material base : baseCommon
{
technique
{
shadow_caster_material DepthShadowCaster
pass : AbstractAmbientPass
{
}
pass : AbstractShadowReceiverDirectionalPass
{
vertex_program_ref PSSMShadowReceiverVPCG
{
}
fragment_program_ref PSSMShadowReceiverDirectionalFPCG
{
shared_params_ref PSSM/SharedParams
}
}
}
set $cull_hardware_value clockwise
set $specular_value "0 0 0 0"
set $diffuse_value "1 1 1 1"
}
}
-
- Gnoblar
- Posts: 2
- Joined: Wed Oct 05, 2011 7:49 am
Re: OgreAssimpConverter
Hello,
I have been using OgreAssimpConverter on our project and it works perfectly when I'm using it in Windows. However, each time I use it in Linux, it throws a segmentation fault even when using exactly the same meshes that I used on Windows (.dae to .mesh, I tried also .obj to .mesh). Is the OgreAssimpConverter supposed to work on Linux? If it is, any idea what might be wrong?
I have been using OgreAssimpConverter on our project and it works perfectly when I'm using it in Windows. However, each time I use it in Linux, it throws a segmentation fault even when using exactly the same meshes that I used on Windows (.dae to .mesh, I tried also .obj to .mesh). Is the OgreAssimpConverter supposed to work on Linux? If it is, any idea what might be wrong?
-
- Gnoblar
- Posts: 2
- Joined: Wed Oct 05, 2011 7:49 am
Re: OgreAssimpConverter
Oops, the problem vanished after recompiling and reinstalling the Assimp libraries. Maybe I tried to use two versions of the library simultaneously. Never mindZcn wrote:Hello,
I have been using OgreAssimpConverter on our project and it works perfectly when I'm using it in Windows. However, each time I use it in Linux, it throws a segmentation fault even when using exactly the same meshes that I used on Windows (.dae to .mesh, I tried also .obj to .mesh). Is the OgreAssimpConverter supposed to work on Linux? If it is, any idea what might be wrong?
-
- Gremlin
- Posts: 196
- Joined: Tue Aug 08, 2006 6:45 pm
- x 14
Re: OgreAssimpConverter
I found a small mistake in Loader::createSubMesh where the normals are computed we do vect *= derivedTransform, but obviously we don't want the translation, just the rotation.. fix is
before the vertex bufer lock and
for the normal, I tried vect = derivedRot.Rotate(vect); but for some reason that didn't work.
Code: Select all
aiVector3D derivedScale;
aiQuaternion derivedRot;
aiVector3D derivedPos;
derivedTransform.Decompose(derivedScale, derivedRot, derivedPos);
Code: Select all
vect *= derivedTransform;
vect -= derivedPos;
-
- Gnoblar
- Posts: 16
- Joined: Sun Dec 18, 2011 11:13 pm
Re: OgreAssimpConverter
Hi, I have a problem with correct loading of STL file. In the AssimpView program the resultant geometry looks as follows: http://dl.dropbox.com/u/3681534/2011-12 ... 9%20pm.png
This means, that the library works and successfully imports the geometry. However when I use the assimp converter code to load the stl file and display its mesh, I get something like that: http://dl.dropbox.com/u/3681534/2011-12 ... 8%20pm.png
Here is the file I try to import and display (I skip the *.mesh generation part): http://dl.dropbox.com/u/3681534/RobotHyb.STL (130 Mb).
I would appreciate any help, because this is a really important matter to me (part of my master thesis).
This means, that the library works and successfully imports the geometry. However when I use the assimp converter code to load the stl file and display its mesh, I get something like that: http://dl.dropbox.com/u/3681534/2011-12 ... 8%20pm.png
Here is the file I try to import and display (I skip the *.mesh generation part): http://dl.dropbox.com/u/3681534/RobotHyb.STL (130 Mb).
I would appreciate any help, because this is a really important matter to me (part of my master thesis).
-
- Gnoblar
- Posts: 16
- Joined: Fri Jan 21, 2011 2:50 pm
- Location: Estonia
Re: OgreAssimpConverter
Great tool, exactly what the Ogre project needs to maintain its reputation...
else ppl might start getting the idea the open-source engine is being used solely as a front-end to sell unreasonably expensive "exporters"....
Could you provide a complied exe for windows? If not, could you kindly provide some info on dependecies/how-to-compile for vs2008?
thanks in advnace!
/regards
else ppl might start getting the idea the open-source engine is being used solely as a front-end to sell unreasonably expensive "exporters"....
Could you provide a complied exe for windows? If not, could you kindly provide some info on dependecies/how-to-compile for vs2008?
thanks in advnace!
/regards
to live, is natural, to die, is not
-
- Gnoblar
- Posts: 6
- Joined: Thu Sep 02, 2010 5:47 pm
Re: OgreAssimpConverter
As far as I can see, you must only download the Assimp SDK (they provide prebuild libs for vs2008 so you have no trouble to find the dependecies of Assimp). Then you only must start up CMake and build OgreAssimp.Could you provide a complied exe for windows? If not, could you kindly provide some info on dependecies/how-to-compile for vs2008?
-
- Gremlin
- Posts: 196
- Joined: Tue Aug 08, 2006 6:45 pm
- x 14
Re: OgreAssimpConverter
I've fixed a couple bugs, the one I mentioned above and another one in the animation keyframe where a reverse iterator got from a forward iterator was umm wrong -- sorry about that. It had the effect that the first key was just plain wrong, took me a while to figure out what was going on, I've rewritten it basically doing the same thing but now its easier on the eyes (in more ways than one)
http://www.pearsonp.force9.co.uk/OgreAssimpLoader.zip (monday 9th Jan 2012)
If I come back with more fixes, I'll just edit this post, I feel guilty reapeatedly bumping this thread.
@rybka007 You could try changing the assimp loader params there are many post process things it can do that AssimpView might well not be doing, here in "may" lie the fault as far as I can tell simple mesh scenes havn't thrown up any problems, but 130mb model file certainly is bigger than anything I've tried. If/when all else fails I'd suggest breaking it into smaller chunks and running them through the loader, good luck.
http://www.pearsonp.force9.co.uk/OgreAssimpLoader.zip (monday 9th Jan 2012)
If I come back with more fixes, I'll just edit this post, I feel guilty reapeatedly bumping this thread.
@rybka007 You could try changing the assimp loader params there are many post process things it can do that AssimpView might well not be doing, here in "may" lie the fault as far as I can tell simple mesh scenes havn't thrown up any problems, but 130mb model file certainly is bigger than anything I've tried. If/when all else fails I'd suggest breaking it into smaller chunks and running them through the loader, good luck.
-
- Gnoblar
- Posts: 7
- Joined: Thu Oct 20, 2011 4:08 pm
- x 5
Re: OgreAssimpConverter
First of all, a great tool!
What do you think about splitting up the AssimpLoader::convert function into two seperated functions,
one for loading and one for saving?
Also add some getter functions for accessing the loaded mesh and skeleton.
That way the AssimpLoader could be used as a loader in projects directly.
Of course AssimpLoader::convert can remain, so we don't break the interface.
I could totally do that myself, if you are willing to add the patch to the repo or give me commit access.
What do you think?
Thanks again, CallForSanity
What do you think about splitting up the AssimpLoader::convert function into two seperated functions,
one for loading and one for saving?
Also add some getter functions for accessing the loaded mesh and skeleton.
That way the AssimpLoader could be used as a loader in projects directly.
Of course AssimpLoader::convert can remain, so we don't break the interface.
I could totally do that myself, if you are willing to add the patch to the repo or give me commit access.
What do you think?
Thanks again, CallForSanity
-
- Gnoblar
- Posts: 7
- Joined: Thu Oct 20, 2011 4:08 pm
- x 5
Re: OgreAssimpConverter
Hi,
I did exactly what I proposed in my last post and here is the patch.
directly as Ogre::Mesh completely with skeleton, etc.
You may just insert the following lines into your code.
A FindOgreAssimp.cmake is provided under CMakeModules.
Just use it to set include dirs and link against the library.
The existing OgreAssimp cmake build script already supports installing the library
using "sudo make install".
Thank you and have fun using this great library/tool.
CallForSanity
I did exactly what I proposed in my last post and here is the patch.
Using the patch below it is now possible to load any models supported by AssimpWhat do you think about splitting up the AssimpLoader::convert function into two seperated functions,
one for loading and one for saving?
Also add some getter functions for accessing the loaded mesh and skeleton.
That way the AssimpLoader could be used as a loader in projects directly.
Of course AssimpLoader::convert can remain, so we don't break the interface.
directly as Ogre::Mesh completely with skeleton, etc.
You may just insert the following lines into your code.
Code: Select all
#include <OgreAssimpLoader/AssimpLoader.h>
AssimpLoader assimpLoader;
assimpLoader.load("model.formatofyourchoice");
Ogre::MeshPtr mesh = assimpLoader.getMeshes().front();
entity = scene_manager_->createEntity(mesh->getName());
if (entity->hasSkeleton())
std::cout << "model has skeleton!" << std::endl;
Just use it to set include dirs and link against the library.
The existing OgreAssimp cmake build script already supports installing the library
using "sudo make install".
Thank you and have fun using this great library/tool.
CallForSanity
Code: Select all
diff -r a62f40292f51 CMakeLists.txt
--- a/CMakeLists.txt Sun Aug 07 11:46:04 2011 +0200
+++ b/CMakeLists.txt Sun Jan 22 01:08:44 2012 +0100
@@ -48,19 +48,19 @@
set(CMAKE_MODULE_PATH "$ENV{OGRE_HOME}/CMake/;${CMAKE_MODULE_PATH}")
endif(WIN32)
-if(UNIX)
- if(EXISTS "/usr/local/lib/OGRE/cmake")
+#if(UNIX)
+# if(EXISTS "/usr/local/lib/OGRE/cmake")
- set(CMAKE_MODULE_PATH "/usr/local/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
+# set(CMAKE_MODULE_PATH "/usr/local/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
- elseif(EXISTS "/usr/lib/OGRE/cmake")
+# elseif(EXISTS "/usr/lib/OGRE/cmake")
- set(CMAKE_MODULE_PATH "/usr/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
+# set(CMAKE_MODULE_PATH "/usr/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
- else ()
- message(SEND_ERROR "Failed to find module path.")
- endif(EXISTS "/usr/local/lib/OGRE")
-endif(UNIX)
+# else ()
+# message(SEND_ERROR "Failed to find module path.")
+# endif(EXISTS "/usr/local/lib/OGRE")
+#endif(UNIX)
if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
diff -r a62f40292f51 CMakeModules/FindOGRE.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeModules/FindOGRE.cmake Sun Jan 22 01:08:44 2012 +0100
@@ -0,0 +1,59 @@
+# Find OGRE includes and library
+#
+# This module defines
+# OGRE_INCLUDE_DIR
+# OGRE_LIBRARIES, the libraries to link against to use OGRE.
+# OGRE_LIB_DIR, the location of the libraries
+# OGRE_FOUND, If false, do not try to use OGRE
+#
+# Copyright © 2007, Matt Williams
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
+ SET(OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
+ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
+
+IF (WIN32) #Windows
+ MESSAGE(STATUS "Looking for OGRE")
+ SET(OGRESDK $ENV{OGRE_HOME})
+ #STRING(REGEX REPLACE "[\\]" "/" OGRESDK "${OGRESDK}" )
+ SET(OGRE_INCLUDE_DIR ${OGRESDK}/include)
+ SET(OGRE_LIB_DIR ${OGRESDK}/lib)
+ SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain)
+ELSE (WIN32) #Unix
+ FIND_PACKAGE(PkgConfig)
+ PKG_SEARCH_MODULE(OGRE OGRE)
+ SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS})
+ SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
+ SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
+ENDIF (WIN32)
+
+#Do some preparation
+#SEPARATE_ARGUMENTS(OGRE_INCLUDE_DIR)
+SEPARATE_ARGUMENTS(OGRE_LIBRARIES)
+
+SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "" FORCE)
+SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "" FORCE)
+SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "" FORCE)
+
+MARK_AS_ADVANCED(OGRE_INCLUDE_DIR)
+MARK_AS_ADVANCED(OGRE_LIB_DIR)
+MARK_AS_ADVANCED(OGRE_LIBRARIES)
+
+IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
+ SET(OGRE_FOUND TRUE)
+ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
+
+INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIRS})
+
+IF (OGRE_FOUND)
+ IF (NOT OGRE_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries : ${OGRE_LIBRARIES} from ${OGRE_LIB_DIR}")
+ MESSAGE(STATUS " includes : ${OGRE_INCLUDE_DIR}")
+ ENDIF (NOT OGRE_FIND_QUIETLY)
+ELSE (OGRE_FOUND)
+ IF (OGRE_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find OGRE")
+ ENDIF (OGRE_FIND_REQUIRED)
+ENDIF (OGRE_FOUND)
diff -r a62f40292f51 src/AssimpLoader.cpp
--- a/src/AssimpLoader.cpp Sun Aug 07 11:46:04 2011 +0200
+++ b/src/AssimpLoader.cpp Sun Jan 22 01:08:44 2012 +0100
@@ -59,6 +59,30 @@
#include <boost/tuple/tuple.hpp>
//#include "OgreXMLSkeletonSerializer.h"
+const std::string whiteSpaces( " \f\n\r\t\v\"" );
+
+void trimRight( std::string& str,
+ const std::string& trimChars = whiteSpaces )
+{
+ std::string::size_type pos = str.find_last_not_of( trimChars );
+ str.erase( pos + 1 );
+}
+
+
+void trimLeft( std::string& str,
+ const std::string& trimChars = whiteSpaces )
+{
+ std::string::size_type pos = str.find_first_not_of( trimChars );
+ str.erase( 0, pos );
+}
+
+
+void trim( std::string& str, const std::string& trimChars = whiteSpaces )
+{
+ trimRight( str, trimChars );
+ trimLeft( str, trimChars );
+}
+
Ogre::String toString(const aiColor4D& colour)
{
return Ogre::StringConverter::toString(Ogre::Real(colour.r)) + " " +
@@ -76,18 +100,26 @@
AssimpLoader::~AssimpLoader()
{
+ // clean up
+ mMeshes.clear();
+ mMaterialCode = "";
+ mBonesByName.clear();
+ mBoneNodesByName.clear();
+ mSkeleton = Ogre::SkeletonPtr(NULL);
+ mCustomAnimationName = "";
+ // etc...
+
+ Ogre::MeshManager::getSingleton().removeUnreferencedResources();
+ Ogre::SkeletonManager::getSingleton().removeUnreferencedResources();
}
-bool AssimpLoader::convert(const Ogre::String& filename,
+bool AssimpLoader::load(const Ogre::String& filename,
const Ogre::String& customAnimationName,
- int loaderParams,
- const Ogre::String& filedest,
- const Ogre::Real animationSpeedModifier)
-{
- mAnimationSpeedModifier = double(animationSpeedModifier);
+ int loaderParams) {
mLoaderParams = loaderParams;
mQuietMode = ((mLoaderParams & LP_QUIET_MODE) == 0) ? false : true;
mCustomAnimationName = customAnimationName;
+
if ((mLoaderParams & LP_USE_LAST_RUN_NODE_DERIVED_TRANSFORMS) == false)
{
mNodeDerivedTransformByName.clear();
@@ -97,11 +129,6 @@
Ogre::StringUtil::splitFullFilename(filename, mBasename, extension, mPath);
mBasename = mBasename + "_" + extension;
- if(!filedest.empty())
- {
- mPath = filedest + "/";
- }
-
Assimp::DefaultLogger::create("asslogger.log",Assimp::Logger::VERBOSE);
Assimp::DefaultLogger::get()->info("Logging asses");
@@ -138,7 +165,7 @@
if(mBonesByName.size())
{
- mSkeleton = Ogre::SkeletonManager::getSingleton().create("conversion", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+ mSkeleton = Ogre::SkeletonManager::getSingleton().create(mBasename + ".skeleton", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
msBoneCount = 0;
createBonesFromNode(scene, scene->mRootNode);
@@ -156,12 +183,29 @@
loadDataFromNode(scene, scene->mRootNode, mPath);
+ // assign skeleton to all meshes
+ if(mBonesByName.size())
+ for(MeshVector::iterator it = mMeshes.begin(); it != mMeshes.end(); ++it)
+ (*it)->_notifySkeleton(mSkeleton);
+
if(!mQuietMode)
{
Ogre::LogManager::getSingleton().logMessage("*** Finished loading ass file ***");
}
Assimp::DefaultLogger::kill();
+ boneMap.clear();
+}
+
+bool AssimpLoader::save(const Ogre::String& filedest,
+ const Ogre::Real animationSpeedModifier) {
+ mAnimationSpeedModifier = double(animationSpeedModifier);
+
+ if(!filedest.empty())
+ {
+ mPath = filedest + "/";
+ }
+
if(!mSkeleton.isNull())
{
@@ -188,10 +232,6 @@
for(MeshVector::iterator it = mMeshes.begin(); it != mMeshes.end(); ++it)
{
Ogre::MeshPtr mMesh = *it;
- if(mBonesByName.size())
- {
- mMesh->setSkeletonName(mBasename + ".skeleton");
- }
Ogre::Mesh::SubMeshIterator smIt = mMesh->getSubMeshIterator();
while (smIt.hasMoreElements())
@@ -260,20 +300,16 @@
stream << mMaterialCode;
stream.close();
}
+}
-
- // clean up
- mMeshes.clear();
- mMaterialCode = "";
- mBonesByName.clear();
- mBoneNodesByName.clear();
- boneMap.clear();
- mSkeleton = Ogre::SkeletonPtr(NULL);
- mCustomAnimationName = "";
- // etc...
-
- Ogre::MeshManager::getSingleton().removeUnreferencedResources();
- Ogre::SkeletonManager::getSingleton().removeUnreferencedResources();
+bool AssimpLoader::convert(const Ogre::String& filename,
+ const Ogre::String& customAnimationName,
+ int loaderParams,
+ const Ogre::String& filedest,
+ const Ogre::Real animationSpeedModifier)
+{
+ load(filename,customAnimationName,loaderParams);
+ save(filedest,animationSpeedModifier);
return true;
}
@@ -873,8 +909,9 @@
if(aiGetMaterialColor(mat, AI_MATKEY_COLOR_SPECULAR, &c) == aiReturn_SUCCESS)
code += "\t\t\tspecular " + toString(c) + "\n";
- if(aiGetMaterialColor(mat, AI_MATKEY_COLOR_EMISSIVE, &c) == aiReturn_SUCCESS)
- code += "\t\t\temmissive " + toString(c) + "\n";
+ // FIXME compiler error
+ //if(aiGetMaterialColor(mat, AI_MATKEY_COLOR_EMISSIVE, &c) == aiReturn_SUCCESS)
+ // code += "\t\t\temmissive " + toString(c) + "\n";
// Specifies the type of the texture to be retrieved ( e.g. diffuse, specular, height map ...)
@@ -908,6 +945,14 @@
Ogre::String texBasename, texExtention, texPath;
Ogre::StringUtil::splitFullFilename(Ogre::String(path.data), texBasename, texExtention, texPath);
+ // remove \" character which is present sometimes for some reason, possible bug in Assimp
+ trimLeft(texPath);
+ trimRight(texExtention);
+
+ // add resource location for later loading of resources
+ if(mLoaderParams & LP_LOAD_MATERIALS)
+ Ogre::ResourceGroupManager::getSingleton().addResourceLocation(texPath, "FileSystem");
+
Ogre::String texName = texBasename + "." + texExtention;
int twoSided = 0;
@@ -956,8 +1001,11 @@
code.length() * sizeof(char), false));
Ogre::MaterialManager::getSingleton().parseScript(stream, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::MaterialPtr omat = Ogre::MaterialManager::getSingleton().getByName(materialName);
- //omat->compile(false);
- //omat->load();
+
+ if(mLoaderParams & LP_LOAD_MATERIALS) {
+ omat->compile(false);
+ omat->load();
+ }
return omat;
}
diff -r a62f40292f51 src/AssimpLoader.h
--- a/src/AssimpLoader.h Sun Aug 07 11:46:04 2011 +0200
+++ b/src/AssimpLoader.h Sun Jan 22 01:08:44 2012 +0100
@@ -70,13 +70,23 @@
LP_USE_LAST_RUN_NODE_DERIVED_TRANSFORMS = 1<<3,
// Quiet mode - don't output anything
- LP_QUIET_MODE = 1<<4
+ LP_QUIET_MODE = 1<<4,
+
+ // Load textures
+ LP_LOAD_MATERIALS = 1<<5
};
+ typedef std::vector<Ogre::MeshPtr> MeshVector;
AssimpLoader();
virtual ~AssimpLoader();
// customAnimationName is only applied if the skeleton only has one animation
+ bool load(const Ogre::String& filename,
+ const Ogre::String& customAnimationName = "",
+ int loaderParams = (LP_GENERATE_SINGLE_MESH | LP_GENERATE_MATERIALS_AS_CODE | LP_LOAD_MATERIALS));
+ bool save(const Ogre::String& destination = "",
+ const Ogre::Real animationSpeedModifier = 1.0f);
+
bool convert(const Ogre::String& filename,
const Ogre::String& customAnimationName = "",
int loaderParams = (LP_GENERATE_SINGLE_MESH | LP_GENERATE_MATERIALS_AS_CODE),
@@ -84,6 +94,8 @@
const Ogre::Real animationSpeedModifier = 1.0f);
const Ogre::String& getBasename(){ return mBasename; }
+ MeshVector& getMeshes() {return mMeshes;}
+ Ogre::SkeletonPtr getSkeleton() {return mSkeleton;}
private:
bool createSubMesh(const Ogre::String& name, int index, const aiNode* pNode, const aiMesh *mesh, const aiMaterial* mat, Ogre::MeshPtr mMesh, Ogre::AxisAlignedBox& mAAB, const Ogre::String& mDir);
@@ -117,7 +129,6 @@
typedef std::map<Ogre::String, aiMatrix4x4> NodeTransformMap;
NodeTransformMap mNodeDerivedTransformByName;
- typedef std::vector<Ogre::MeshPtr> MeshVector;
MeshVector mMeshes;
Ogre::SkeletonPtr mSkeleton;
diff -r a62f40292f51 src/CMakeLists.txt
--- a/src/CMakeLists.txt Sun Aug 07 11:46:04 2011 +0200
+++ b/src/CMakeLists.txt Sun Jan 22 01:08:44 2012 +0100
@@ -49,7 +49,7 @@
)
add_library(OgreAssimpLoader STATIC ${HDRS} ${SRCS})
-set_target_properties(OgreAssimpLoader PROPERTIES DEBUG_POSTFIX _d)
+set_target_properties(OgreAssimpLoader PROPERTIES DEBUG_POSTFIX _d COMPILE_FLAGS -fPIC)
target_link_libraries(OgreAssimpLoader ${OGRE_LIBRARIES} ${ASSIMP_LIBRARIES})
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Great!
I am not as active these days, so thanks for pinging me at my Google account!
I'll see if I can manage to scramble together a dev machine and apply it.
Thanks.
I am not as active these days, so thanks for pinging me at my Google account!
I'll see if I can manage to scramble together a dev machine and apply it.
Thanks.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 10
- Joined: Fri Sep 23, 2011 2:49 am
Re: OgreAssimpConverter
Heya,
Just making a quick post to support this project. It's a great idea, and I really like that it supports .blend files (not all of us can justify buying 3ds max ). I hope project does not fall by the way-side in the future (:
Just making a quick post to support this project. It's a great idea, and I really like that it supports .blend files (not all of us can justify buying 3ds max ). I hope project does not fall by the way-side in the future (:
- LiMuBei
- Goblin
- Posts: 297
- Joined: Mon Jun 09, 2008 3:56 pm
- Location: Karlsruhe, Germany
- x 10
Re: OgreAssimpConverter
Just tried to compile this. Costs me a ton of self discipline not to rant about assimp right now (you know it's got "ass" in its name?)...
Well, I finally managed to built that ... library but now when linking ogreassimp I'm getting this unresolved external symbol error
Anyone already experienced this? It seems to be dependent on the way one builds assimp. For the love of God though, I don't want to fiddle with that again...
EDIT: Solved this, one needs to manually add zlib as dependency to OgreAssimp.
Well, I finally managed to built that ... library but now when linking ogreassimp I'm getting this unresolved external symbol error
Code: Select all
unresolved external symbol _inflateEnd referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(...)
EDIT: Solved this, one needs to manually add zlib as dependency to OgreAssimp.
- Attachments
-
- ZlibMissing.patch
- (1.79 KiB) Downloaded 337 times
-
- Gremlin
- Posts: 196
- Joined: Tue Aug 08, 2006 6:45 pm
- x 14
Re: OgreAssimpConverter
I've just noticed that when assimp imports and triangluates polygons it creates faces with > 3 indices see the wxAssert that was present before. Using all the indices does create the proper geometry... I think heh. I need to merge my code with joes but untill then heres a fix. Most of the time the data you start with is already triangluated so its not an issue. But if you are seeing glitches with certain submeshes over what the assimpview app shows, it could well be this.
Need to change
Need to change
Code: Select all
submesh->indexData->indexCount = mesh->mNumFaces * 3;
to
submesh->indexData->indexCount = mesh->mNumFaces * f->mNumIndices;
and the iteration over the face data is
for (size_t i=0; i < mesh->mNumFaces; ++i)
{
for(int j=0; j<f->mNumIndices; ++j)
{
*idata++ = f->mIndices[j];
}
f++;
}
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
The project has moved to Bitbucket:
https://bitbucket.org/jacmoe/ogreassimp
Would make it easier if anyone likes to contribute as it's easier to create forks and issue pull requests.
Update your links/bookmarks.
I will tend to the project before spring becomes summer..
https://bitbucket.org/jacmoe/ogreassimp
Would make it easier if anyone likes to contribute as it's easier to create forks and issue pull requests.
Update your links/bookmarks.
I will tend to the project before spring becomes summer..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Minaton
- Posts: 933
- Joined: Mon Mar 05, 2012 11:37 am
- Location: Germany
- x 110
Re: OgreAssimpConverter
diff -r 484659933f54 CMakeLists.txt
--- a/CMakeLists.txt Fri Apr 27 21:12:45 2012 +0200
+++ b/CMakeLists.txt Thu Jun 14 12:53:29 2012 +0200
@@ -89,9 +89,9 @@
# search names with "lib". This is the workaround.
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
endif ()
- set(Boost_ADDITIONAL_VERSIONS "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
+ set(Boost_ADDITIONAL_VERSIONS "1.50" "1.50.0" "1.49" "1.49.0" "1.48" "1.48.0" "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
# Components that need linking (NB does not include header-only components like bind)
set(OGRE_BOOST_COMPONENTS thread date_time)
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
if (NOT Boost_FOUND)
# Try again with the other type of libs
@@ -105,6 +105,8 @@
add_definitions(-DBOOST_ALL_NO_LIB)
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})
endif()
+find_package(ZLIB REQUIRED)
+set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZLIB_LIBRARIES})
find_package(ASSIMP REQUIRED)
diff -r 484659933f54 CMakeModules/FindASSIMP.cmake
--- a/CMakeModules/FindASSIMP.cmake Fri Apr 27 21:12:45 2012 +0200
+++ b/CMakeModules/FindASSIMP.cmake Thu Jun 14 12:53:29 2012 +0200
@@ -33,7 +33,7 @@
findpkg_framework(ASSIMP)
-find_path(ASSIMP_INCLUDE_DIR NAMES assimp.h HINTS ${ASSIMP_INC_SEARCH_PATH} ${ASSIMP_PKGC_INCLUDE_DIRS} PATH_SUFFIXES assimp)
+find_path(ASSIMP_INCLUDE_DIR NAMES config.h HINTS ${ASSIMP_INC_SEARCH_PATH} ${ASSIMP_PKGC_INCLUDE_DIRS} PATH_SUFFIXES assimp)
find_library(ASSIMP_LIBRARY_REL NAMES ${ASSIMP_LIBRARY_NAMES} HINTS ${ASSIMP_LIB_SEARCH_PATH} ${ASSIMP_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
find_library(ASSIMP_LIBRARY_DBG NAMES ${ASSIMP_LIBRARY_NAMES_DBG} HINTS ${ASSIMP_LIB_SEARCH_PATH} ${ASSIMP_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
make_library_set(ASSIMP_LIBRARY)
- ASSIMP requires ZLIB (only on static assimp build)
- Update boost versions
- assimp.h and assimp.hpp are missing
- Attachments
-
- update.patch
- Patch
- (1.99 KiB) Downloaded 282 times
Last edited by Transporter on Fri Jun 15, 2012 2:55 pm, edited 1 time in total.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Zlib ?
How and when?
Static linking, I presume?
I'll add the extra Boost versions, but I am not so sure about the other changes.
What version of assimp are you using, Transporter?
We are working against the assimp repository on Github, 'master' branch:
https://github.com/assimp/assimp
It's a mirror of the svn repository, so I guess you can call it 'trunk'.
The main reason is important assimp fixes for new Boost versions.
How and when?
Static linking, I presume?
I'll add the extra Boost versions, but I am not so sure about the other changes.
What version of assimp are you using, Transporter?
We are working against the assimp repository on Github, 'master' branch:
https://github.com/assimp/assimp
It's a mirror of the svn repository, so I guess you can call it 'trunk'.
The main reason is important assimp fixes for new Boost versions.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- LiMuBei
- Goblin
- Posts: 297
- Joined: Mon Jun 09, 2008 3:56 pm
- Location: Karlsruhe, Germany
- x 10
Re: OgreAssimpConverter
As you can see some posts above, I also had the problem with the extra zlib dependency. I'm not sure, it's been a while, but I think I used the latest released version of assimp at the time. So it's possbile that with trunk this got fixed in the meantime
-
- Minaton
- Posts: 933
- Joined: Mon Mar 05, 2012 11:37 am
- Location: Germany
- x 110
Re: OgreAssimpConverter
Yes, I'm working against the SVN trunk. I didn't know that there is a git repository. I just followed the main website on sourceforge. zlib is needed for compressed XGL files, compressed blend files and quake 3 bsp. But you're right I made a mistake and created a static build of assimp.
I've checked out assimp and ogreassimp again and rebuild it a few minutes ago.
Now, I don't need to link zlib but I still have to change FindASSIMP because assimp.h doesn't exist.
Edit: Should I make a patch for static assimp support?
I've checked out assimp and ogreassimp again and rebuild it a few minutes ago.
Now, I don't need to link zlib but I still have to change FindASSIMP because assimp.h doesn't exist.
Edit: Should I make a patch for static assimp support?
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Not so fast.
What do you mean 'assimp.h' doesn't exist?
I will try against a fresh checkout, but I clearly see assimp.h being installed into /usr/local/include/assimp.
Or is this a platform issue?
You can create a pull request or patch for a static build, that would be nice.
((As I am not building statically on my machines))
What do you mean 'assimp.h' doesn't exist?
I will try against a fresh checkout, but I clearly see assimp.h being installed into /usr/local/include/assimp.
Or is this a platform issue?
You can create a pull request or patch for a static build, that would be nice.
((As I am not building statically on my machines))
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Minaton
- Posts: 933
- Joined: Mon Mar 05, 2012 11:37 am
- Location: Germany
- x 110
Re: OgreAssimpConverter
Looks like a strange issue, there is no assimp.h in trunk (also no assimp.h on github). I can't find any install script to create this file.jacmoe wrote:Not so fast.
What do you mean 'assimp.h' doesn't exist?
I will try against a fresh checkout, but I clearly see assimp.h being installed into /usr/local/include/assimp.
Or is this a platform issue?
You can create a pull request or patch for a static build, that would be nice.
((As I am not building statically on my machines))
Edit: I use win32.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Never mind me - looks like I am rambling on about the wrong version of assimp (more than 4 months old).
assimp.h doesn't exist, of course.
And we are not including it in ogreassimp either.
The last 3 commits to ogreassimp deals with that.
It looks like we missed the mention of assimp.h in FINDAssimp, though.
I'll check it.
assimp.h doesn't exist, of course.
And we are not including it in ogreassimp either.
The last 3 commits to ogreassimp deals with that.
It looks like we missed the mention of assimp.h in FINDAssimp, though.
I'll check it.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Gah - okay.
I was sure that I used my Debian box, but I was actually working from my Windows installation when I fixed ogreassimp. Andrew was on Linux and I was on Windows.
Sorry about the confusion (on my side)
I'll also check if we are linking to assimp statically, and if if not: why not?
I guess the Zlib error occurs when Ogre is statically built, am I right?
I'll check that too.
I just need to boot out of Linux.
I was sure that I used my Debian box, but I was actually working from my Windows installation when I fixed ogreassimp. Andrew was on Linux and I was on Windows.
Sorry about the confusion (on my side)
I'll also check if we are linking to assimp statically, and if if not: why not?
I guess the Zlib error occurs when Ogre is statically built, am I right?
I'll check that too.
I just need to boot out of Linux.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: OgreAssimpConverter
Looks like the CMake script for Assimp is coded by a bloody amateur - this calls for a fork, I think..
Yes, it needs ZLib now.
I wonder what 'minizip' is?
I'll get this working on my Linux box, and then later on Windows..
Yes, it needs ZLib now.
I wonder what 'minizip' is?
I'll get this working on my Linux box, and then later on Windows..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.