Exemplo n.º 1
0
            public CachedBatch(
                CachedBatchType cbt,
                IBatchContainer container,
                int layer,
                bool worldSpace,
                RasterizerState rasterizerState,
                DepthStencilState depthStencilState,
                BlendState blendState,
                SamplerState samplerState,
                Material customMaterial,
                bool useZBuffer
                )
            {
                Batch     = null;
                BatchType = cbt;
                Container = container;
                Layer     = layer;
                // FIXME: Mask if multimaterial?
                WorldSpace = worldSpace;
                UseZBuffer = useZBuffer;

                if (cbt != CachedBatchType.MultimaterialBitmap)
                {
                    RasterizerState   = rasterizerState;
                    DepthStencilState = depthStencilState;
                    BlendState        = blendState;
                    SamplerState      = samplerState;
                    CustomMaterial    = customMaterial;
                }
                else
                {
                    RasterizerState   = null;
                    DepthStencilState = null;
                    BlendState        = null;
                    SamplerState      = null;
                    CustomMaterial    = null;
                }

                HashCode = Container.GetHashCode() ^
                           Layer.GetHashCode();

                if (BlendState != null)
                {
                    HashCode ^= BlendState.GetHashCode();
                }

                if (SamplerState != null)
                {
                    HashCode ^= SamplerState.GetHashCode();
                }

                if (CustomMaterial != null)
                {
                    HashCode ^= CustomMaterial.GetHashCode();
                }
            }
Exemplo n.º 2
0
            public CachedBatch(
                Type batchType,
                IBatchContainer container,
                int layer,
                bool worldSpace,
                RasterizerState rasterizerState,
                DepthStencilState depthStencilState,
                BlendState blendState,
                SamplerState samplerState,
                bool useZBuffer
                )
            {
                Batch             = null;
                BatchType         = batchType;
                Container         = container;
                Layer             = layer;
                WorldSpace        = worldSpace;
                RasterizerState   = rasterizerState;
                DepthStencilState = depthStencilState;
                BlendState        = blendState;
                SamplerState      = samplerState;
                UseZBuffer        = useZBuffer;

                HashCode = Container.GetHashCode() ^
                           Layer.GetHashCode();

                if (BlendState != null)
                {
                    HashCode ^= BlendState.GetHashCode();
                }

                if (SamplerState != null)
                {
                    HashCode ^= SamplerState.GetHashCode();
                }
            }
Exemplo n.º 3
0
 public static int ComputeHashCode(SpriteTexture texture, SamplerState sampler, int groupId, float rotation = 0)
 {
     return(texture.GetHashCode() ^ sampler.GetHashCode() ^ groupId.GetHashCode() ^ rotation.GetHashCode());
 }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     return(Texture.GetHashCode() ^ TextureSampler.GetHashCode());
 }