FIX: SMDLoader was broken due to erroneous 'rt' in input stream construction.

FIX: MD3Loader, revive dead branch.
FIX: TargetAnimation - clarify doc on preconditions. 
FIX: aiMatrix3x3::FromTo - move cross product into a branch to save it we can do it without it.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@530 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-01-19 20:05:14 +00:00
parent 1c0f3f1b2e
commit c999f65a7d
5 changed files with 19 additions and 26 deletions

View File

@ -303,7 +303,7 @@ void Q3Shader::ConvertShaderToMaterial(MaterialHelper* out, const ShaderDataBloc
type = aiTextureType_EMISSIVE;
}
}
else if ((*it).blend_src == Q3Shader::BLEND_GL_DST_COLOR && Q3Shader::BLEND_GL_ZERO) {
else if ((*it).blend_src == Q3Shader::BLEND_GL_DST_COLOR && (*it).blend_dest == Q3Shader::BLEND_GL_ZERO) {
index = cur_lm++;
type = aiTextureType_LIGHTMAP;
}

View File

@ -96,7 +96,7 @@ void SMDImporter::SetupProperties(const Importer* pImp)
void SMDImporter::InternReadFile(
const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
{
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rt"));
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
if( file.get() == NULL) {

View File

@ -92,8 +92,9 @@ inline T Interpolate(const T& one, const T& two, float val)
void KeyIterator::operator ++()
{
// If we are already at the end of all keyframes, return
if (reachedEnd)return;
if (reachedEnd) {
return;
}
// Now search in all arrays for the time value closest
// to our current position on the time line
@ -125,8 +126,7 @@ void KeyIterator::operator ++()
curTime = d0;
// interpolate the other
if (1 == targetObjPos->size() || !nextTargetObjPos)
{
if (1 == targetObjPos->size() || !nextTargetObjPos) {
curTargetPosition = targetObjPos->at(0).mValue;
}
else
@ -147,8 +147,7 @@ void KeyIterator::operator ++()
curTime = d1;
// interpolate the other
if (1 == objPos->size() || !nextObjPos)
{
if (1 == objPos->size() || !nextObjPos) {
curPosition = objPos->at(0).mValue;
}
else
@ -199,15 +198,12 @@ void TargetAnimationHelper::SetFixedMainAnimationChannel(
// ------------------------------------------------------------------------------------------------
void TargetAnimationHelper::Process(std::vector<aiVectorKey>* distanceTrack)
{
ai_assert(NULL != targetPositions);
ai_assert(NULL != targetPositions && NULL != distanceTrack);
// TODO: in most cases we won't need the extra array
std::vector<aiVectorKey>* fill = NULL;
std::vector<aiVectorKey> real;
if (distanceTrack)
{
fill = (distanceTrack == objectPositions ? &real : distanceTrack);
}
std::vector<aiVectorKey>* fill = (distanceTrack == objectPositions ? &real : distanceTrack);
fill->reserve(std::max( objectPositions->size(), targetPositions->size() ));
// Iterate through all object keys and interpolate their values if necessary.
@ -238,11 +234,13 @@ void TargetAnimationHelper::Process(std::vector<aiVectorKey>* distanceTrack)
}
else
{
// FIXME: handle this
}
// diff is now the vector in which our camera is pointing
}
if (real.size())
if (real.size()) {
*distanceTrack = real;
}
}

View File

@ -125,8 +125,7 @@ private:
* 3DS and ASE store the differently to Assimp - there is an animation
* channel for the camera/spot light itself and a separate position
* animation channels specifying the position of the camera/spot light
* look-at target
*/
* look-at target */
class ASSIMP_API TargetAnimationHelper
{
public:
@ -143,8 +142,7 @@ public:
* This channel specifies the position of the camera/spot light
* target at a specific position.
*
* @param targetPositions Translation channel
*/
* @param targetPositions Translation channel*/
void SetTargetAnimationChannel (const
std::vector<aiVectorKey>* targetPositions);
@ -152,23 +150,20 @@ public:
// ------------------------------------------------------------------
/** Sets the main animation channel
*
* @param objectPositions Translation channel
*/
* @param objectPositions Translation channel */
void SetMainAnimationChannel ( const
std::vector<aiVectorKey>* objectPositions);
// ------------------------------------------------------------------
/** Sets the main animation channel to a fixed value
*
* @param fixed Fixed value for the main animation channel
*/
* @param fixed Fixed value for the main animation channel*/
void SetFixedMainAnimationChannel(const aiVector3D& fixed);
// ------------------------------------------------------------------
/** Computes final animation channels
*
*/
* @param distanceTrack Receive camera translation keys ... != NULL. */
void Process( std::vector<aiVectorKey>* distanceTrack );

View File

@ -168,7 +168,6 @@ inline aiMatrix3x3& aiMatrix3x3::Translation( const aiVector2D& v, aiMatrix3x3&
inline aiMatrix3x3& aiMatrix3x3::FromToMatrix(const aiVector3D& from,
const aiVector3D& to, aiMatrix3x3& mtx)
{
const aiVector3D v = from ^ to;
const float e = from * to;
const float f = (e < 0)? -e:e;
@ -223,6 +222,7 @@ inline aiMatrix3x3& aiMatrix3x3::FromToMatrix(const aiVector3D& from,
}
else /* the most common case, unless "from"="to", or "from"=-"to" */
{
const aiVector3D v = from ^ to;
/* ... use this hand optimized version (9 mults less) */
const float h = 1.0f/(1.0f + e); /* optimization by Gottfried Chen */
const float hvx = h * v.x;