15 #include "softNodeDesc.h" 16 #include "config_softegg.h" 18 #include "eggXfmSAnim.h" 19 #include "eggSAnimData.h" 20 #include "softToEggConverter.h" 35 _model = (SAA_Elem *)NULL;
39 _joint_type = JT_none;
43 softegg_cat.spam() <<
"parent name " << _parent->get_name();
44 _parent->_children.push_back(
this);
67 gtype = SAA_GEOM_ORIGINAL;
109 softegg_cat.spam() << endl;
122 softegg_cat.spam() <<
" set parent to " << _parent->get_name() << endl;
125 _parent->_children.push_back(
this);
137 softegg_cat.spam() <<
" current parent " << _parent->get_name();
142 softegg_cat.spam() <<
" new parent " << _parent->get_name() << endl;
145 _parent->_children.push_back(
this);
156 return (_model != (SAA_Elem *)NULL);
168 nassertr(_model != (SAA_Elem *)NULL, _model);
181 return _joint_type == JT_joint;
192 return _joint_type == JT_junk;
202 _joint_type = JT_joint;
212 return _joint_type == JT_joint_parent;
227 Children::const_iterator ci;
228 for (ci = _children.begin(); ci != _children.end(); ++ci) {
241 mark_joint_parent() {
242 if (_joint_type == JT_none) {
243 _joint_type = JT_joint_parent;
244 softegg_cat.spam() <<
" marked parent " << get_name();
247 softegg_cat.spam() <<
" ?parent " << get_name() <<
" joint type " << _joint_type;
250 _parent->mark_joint_parent();
252 softegg_cat.spam() << endl;
262 check_joint_parent() {
263 Children::const_iterator ci;
264 for (ci = _children.begin(); ci != _children.end(); ++ci) {
267 softegg_cat.spam() <<
"child " << child->get_name();
270 child->check_joint_parent();
282 check_junk(
bool parent_junk) {
283 const char *name = get_name().c_str();
286 _joint_type = JT_junk;
287 softegg_cat.spam() <<
"junk node " << get_name() << endl;
289 if ( (strstr(name,
"con-") != NULL) ||
290 (strstr(name,
"con_") != NULL) ||
291 (strstr(name,
"fly_") != NULL) ||
292 (strstr(name,
"fly-") != NULL) ||
293 (strstr(name,
"camRIG") != NULL) ||
294 (strstr(name,
"cam_rig") != NULL) ||
295 (strstr(name,
"bars") != NULL) )
297 _joint_type = JT_junk;
298 softegg_cat.spam() <<
"junk node " << get_name() << endl;
300 Children::const_iterator ci;
301 for (ci = _children.begin(); ci != _children.end(); ++ci) {
303 softegg_cat.spam() << child->get_name() <<
",";
305 softegg_cat.spam() << endl;
307 Children::const_iterator ci;
308 for (ci = _children.begin(); ci != _children.end(); ++ci) {
310 child->check_junk(parent_junk);
323 const char *name = fullname;
329 if (strstr(name, search_prefix) != NULL) {
330 softegg_cat.debug() <<
"matched " << name <<
" ";
334 if (strstr(name, search_prefix) == NULL) {
335 softegg_cat.debug() <<
"node " << name <<
" ";
350 set_parentJoint(SAA_Scene *scene,
SoftNodeDesc *lastJoint) {
354 _parentJoint = lastJoint;
355 softegg_cat.spam() << get_name() <<
": parent joint set to :" << lastJoint;
357 softegg_cat.spam() <<
"(" << lastJoint->get_name() <<
")";
358 softegg_cat.spam() << endl;
361 SAA_Boolean isSkeleton =
false;
363 SAA_modelIsSkeleton( scene,
get_model(), &isSkeleton );
366 const char *name = get_name().c_str();
367 if (
is_joint() || isSkeleton || strstr(name,
"joint") != NULL) {
370 if ( _parentJoint && strstr( _parentJoint->get_name().c_str(),
"scale" ) != NULL ) {
372 if (strstr(_parentJoint->get_name().c_str(),
"joint") == NULL) {
375 softegg_cat.spam() <<
"scale joint flag set!\n";
380 Children::const_iterator ci;
381 for (ci = _children.begin(); ci != _children.end(); ++ci) {
383 child->set_parentJoint(scene, lastJoint);
396 check_pseudo_joints(
bool joint_above) {
397 if (_joint_type == JT_joint_parent && joint_above) {
401 _joint_type = JT_pseudo_joint;
402 softegg_cat.debug() <<
"pseudo " << get_name() <<
" case1\n";
405 if (_joint_type == JT_joint) {
413 if (_joint_type != JT_none && _joint_type != JT_junk) {
415 bool any_joints =
false;
416 Children::const_iterator ci;
417 for (ci = _children.begin(); ci != _children.end(); ++ci) {
419 child->check_pseudo_joints(joint_above);
421 softegg_cat.spam() << get_name() <<
" any_joint true by " << child->get_name() << endl;
429 bool all_joints =
true;
430 for (ci = _children.begin(); ci != _children.end(); ++ci) {
432 if (child->_joint_type == JT_joint_parent) {
433 child->_joint_type = JT_pseudo_joint;
434 softegg_cat.debug() <<
"pseudo " << child->get_name() <<
" case2 by parent " << get_name() <<
"\n";
435 }
else if (child->_joint_type == JT_none || child->_joint_type == JT_junk) {
440 if (all_joints || any_joints) {
442 if (_joint_type == JT_joint_parent) {
443 _joint_type = JT_pseudo_joint;
444 softegg_cat.debug() <<
"pseudo " << get_name() <<
" case3\n";
450 softegg_cat.spam() <<
"found null joint " << get_name() << endl;
464 if (!global && _parentJoint && !stec.flatten && !scale_joint) {
466 SAA_modelGetMatrix( scene,
get_model(), SAA_COORDSYS_LOCAL, matrix );
467 softegg_cat.debug() << get_name() <<
" using local matrix :parent ";
471 SAA_modelGetMatrix( scene,
get_model(), SAA_COORDSYS_GLOBAL, matrix );
472 softegg_cat.debug() << get_name() <<
" using global matrix :parent ";
476 if (_parentJoint && !stec.flatten)
477 softegg_cat.debug() << _parentJoint->get_name() << endl;
479 softegg_cat.debug() << _parentJoint << endl;
482 softegg_cat.spam() <<
"model matrix = " << matrix[0][0] <<
" " << matrix[0][1] <<
" " << matrix[0][2] <<
" " << matrix[0][3] <<
"\n";
483 softegg_cat.spam() <<
"model matrix = " << matrix[1][0] <<
" " << matrix[1][1] <<
" " << matrix[1][2] <<
" " << matrix[1][3] <<
"\n";
484 softegg_cat.spam() <<
"model matrix = " << matrix[2][0] <<
" " << matrix[2][1] <<
" " << matrix[2][2] <<
" " << matrix[2][3] <<
"\n";
485 softegg_cat.spam() <<
"model matrix = " << matrix[3][0] <<
" " << matrix[3][1] <<
" " << matrix[3][2] <<
" " << matrix[3][3] <<
"\n";
488 LMatrix4d m4d(matrix[0][0], matrix[0][1], matrix[0][2], matrix[0][3],
489 matrix[1][0], matrix[1][1], matrix[1][2], matrix[1][3],
490 matrix[2][0], matrix[2][1], matrix[2][2], matrix[2][3],
491 matrix[3][0], matrix[3][1], matrix[3][2], matrix[3][3]);
494 softegg_cat.spam() <<
"set transform in egg_group\n";
515 SAA_Elem *skeletonPart = _model;
516 const char *name = get_name().c_str();
518 if ( skeletonPart != NULL ) {
524 softegg_cat.spam() <<
"\n\nanimating child " << name << endl;
526 if (_parentJoint && !stec.flatten && !scale_joint ) {
527 softegg_cat.debug() <<
"using local matrix\n";
530 SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_LOCAL,
534 SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_LOCAL,
538 SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_LOCAL,
541 softegg_cat.debug() <<
" using global matrix\n";
544 SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_GLOBAL,
548 SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_GLOBAL,
552 SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_GLOBAL,
556 softegg_cat.spam() <<
"\nanim data: " << i <<
" " << j <<
" " << k << endl;
557 softegg_cat.spam() <<
"\t" << p <<
" " << h <<
" " << r << endl;
558 softegg_cat.spam() <<
"\t" << x <<
" " << y <<
" " << z << endl;
563 anim->set_order(
"sphrt");
577 softegg_cat.debug() <<
"Cannot build anim table - no skeleton\n";
591 const char *name = get_name().c_str();
597 if ( stec.make_pose )
598 gtype = SAA_GEOM_DEFORMED;
601 else if ( type == SAA_MPTCH )
602 SAA_patchSetStep( scene, _model, stec.nurbs_step, stec.nurbs_step );
605 result = SAA_modelGetNbTriangles( scene, _model, gtype,
id, &numTri);
606 softegg_cat.spam() <<
"triangles: " << numTri <<
"\n";
608 if ( result != SI_SUCCESS ) {
609 softegg_cat.spam() <<
"Error: couldn't get number of triangles!\n";
610 softegg_cat.debug() <<
"\tbailing on model: " << name <<
"\n";
615 SAA_Boolean isSkeleton = FALSE;
617 SAA_modelIsSkeleton( scene, _model, &isSkeleton );
623 softegg_cat.spam() <<
"is Skeleton? " << isSkeleton <<
"\n";
629 softegg_cat.spam() <<
"no triangles!\n";
633 triangles = (SAA_SubElem *)
new SAA_SubElem[numTri];
635 softegg_cat.info() <<
"Not enough Memory for triangles...\n";
639 SAA_modelGetTriangles( scene, _model, gtype,
id, numTri, triangles );
640 softegg_cat.spam() <<
"got triangles\n";
647 materials = (SAA_Elem*)
new SAA_Elem[numTri];
648 SAA_triangleGetMaterials( scene, _model, numTri, triangles, materials );
650 softegg_cat.info() <<
"Not enough Memory for materials...\n";
653 softegg_cat.spam() <<
"got materials\n";
658 numTexTri =
new int[numTri];
662 for (i = 0; i < numTri; i++) {
663 result = SAA_materialRelationGetT2DLocNbElements( scene, &materials[i], FALSE,
664 &relinfo, &numTexTri[i] );
666 if ( result == SI_SUCCESS )
667 numTexLoc += numTexTri[i];
675 softegg_cat.spam() <<
"numTexLoc = " << numTexLoc << endl;
678 uScale =
new PN_stdfloat[numTri];
679 vScale =
new PN_stdfloat[numTri];
680 uOffset =
new PN_stdfloat[numTri];
681 vOffset =
new PN_stdfloat[numTri];
682 texNameArray =
new char *[numTri];
683 uRepeat =
new int[numTri];
684 vRepeat =
new int[numTri];
687 textures =
new SAA_Elem[numTri];
689 for ( i = 0; i < numTri; i++ ) {
691 SAA_materialRelationGetT2DLocElements( scene, &materials[i],
692 TEX_PER_MAT , &textures[i] );
695 texNameArray[i] = NULL;
697 uRepeat[i] = vRepeat[i] = 0;
700 if (numTexTri[i] == 0)
704 result = SAA_elementIsValid( scene, &textures[i], &valid );
706 if ( result != SI_SUCCESS )
707 softegg_cat.spam() <<
"SAA_elementIsValid failed!!!!\n";
715 softegg_cat.spam() <<
" tritex[" << i <<
"] named: " << texNameArray[i] << endl;
717 SAA_texture2DGetUVSwap( scene, &textures[i], &uv_swap );
719 if ( uv_swap == TRUE )
720 softegg_cat.spam() <<
" swapping u and v...\n" ;
722 SAA_texture2DGetUScale( scene, &textures[i], &uScale[i] );
723 SAA_texture2DGetVScale( scene, &textures[i], &vScale[i] );
724 SAA_texture2DGetUOffset( scene, &textures[i], &uOffset[i] );
725 SAA_texture2DGetVOffset( scene, &textures[i], &vOffset[i] );
727 softegg_cat.spam() <<
"tritex[" << i <<
"] uScale: " << uScale[i] <<
" vScale: " << vScale[i] << endl;
728 softegg_cat.spam() <<
" uOffset: " << uOffset[i] <<
" vOffset: " << vOffset[i] << endl;
730 SAA_texture2DGetRepeats( scene, &textures[i], &uRepeat[i], &vRepeat[i] );
731 softegg_cat.spam() <<
"uRepeat = " << uRepeat[i] <<
", vRepeat = " << vRepeat[i] << endl;
734 softegg_cat.spam() <<
"Invalid texture...\n";
735 softegg_cat.spam() <<
" tritex[" << i <<
"] named: (null)\n";
740 SAA_modelRelationGetT2DGlbNbElements( scene, _model,
741 FALSE, &relinfo, &numTexGlb );
744 textures =
new SAA_Elem;
746 SAA_modelRelationGetT2DGlbElements( scene, _model,
747 TEX_PER_MAT, textures );
748 softegg_cat.spam() <<
"numTexGlb = " << numTexGlb << endl;
750 SAA_elementIsValid( scene, textures, &valid );
752 SAA_texture2DGetUVSwap( scene, textures, &uv_swap );
754 if ( uv_swap == TRUE )
755 softegg_cat.spam() <<
" swapping u and v...\n";
759 texNameArray =
new char *[1];
765 softegg_cat.spam() <<
" global tex named: " << *texNameArray << endl;
768 uScale =
new PN_stdfloat;
769 vScale =
new PN_stdfloat;
770 uOffset =
new PN_stdfloat;
771 vOffset =
new PN_stdfloat;
773 SAA_texture2DGetUScale( scene, textures, uScale );
774 SAA_texture2DGetVScale( scene, textures, vScale );
775 SAA_texture2DGetUOffset( scene, textures, uOffset );
776 SAA_texture2DGetVOffset( scene, textures, vOffset );
778 softegg_cat.spam() <<
" global tex uScale: " << *uScale <<
" vScale: " << *vScale << endl;
779 softegg_cat.spam() <<
" uOffset: " << *uOffset <<
" vOffset: " << *vOffset << endl;
781 SAA_texture2DGetRepeats( scene, textures, uRepeat, vRepeat );
782 softegg_cat.spam() <<
"uRepeat = " << *uRepeat <<
", vRepeat = " << *vRepeat << endl;
785 softegg_cat.spam() <<
"Invalid Texture...\n";
790 softegg_cat.spam() <<
"got textures" << endl;
803 const char *name = get_name().c_str();
806 if ( stec.make_pose )
807 gtype = SAA_GEOM_DEFORMED;
810 if ( type == SAA_MNSRF )
811 SAA_nurbsSurfaceSetStep( scene, _model, stec.nurbs_step, stec.nurbs_step );
817 SAA_modelRelationGetMatNbElements( scene,
get_model(), FALSE, &relinfo,
820 softegg_cat.spam() <<
"nurbs surf has " << numNurbMats <<
" materials\n";
823 materials =
new SAA_Elem[numNurbMats];
825 softegg_cat.info() <<
"Out Of Memory on allocating materials\n";
829 SAA_modelRelationGetMatElements( scene,
get_model(), relinfo,
830 numNurbMats, materials );
832 softegg_cat.spam() <<
"got materials\n";
841 SAA_materialRelationGetT2DLocNbElements( scene, &materials[0], FALSE, &relinfo, &numNurbTexLoc );
844 if ( numNurbTexLoc ) {
845 softegg_cat.spam() << name <<
" had " << numNurbTexLoc <<
" local tex\n";
846 nassertv(numNurbTexLoc == 1);
848 textures =
new SAA_Elem[numNurbTexLoc];
851 SAA_materialRelationGetT2DLocElements( scene, &materials[0], TEX_PER_MAT, &textures[0] );
856 SAA_modelRelationGetT2DGlbNbElements( scene,
get_model(), FALSE, &relinfo, &numNurbTexGlb );
858 if ( numNurbTexGlb ) {
859 softegg_cat.spam() << name <<
" had " << numNurbTexGlb <<
" global tex\n";
860 nassertv(numNurbTexGlb == 1);
862 textures =
new SAA_Elem[numNurbTexGlb];
865 SAA_modelRelationGetT2DGlbElements( scene,
get_model(), TEX_PER_MAT, &textures[0] );
869 if ( numNurbTexLoc || numNurbTexGlb) {
872 texNameArray =
new char *[1];
874 uScale =
new PN_stdfloat;
875 vScale =
new PN_stdfloat;
876 uOffset =
new PN_stdfloat;
877 vOffset =
new PN_stdfloat;
882 result = SAA_elementIsValid( scene, &textures[0], &valid );
884 if ( result != SI_SUCCESS )
885 softegg_cat.spam() <<
"SAA_elementIsValid failed!!!!\n";
893 softegg_cat.spam() <<
" tritex[0] named: " << texNameArray[0] << endl;
895 SAA_texture2DGetUVSwap( scene, &textures[0], &uv_swap );
897 if ( uv_swap == TRUE )
898 softegg_cat.spam() <<
" swapping u and v...\n" ;
900 SAA_texture2DGetUScale( scene, &textures[0], uScale );
901 SAA_texture2DGetVScale( scene, &textures[0], vScale );
902 SAA_texture2DGetUOffset( scene, &textures[0], uOffset );
903 SAA_texture2DGetVOffset( scene, &textures[0], vOffset );
905 softegg_cat.spam() <<
"tritex[0] uScale: " << *uScale <<
" vScale: " << *vScale << endl;
906 softegg_cat.spam() <<
" uOffset: " << *uOffset <<
" vOffset: " << *vOffset << endl;
908 SAA_texture2DGetRepeats( scene, &textures[0], uRepeat, vRepeat );
909 softegg_cat.spam() <<
"uRepeat = " << *uRepeat <<
", vRepeat = " << *vRepeat << endl;
912 softegg_cat.spam() <<
"Invalid texture...\n";
913 softegg_cat.spam() <<
" tritex[0] named: (null)\n";
917 softegg_cat.spam() <<
"got textures\n";
931 for (i = 0; i < numVert && !found ; i++) {
932 if ((p3d[0] == vertices[i].x) &&
933 (p3d[1] == vertices[i].y) &&
934 (p3d[2] == vertices[i].z)) {
936 softegg_cat.spam() <<
"found shape vert at index " << i << endl;
962 char tableName[_MAX_PATH];
963 SAA_DVector *shapeVerts = NULL;
964 SAA_DVector *uniqueVerts = NULL;
966 SAA_Scene *scene = &stec.scene;
969 string vpool_name = get_name() +
".verts";
972 DCAST_INTO_V(vpool, t);
974 int numOrigVert = (int) vpool->
size();
977 if ((type == SAA_MNSRF) && stec.make_nurbs)
978 SAA_nurbsSurfaceSetStep( scene, model, stec.nurbs_step, stec.nurbs_step );
980 SAA_modelGetNbVertices( scene, model, &numCV );
983 uniqueVerts =
new SAA_DVector[numCV];
984 SAA_modelGetVertices( scene, model, SAA_GEOM_ORIGINAL, 0,
985 numCV, uniqueVerts );
987 softegg_cat.spam() << numCV <<
" CV's\n";
989 for ( i = 0; i < numCV; i++ )
991 _VCT_X_MAT( uniqueVerts[i], uniqueVerts[i], matrix);
992 softegg_cat.spam() <<
"uniqueVerts[" << i <<
"] = " << uniqueVerts[i].x <<
" " << uniqueVerts[i].y
993 <<
" " << uniqueVerts[i].z <<
" " << uniqueVerts[i].w << endl;
996 for ( i = 1; i < numShapes; i++ ) {
998 sprintf(tableName,
"%s.%d", get_name().c_str(), i);
1000 softegg_cat.spam() <<
"\nMaking geometry offsets for " << tableName <<
"...\n";
1002 if ((type == SAA_MNSRF) && stec.make_nurbs)
1003 softegg_cat.spam() <<
"calculating NURBS morphs...\n";
1005 softegg_cat.spam() <<
"calculating triangle morphs...\n";
1008 shapeVerts =
new SAA_DVector[numCV];
1009 SAA_modelGetVertices( scene, model, SAA_GEOM_SHAPE, i+1, numCV, shapeVerts );
1011 for ( j=0; j < numCV; j++ ) {
1013 _VCT_X_MAT( shapeVerts[j], shapeVerts[j], matrix);
1015 softegg_cat.spam() <<
"shapeVerts[" << j <<
"] = " << shapeVerts[j].x <<
" " 1016 << shapeVerts[j].y <<
" " << shapeVerts[j].z << endl;
1018 softegg_cat.spam() << endl;
1023 for (vi = vpool->
begin(); vi != vpool->
end(); ++vi, ++j) {
1029 softegg_cat.spam() <<
"oVert[" << j <<
"] = " << p3d[0] <<
" " << p3d[1] <<
" " << p3d[2] << endl;
1030 if ((type == SAA_MNSRF) && stec.make_nurbs) {
1031 dx = shapeVerts[j].x - p3d[0];
1032 dy = shapeVerts[j].y - p3d[1];
1033 dz = shapeVerts[j].z - p3d[2];
1035 softegg_cat.spam() <<
"global shapeVerts[" << j <<
"] = " << shapeVerts[j].x <<
" " 1036 << shapeVerts[j].y <<
" " << shapeVerts[j].z <<
" " << shapeVerts[j].w << endl;
1043 dx = shapeVerts[offset].x - p3d[0];
1044 dy = shapeVerts[offset].y - p3d[1];
1045 dz = shapeVerts[offset].z - p3d[2];
1047 softegg_cat.spam() <<
"global shapeVerts[" << offset <<
"] = " << shapeVerts[offset].x <<
" " 1048 << shapeVerts[offset].y <<
" " << shapeVerts[offset].z << endl;
1051 softegg_cat.spam() << j <<
": dx = " << dx <<
", dy = " << dy <<
", dz = " << dz << endl;
1054 double total = fabs(dx)+fabs(dy)+fabs(dz);
1055 if ( total > 0.00001 ) {
1056 if ( vpool != NULL ) {
1061 vert->_dxyzs.
insert(*dxyz);
1064 softegg_cat.spam() <<
"Error: couldn't find vertex pool " << vpool_name << endl;
1082 SAA_Elem *model = NULL;
1083 SAA_AnimInterpType type;
1084 SAA_Scene *scene = &stec.scene;
1092 SAA_modelGetNbShapes( scene, model, &numShapes );
1094 if ( numShapes <= 0 ) {
1098 stec.has_morph =
true;
1100 softegg_cat.spam() <<
"make_morph_table: " << get_name() <<
" : num shapes: " << numShapes << endl;
1102 SAA_modelGetShapeInterpolation( scene, model, &type );
1104 if ( type == SAA_ANIM_LINEAR || type == SAA_ANIM_CARDINAL ) {
1105 softegg_cat.spam() <<
"linear morph" << endl;
1110 softegg_cat.spam() <<
"expression morph" << endl;
1126 PN_stdfloat curveVal;
1127 char tableName[_MAX_PATH];
1132 SAA_Scene *scene = &stec.scene;
1134 softegg_cat.spam() <<
"linear interp, getting fcurve\n";
1136 SAA_modelFcurveGetShape( scene, model, &fcurve );
1138 SAA_fcurveEval( scene, &fcurve, time, &curveVal );
1140 softegg_cat.spam() <<
"at time " << time <<
", fcurve for " << get_name() <<
" = " << curveVal << endl;
1142 PN_stdfloat nextVal = 0.0f;
1145 for ( i = 1; i < numShapes; i++ ) {
1147 sprintf(tableName,
"%s.%d", get_name().c_str(), i);
1149 softegg_cat.spam() <<
"Linear: looking for table '" << tableName <<
"'\n";
1154 if ( anim != NULL ) {
1155 if ( i == (
int)curveVal ) {
1156 if ( curveVal - i == 0 ) {
1158 softegg_cat.spam() <<
"adding element 1.0f\n";
1161 anim->
add_data(1.0f - (curveVal - i));
1162 nextVal = curveVal - i;
1163 softegg_cat.spam() <<
"adding element " << 1.0f - (curveVal - i) << endl;
1170 softegg_cat.spam() <<
"adding element " << nextVal << endl;
1174 softegg_cat.spam() <<
"adding element 0.0f\n";
1178 softegg_cat.spam() <<
" to '" << tableName <<
"'\n";
1181 softegg_cat.spam() << i <<
" : Couldn't find table '" << tableName <<
"'\n";
1197 PN_stdfloat curveVal;
1199 char tableName[_MAX_PATH];
1200 SAA_Elem *weightCurves;
1204 SAA_Scene *scene = &stec.scene;
1207 weightCurves =
new SAA_Elem[numShapes];
1209 result = SAA_modelFcurveGetShapeWeights(scene, model, numShapes, weightCurves);
1211 if ( result == SI_SUCCESS ) {
1212 for (
int i = 1; i < numShapes; i++ ) {
1213 SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal );
1219 softegg_cat.spam() <<
"at time " << time <<
", weightCurve[" << i <<
"] for " << get_name() <<
" = " << curveVal << endl;
1222 sprintf(tableName,
"%s.%d", get_name().c_str(), i);
1225 softegg_cat.spam() <<
"Weight: looking for table '" << tableName <<
"'\n";
1230 if ( anim != NULL ) {
1232 softegg_cat.spam() <<
"adding element " << curveVal << endl;
1235 softegg_cat.spam() << i <<
" : Couldn't find table '" << tableName <<
"'\n";
1259 SAA_Elem *expressions;
1263 SAA_Scene *scene = &stec.scene;
1271 SAA_elementGetNbExpressions( scene, model, track, FALSE, &numExp );
1273 softegg_cat.spam() << get_name() <<
" has " << numExp <<
" RHS expressions\n";
1277 expressions =
new SAA_Elem[numExp];
1278 softegg_cat.spam() <<
"getting " << numExp <<
" RHS expressions...\n";
1280 result = SAA_elementGetExpressions( scene, model, track, FALSE,
1281 numExp, expressions );
1386 softegg_cat.spam() <<
"weighted morph" << endl;
This is an iterator adaptor that converts any iterator that returns a pair (e.g.
This is a 4-by-4 transform matrix.
bool has_model() const
Returns true if a Soft dag path has been associated with this node, false otherwise.
void get_joint_transform(SAA_Scene *scene, EggGroup *egg_group, EggXfmSAnim *anim, bool global)
Extracts the transform on the indicated Soft node, as appropriate for a joint in an animated characte...
void add_data(double value)
Adds a single element to the table.
bool almost_equal(const LMatrix4d &other, double threshold) const
Returns true if two matrices are memberwise equal within a specified tolerance.
void add_component_data(const string &component_name, double value)
Adds a new row to the named component (one of matrix_component_letters) of the table.
void force_set_parent(SoftNodeDesc *parent)
Sometimes, parent is not known at node creation As soon as it is known, set the parent.
void make_linear_morph_table(int numShapes, PN_stdfloat time)
Given a scene, a model, its name, and the time, get the shape fcurve for the model and determine the ...
void make_expression_morph_table(int numShapes, PN_stdfloat time)
Given a scene, a model and its number of key shapes generate a morph table describing transitions btw...
pair< iterator, bool > insert(const MorphType &value)
This is similar to the insert() interface for sets, except it does not guarantee that the resulting l...
Corresponding to an <S$Anim> entry, this stores a single column of numbers, for instance for a morph ...
SAA_Elem * get_model() const
Returns the SAA_Elem * associated with this node.
LVertexd get_pos3() const
Valid if get_num_dimensions() returns 3 or 4.
A single <Dxyz> or <Duv> or some such entry.
size_type size() const
Returns the number of vertices in the pool.
iterator end() const
Returns an iterator that can be used to traverse through all the vertices in the pool.
iterator begin() const
Returns an iterator that can be used to traverse through all the vertices in the pool.
char * GetTextureName(SAA_Scene *scene, SAA_Elem *texture)
Given a texture element, return texture name with given tex_path.
EggSAnimData * find_morph_table(char *name)
Given a tablename, it either creates a new eggSAnimData structure (if doesn't exist) or locates it...
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
A base class for all things which can have a name.
bool is_joint_parent() const
Returns true if the node is the parent or ancestor of a joint.
bool is_partial(char *search_prefix)
check to see if this is a selected branch we want to descend - this will prevent creating geometry fo...
static const LMatrix4d & ident_mat()
Returns an identity matrix.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
void make_vertex_offsets(int numShapes)
Given a scene, a model , the vertices of its original shape and its name find the difference between ...
Describes a single instance of a node aka element in the Soft scene graph, relating it to the corresp...
void set_joint()
sets the _joint_type to JT_joint
void make_weighted_morph_table(int numShapes, PN_stdfloat time)
Given a scene, a model, a list of all models in the scene, the number of models in the scece...
void load_nurbs_model(SAA_Scene *scene, SAA_ModelType type)
Converts the indicated Soft polyset to a bunch of EggPolygons and parents them to the indicated egg g...
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
void set_parent(SoftNodeDesc *parent)
Sometimes, parent is not known at node creation As soon as it is known, set the parent.
A base class for things that may be directly added into the egg hierarchy.
int find_shape_vert(LPoint3d p3d, SAA_DVector *vertices, int numVert)
given a vertex, find its corresponding shape vertex and return its index.
void get_transform(SAA_Scene *scene, EggGroup *egg_group, bool global)
Extracts the transform on the indicated Soft node, and applies it to the corresponding Egg node...
EggNode * find_child(const string &name) const
Returns the child of this node whose name is the indicated string, or NULL if there is no child of th...
TypeHandle is the identifier used to differentiate C++ class types.
void set_model(SAA_Elem *model)
Indicates an associated between the SoftNodeDesc and some SAA_Elem instance.
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
A collection of vertices.
void load_poly_model(SAA_Scene *scene, SAA_ModelType type)
Converts the indicated Soft polyset to a bunch of EggPolygons and parents them to the indicated egg g...
void make_morph_table(PN_stdfloat time)
Given a scene, a model, a name and a frame time, determine what type of shape interpolation is used a...
bool is_junk() const
Returns true if the node should be treated as a junk by the converter.