//---------------------------------------------------------------------------- VisualEffectInstance::VisualEffectInstance (const VisualEffect* effect, int techniqueIndex) : mEffect((VisualEffect*)effect), // conceptual constness mTechniqueIndex(techniqueIndex) { assertion(effect != 0, "Effect must be specified.\n"); assertion( 0 <= techniqueIndex && techniqueIndex < effect->GetNumTechniques(), "Invalid technique index.\n"); VisualTechnique* technique = mEffect->GetTechnique(mTechniqueIndex); mNumPasses = technique->GetNumPasses(); mVertexParameters = new1<ShaderParametersPtr>(mNumPasses); mPixelParameters = new1<ShaderParametersPtr>(mNumPasses); int p; for (p = 0; p < mNumPasses; ++p) { VisualPass* pass = technique->GetPass(p); mVertexParameters[p] = new0 ShaderParameters(pass->GetVertexShader()); mPixelParameters[p] = new0 ShaderParameters(pass->GetPixelShader()); } }
//---------------------------------------------------------------------------- void LightAmbEffect::PostLink () { VisualEffect::PostLink(); VisualPass* pass = mTechniques[0]->GetPass(0); VertexShader* vshader = pass->GetVertexShader(); PixelShader* pshader = pass->GetPixelShader(); vshader->SetBaseRegisters(msVRegisters); vshader->SetPrograms(msVPrograms); pshader->SetPrograms(msPPrograms); }
//---------------------------------------------------------------------------- void Texture2ColorBlendEffect::PostLink () { VisualEffect::PostLink(); VisualPass* pass = mTechniques[0]->GetPass(0); VertexShader* vshader = pass->GetVertexShader(); PixelShader* pshader = pass->GetPixelShader(); vshader->SetBaseRegisters(msVRegisters); vshader->SetPrograms(msVPrograms); pshader->SetTextureUnits(msPTextureUnits); pshader->SetPrograms(msPPrograms); }