Sparrow.Core.RenderState.Setup C# (CSharp) Method

Setup() public method

public Setup ( RenderState state, Matrix modelViewMatrix, float alpha, uint blendMode ) : void
state RenderState
modelViewMatrix Sparrow.Geom.Matrix
alpha float
blendMode uint
return void
        public void Setup(RenderState state, Matrix modelViewMatrix, float alpha, uint blendMode)
        {
            Alpha = alpha * state.Alpha;
            BlendMode = blendMode == Sparrow.Display.BlendMode.AUTO ? state.BlendMode : blendMode;

            ModelViewMatrix.CopyFromMatrix(state.ModelViewMatrix);
            ModelViewMatrix.PrependMatrix(modelViewMatrix);
        }
    }

Usage Example

        /// <summary>
        /// Adds a new render state to the stack. The passed matrix is prepended to the modelview matrix;
        /// the alpha value is multiplied with the current alpha; the blend mode replaces the existing
        /// mode (except 'BlendMode.Auto', which will cause the current mode to prevail).
        /// </summary>
        public void PushState(Matrix matrix, float alpha, uint blendMode)
        {
            RenderState previousState = _stateStackTop;

            if (_stateStackSize == _stateStackIndex + 1)
            {
                _stateStack.Add(new RenderState());
                _stateStackSize++;
            }

            _stateStackTop = _stateStack[++_stateStackIndex];
            _stateStackTop.Setup(previousState, matrix, alpha, blendMode);
        }
All Usage Examples Of Sparrow.Core.RenderState::Setup