From 96f2b0b53604626a8a0de67b56d387d7d0d5186e Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Wed, 10 Sep 2008 14:39:35 +0000 Subject: [PATCH] Removed AI_C_THREADSAFE flag - there are unknown compiler errors in the x64 build. Removed config options for LWO, code cleanup; still WIP Added a few StandardShapes implementations. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@126 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CREDITS | 7 ++ code/Assimp.cpp | 2 +- code/LWOFileData.h | 47 +++------ code/LWOLoader.cpp | 9 +- code/LWOLoader.h | 17 +-- code/LWOMaterial.cpp | 22 +--- code/NFFLoader.cpp | 15 +-- code/StandardShapes.cpp | Bin 2835 -> 10392 bytes code/StandardShapes.h | 10 ++ include/aiConfig.h | 11 -- workspaces/vc8/assimp.vcproj | 1 + workspaces/vc8/assimp_view.vcproj | 166 +++++++++++++++--------------- 12 files changed, 137 insertions(+), 170 deletions(-) diff --git a/CREDITS b/CREDITS index ca96c05f3..7ac0ffe03 100644 --- a/CREDITS +++ b/CREDITS @@ -9,3 +9,10 @@ Thanks for your help! - Andrew Galante, submitted patches to make Assimp compile with GCC-4, a makefile and the xcode3 workspace. +- Andreas Nagel +tested Assimp under Windows Vista 64 Bit + +- Marius Schröder +allowed us to use many of his models for screenshots and testing + +... and many others \ No newline at end of file diff --git a/code/Assimp.cpp b/code/Assimp.cpp index 8c9ba964d..1170bb768 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "GenericProperty.h" // boost headers -#define AI_C_THREADSAFE +//#define AI_C_THREADSAFE #if (defined AI_C_THREADSAFE) # include # include diff --git a/code/LWOFileData.h b/code/LWOFileData.h index b4ae07c8f..fba4b10fc 100644 --- a/code/LWOFileData.h +++ b/code/LWOFileData.h @@ -325,31 +325,6 @@ struct WeightChannel : public VMapEntry }; -// --------------------------------------------------------------------------- -/** \brief LWO2 gradient keyframe - */ -struct GradientKey -{ - aiColor4D color; - float value; -}; - -// --------------------------------------------------------------------------- -/** \brief Data structure for a LWO2 gradient - */ -struct GradientInfo -{ - GradientInfo() - : mStart(0.0f) - , mEnd(1.0f) - {} - - float mStart,mEnd; - bool mRepeat; - std::vector mKeys; -}; - - // --------------------------------------------------------------------------- /** \brief Data structure for a LWO file texture */ @@ -357,12 +332,16 @@ struct Texture { Texture() : mStrength (1.0f) - , iUVChannelIndex (0) + , mUVChannelIndex ("unknown") + , mClipIdx(0xffffffff) {} //! File name of the texture std::string mFileName; + //! Clip index + unsigned int mClipIdx; + //! Strength of the texture float mStrength; @@ -370,13 +349,18 @@ struct Texture /*************** SPECIFIC TO LWO2 *********************/ uint32_t type; // type of the texture - //! Index of the corresponding UV channel - unsigned int iUVChannelIndex; - - GradientInfo mGradient; - // todo ... maybe support for procedurals? + //! Name of the corresponding UV channel + std::string mUVChannelIndex; }; +// --------------------------------------------------------------------------- +/** \brief Data structure for a LWO file clip + */ +struct Clip +{ + //! path to the base texture + std::string path; +}; // --------------------------------------------------------------------------- /** \brief Data structure for a LWO file surface (= material) @@ -432,6 +416,7 @@ typedef std::vector < unsigned int > TagMappingTable; typedef std::vector < WeightChannel > WeightChannelList; typedef std::vector < VColorChannel > VColorChannelList; typedef std::vector < UVChannel > UVChannelList; +typedef std::vector < Clip > ClipList; // --------------------------------------------------------------------------- diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index 952c98964..a490fe60f 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -95,8 +95,7 @@ bool LWOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler) const // Setup configuration properties void LWOImporter::SetupProperties(const Importer* pImp) { - this->configGradientResX = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_LWO_GRADIENT_RESX,512); - this->configGradientResY = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_LWO_GRADIENT_RESY,512); + // -- no configuration options at the moment } // ------------------------------------------------------------------------------------------------ // Imports the given file into the given scene structure. @@ -669,14 +668,14 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) { DefaultLogger::get()->warn("LWO2: Found UV channel with != 2 components"); } - mCurLayer->mUVChannels.push_back(UVChannel(mCurLayer->mTempPoints.size())); + mCurLayer->mUVChannels.push_back(UVChannel((unsigned int)mCurLayer->mTempPoints.size())); base = &mCurLayer->mUVChannels.back(); case AI_LWO_WGHT: if (dims != 1) { DefaultLogger::get()->warn("LWO2: found vertex weight map with != 1 components"); } - mCurLayer->mWeightChannels.push_back(WeightChannel(mCurLayer->mTempPoints.size())); + mCurLayer->mWeightChannels.push_back(WeightChannel((unsigned int)mCurLayer->mTempPoints.size())); base = &mCurLayer->mWeightChannels.back(); case AI_LWO_RGB: case AI_LWO_RGBA: @@ -684,7 +683,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) { DefaultLogger::get()->warn("LWO2: found vertex color map with != 3&4 components"); } - mCurLayer->mVColorChannels.push_back(VColorChannel(mCurLayer->mTempPoints.size())); + mCurLayer->mVColorChannels.push_back(VColorChannel((unsigned int)mCurLayer->mTempPoints.size())); base = &mCurLayer->mVColorChannels.back(); default: return; }; diff --git a/code/LWOLoader.h b/code/LWOLoader.h index dd8002ecf..e1f6ed449 100644 --- a/code/LWOLoader.h +++ b/code/LWOLoader.h @@ -217,17 +217,6 @@ private: */ void ResolveTags(); - // ------------------------------------------------------------------- - /** Computes a proper texture form a procedural gradient - * description. - * @param grad Gradient description - * @param out List of output textures. The new texture should - * be added to the list, if the conversion was successful. - * @return true if successful - */ - bool ComputeGradientTexture(LWO::GradientInfo& grad, - std::vector& out); - // ------------------------------------------------------------------- /** Parse a string from the current file position */ @@ -294,6 +283,9 @@ protected: /** Temporary surface list from the file */ SurfaceList* mSurfaces; + /** Temporary clip list from the file */ + ClipList mClips; + /** file buffer */ LE_NCONST uint8_t* mFileBuffer; @@ -302,9 +294,6 @@ protected: /** Output scene */ aiScene* pScene; - - /** Configuration option: X and Y size of gradient maps */ - unsigned int configGradientResX,configGradientResY; }; } // end of namespace Assimp diff --git a/code/LWOMaterial.cpp b/code/LWOMaterial.cpp index 85ad1f0d1..a8fa4f453 100644 --- a/code/LWOMaterial.cpp +++ b/code/LWOMaterial.cpp @@ -135,13 +135,13 @@ void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex ) // ------------------------------------------------------------------------------------------------ void LWOImporter::LoadLWO2Procedural(unsigned int size, LWO::Texture& tex ) { - LE_NCONST uint8_t* const end = mFileBuffer + size; + // --- not supported at the moment } // ------------------------------------------------------------------------------------------------ void LWOImporter::LoadLWO2Gradient(unsigned int size, LWO::Texture& tex ) { - LE_NCONST uint8_t* const end = mFileBuffer + size; + // --- not supported at the moment } // ------------------------------------------------------------------------------------------------ @@ -245,6 +245,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size) { case AI_LWO_IMAP: case AI_LWO_PROC: + break; case AI_LWO_GRAD: mFileBuffer+=4; LoadLWO2TextureBlock(type,head_length-4); @@ -257,20 +258,3 @@ void LWOImporter::LoadLWO2Surface(unsigned int size) mFileBuffer = next; } } - -// ------------------------------------------------------------------------------------------------ -bool LWOImporter::ComputeGradientTexture(LWO::GradientInfo& grad, - std::vector& out) -{ - aiTexture* tex = new aiTexture(); - - tex->mHeight = configGradientResY; - tex->mWidth = configGradientResX; - unsigned int numPixels; - tex->pcData = new aiTexel[numPixels = tex->mHeight * tex->mWidth]; - - // to be implemented ... - - out.push_back(tex); - return true; -} diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index 9c01c435a..45977a7ce 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -112,6 +112,14 @@ bool GetNextLine(const char*& buffer, char out[4096]) AI_NFF_PARSE_FLOAT(v.y) \ AI_NFF_PARSE_FLOAT(v.z) +// ------------------------------------------------------------------------------------------------ +#define AI_NFF_PARSE_SHAPE_INFORMATION() \ + sz = &line[1]; \ + aiVector3D center; float radius; \ + AI_NFF_PARSE_TRIPLE(center); \ + AI_NFF_PARSE_FLOAT(radius); \ + currentMesh.center = center; + // ------------------------------------------------------------------------------------------------ // Imports the given file into the given scene structure. void NFFImporter::InternReadFile( const std::string& pFile, @@ -243,12 +251,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, MeshInfo& currentMesh = meshesLocked.back(); currentMesh.shader = s; - sz = &line[1]; - aiVector3D center; float radius; - AI_NFF_PARSE_TRIPLE(center); - AI_NFF_PARSE_FLOAT(radius); - - currentMesh.center = center; + AI_NFF_PARSE_SHAPE_INFORMATION(); // generate the sphere - it consists of simple triangles StandardShapes::MakeSphere(aiVector3D(), radius, 500.0f, currentMesh.vertices); diff --git a/code/StandardShapes.cpp b/code/StandardShapes.cpp index 7e9dca41f50d0f4ccff2363653be809383e2fed0..e696f78e097ef2773d0aa115f89459fd946e0b64 100644 GIT binary patch literal 10392 zcmeI2Yfl?T6o%)kEA>CPM2eh1xTd+bRn09y;#M1yMr~DrfdmCiY8z5g<*&DWpL2FR zYgijYQk6E5wd>ilGv~bLIv4w|KPSTN@MZWStc5pWH#9>zR6|>z-Oy2cDIAJ^6k7JQ z9QMPu+FQC#^|qqEb$yn?N>~rKjL)5LeLm>LH75<;2ysjJUxrtvOC>afxE!X#q(1kA z+FK98nAsrdRSxsA#)+;2<8x?s!a5sjZOKB&sOs&3Xh}xfo_5WaEgQcR#;q^?YZ|*F zJZ+(2%yu|dYhM!Z!Ithj`aZVNWl{I^)Dd<@lyyPrgtz94T~YRJ9Q0%HYlwT|vTbjp z*Y?z>CDd)x6fAG`9^S}l=^mfqg`S6^gLO|=LlPrSECp9&5j}8)Q^$0J*3!rm(RMNl zQW)>LFb?@3!g@z0xhWr&B?n6&HA+M8C=DNU!lSM=Z|mJ4i!#=2*lQuAfDIk7HOSDX zBS~&i5W6k6)t4v$aakY6o{g%eXyC>ESSNYxKvd`NIQr@5es`%+QjvW;b{eu8NU=vN z7hS{H!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%+)Ii!4~|T6XLn|YOOMV6{d6N+3c5~O;>|`IOR-v+!aUMxAOxSy&j$VXZ}K7@oQbz`a!j~RO+@;F0AumjkK4p z%yW8PXy+>27gXv>QnT$WnArk_I?Q6F@8zIR0DO|F)mD{qxFc4BwZk~h2kr=UL5F&v zPFWYKk;cpQvJT`sQsb!(kgT>4>)$EGb;BW7y4<=Rd!1clM(BaY8{I`|_>4st zC;&-`U9%)7F%9DQE2AViQYhkH=L{#alaUQ!gyf(a9J`b}NXoN$q`nX4OOh{agsJYVFDCTSXZy#>pz zdC0`i6sN8OSF{iel|(@v_}svNV0aG(hf|{{3XQ(^H`n^`n^J3%hGD|L-elKD>3nzSfb+wOS9%Fci9Y;}2g?_+;Cfc*B3HoDtgv-n*Cs-ORRwxMocu9X>8-S`Y2|+1;ffla|4M6IsPcUD|B+3ZvVKiCPvMzLxWJpD R_Umu#p3gKI(Rcgf^AEZRCO!ZF diff --git a/code/StandardShapes.h b/code/StandardShapes.h index ceb00b4d7..213dcdd19 100644 --- a/code/StandardShapes.h +++ b/code/StandardShapes.h @@ -59,6 +59,16 @@ class ASSIMP_API StandardShapes public: + /** @brief Generates an icosahedron + * + * @param center Center point of the icosahedron + * @param length Face length of the icosahedron + * @param positions Receives output triangles. + */ + static void MakeIcosahedron(aiVector3D& center,float length, + std::vector& positions); + + /** @brief Generates a sphere * * @param center Center point of the sphere diff --git a/include/aiConfig.h b/include/aiConfig.h index 005290395..5d3e14022 100644 --- a/include/aiConfig.h +++ b/include/aiConfig.h @@ -110,17 +110,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define AI_CONFIG_IMPORT_3DS_IGNORE_PIVOT "imp.3ds.nopivot" -// --------------------------------------------------------------------------- -/** \brief Sets the resolution of gradient textures generated by - * the LWO loader. - * - * LightWave represents the gradients with infinite detail, - * but for use in realtime the loader computes replacement textures. - * The default size is 512 * 512. - * Property type: integer. - */ -#define AI_CONFIG_IMPORT_LWO_GRADIENT_RESX "imp.lwo.gradres_x" -#define AI_CONFIG_IMPORT_LWO_GRADIENT_RESY "imp.lwo.gradres_y" // --------------------------------------------------------------------------- /** \brief Specifies the maximum angle that may be between two vertex tangents diff --git a/workspaces/vc8/assimp.vcproj b/workspaces/vc8/assimp.vcproj index 313e5a70c..d2ab7d68a 100644 --- a/workspaces/vc8/assimp.vcproj +++ b/workspaces/vc8/assimp.vcproj @@ -235,6 +235,7 @@ AdditionalIncludeDirectories="" PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32" StringPooling="true" + RuntimeLibrary="0" BufferSecurityCheck="false" EnableEnhancedInstructionSet="2" WarningLevel="3" diff --git a/workspaces/vc8/assimp_view.vcproj b/workspaces/vc8/assimp_view.vcproj index 4d858155a..9d24c8955 100644 --- a/workspaces/vc8/assimp_view.vcproj +++ b/workspaces/vc8/assimp_view.vcproj @@ -99,87 +99,6 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +