示例#1
0
        public static BasicEffect GetBasicEffect(this IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              const string key = "__WrappedBasicEffect";
              object effect;
              graphicsService.Data.TryGetValue(key, out effect);
              var instance = effect as WrappedBasicEffect;
              if (instance == null)
              {
            instance = new WrappedBasicEffect(graphicsService.GraphicsDevice);
            graphicsService.Data[key] = instance;
              }
              return instance;
        }
        public static BasicEffect GetBasicEffect(this IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            {
                throw new ArgumentNullException("graphicsService");
            }

            const string key = "__WrappedBasicEffect";
            object       effect;

            graphicsService.Data.TryGetValue(key, out effect);
            var instance = effect as WrappedBasicEffect;

            if (instance == null)
            {
                instance = new WrappedBasicEffect(graphicsService.GraphicsDevice);
                graphicsService.Data[key] = instance;
            }
            return(instance);
        }