Esempio n. 1
0
bool EffectManager::DoEffect(const PluginID & ID,
                             wxWindow *parent,
                             double projectRate,
                             TrackList *list,
                             TrackFactory *factory,
                             SelectedRegion *selectedRegion,
                             bool shouldPrompt /* = true */)

{
   this->SetSkipStateFlag(false);
   Effect *effect = GetEffect(ID);
   
   if (!effect)
   {
      return false;
   }

#if defined(EXPERIMENTAL_EFFECTS_RACK)
   if (effect->SupportsRealtime())
   {
      GetRack()->Add(effect);
   }
#endif

   bool res = effect->DoEffect(parent,
                               projectRate,
                               list,
                               factory,
                               selectedRegion,
                               shouldPrompt);

   return res;
}
Esempio n. 2
0
static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
	mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
	mlt_filter filter = (mlt_filter) mlt_frame_pop_service( frame );
	mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter );
	mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );

	// Correct width/height if necessary
	if ( *width == 0 || *height == 0 )
	{
		*width = profile->width;
		*height = profile->height;
	}

	int iwidth = *width;
	int iheight = *height;
	double factor = mlt_properties_get_double( filter_properties, "factor" );
	factor = factor > 0 ? factor : 1.0;
	int owidth = *width * factor;
	int oheight = *height * factor;

	// If meta.media.width/height exist, we want that as minimum information
	if ( mlt_properties_get_int( properties, "meta.media.width" ) )
	{
		iwidth = mlt_properties_get_int( properties, "meta.media.width" );
		iheight = mlt_properties_get_int( properties, "meta.media.height" );
	}

	mlt_properties_set_int( properties, "rescale_width", *width );
	mlt_properties_set_int( properties, "rescale_height", *height );

	// Deinterlace if height is changing to prevent fields mixing on interpolation
	if ( iheight != oheight )
		mlt_properties_set_int( properties, "consumer_deinterlace", 1 );

	GlslManager::get_instance()->lock_service( frame );
	mlt_properties_set_int( filter_properties, "movit.parms.int.width", owidth );
	mlt_properties_set_int( filter_properties, "movit.parms.int.height", oheight );

	bool disable = ( iwidth == owidth && iheight == oheight );
	mlt_properties_set_int( filter_properties, "movit.parms.int.disable", disable );

	*width = owidth;
	*height = oheight;

	GlslManager::get_instance()->unlock_service( frame );

	// Get the image as requested
	if ( *format != mlt_image_none )
		*format = mlt_image_glsl;
	int error = mlt_frame_get_image( frame, image, format, &iwidth, &iheight, writable );
	GlslManager::set_effect_input( MLT_FILTER_SERVICE( filter ), frame, (mlt_service) *image );
	Effect *effect = GlslManager::set_effect( MLT_FILTER_SERVICE( filter ), frame, new OptionalEffect<ResampleEffect> );
	// This needs to be something else than 0x0 at chain finalization time.
	bool ok = effect->set_int("width", owidth);
	ok |= effect->set_int("height", oheight);
	assert( ok );
	*image = (uint8_t *) MLT_FILTER_SERVICE( filter );
        return error;
}
Esempio n. 3
0
wxString EffectManager::GetDefaultPreset(const PluginID & ID)
{
   Effect *effect = GetEffect(ID);

   if (!effect)
   {
      return wxEmptyString;
   }

   wxString preset;
   if (effect->HasCurrentSettings())
   {
      preset = Effect::kCurrentSettingsIdent;
   }
   else if (effect->HasFactoryDefaults())
   {
      preset = Effect::kFactoryDefaultsIdent;
   }

   if (!preset.IsEmpty())
   {
      EffectAutomationParameters eap;

      eap.Write(wxT("Use Preset"), preset);
      eap.GetParameters(preset);
   }

   return preset;
}
Esempio n. 4
0
void Bloom::Render(const ITexture* input, RenderTarget* output) const {
    RenderTarget* downsampled_rt = Assets<RenderTarget>::Get(s_RTName);
    RenderTarget* downsampled_rt_blur_x = Assets<RenderTarget>::Get(s_RTNameBlurX);
    RenderTarget* downsampled_rt_blur_y = Assets<RenderTarget>::Get(s_RTNameBlurY);

    const Model* model = m_Object->GetModel();
    const Mesh& mesh = *model->GetMesh();
    Effect* effect = model->GetEffect();
    effect->SetTexture(input, TextureIndex::Texture0);

    m_Object->PopulateObjectBuffer();

    // The bloom effect needs a downsampled texture, so we first render into that.
    downsampled_rt->Set();
    effect->RenderPass(bloom_downsample_pass, mesh);

    // Render from downsampled to x-blurred
    downsampled_rt_blur_x->Set();
    effect->SetTexture(downsampled_rt, TextureIndex::Texture0);
    effect->RenderPass(bloom_blur_pass_1, mesh);

    // Render from x-blurred to xy-blurred
    downsampled_rt_blur_y->Set();
    effect->SetTexture(downsampled_rt_blur_x, TextureIndex::Texture0);
    effect->RenderPass(bloom_blur_pass_2, mesh);

    // Then combine the original and the downsampled copy.
    output->Set();
    effect->SetTexture(input, TextureIndex::Texture0);
    effect->SetTexture(downsampled_rt_blur_y, TextureIndex::Texture1);
    effect->RenderPass(bloom_postprocess_pass, mesh);
}
Esempio n. 5
0
void
Participant::restoreEffect(const QVariant &state)
{
    Effect *effect = addEffect();
    const QVariantMap map = state.toMap();
    effect->setName(map.value("name", tr("Reverser")).toString());
}
//Apply an effect to the audio input
//Because apply also sets some internal values
//it has to be called for every effect all the time
//The difference is just which value gets returned
float EffectProcessor::applyEffects(float input){
    Effect* effect = chooseEffect();
    float strength = calculateEffectStrength(effect->getPosition());
    if(effect == e1){
        e2->apply(input, 0);
        e3->apply(input, 0);
        e4->apply(input, 0);
        return e1->apply(input, strength);
    } else if (effect == e2){
        e1->apply(input, 0);
        e3->apply(input, 0);
        e4->apply(input, 0);
        return e2->apply(input, strength);
    } else if (effect == e3){
        e1->apply(input, 0);
        e2->apply(input, 0);
        e4->apply(input, 0);
        return e3->apply(input, strength);
    } else if (effect == e4){
        e1->apply(input, 0);
        e2->apply(input, 0);
        e3->apply(input, 0);
        return e4->apply(input, strength);
    } else {
        return input;
    }
}
Esempio n. 7
0
	QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const
	{
		if (role != Qt::DisplayRole || !index.isValid () || !_effect || index.column () >= 2)
			{
				return QVariant ();
			}

		unsigned num = _effect->GetNumberOfPrograms (_stage);
		if (index.row () >= num)
			{
				return QVariant ();
			}

		if (index.column () == 0)
			{
				return QVariant (_effect->GetProgramName (_stage, index.row ()));
			}
		else if (index.column () == 1)
			{
				Program* prog = _effect->GetProgram (_stage, _effect->GetProgramName (_stage, index.row ()));
				if (prog)
					{
						return QVariant (prog->GetCategory().GetFullName()+"."+prog->GetFullname());
					}
			
				return  QVariant ("<undefined>");
			}
		return QVariant ();
	}
Esempio n. 8
0
TEST(PaddingEffectTest, Crop) {
	float data[2 * 2] = {
		1.0f, 0.5f,
		0.8f, 0.3f,
	};
	float expected_data[1 * 1] = {
		0.3f,
	};
	float out_data[1 * 1];

        EffectChainTester tester(NULL, 1, 1);

	ImageFormat format;
	format.color_space = COLORSPACE_sRGB;
	format.gamma_curve = GAMMA_LINEAR;

	FlatInput *input = new FlatInput(format, FORMAT_GRAYSCALE, GL_FLOAT, 2, 2);
	input->set_pixel_data(data);
	tester.get_chain()->add_input(input);

	Effect *effect = tester.get_chain()->add_effect(new PaddingEffect());
	CHECK(effect->set_int("width", 1));
	CHECK(effect->set_int("height", 1));
	CHECK(effect->set_float("left", -1.0f));
	CHECK(effect->set_float("top", -1.0f));

	tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
	expect_equal(expected_data, out_data, 1, 1);
}
Esempio n. 9
0
wxString EffectManager::GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent)
{
   Effect *effect = GetEffect(ID);

   if (!effect)
   {
      return wxEmptyString;
   }

   EffectAutomationParameters eap(params);

   wxString preset;
   if (eap.HasEntry(wxT("Use Preset")))
   {
      preset = eap.Read(wxT("Use Preset"));
   }

   preset = effect->GetPreset(parent, preset);
   if (preset.IsEmpty())
   {
      return preset;
   }

   eap.DeleteAll();
   
   eap.Write(wxT("Use Preset"), preset);
   eap.GetParameters(preset);

   return preset;
}
Esempio n. 10
0
bool AudioView::ProcessEvent(wxEvent& event)
{
  if (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED &&
      event.GetId() >= FirstEffectID &&
      event.GetId() < FirstEffectID + numEffects) {
    Effect *f = Effect::GetEffect(event.GetId() - FirstEffectID);

    TrackList *tracks = GetTracks();
    VTrack *t = tracks->First();
    
    while(t) {
      if (t->selected && t->GetKind() == (VTrack::Wave)) {
	f->DoInPlaceEffect((WaveTrack *)t, sel0, sel1);
      }
      
      t = tracks->Next();
    }
    
    PushState();
    
    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
    
    // This indicates we handled the event.
    return true;
  }
  
  return wxView::ProcessEvent(event);
}
Esempio n. 11
0
TEST(PaddingEffectTest, NonIntegerOffset) {
	float data[4 * 1] = {
		0.25f, 0.50f, 0.75f, 1.0f,
	};
	float expected_data[5 * 2] = {
		0.1875f, 0.4375f, 0.6875f, 0.9375f, 0.25f,
		0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
	};
	float out_data[5 * 2];

        EffectChainTester tester(NULL, 5, 2);

	ImageFormat format;
	format.color_space = COLORSPACE_sRGB;
	format.gamma_curve = GAMMA_LINEAR;

	FlatInput *input = new FlatInput(format, FORMAT_GRAYSCALE, GL_FLOAT, 4, 1);
	input->set_pixel_data(data);
	tester.get_chain()->add_input(input);

	Effect *effect = tester.get_chain()->add_effect(new PaddingEffect());
	CHECK(effect->set_int("width", 5));
	CHECK(effect->set_int("height", 2));
	CHECK(effect->set_float("left", 0.25f));
	CHECK(effect->set_float("top", 0.0f));

	tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
	expect_equal(expected_data, out_data, 5, 2);
}
void Renderer::RenderXModel(const XModel& model, const Effect& effect, const D3DXMATRIX& model_matrix)
{
  assert(model.IsCorrect());
  assert(effect.IsCorrect());

  D3DXMATRIX full_matrix = model_matrix * view_ * projection_;

  const auto& effect_data = effect.d3d9_effect();
  effect_data->SetMatrix
    ("matrix_world_view_proj", &full_matrix);

  UINT passes;
  D3DXHANDLE tech;
  effect_data->FindNextValidTechnique(0, &tech);
  effect_data->SetTechnique(tech);
  effect_data->Begin(&passes, 0);
  for (UINT pass = 0; pass < passes; ++pass)
  {
    effect_data->BeginPass(pass);

    const auto& materials = model.textures();
    for (UINT i = 0; i < model.subset_number(); ++i) {
      if (i < materials.size())
        effect_data->SetTexture("tex0", materials[i]->d3d9_texture());
      effect_data->CommitChanges();
      model.mesh()->DrawSubset(i);
    }

    effect_data->EndPass();
  }
  effect_data->End();
}
Esempio n. 13
0
void StartMenu::flareEffect(CCObject *node)
{
    onButtonEffect();
    Effect* flareEffect = Effect::create();
    CCCallFunc *callback =  CCCallFunc::create(this, callfunc_selector(StartMenu::newGame));
    flareEffect->flareEffect(this, callback);
}
void Renderer::RenderRawModel(const gfx::Model3d& model, const Effect& effect, const D3DXMATRIX& model_matrix)
{
  assert(effect.IsCorrect());

  for (auto& data : model.render_data()) {
    D3DXMATRIX full_matrix = model_matrix * view_ * projection_;

    const auto& effect_data = effect.d3d9_effect();
    effect_data->SetMatrix
      ("matrix_world_view_proj", &full_matrix);

    UINT passes;
    D3DXHANDLE tech;
    effect_data->FindNextValidTechnique(0, &tech);
    effect_data->SetTechnique(tech);
    effect_data->Begin(&passes, 0);
    for (UINT pass = 0; pass < passes; ++pass)
    {
      effect_data->BeginPass(pass);

      effect_data->SetTexture("tex0", storage_->FetchTexture(data));
      effect_data->CommitChanges();
      device_->SetFVF(VERTEX_XYZ_FVF);
      device_->SetStreamSource(0, storage_->FetchVertexBuffer(data), 0, sizeof(Vertex_xyz));
      device_->SetIndices(storage_->FetchIndexBuffer(data));
      device_->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, data.vertices_number, 0, data.faces_number);
      effect_data->EndPass();
    }
    effect_data->End();
  }
}
Esempio n. 15
0
	void SpriteShape::Draw(IGraphicsDevice *device, RenderState &state)
	{
		IGraphicsContext *context = device->GetContext();
		
		Effect *effect = context->GetEffect("Sprite");
		if(mHasBackgroundImage) {
			effect->SetActiveTechnique("SpriteTexture");
		} else {
			effect->SetActiveTechnique("SpriteColor");
		}

		glm::mat4 wvp = state.GetWorldViewProjection();

		state.SetShaderData(mWVPIndex, &wvp);
		state.SetShaderData(mFrameIndex, &mFrame);
		state.SetShaderData(mTextureFrameIndex, &mTexFrame);
		state.SetShaderData(mBackgroundColorIndex, &mBackgroundColor);

		if(mBackgroundImage) {
			state.SetShaderData(mBackgroundImageIndex, mBackgroundImage);
		}

		state.SetShaderData(mBorderWidthIndex, &mBorderWidth);
		state.SetShaderData(mBorderColorIndex, &mBorderColor);

		if(sSpriteVertexBuffer) {
			Technique *technique = effect->GetActiveTechnique();
			technique->Begin();
			while(technique->HasNextPass()) {
				sSpriteVertexBuffer->Activate();
				technique->ProcessNextPass(device, state);
				device->Draw(PrimitiveTypeTriangleStrip, 4, 0);
			}
		}
	}
Esempio n. 16
0
Effect WindowsGame::createBasicEffect()
{
    Effect effect;
    PassDescription passDesc;
    passDesc.shaderProgram = std::move(std::unique_ptr<ShaderProgram>(createShaderProgram()));
    passDesc.name = "Light";

    DepthStencilStateDescription depthDesc;
    depthDesc.depthEnabled = true;
    depthDesc.writeEnabled = true;
    depthDesc.function = CompareFunction::Less;
    depthDesc.stencilEnabled = false;

    DepthStencilState* depthState = new DepthStencilState();
    depthState->initialize(graphicsDevice, depthDesc);

    passDesc.depthStencilState = std::move(std::unique_ptr<DepthStencilState>(depthState));

    EffectDescription effectDesc;
    effectDesc.passDescriptions = &passDesc;
    effectDesc.passCount = 1;
    effectDesc.instanceParameters.push_back(InstanceParameterBinding("PointLights", 0));
    effectDesc.instanceParameters.push_back(InstanceParameterBinding("Camera", 1));
    effectDesc.instanceParameters.push_back(InstanceParameterBinding("Transformation", 2));

    effect.initialize(effectDesc);

    return effect;
}
Esempio n. 17
0
bool Shader::setEffect(engine::IEffect* effect)
{
    Effect* e = dynamic_cast<Effect*>( effect );
    if( e && !e->isCompatible( this ) ) return false;
    _effect = e;
    return true;
}
Esempio n. 18
0
    int AudioOutputDevice::RenderAudio(uint Samples) {
        if (Channels.empty()) return 0;

        // reset all channels with silence
        {
            std::vector<AudioChannel*>::iterator iterChannels = Channels.begin();
            std::vector<AudioChannel*>::iterator end          = Channels.end();
            for (; iterChannels != end; iterChannels++)
                (*iterChannels)->Clear(Samples); // zero out audio buffer
        }
        // do the same for master effects
        {
            std::vector<EffectChain*>::iterator iterChains = vEffectChains.begin();
            std::vector<EffectChain*>::iterator end        = vEffectChains.end();
            for (; iterChains != end; ++iterChains)
                (*iterChains)->ClearAllChannels(); // zero out audio buffers
        }

        int result = 0;

        // let all connected engines render audio for the current audio fragment cycle
        const std::set<Engine*>& engines = EnginesReader.Lock();
        #if CONFIG_RT_EXCEPTIONS
        try
        #endif // CONFIG_RT_EXCEPTIONS
        {
            std::set<Engine*>::iterator iterEngine = engines.begin();
            std::set<Engine*>::iterator end        = engines.end();
            for (; iterEngine != end; iterEngine++) {
                int res = (*iterEngine)->RenderAudio(Samples);
                if (res != 0) result = res;
            }
        }
        #if CONFIG_RT_EXCEPTIONS
        catch (std::runtime_error se) {
            std::cerr << "std::runtime_error: " << se.what() << std::endl << std::flush;
            exit(EXIT_FAILURE);
        }
        #endif // CONFIG_RT_EXCEPTIONS
        EnginesReader.Unlock();

        // now that the engines (might) have left fx send signals for master
        // effects, render all master effects
        {
            std::vector<EffectChain*>::iterator iterChains = vEffectChains.begin();
            std::vector<EffectChain*>::iterator end        = vEffectChains.end();
            for (; iterChains != end; ++iterChains) {
                if (!(*iterChains)->EffectCount()) continue;
                (*iterChains)->RenderAudio(Samples);
                // mix the result of the last effect in the chain to the audio
                // output device channel(s)
                Effect* pLastEffect =
                    (*iterChains)->GetEffect((*iterChains)->EffectCount() - 1);
                for (int iChan = 0; iChan < pLastEffect->OutputChannelCount() && iChan < ChannelCount(); ++iChan)
                    pLastEffect->OutputChannel(iChan)->MixTo(Channel(iChan), Samples);
            }
        }

        return result;
    }
Esempio n. 19
0
boost::shared_ptr<NodeCollection>
App::getCollectionFromGroup(Group* group) const
{
    boost::shared_ptr<NodeCollection> collection;
    if (group) {
        App* isApp = dynamic_cast<App*>(group);
        Effect* isEffect = dynamic_cast<Effect*>(group);
        if (isApp) {
            collection = boost::dynamic_pointer_cast<NodeCollection>(isApp->getInternalApp()->getProject());
        } else if (isEffect) {
            NodePtr node = isEffect->getInternalNode();
            assert(node);
            boost::shared_ptr<NodeGroup> isGrp = boost::dynamic_pointer_cast<NodeGroup>(node->getEffectInstance()->shared_from_this());
            if (!isGrp) {
                qDebug() << "The group passed to createNode() is not a group, defaulting to the project root.";
            } else {
                collection = boost::dynamic_pointer_cast<NodeCollection>(isGrp);
                assert(collection);
            }
            
        }
    }
    
    if (!collection) {
        collection = boost::dynamic_pointer_cast<NodeCollection>(_instance->getProject());
    }
    return collection;
}
Esempio n. 20
0
void Pipeline::setVideoEffect(const QString &value)
{
    Effect *newEffect = EffectManager::instance()->getEffect(value);

    // close valves
    g_object_set(effectValve, "drop", TRUE, NULL);

    // unlink current effect, remove and destroy it
    gst_element_unlink_many(effectCapsFilter, effect, effectPostCS, NULL);
    g_object_ref(effect);
    gst_bin_remove(GST_BIN(effectInternalBin), effect);
    gst_element_set_state(effect, GST_STATE_NULL);
    g_object_unref(GST_OBJECT(effect));

    effect = gst_parse_bin_from_description(newEffect->desc().toUtf8(), TRUE, NULL);

    // add new effect to the bin and link it
    gst_bin_add(GST_BIN(effectInternalBin), effect);
    gst_element_link_many(effectCapsFilter, effect, effectPostCS, NULL);

    gst_element_set_state(effectInternalBin, GST_STATE_READY);
    gst_element_set_state(effectInternalBin, GST_STATE_PAUSED);

    //open valve
    g_object_set(effectValve, "drop", FALSE, NULL);

}
Esempio n. 21
0
void EffectManager::addEffect(EffectInfo& effectInfo)
{
	if (effectInfo.m_configData.m_particleName=="" || !effectInfo.m_effectParent)
	{
		return;
	}
	Effect* effect = new Effect();
	effect->setEffectInfo(effectInfo);
	effect->init();
	std::map<EffectNode*, std::map<std::string, Effect*> >::iterator itr = effectDic.find(effectInfo.m_effectParent);
	if (itr!=effectDic.end())
	{
		itr->second.insert(std::map<std::string, Effect*>::value_type(effectInfo.m_configData.m_effectName, effect));
	}
	else
	{
		std::map<std::string, Effect*> effDic;
		effDic.insert(std::map<std::string, Effect*>::value_type(effectInfo.m_configData.m_effectName, effect));
		effectDic.insert(std::map<EffectNode*, std::map<std::string, Effect*> >::value_type(effectInfo.m_effectParent, effDic));
	}
	if (effectDic.size()==1)
	{
		CCDirector::sharedDirector()->getScheduler()->resumeTarget(this);
	}
}
Esempio n. 22
0
/**\brief Update the Projectile
 *
 * Projectiles do all the normal Sprite things like moving.
 * Projectiles check for collisions with nearby Ships, and if they collide,
 * they deal damage to that ship. Note that since each projectile knows which ship fired it and will never collide with them.
 *
 * Projectiles have a life time limit (in milli-seconds).  Each tick they need
 * to check if they've lived to long and need to disappear.
 *
 * Projectiles have the ability to track down a specific target.  This only
 * means that they will turn slightly to head towards their target.
 */
void Projectile::Update( void ) {
	Sprite::Update(); // update momentum and other generic sprite attributes
	SpriteManager *sprites = SpriteManager::Instance();

	// Check for projectile collisions
	Sprite* impact = sprites->GetNearestSprite( (Sprite*)this, 100,DRAW_ORDER_SHIP|DRAW_ORDER_PLAYER );
	if( (impact != NULL) && (impact->GetID() != ownerID) && ((this->GetWorldPosition() - impact->GetWorldPosition()).GetMagnitude() < impact->GetRadarSize() )) {
		((Ship*)impact)->Damage( (weapon->GetPayload())*damageBoost );
		sprites->Delete( (Sprite*)this );
		
		// Create a fire burst where this projectile hit the ship's shields.
		// TODO: This shows how much we need to improve our collision detection.
		Effect* hit = new Effect(this->GetWorldPosition(), "Resources/Animations/shield.ani", 0);
		hit->SetAngle( -this->GetAngle() );
		hit->SetMomentum( impact->GetMomentum() );
		sprites->Add( hit );
	}

	// Expire the projectile after a time period
	if (( Timer::GetTicks() > secondsOfLife + start )) {
		sprites->Delete( (Sprite*)this );
	}

	// Track the target
	Sprite* target = sprites->GetSpriteByID( targetID );
	float tracking = weapon->GetTracking();
	if( target != NULL && tracking > 0.00000001f ) {
		float angleTowards = normalizeAngle( ( target->GetWorldPosition() - this->GetWorldPosition() ).GetAngle() - GetAngle() );
		SetMomentum( GetMomentum().RotateBy( angleTowards*tracking ) );
		SetAngle( GetMomentum().GetAngle() );
	}
}
Esempio n. 23
0
/**
*  @brief
*    Constructor
*/
EffectManager::EffectManager(RendererContext &cRendererContext) :
	m_pRendererContext(&cRendererContext),
	m_pDefault(new EffectHandler())
{
	PL_LOG(Debug, "Create effect manager")

	// Set manager name
	SetManagerName("Effect manager");

	// Unload unused resources, please
	SetUnloadUnused(true);

	// Create the standard effect
	Effect *pFX = CreateResource(Default);
	if (pFX) {
		// Create the effect
		EffectTechnique *pEffectTechnique = pFX->AddTechnique();
		if (pEffectTechnique) {
			pEffectTechnique->AddPass();
			pFX->SelectTechnique(0);
		}

		// Setup effect
		pFX->SetProtected(true);
		m_pDefault->SetResource(pFX);
		SetStandard(pFX);
	}
}
Esempio n. 24
0
bool BulletRapidFire::update( ) {
	_exist_time++;
	if ( _exist_time < WAIT_TIME  ) {
		return true;
	}
	if ( _exist_time >= VANISH_TIME  ) {
		return false;
	}

	Effect effect;
	if ( _exist_time == RAPID_TIME ) {
		_bullet_effect_handle[ 1 ] = effect.setEffect( Effect::EFFECT_ENEMY_ATTACK_FIRE_BALL );
		_exist_bullet[ 1 ] = true;
	}

	for ( int i = 0; i < BULLET_NUM; i++ ) {
		if ( !_exist_bullet[ i ] ) {
			continue;
		}
		// ˆÚ“®
		_bullet_pos[ i ] += _dir * _speed;

		attackEnemy( _bullet_pos[ i ], _power );

		Effect effect;
		
		effect.drawEffect( _bullet_effect_handle[ i ], Vector( 0.3, 0.3, 0.3 ), _bullet_pos[ i ], _dir );

	}
	return true;
}
Esempio n. 25
0
void AfterEffectManager::update(float dt)
{
	if (core->particlesPaused) return;	

	resetGrid();

	if (core->frameBuffer.isInited())
		active = true;
	else
		active = false;

	for (int i = 0; i < effects.size(); i++)
	{		
		Effect *e = effects[i];
		if (e)
		{
			active = true;
			e->update(dt, drawGrid, xDivs, yDivs);
			if (e->done)
			{
				numEffects--;
				destroyEffect(i);
			}
		}
	}
}
Esempio n. 26
0
 Effect* ResourceManager::GetEffect(const std::string& name)
 {
	 hash_map<string,Effect*>::iterator iterator = effects.find(name);
	 if(iterator == effects.end()) return NULL;
	 Effect* result = iterator->second;
	 result->AddRef();
	 return result;
 }
Esempio n. 27
0
void Engine::Init()
{
	GUI gui;
	gui.Init();

	Effect effect;
	effect.Init();
}
Esempio n. 28
0
void Actor::kill()
{
	mbIsDead = true;
	AudioManager::Instance().PlaySFX("scifi_explosion-001.ogg");

	Effect * pExplosion = ModContentManager::Instance().SpawnEffect("explosion");
	pExplosion->SetPosition(mPosition);
	Game::Instance().QueueEffect(pExplosion);
}
Esempio n. 29
0
void EffectRackView::deletePlugin( EffectView* view )
{
	Effect * e = view->effect();
	m_effectViews.erase( qFind( m_effectViews.begin(), m_effectViews.end(), view ) );
	delete view;
	fxChain()->removeEffect( e );
	e->deleteLater();
	update();
}
Esempio n. 30
0
void GameMap::ShowEffect(int dataid,const string& name,const Point& pos,float duration /* = 0.0f */,float scale /* = 1.0f */)
{
	Effect* pEffect = Effect::createWithDataID(dataid);
	if ( pEffect )
	{
		pEffect->setName(name);
		ShowEffect(pEffect,pos,duration,scale);
	}
}