Beispiel #1
0
IPluginObject *Factory::CreateObject(ISystem *pSys, const char *identifier) {
  ILogger *pLogger = pSys->GetLogger("Enigma.Factory");
  IPluginObject *pObject = NULL;
  pLogger->Debug("Trying '%s'", identifier);
  // if (!strcmp(identifier, "enigma.Starfield")) {
  //   pObject = dynamic_cast<IPluginObject *>(new TestTriangleGenerator());
  // }
  if (!strcmp(identifier, "enigma.RenderTVBox")) {
     pObject = dynamic_cast<IPluginObject *>(new EnigmaTVBox());
  }
  if (!strcmp(identifier, "enigma.Starfield")) {
     pObject = dynamic_cast<IPluginObject *>(new Starfield());
  }
  if (!strcmp(identifier, "enigma.RayTracer")) {
     pObject = dynamic_cast<IPluginObject *>(new RayTracer());
  }
  if (!strcmp(identifier, "enigma.RayTracer.Sphere")) {
     pObject = dynamic_cast<IPluginObject *>(new Sphere());
  }
  if (pObject != NULL) {
    pLogger->Debug("Ok");
  } else
    pLogger->Debug("Failed");
  return pObject;
}
Beispiel #2
0
IPluginObject *CurveFactory::CreateObject(ISystem *pSys, const char *identifier)
{
	ILogger *pLogger = pSys->GetLogger("StdCurve.Factory");//Logger::GetLogger("StdCurve.Factory");
	IPluginObject *pObject = NULL;
	pLogger->Debug("Trying '%s'", identifier);
	if (!strcmp(identifier,"Animation.GenericCurve"))
	{
		pObject = dynamic_cast<IPluginObject *> (new YaptCurveFacade());
	}
	if (!strcmp(identifier,"Animation.Key"))
	{
		pObject = dynamic_cast<IPluginObject *> (new GenericCurveKey());
	}
	if (!strcmp(identifier,"Animation.VectorKey"))
	{
		pObject = dynamic_cast<IPluginObject *> (new VectorCurveKey());
	}
	if (!strcmp(identifier,"Animation.ExpSolver"))
	{
		pObject = dynamic_cast<IPluginObject *> (new YaptExpSolverFacade());
	}
	if (!strcmp(identifier,"Animation.Expression"))
	{
		pObject = dynamic_cast<IPluginObject *> (new YaptExpSolverFacade());
	}
	if (!strcmp(identifier,"Animation.VectorExpression"))
	{
		pObject = dynamic_cast<IPluginObject *> (new YaptVecExpSolverFacade());
	}
	if (!strcmp(identifier,"Numeric.VectorMux"))
	{
		pObject = dynamic_cast<IPluginObject *> (new VectorMux());
	}
	if (!strcmp(identifier,"Numeric.IntMinMax"))
	{
		pObject = dynamic_cast<IPluginObject *> (new IntMinMax());
	}
	if (!strcmp(identifier,"Numeric.FloatToInt"))
	{
		pObject = dynamic_cast<IPluginObject *> (new FloatToInt());
	}
	if (!strcmp(identifier,"Numeric.VectorElement"))
	{
		pObject = dynamic_cast<IPluginObject *> (new VectorElement());
	}

	if (pObject != NULL) 
	{
		pLogger->Debug("Ok");
	}
	else pLogger->Debug("Failed");
	return pObject;
}
Beispiel #3
0
void YaptCurveFacade::PostInitialize(ISystem *ySys, IPluginObjectInstance *pInstance)
{
	ILogger *pLogger = ySys->GetLogger("YaptCurveFacade");//Logger::GetLogger("YaptCurveFacade");
	pLogger->Debug("PostInitialize");
	if (pCurve != NULL)
	{
		pLogger->Debug("Dispose curve - not implemented, leaking memory");
	}

	// 'unknown' not supported (it's pointless) so just add '1' to the incoming type
	pCurve = Curve::CreateCurve(kCurveClass(curveType->v->int_val+1), channels->v->int_val);

	IDocNode *pNode = pInstance->GetDocumentNode();
	int nChildren = pNode->GetNumChildren(kNodeType_ObjectInstance);
	pLogger->Debug("Assigning keys from children (num childs = '%d')",nChildren);
	int i;
	pLogger->Enter();
	for (i=0;i<nChildren;i++)
	{
		//		IPluginObjectInstance *pObject = pDoc->GetChildAt(pInstance, i, kNodeType_ObjectInstance);
		IDocNode *pChildNode = pNode->GetChildAt(i, kNodeType_ObjectInstance);
		IPluginObjectInstance *pObject = dynamic_cast<IPluginObjectInstance *>(pChildNode->GetNodeObject());
		GenericCurveKey *pCurveKey = dynamic_cast<GenericCurveKey *> (pObject->GetExtObject());
		if (pCurveKey != NULL)
		{
			Key *pKey = pCurveKey->GetKey();
			if (pKey != NULL) {
				pKey->t *= tScale->v->float_val;
				pCurve->AddKey(pKey);
				pLogger->Debug("Added key '%d' at t=%f",i,pKey->t);				
			} else {
				pLogger->Debug("Key is NULL!");
				exit(1);
			}
		} else
		{
			pLogger->Error("Unsupported child type, Animation curves only supports 'GenericKey' derivates");
		}
	}
	pLogger->Leave();
}