Author: mp3butcher
Date: Thu Jan 29 17:09:40 2015
New Revision: 579
URL: http://svn.gna.org/viewcvs/cal3d?rev=579&view=rev
Log:
add funcs to the API:
-move morph mixer CalKeyframe from private to public
-add CoreMesh getMorphTargetId(string) (as morphtargets name are shared by all
submeshes)
Modified:
trunk/cal3d/src/cal3d/coremesh.cpp
trunk/cal3d/src/cal3d/coremesh.h
trunk/cal3d/src/cal3d/morphtargetmixer.h
Modified: trunk/cal3d/src/cal3d/coremesh.cpp
URL:
http://svn.gna.org/viewcvs/cal3d/trunk/cal3d/src/cal3d/coremesh.cpp?rev=579&r1=578&r2=579&view=diff
==============================================================================
--- trunk/cal3d/src/cal3d/coremesh.cpp (original)
+++ trunk/cal3d/src/cal3d/coremesh.cpp Thu Jan 29 17:09:40 2015
@@ -254,10 +254,10 @@
blendVertex.normal = (*iteratorVectorVertex).normal-
originVectorVertex[i].normal;
blendVertex.textureCoords.clear();
blendVertex.textureCoords.reserve(textCoordVector.size());
- for( unsigned int tcI = 0; tcI < textCoordVector.size(); tcI++ )
+ for( unsigned int tcI = 0; tcI < textCoordVector.size(); tcI++ )
{
blendVertex.textureCoords.push_back(textCoordVector[tcI][i]);
- }
+ }
if(!pCalCoreSubMorphTarget->setBlendVertex(i,blendVertex)) return -1;
@@ -267,9 +267,20 @@
++iteratorCoreSubmesh;
++otherIteratorCoreSubmesh;
}
+ ///store morphid as a mesh attribute
+ m_morphTargets[morphTargetName]=subMorphTargetID;
return subMorphTargetID;
}
-
+
/*****************************************************************************/
+/**
+ * Set the name of the file in which the core mesh is stored, if any.
+ *
+ * @param filename The path of the file.
+
*****************************************************************************/
+ int CalCoreMesh::getMorphTargetId(std::string const & morphTargetName){
+ return m_morphTargets[morphTargetName];
+
+ }
/*****************************************************************************/
/** Scale the Mesh.
*
@@ -285,12 +296,12 @@
std::vector<CalCoreSubmesh *>::iterator iteratorCoreSubmesh;
for(iteratorCoreSubmesh = m_vectorCoreSubmesh.begin();
iteratorCoreSubmesh != m_vectorCoreSubmesh.end(); ++iteratorCoreSubmesh)
{
- (*iteratorCoreSubmesh)->scale(factor);
+ (*iteratorCoreSubmesh)->scale(factor);
}
}
/*****************************************************************************/
-/**
+/**
* Set the name of the file in which the core mesh is stored, if any.
*
* @param filename The path of the file.
@@ -302,7 +313,7 @@
}
/*****************************************************************************/
-/**
+/**
* Get the name of the file in which the core mesh is stored, if any.
*
* @return One of the following values:
@@ -317,7 +328,7 @@
}
/*****************************************************************************/
-/**
+/**
* Set the symbolic name of the core mesh.
*
* @param name A symbolic name.
@@ -329,7 +340,7 @@
}
/*****************************************************************************/
-/**
+/**
* Get the symbolic name the core mesh.
*
* @return One of the following values:
Modified: trunk/cal3d/src/cal3d/coremesh.h
URL:
http://svn.gna.org/viewcvs/cal3d/trunk/cal3d/src/cal3d/coremesh.h?rev=579&r1=578&r2=579&view=diff
==============================================================================
--- trunk/cal3d/src/cal3d/coremesh.h (original)
+++ trunk/cal3d/src/cal3d/coremesh.h Thu Jan 29 17:09:40 2015
@@ -38,14 +38,21 @@
void reserve(int submeshes) { m_vectorCoreSubmesh.reserve(submeshes); }
std::vector<CalCoreSubmesh *>& getVectorCoreSubmesh();
const std::vector<CalCoreSubmesh *>& getVectorCoreSubmesh() const;
+ ///add a CalCoreMesh as MorphId
int addAsMorphTarget(CalCoreMesh *pCoreMesh, std::string const &
morphTargetName);
+ ///retrieve MorphId from MorphTargetName
+ int getMorphTargetId(std::string const & morphTargetName);
+ /// return true if submeshes have morphTargets
+ inline bool hasMorphTargets(){return !m_morphTargets.empty();}
void scale(float factor);
void setFilename(const std::string& filename);
const std::string& getFilename(void) const;
void setName(const std::string& name);
const std::string& getName(void) const;
+
private:
+ std::map<std::string,int> m_morphTargets;
std::vector<CalCoreSubmesh *> m_vectorCoreSubmesh;
std::string m_name;
std::string m_filename;
Modified: trunk/cal3d/src/cal3d/morphtargetmixer.h
URL:
http://svn.gna.org/viewcvs/cal3d/trunk/cal3d/src/cal3d/morphtargetmixer.h?rev=579&r1=578&r2=579&view=diff
==============================================================================
--- trunk/cal3d/src/cal3d/morphtargetmixer.h (original)
+++ trunk/cal3d/src/cal3d/morphtargetmixer.h Thu Jan 29 17:09:40 2015
@@ -40,6 +40,7 @@
int getMorphTargetCount() const;
void update(float deltaTime);
+ float CalcKeyframeWeight(const std::vector<CalCoreMorphKeyframe>
&keyframes, float elapsedTime);
private:
struct MorphAnimData
@@ -65,7 +66,6 @@
void SetTrackWeights(const CalCoreAnimatedMorph& morph, MorphAnimData&
data);
void ApplyWeightToMorphMesh(const std::string &morphMeshName, float
trackWeight);
- float CalcKeyframeWeight(const std::vector<CalCoreMorphKeyframe>
&keyframes, float elapsedTime);
};
#endif
_______________________________________________
Cal3d-commits mailing list
[email protected]
https://mail.gna.org/listinfo/cal3d-commits