Ejemplo n.º 1
0
static void ComputeJointMats(iqmData_t* data, int frame, int oldframe,
                             float backlerp, float* mat) {
    float*   mat1, *mat2;
    int* joint = data->jointParents;
    int i;

    if (oldframe == frame) {
        mat1 = data->poseMats + 12 * data->num_joints * frame;
        for (i = 0; i < data->num_joints; i++, joint++) {
            if (*joint >= 0) {
                Matrix34Multiply(mat + 12 * *joint,
                                 mat1 + 12 * i, mat + 12 * i);
            } else {
                Com_Memcpy(mat + 12 * i, mat1 + 12 * i, 12 * sizeof(float));
            }
        }
    } else  {
        mat1 = data->poseMats + 12 * data->num_joints * frame;
        mat2 = data->poseMats + 12 * data->num_joints * oldframe;

        for (i = 0; i < data->num_joints; i++, joint++) {
            if (*joint >= 0) {
                float tmpMat[12];
                InterpolateMatrix(mat1 + 12 * i, mat2 + 12 * i,
                                  backlerp, tmpMat);
                Matrix34Multiply(mat + 12 * *joint,
                                 tmpMat, mat + 12 * i);

            } else {
                InterpolateMatrix(mat1 + 12 * i, mat2 + 12 * i,
                                  backlerp, mat);
            }
        }
    }
}
Ejemplo n.º 2
0
static void ComputePoseMats( iqmData_t *data, iqmData_t *skeleton, iqmData_t *oldSkeleton, int frame, int oldframe,
			      float backlerp, float *mat ) {
	float tmpMat1[12], tmpMat2[12];
	float	*mat1, *mat2;
	int	*joint = data->jointParents;
	int	i;

	if ( skeleton->num_poses == 0 ) {
		for( i = 0; i < data->num_joints; i++, joint++ ) {
			if( *joint >= 0 ) {
				Matrix34Multiply( mat + 12 * *joint,
						  identityMatrix, mat + 12*i );
			} else {
				Com_Memcpy( mat + 12*i, identityMatrix, 12 * sizeof(float) );
			}
		}
		return;
	}

	if ( oldframe == frame && skeleton == oldSkeleton ) {
		mat1 = skeleton->poseMats + 12 * skeleton->num_poses * frame;
		for( i = 0; i < skeleton->num_poses; i++, joint++ ) {
			BuildPoseMat( data, skeleton, mat1 + 12*i, i, *joint, tmpMat1 );
			if( *joint >= 0 ) {
				Matrix34Multiply( mat + 12 * *joint,
						  tmpMat1, mat + 12*i );
			} else {
				Com_Memcpy( mat + 12*i, tmpMat1, 12 * sizeof(float) );
			}
		}
	} else  {
		mat1 = skeleton->poseMats + 12 * skeleton->num_poses * frame;
		mat2 = oldSkeleton->poseMats + 12 * oldSkeleton->num_poses * oldframe;
		
		for( i = 0; i < skeleton->num_poses; i++, joint++ ) {
			BuildPoseMat( data, skeleton, mat1 + 12*i, i, *joint, tmpMat1 );
			BuildPoseMat( data, oldSkeleton, mat2 + 12*i, i, *joint, tmpMat2 );
			if( *joint >= 0 ) {
				float tmpMat[12];
				InterpolateMatrix( tmpMat1, tmpMat2,
						   backlerp, tmpMat );
				Matrix34Multiply( mat + 12 * *joint,
						  tmpMat, mat + 12*i );
				
			} else {
				InterpolateMatrix( tmpMat1, tmpMat2,
						   backlerp, mat );
			}
		}
	}
}
Ejemplo n.º 3
0
void MyFrame::OnInterpolateSimulationData(wxCommandEvent& event)
{
  InterpolateMatrix(_T("external simulation data"), precomputationState.sketchDataMatrix);
}
Ejemplo n.º 4
0
void MyFrame::OnInterpolateModalDerivatives(wxCommandEvent& event)
{
  InterpolateMatrix(_T("modal derivatives"), precomputationState.modalDerivativesMatrix);
}
Ejemplo n.º 5
0
void MyFrame::OnInterpolateNonLinearModes(wxCommandEvent& event)
{
  InterpolateMatrix(_T("nonlinear modes"), precomputationState.nonLinearModalMatrix);
}