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
pull/1/head
aramis_acg 2008-09-10 14:39:35 +00:00
parent d4d9d016d1
commit 96f2b0b536
12 changed files with 137 additions and 170 deletions

View File

@ -9,3 +9,10 @@ Thanks for your help!
- Andrew Galante, - Andrew Galante,
submitted patches to make Assimp compile with GCC-4, a makefile and the xcode3 workspace. 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

View File

@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "GenericProperty.h" #include "GenericProperty.h"
// boost headers // boost headers
#define AI_C_THREADSAFE //#define AI_C_THREADSAFE
#if (defined AI_C_THREADSAFE) #if (defined AI_C_THREADSAFE)
# include <boost/thread/thread.hpp> # include <boost/thread/thread.hpp>
# include <boost/thread/mutex.hpp> # include <boost/thread/mutex.hpp>

View File

@ -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 /** \brief Data structure for a LWO file texture
*/ */
@ -357,12 +332,16 @@ struct Texture
{ {
Texture() Texture()
: mStrength (1.0f) : mStrength (1.0f)
, iUVChannelIndex (0) , mUVChannelIndex ("unknown")
, mClipIdx(0xffffffff)
{} {}
//! File name of the texture //! File name of the texture
std::string mFileName; std::string mFileName;
//! Clip index
unsigned int mClipIdx;
//! Strength of the texture //! Strength of the texture
float mStrength; float mStrength;
@ -370,13 +349,18 @@ struct Texture
/*************** SPECIFIC TO LWO2 *********************/ /*************** SPECIFIC TO LWO2 *********************/
uint32_t type; // type of the texture uint32_t type; // type of the texture
//! Index of the corresponding UV channel //! Name of the corresponding UV channel
unsigned int iUVChannelIndex; std::string mUVChannelIndex;
GradientInfo mGradient;
// todo ... maybe support for procedurals?
}; };
// ---------------------------------------------------------------------------
/** \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) /** \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 < WeightChannel > WeightChannelList;
typedef std::vector < VColorChannel > VColorChannelList; typedef std::vector < VColorChannel > VColorChannelList;
typedef std::vector < UVChannel > UVChannelList; typedef std::vector < UVChannel > UVChannelList;
typedef std::vector < Clip > ClipList;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -95,8 +95,7 @@ bool LWOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler) const
// Setup configuration properties // Setup configuration properties
void LWOImporter::SetupProperties(const Importer* pImp) void LWOImporter::SetupProperties(const Importer* pImp)
{ {
this->configGradientResX = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_LWO_GRADIENT_RESX,512); // -- no configuration options at the moment
this->configGradientResY = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_LWO_GRADIENT_RESY,512);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // 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"); 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(); base = &mCurLayer->mUVChannels.back();
case AI_LWO_WGHT: case AI_LWO_WGHT:
if (dims != 1) if (dims != 1)
{ {
DefaultLogger::get()->warn("LWO2: found vertex weight map with != 1 components"); 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(); base = &mCurLayer->mWeightChannels.back();
case AI_LWO_RGB: case AI_LWO_RGB:
case AI_LWO_RGBA: 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"); 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(); base = &mCurLayer->mVColorChannels.back();
default: return; default: return;
}; };

View File

@ -217,17 +217,6 @@ private:
*/ */
void ResolveTags(); 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 /** Parse a string from the current file position
*/ */
@ -294,6 +283,9 @@ protected:
/** Temporary surface list from the file */ /** Temporary surface list from the file */
SurfaceList* mSurfaces; SurfaceList* mSurfaces;
/** Temporary clip list from the file */
ClipList mClips;
/** file buffer */ /** file buffer */
LE_NCONST uint8_t* mFileBuffer; LE_NCONST uint8_t* mFileBuffer;
@ -302,9 +294,6 @@ protected:
/** Output scene */ /** Output scene */
aiScene* pScene; aiScene* pScene;
/** Configuration option: X and Y size of gradient maps */
unsigned int configGradientResX,configGradientResY;
}; };
} // end of namespace Assimp } // end of namespace Assimp

View File

@ -135,13 +135,13 @@ void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex )
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void LWOImporter::LoadLWO2Procedural(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 ) 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_IMAP:
case AI_LWO_PROC: case AI_LWO_PROC:
break;
case AI_LWO_GRAD: case AI_LWO_GRAD:
mFileBuffer+=4; mFileBuffer+=4;
LoadLWO2TextureBlock(type,head_length-4); LoadLWO2TextureBlock(type,head_length-4);
@ -257,20 +258,3 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
mFileBuffer = next; 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;
}

View File

@ -112,6 +112,14 @@ bool GetNextLine(const char*& buffer, char out[4096])
AI_NFF_PARSE_FLOAT(v.y) \ AI_NFF_PARSE_FLOAT(v.y) \
AI_NFF_PARSE_FLOAT(v.z) 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. // Imports the given file into the given scene structure.
void NFFImporter::InternReadFile( const std::string& pFile, void NFFImporter::InternReadFile( const std::string& pFile,
@ -243,12 +251,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
MeshInfo& currentMesh = meshesLocked.back(); MeshInfo& currentMesh = meshesLocked.back();
currentMesh.shader = s; currentMesh.shader = s;
sz = &line[1]; AI_NFF_PARSE_SHAPE_INFORMATION();
aiVector3D center; float radius;
AI_NFF_PARSE_TRIPLE(center);
AI_NFF_PARSE_FLOAT(radius);
currentMesh.center = center;
// generate the sphere - it consists of simple triangles // generate the sphere - it consists of simple triangles
StandardShapes::MakeSphere(aiVector3D(), radius, 500.0f, currentMesh.vertices); StandardShapes::MakeSphere(aiVector3D(), radius, 500.0f, currentMesh.vertices);

Binary file not shown.

View File

@ -59,6 +59,16 @@ class ASSIMP_API StandardShapes
public: 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 /** @brief Generates a sphere
* *
* @param center Center point of the sphere * @param center Center point of the sphere

View File

@ -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" #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 /** \brief Specifies the maximum angle that may be between two vertex tangents

View File

@ -235,6 +235,7 @@
AdditionalIncludeDirectories="" AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32" PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2" EnableEnhancedInstructionSet="2"
WarningLevel="3" WarningLevel="3"

View File

@ -99,87 +99,6 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
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"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<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=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)" OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
@ -262,6 +181,87 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
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"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<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=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)" OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
@ -417,7 +417,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Release|Win32" Name="Debug|x64"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
@ -425,7 +425,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Debug|x64" Name="Release|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"