FerretEngine/src/Graphics/Effects/Material.cs
/// <summary>
/// Used before each render call.
/// </summary>
Used before each render call.
Used before each render call .
internal void Bind()
        {
            if (Effect == null || !_isDirty)
                return;
            _isDirty = false;
            foreach (EffectParameter p in Effect.Parameters)
            {
                switch (p.ParameterType)
                {
                    case EffectParameterType.Texture:
                    case EffectParameterType.Texture2D:
                        BindTexture(p);
                        break;
                    case EffectParameterType.Bool:
                        BindBool(p);
                        break;
                    case EffectParameterType.Int32:
                        BindInt(p);
                        break;
                    case EffectParameterType.Single:
                        if (p.ParameterClass == EffectParameterClass.Vector)
                        {
                            if (p.ColumnCount == 2)
                                BindVector2(p);
                            else if (p.ColumnCount == 3)
                                BindVector3(p);
                            else if (p.ColumnCount == 4)
                                BindVector4(p);
                            else goto default;
                        }
                        else if (p.ParameterClass == EffectParameterClass.Scalar)
                            BindFloat(p);
                        break;
                    default:
                        UnknownEffectParameter(p);
                        break;
                }
            }
        }
internal void Bind ( ) { if ( Effect == null || ! _isDirty ) return ; _isDirty = false ; foreach ( EffectParameter p in Effect . Parameters ) { switch ( p . ParameterType ) { case EffectParameterType . Texture : case EffectParameterType . Texture2D : BindTexture ( p ) ; break ; case EffectParameterType . Bool : BindBool ( p ) ; break ; case EffectParameterType . Int32 : BindInt ( p ) ; break ; case EffectParameterType . Single : if ( p . ParameterClass == EffectParameterClass . Vector ) { if ( p . ColumnCount == 2 ) BindVector2 ( p ) ; else if ( p . ColumnCount == 3 ) BindVector3 ( p ) ; else if ( p . ColumnCount == 4 ) BindVector4 ( p ) ; else goto default ; } else if ( p . ParameterClass == EffectParameterClass . Scalar ) BindFloat ( p ) ; break ; default : UnknownEffectParameter ( p ) ; break ; } } }
Used before each render call.
Used before each render call .
// TODO matrices, etc // else UnknownEffectParameter(p);