Browse Source

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

aramis_acg 17 years ago
parent
commit
96f2b0b536

+ 7 - 0
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

+ 1 - 1
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 <boost/thread/thread.hpp>
 #	include <boost/thread/mutex.hpp>

+ 16 - 31
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<GradientKey> 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;
 
 
 // ---------------------------------------------------------------------------

+ 4 - 5
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;
 	};

+ 3 - 14
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<aiTexture*>& 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

+ 3 - 19
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<aiTexture*>& 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;
-}

+ 9 - 6
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);

BIN
code/StandardShapes.cpp


+ 10 - 0
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<aiVector3D>& positions);
+
+
 	/** @brief Generates a sphere
 	 *
 	 *  @param center Center point of the sphere

+ 0 - 11
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

+ 1 - 0
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"

+ 29 - 29
workspaces/vc8/assimp_view.vcproj

@@ -100,12 +100,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
 			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
 			ConfigurationType="1"
 			CharacterSet="2"
-			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -121,15 +120,21 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
-				RuntimeLibrary="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				SmallerTypeCheck="true"
+				RuntimeLibrary="1"
+				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="2"
 				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
+				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
 			/>
 			<Tool
@@ -144,16 +149,12 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
-				OutputFile="$(OutDir)\assimpview32.exe"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\lib\assimp_release_win32;&quot;$(DXSDK_DIR)lib\x86&quot;"
-				IgnoreAllDefaultLibraries="false"
-				IgnoreDefaultLibraryNames=""
+				OutputFile="$(OutDir)\assimpview64d.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\lib\assimp_debug_x64;&quot;$(DXSDK_DIR)lib\x64&quot;"
 				GenerateDebugInformation="true"
 				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
+				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -181,11 +182,12 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
 			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
 			ConfigurationType="1"
 			CharacterSet="2"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -201,21 +203,15 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				SmallerTypeCheck="true"
-				RuntimeLibrary="1"
-				EnableFunctionLevelLinking="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
 				UsePrecompiledHeader="2"
 				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
+				Detect64BitPortabilityProblems="true"
 				DebugInformationFormat="3"
 			/>
 			<Tool
@@ -230,12 +226,16 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
-				OutputFile="$(OutDir)\assimpview64d.exe"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="..\..\lib\assimp_debug_x64;&quot;$(DXSDK_DIR)lib\x64&quot;"
+				OutputFile="$(OutDir)\assimpview32.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\lib\assimp_release_win32;&quot;$(DXSDK_DIR)lib\x86&quot;"
+				IgnoreAllDefaultLibraries="false"
+				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="true"
 				SubSystem="2"
-				TargetMachine="17"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -417,7 +417,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|Win32"
+					Name="Debug|x64"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -425,7 +425,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|x64"
+					Name="Release|Win32"
 					>
 					<Tool
 						Name="VCCLCompilerTool"