public CGfxEffect TryGetEffect(CRenderContext RHICtx, CGfxMesh mesh, bool tryLoad, GfxEnvShaderCode ShaderEnv)
        {
            var result = CGfxEffectDesc.CreateDesc(MtlInst.Material, mesh.MdfQueue, ShaderEnv);//, mShaderDefinition);
            var hash64 = result.GetHash64();

            return(CEngine.Instance.EffectManager.TryGetEffect(ref hash64));
        }
Beispiel #2
0
        private CGfxEffect GetEffect(CRenderContext rc, CGfxMesh mesh, bool tryLoad)
        {
            CGfxEffectDesc desc = new CGfxEffectDesc();

            desc.Material    = Material.Material;
            desc.ShadingEnv  = mesh.ShadingEnv;
            desc.MdfQueue    = mesh.MdfQueue;
            desc.Definitions = ShaderDefinition;

            desc.UpdateDefinitions();

            return(CEngine.Instance.EffectManager.GetEffect(rc, desc, tryLoad));
        }
Beispiel #3
0
        public async System.Threading.Tasks.Task <bool> SetMaterial(CRenderContext rc, CGfxMaterialInstance mtl, string textureName)
        {
            mMaterialInst = mtl;
            var senv = CEngine.Instance.PrebuildPassData.Font2DShadingEnvs;

            mEffects = new CGfxEffect[senv.Length];
            for (int i = 0; i < mEffects.Length; i++)
            {
                if (senv[i] == null)
                {
                    continue;
                }

                var desc   = CGfxEffectDesc.CreateDesc(mMaterialInst.Material, new CGfxMdfQueue(), senv[i].EnvCode);
                var effect = CEngine.Instance.EffectManager.GetEffect(rc, desc);
                await effect.AwaitLoad();

                mEffects[i] = effect;
            }

            var defEffect = mEffects[(int)PrebuildPassIndex.PPI_Default];

            if (defEffect != null)
            {
                if (textureName != null)
                {
                    mEffects[(int)PrebuildPassIndex.PPI_Default].ShaderProgram.FindTextureBindInfo(mMaterialInst, textureName, ref mTextureBindInfo);
                }
                else
                {
                    mEffects[(int)PrebuildPassIndex.PPI_Default].ShaderProgram.GetTextureBindDesc(0, ref mTextureBindInfo);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
        internal CGfxEffectDesc GetEffectDesc(CGfxMesh mesh, GfxEnvShaderCode ShaderEnv)
        {
            var result = CGfxEffectDesc.CreateDesc(MtlInst.Material, mesh.MdfQueue, ShaderEnv);//, mShaderDefinition);

            return(result);
        }