當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。