Ejemplo n.º 1
0
std::string Iwa_TiledParticlesFx::getAlias(double frame, const TRenderSettings &info) const
{
	std::string alias = getFxType();
	alias += "[";

	// alias degli effetti connessi alle porte di input separati da virgole
	// una porta non connessa da luogo a un alias vuoto (stringa vuota)
	for (int i = 0; i < getInputPortCount(); ++i) {
		TFxPort *port = getInputPort(i);
		if (port->isConnected()) {
			TRasterFxP ifx = port->getFx();
			assert(ifx);
			alias += ifx->getAlias(frame, info);
		}
		alias += ",";
	}

	std::string paramalias("");
	for (int i = 0; i < getParams()->getParamCount(); ++i) {
		TParam *param = getParams()->getParam(i);
		paramalias += param->getName() + "=" + param->getValueAlias(frame, 3);
	}

	return alias + toString(frame) + "," + toString(getIdentifier()) + paramalias + "]";
}
Ejemplo n.º 2
0
//!Build the scene fx for each node below the xsheet one.
//!Remember that left xsheet ports must not be expanded.
void MultimediaRenderer::Imp::scanSceneForLayers()
{
	//Retrieve the terminal fxs (ie, fxs which are implicitly
	//connected to the xsheet one)
	TXsheet *xsh = m_scene->getXsheet();
	TFxSet *fxs = xsh->getFxDag()->getTerminalFxs();

	//Examine all of them and - eventually - expand left xsheet
	//ports (ie fx nodes who allow implicit overlaying)
	for (int i = 0; i < fxs->getFxCount(); ++i) {
		TFx *fx = fxs->getFx(i);
		TFxPort *leftXSheetPort;

	retry:

		if (!fx)
			continue;
		leftXSheetPort = fx->getXsheetPort();

		if (!leftXSheetPort) {
			m_fxsToRender.addFx(fx);
			continue;
		}

		//If the leftXSheetPort is not connected, retry on port 0
		if (leftXSheetPort->isConnected())
			m_fxsToRender.addFx(fx);
		else {
			fx = fx->getInputPort(0)->getFx();
			goto retry;
		}
	}
}
Ejemplo n.º 3
0
string TMacroFx::getAlias(double frame, const TRenderSettings &info) const
{
	string alias = getFxType();
	alias += "[";

	// alias degli effetti connessi alle porte di input separati da virgole
	// una porta non connessa da luogo a un alias vuoto (stringa vuota)
	int i;
	for (i = 0; i < getInputPortCount(); i++) {
		TFxPort *port = getInputPort(i);
		if (port->isConnected()) {
			TRasterFxP ifx = port->getFx();
			assert(ifx);
			alias += ifx->getAlias(frame, info);
		}
		alias += ",";
	}

	// alias dei valori dei parametri dell'effetto al frame dato
	for (int j = 0; j < (int)m_fxs.size(); j++) {
		alias += (j == 0) ? "(" : ",(";
		for (i = 0; i < m_fxs[j]->getParams()->getParamCount(); i++) {
			if (i > 0)
				alias += ",";
			TParam *param = m_fxs[j]->getParams()->getParam(i);
			alias += param->getName() + "=" + param->getValueAlias(frame, 2);
		}
		alias += ")";
	}

	alias += "]";
	return alias;
}
Ejemplo n.º 4
0
std::string TGeometryFx::getAlias(double frame,
                                  const TRenderSettings &info) const {
  TGeometryFx *tthis = const_cast<TGeometryFx *>(this);
  TAffine affine     = tthis->getPlacement(frame);

  std::string alias = getFxType();
  alias += "[";

  // alias degli effetti connessi alle porte di input separati da virgole
  // una porta non connessa da luogo a un alias vuoto (stringa vuota)

  for (int i = 0; i < getInputPortCount(); ++i) {
    TFxPort *port = getInputPort(i);
    if (port->isConnected()) {
      TRasterFxP ifx = port->getFx();
      assert(ifx);
      alias += ifx->getAlias(frame, info);
    }
    alias += ",";
  }

  return alias +
         (areAlmostEqual(affine.a11, 0) ? "0" : ::to_string(affine.a11, 5)) +
         "," +
         (areAlmostEqual(affine.a12, 0) ? "0" : ::to_string(affine.a12, 5)) +
         "," +
         (areAlmostEqual(affine.a13, 0) ? "0" : ::to_string(affine.a13, 5)) +
         "," +
         (areAlmostEqual(affine.a21, 0) ? "0" : ::to_string(affine.a21, 5)) +
         "," +
         (areAlmostEqual(affine.a22, 0) ? "0" : ::to_string(affine.a22, 5)) +
         "," +
         (areAlmostEqual(affine.a23, 0) ? "0" : ::to_string(affine.a23, 5)) +
         "]";
}
Ejemplo n.º 5
0
void SwatchCacheManager::setFx(const TFxP &fx)
{
	QMutexLocker locker(&m_mutex);

	//Update the fxs id data
	if (fx == TFxP()) {
		//Clear if no fx is set
		m_setFxId = 0;
		m_childrenFxIds.clear();
	} else {
		m_setFxId = fx->getIdentifier();
		m_childrenFxIds.clear();
		assert(m_setFxId != 0);

		TRasterFx *rfx = dynamic_cast<TRasterFx *>(fx.getPointer());
		assert(rfx);

		for (int i = 0; i < fx->getInputPortCount(); ++i) {
			//Fxs not allowing cache on the input port are skipped
			if (!rfx->allowUserCacheOnPort(i))
				continue;

			TFxPort *iport = fx->getInputPort(i);
			if (iport && iport->isConnected()) {
				TFx *child = iport->getFx();

				//In the zerary case, extract the actual fx
				TZeraryColumnFx *zcfx = dynamic_cast<TZeraryColumnFx *>(child);
				if (zcfx)
					child = zcfx->getZeraryFx();

				assert(child && child->getIdentifier() != 0);
				m_childrenFxIds.insert(child->getIdentifier());
			}
		}
	}

	//NOTE: Check if this should be avoided in some case...

	//Release the locks and clear the resources
	if (m_currEditedFxResult)
		m_currEditedFxResult->releaseLock();
	m_currEditedFxResult = TCacheResourceP();

	std::set<TCacheResourceP>::iterator it;
	for (it = m_swatchCacheContainer.begin(); it != m_swatchCacheContainer.end(); ++it)
		(*it)->releaseLock();
	m_swatchCacheContainer.clear();

#ifdef USE_SQLITE_HDPOOL
	TCacheResourcePool::instance()->releaseReferences("S");
#else
	for (it = m_genericCacheContainer.begin(); it != m_genericCacheContainer.end(); ++it)
		(*it)->releaseLock();
	m_genericCacheContainer.clear();
#endif
}
Ejemplo n.º 6
0
void TRasterFx::compute(TFlash &flash, int frame) {
  for (int i = getInputPortCount() - 1; i >= 0; i--) {
    TFxPort *port = getInputPort(i);

    if (port->isConnected() && !port->isaControlPort()) {
      flash.pushMatrix();
      ((TRasterFxP)(port->getFx()))->compute(flash, frame);
      flash.popMatrix();
    }
  }
}
Ejemplo n.º 7
0
void Iwa_TiledParticlesFx::doDryCompute(TRectD &rect, double frame, const TRenderSettings &info)
{
	Iwa_ParticlesManager *pc = Iwa_ParticlesManager::instance();
	unsigned long fxId = getIdentifier();
	int inputPortCount = getInputPortCount();

	int i,
		j,
		curr_frame = frame,					   /*- 現在のフレーム -*/
		startframe = startpos_val->getValue(); /*- Particesの開始フレーム -*/

	TRenderSettings infoOnInput(info);
	infoOnInput.m_affine = TAffine(); // Using the standard reference - indep. from cameras.
	infoOnInput.m_bpp = 64;			  // Control ports rendered at 32 bit - since not visible.

	for (i = startframe - 1; i <= curr_frame; ++i) {
		double frame = tmax(0, i);

		for (j = 0; j < inputPortCount; ++j) {
			TFxPort *port = getInputPort(j);
			std::string tmpName = getInputPortName(j);
			if (port->isConnected()) {
				TRasterFxP fx = port->getFx();

				// Now, consider that source ports work different than control ones
				QString portName = QString::fromStdString(tmpName);
				if (portName.startsWith("C")) {
					// Control ports are calculated from start to current frame, since
					// particle mechanics at current frame is influenced by previous ones
					// (and therefore by all previous control images).

					TRectD bbox;
					fx->getBBox(frame, bbox, infoOnInput);
					if (bbox == TConsts::infiniteRectD)
						bbox = info.m_affine.inv() * rect;
					fx->dryCompute(bbox, frame, infoOnInput);
				} else if (portName.startsWith("T")) {
					// Particles handle source ports caching procedures on its own.
				}
			}
		}
	}
}