当前位置: 首页>>代码示例>>C#>>正文


C# All类代码示例

本文整理汇总了C#中All的典型用法代码示例。如果您正苦于以下问题:C# All类的具体用法?C# All怎么用?C# All使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


All类属于命名空间,在下文中一共展示了All类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompileShader

        private int CompileShader(string shaderName, All shaderType)
        {
            string shaderPath = NSBundle.PathForResourceAbsolute(shaderName, ".glsl", "Content");
            string shaderProgram = File.ReadAllText(shaderPath);

            int shader = GL.CreateShader(shaderType);
            int length = shaderProgram.Length;

            GL.ShaderSource(shader, 1, new string[] { shaderProgram }, ref length);
            GL.CompileShader(shader);

            int compileStatus = 0;

            GL.GetShader(shader, All.CompileStatus, ref compileStatus);

            if (compileStatus == (int)All.False)
            {
                StringBuilder sb = new StringBuilder(256);
                length = 0;
                GL.GetShaderInfoLog(shader, sb.Capacity, ref length, sb);
                Console.WriteLine(sb.ToString());
                throw new InvalidOperationException();
            }

            return shader;
        }
开发者ID:jlyonsmith,项目名称:GLES2Tutorial,代码行数:26,代码来源:OpenGLView.cs

示例2: Cull

 public static void Cull(All cullMode)
 {
     if (_cull != cullMode)
     {
         _cull = cullMode;
        // TODO  GL.Enable(_cull);
     }
 }
开发者ID:QHebert,项目名称:monogame,代码行数:8,代码来源:GLStateManager.cs

示例3: testAll

        // throws jjtraveler.VisitFailure
        public virtual void testAll()
        {
            Identity id = new Identity();
            Logger expected = new Logger(id, new IVisitable[]{n3, n2} );

            All  all = new All( logVisitor(id) );

            IVisitable nodeReturned = all.visit(n4);
            Assertion.AssertEquals(expected, logger);
            Assertion.AssertEquals(n4, nodeReturned);
        }
开发者ID:cwi-swat,项目名称:jjtraveler-csharp,代码行数:12,代码来源:LibraryTest.cs

示例4: GLESTextureBuffer

		/// <summary>
		/// 
		/// </summary>
		/// <param name="name"></param>
		/// <param name="target"></param>
		/// <param name="id"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		/// <param name="format"></param>
		/// <param name="face"></param>
		/// <param name="level"></param>
		/// <param name="usage"></param>
		/// <param name="crappyCard"></param>
		/// <param name="writeGamma"></param>
		/// <param name="fsaa"></param>
		public GLESTextureBuffer( string basename, All targetfmt, int id, int width, int height, int format, int face, int level, BufferUsage usage, bool crappyCard, bool writeGamma, int fsaa )
			: base( 0, 0, 0, Media.PixelFormat.Unknown, usage )
		{
			_target = targetfmt;
			_textureId = id;
			_face = face;
			_level = level;
			_softwareMipmap = crappyCard;

			GLESConfig.GlCheckError( this );
			OpenGL.BindTexture( All.Texture2D, _textureId );
			GLESConfig.GlCheckError( this );

			// Get face identifier
			_faceTarget = _target;

			// TODO verify who get this
			Width = width;
			Height = height;
			Depth = 1;

			_glInternalFormat = (All)format;
			Format = GLESPixelUtil.GetClosestAxiomFormat( _glInternalFormat );

			RowPitch = Width;
			SlicePitch = Height * Width;
			sizeInBytes = PixelUtil.GetMemorySize( Width, Height, Depth, Format );

			// Set up a pixel box
			_buffer = new PixelBox( Width, Height, Depth, Format );
			if ( Width == 0 || Height == 0 || Depth == 0 )
			{
				/// We are invalid, do not allocate a buffer
				return;
			}

			// Is this a render target?
			if ( ( (int)Usage & (int)TextureUsage.RenderTarget ) != 0 )
			{
				// Create render target for each slice
				for ( int zoffset = 0; zoffset < Depth; zoffset++ )
				{
					string name = string.Empty;
					name = "rtt/" + this.GetHashCode() + "/" + basename;
					GLESSurfaceDescription target = new GLESSurfaceDescription();
					target.Buffer = this;
					target.ZOffset = zoffset;
					RenderTexture trt = GLESRTTManager.Instance.CreateRenderTexture( name, target, writeGamma, fsaa );
					_sliceTRT.Add( trt );
					Root.Instance.RenderSystem.AttachRenderTarget( _sliceTRT[ zoffset ] );
				}
			}

		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:69,代码来源:GLESTextureBuffer.cs

示例5: EAGLView

		public EAGLView (RectangleF frame, All format, All depth, bool retained) : base (frame)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject [] {NSNumber.FromBoolean (true),           EAGLColorFormat.RGBA8},
				new NSObject [] {EAGLDrawableProperty.RetainedBacking,  EAGLDrawableProperty.ColorFormat}
			);
			_format = format;
			_depthFormat = depth;

			_context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;
			CreateSurface ();
		}
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:13,代码来源:EAGLView.cs

示例6: EAGLView

		public EAGLView (CGRect frame, All format, All depth, bool retained) : base (frame)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.DrawableProperties = new NSDictionary (
				EAGLDrawableProperty.RetainedBacking, true,
				EAGLDrawableProperty.ColorFormat, EAGLColorFormat.RGBA8
			);

			_depthFormat = depth;

			_context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;
			CreateSurface ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:13,代码来源:EAGLView.cs

示例7: testOnceTopDownIsLeaf

 public virtual void testOnceTopDownIsLeaf()
 {
     IVisitor isLeaf = new All(new Fail());
     OnceTopDown onceTopDown = new OnceTopDown(logVisitor(isLeaf));
     Logger expected = new Logger(isLeaf, new IVisitable[]{n0,n1,n11});
     try
     {
         IVisitable nodeReturned = onceTopDown.visit(n0);
         Assertion.AssertEquals("visit trace",expected, logger);
         Assertion.AssertEquals("return value",n0, nodeReturned);
     }
     catch (VisitFailure)
     {
         Assertion.Fail("VisitFailure should not occur!");
     }
 }
开发者ID:cwi-swat,项目名称:jjtraveler-csharp,代码行数:16,代码来源:OnceTopDownTest.cs

示例8: testAll

 public virtual void testAll()
 {
     Identity id = new Identity();
     All all = new All(logVisitor(id));
     Logger expected = new Logger(id, new IVisitable[] { n1, n2 });
     try
     {
         IVisitable nodeReturned = all.visit(n0);
         Assertion.AssertEquals(expected, logger);
         Assertion.AssertEquals(n0, nodeReturned);
     }
     catch (VisitFailure)
     {
         Assertion.Fail("VisitFailure should not occur!");
     }
 }
开发者ID:cwi-swat,项目名称:jjtraveler-csharp,代码行数:16,代码来源:AllTest.cs

示例9: GLESRenderBuffer

		/// <summary>
		/// </summary>
		/// <param name="format"> </param>
		/// <param name="width"> </param>
		/// <param name="height"> </param>
		/// <param name="numSamples"> </param>
		public GLESRenderBuffer( All format, int width, int height, int numSamples )
			: base( width, height, 1, GLESPixelUtil.GetClosestAxiomFormat( format ), BufferUsage.WriteOnly )
		{
			_glInternalFormat = format;
			/// Generate renderbuffer
			OpenGLOES.GenRenderbuffers( 1, ref this._renderbufferID );
			GLESConfig.GlCheckError( this );
			/// Bind it to FBO
			OpenGLOES.BindRenderbuffer( All.RenderbufferOes, this._renderbufferID );
			GLESConfig.GlCheckError( this );

			/// Allocate storage for depth buffer
			if ( numSamples <= 0 )
			{
				OpenGLOES.RenderbufferStorage( All.RenderbufferOes, format, width, height );
				GLESConfig.GlCheckError( this );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:24,代码来源:GLESRenderBuffer.cs

示例10: InitWithBitmap

        public void InitWithBitmap(Bitmap image, All filter)
        {
            //TODO:  Android.Opengl.GLUtils.GetInternalFormat()

            _format = SurfaceFormat.Color;
            if(image.HasAlpha)
                _format = SurfaceFormat.Color;

            GL.GenTextures(1, ref _name);
            GL.BindTexture(All.Texture2D, _name);
            GL.TexParameter(All.Texture2D, All.TextureMinFilter, (int)filter);
            GL.TexParameter(All.Texture2D, All.TextureMagFilter, (int)filter);

            Android.Opengl.GLUtils.TexImage2D((int)All.Texture2D, 0, image, 0);

            _size = new Size(image.Width, image.Height);
            _width = image.Width;
            _height = image.Height;
            
            _maxS = _size.Width / (float)_width;
            _maxT = _size.Height / (float)_height;
        }
开发者ID:johnkwaters,项目名称:MonoGame,代码行数:22,代码来源:ESTexture2D.cs

示例11: ESTexture2D

 public ESTexture2D(UIImage uiImage, All filter)
 {
     InitWithCGImage(uiImage.CGImage,filter);
 }
开发者ID:JoelCarter,项目名称:MonoGame,代码行数:4,代码来源:ESTexture2D.cs

示例12: InitWithData

        public void InitWithData(IntPtr data, SurfaceFormat pixelFormat, int width, int height, Size size, All filter)
        {
            GL.GenTextures(1,ref _name);
            GL.BindTexture(All.Texture2D, _name);
            GL.TexParameter(All.Texture2D, All.TextureMinFilter, (int) filter);
            GL.TexParameter(All.Texture2D, All.TextureMagFilter, (int) filter);

            int sz = 0;

            switch(pixelFormat) {
                case SurfaceFormat.Color /*kTexture2DPixelFormat_RGBA8888*/:
                case SurfaceFormat.Dxt1:
                case SurfaceFormat.Dxt3:
                    sz = 4;
                    GL.TexImage2D(All.Texture2D, 0, (int) All.Rgba, (int) width, (int) height, 0, All.Rgba, All.UnsignedByte, data);
                    break;
                case SurfaceFormat.Bgra4444 /*kTexture2DPixelFormat_RGBA4444*/:
                    sz = 2;
                    GL.TexImage2D(All.Texture2D, 0, (int) All.Rgba, (int) width, (int) height, 0, All.Rgba, All.UnsignedShort4444, data);
                    break;
                case SurfaceFormat.Bgra5551 /*kTexture2DPixelFormat_RGB5A1*/:
                    sz = 2;
                    GL.TexImage2D(All.Texture2D, 0, (int) All.Rgba, (int) width, (int) height, 0, All.Rgba, All.UnsignedShort5551, data);
                    break;
                case SurfaceFormat.Alpha8 /*kTexture2DPixelFormat_A8*/:
                    sz = 1;
                    GL.TexImage2D(All.Texture2D, 0, (int) All.Alpha, (int) width, (int) height, 0, All.Alpha, All.UnsignedByte, data);
                    break;
                default:
                    throw new NotSupportedException("Texture format");;
            }

            _size = size;
            _width = width;
            _height = height;
            _format = pixelFormat;
            _maxS = size.Width / (float)width;
            _maxT = size.Height / (float)height;
        }
开发者ID:JoelCarter,项目名称:MonoGame,代码行数:39,代码来源:ESTexture2D.cs

示例13: ESTexture2D

        public ESTexture2D(UIImage uiImage, All filter)
        {
            CGImage image = uiImage.CGImage;
            if(uiImage == null)
                throw new ArgumentNullException("uiImage");

            // TODO: could use this to implement lower-bandwidth textures
            //bool hasAlpha = (image.AlphaInfo == CGImageAlphaInfo.First || image.AlphaInfo == CGImageAlphaInfo.Last
            //		|| image.AlphaInfo == CGImageAlphaInfo.PremultipliedFirst || image.AlphaInfo == CGImageAlphaInfo.PremultipliedLast);

            // Image dimentions:
            logicalSize = new Point((int)uiImage.Size.Width, (int)uiImage.Size.Height);

            pixelWidth = uiImage.CGImage.Width;
            pixelHeight = uiImage.CGImage.Height;

            // Round up the target texture width and height to powers of two:
            potWidth = pixelWidth;
            potHeight = pixelHeight;
            if(( potWidth & ( potWidth-1)) != 0) { int w = 1; while(w <  potWidth) { w *= 2; }  potWidth = w; }
            if((potHeight & (potHeight-1)) != 0) { int h = 1; while(h < potHeight) { h *= 2; } potHeight = h; }

            // Scale down textures that are too large...
            CGAffineTransform transform = CGAffineTransform.MakeIdentity();
            while((potWidth > 1024) || (potHeight > 1024))
            {
                potWidth /= 2;    // Note: no precision loss - it's a power of two
                potHeight /= 2;
                pixelWidth /= 2;  // Note: precision loss - assume possibility of dropping a pixel at each step is ok
                pixelHeight /= 2;
                transform.Multiply(CGAffineTransform.MakeScale(0.5f, 0.5f));
            }

            RecalculateRatio();

            lock(textureLoadBufferLockObject)
            {
                CreateTextureLoadBuffer();

                unsafe
                {
                    fixed(byte* data = textureLoadBuffer)
                    {
                        var colorSpace = CGColorSpace.CreateDeviceRGB();
                        var context = new CGBitmapContext(new IntPtr(data), potWidth, potHeight,
                                8, 4 * potWidth, colorSpace, CGImageAlphaInfo.PremultipliedLast);

                        context.ClearRect(new RectangleF(0, 0, potWidth, potHeight));
                        context.TranslateCTM(0, potHeight - pixelHeight); // TODO: this does not play nice with the precision-loss above (keeping half-pixel to the edge)

                        if(!transform.IsIdentity)
                            context.ConcatCTM(transform);

                        context.DrawImage(new RectangleF(0, 0, image.Width, image.Height), image);
                        SetupTexture(new IntPtr(data), filter);

                        context.Dispose();
                        colorSpace.Dispose();
                    }
                }
            }
        }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:62,代码来源:ESTexture2D.cs

示例14: SetupTexture

        private void SetupTexture(IntPtr data, All filter)
        {
            GL.GenTextures(1, ref name);
            GL.BindTexture(All.Texture2D, name);
            GL.TexParameter(All.Texture2D, All.TextureMinFilter, (int)filter);
            GL.TexParameter(All.Texture2D, All.TextureMagFilter, (int)filter);

            GL.TexImage2D(All.Texture2D, 0, (int)All.Rgba, (int)potWidth, (int)potHeight, 0, All.Rgba, All.UnsignedByte, data);
        }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:9,代码来源:ESTexture2D.cs

示例15: LoadShader

        int LoadShader(All type, string source)
        {
            int shader = GL.CreateShader (type);
            if (shader == 0)
                throw new InvalidOperationException ("Unable to create shader");

            int length = 0;
            GL.ShaderSource (shader, 1, new string [] {source}, (int[])null);
            GL.CompileShader (shader);

            int compiled = 0;
            GL.GetShader (shader, All.CompileStatus, ref compiled);
            if (compiled == 0) {
                length = 0;
                GL.GetShader (shader, All.InfoLogLength, ref length);
                if (length > 0) {
                    var log = new StringBuilder (length);
                    GL.GetShaderInfoLog (shader, length, ref length, log);
                    Log.Debug ("GL2", "Couldn't compile shader: " + log.ToString ());
                }

                GL.DeleteShader (shader);
                throw new InvalidOperationException ("Unable to compile shader of type : " + type.ToString ());
            }

            return shader;
        }
开发者ID:4ndr01d,项目名称:monodroid-samples,代码行数:27,代码来源:PaintingView.cs


注:本文中的All类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。