Beispiel #1
0
  void Material::Initialize(Effect* effect) {
    effect_ = effect;
    assert(effect_ != nullptr);

    Technique* default_technique = nullptr;
    assert(effect->Techniques().size() > 0);
    if (default_technique_name_.empty() == false) {
      default_technique = effect->TechniquesByName().at(default_technique_name_);
      assert(default_technique != nullptr);
    }
    else {
      default_technique = effect_->Techniques().at(0);
    }
    SetCurrentTechnique(default_technique);
  }
Beispiel #2
0
    void Material::Initialize(Effect& effect)
    {
		for (std::pair<Pass*, ID3D11InputLayout*> inputLayout : mInputLayouts)
        {
            ReleaseObject(inputLayout.second);
        }
		mInputLayouts.clear();

        mEffect = &effect;

        Technique* defaultTechnique = nullptr;
        assert(mEffect->Techniques().size() > 0);
        if (mDefaultTechniqueName.empty() == false)
        {
            defaultTechnique = mEffect->TechniquesByName().at(mDefaultTechniqueName);
            assert(defaultTechnique != nullptr);
        }
        else
        {
            defaultTechnique = mEffect->Techniques().at(0);
        }

        SetCurrentTechnique(*defaultTechnique);
    }