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
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
Binary file not shown.
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user