Exemple #1
0
void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_BlenderSceneConverter *converter)
{

	if (blenderlamp->adt) {

		KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController();
		lightobj->GetSGNode()->AddSGController(ipocontr);
		ipocontr->SetObject(lightobj->GetSGNode());
		
		ipocontr->m_energy = blenderlamp->energy;
		ipocontr->m_col_rgb[0] = blenderlamp->r;
		ipocontr->m_col_rgb[1] = blenderlamp->g;
		ipocontr->m_col_rgb[2] = blenderlamp->b;
		ipocontr->m_dist = blenderlamp->dist;

		BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt, converter);

		// For each active channel in the adtList add an
		// interpolator to the game object.
		
		KX_IInterpolator *interpolator;
		KX_IScalarInterpolator *interp;
		
		if ((interp= adtList->GetScalarInterpolator("energy", 0))) {
			interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp);
			ipocontr->AddInterpolator(interpolator);
			ipocontr->SetModifyEnergy(true);
		}

		if ((interp = adtList->GetScalarInterpolator("distance", 0))) {
			interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp);
			ipocontr->AddInterpolator(interpolator);
			ipocontr->SetModifyDist(true);
		}
		
		for(int i=0; i<3; i++) {
			if ((interp = adtList->GetScalarInterpolator("color", i))) {
				interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp);
				ipocontr->AddInterpolator(interpolator);
				ipocontr->SetModifyColor(true);
			}
		}
	}
}
Exemple #2
0
SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject*  lightobj, KX_BlenderSceneConverter *converter)
{
	KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController();

	Lamp *blenderlamp = (Lamp*)lightobj->GetBlenderObject()->data;

	ipocontr->m_energy = blenderlamp->energy;
	ipocontr->m_col_rgb[0] = blenderlamp->r;
	ipocontr->m_col_rgb[1] = blenderlamp->g;
	ipocontr->m_col_rgb[2] = blenderlamp->b;
	ipocontr->m_dist = blenderlamp->dist;

	BL_InterpolatorList *adtList= GetAdtList(action, converter);

	// For each active channel in the adtList add an
	// interpolator to the game object.
		
	KX_IInterpolator *interpolator;
	KX_IScalarInterpolator *interp;
		
	if ((interp= adtList->GetScalarInterpolator("energy", 0))) {
		interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp);
		ipocontr->AddInterpolator(interpolator);
		ipocontr->SetModifyEnergy(true);
	}

	if ((interp = adtList->GetScalarInterpolator("distance", 0))) {
		interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp);
		ipocontr->AddInterpolator(interpolator);
		ipocontr->SetModifyDist(true);
	}
		
	for(int i=0; i<3; i++) {
		if ((interp = adtList->GetScalarInterpolator("color", i))) {
			interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp);
			ipocontr->AddInterpolator(interpolator);
			ipocontr->SetModifyColor(true);
		}
	}

	return ipocontr;
}