示例#1
0
// update the design matrix for a new timepoint
// NOTE: this should be called after all events and  artifacts have been
// added (through addEvent and addArtifact) and motion has been added to the
// datastore for this timepoint. usually this function will be called from
// RtModelFit::process()
//  in
//   tr of the timepoint to update for
bool RtDesignMatrix::updateAtTr(unsigned int thisTr) {

  if (!isBuilt()) {
    cerr << "WARNING: can't update() a design matrix that hasn't been build()t."
         << endl;
    return false;
  }

  // check bounds
  if (thisTr >= numMeas) {
    cerr
        << "WARNING: RtDesignMatrix::update trying to process tr out of range ("
        << thisTr << ")" << endl;
    return false;
  }

  // copy the motion parameters
  if (modelMotionParameters) {
    RtDataID motID(templateDataID);
    motID.setModuleID("motion");

    RtMotion *mot = static_cast<RtMotion*> (getDataStore().getData(motID));

    if (mot != NULL) {
      unsigned int motionCol = getNumConditionBases() + maxTrendOrder;
      vnl_matrix<double> motionMat(mot->getMotion(), 1, NUM_MOTION_DIMENSIONS);
      update(motionMat, thisTr, motionCol);
    }
  }

  return true;
}
void SkinnedMesh::setGpuSkinning(bool on)
{
	if (on == m_gpuSkinning)
	{
		return;
	}
	m_gpuSkinning = on;

	if (!isBuilt())
	{
		return;
	}
	assert(m_resource != NULL && m_resource->getResourceState() == RES_STATE_COMPLETE);
	if (on)
	{
		if (m_dynamicStream.buffer != NULL)
		{
			GRP_DELETE(m_dynamicStream.buffer);
		}
		m_dynamicStream.buffer = const_cast<unsigned char*>(m_resource->getDynamicVertexStream());
	}
	else
	{
		m_dynamicStream.buffer = GRP_NEW unsigned char[m_resource->getVertexCount() * m_dynamicStream.stride];
	}
}