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


C# TextureWrapMode类代码示例

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


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

示例1: Texture

        public Texture(Bitmap bmp, int xTiles, int yTiles, TextureMinFilter minFilter, TextureMagFilter magFilter, TextureWrapMode wrapS, TextureWrapMode wrapT)
        {
            this.bmp = bmp;
            this.xSize = bmp.Width;
            this.ySize = bmp.Height;
            this.xTiles = xTiles;
            this.yTiles = yTiles;
            if (xTiles == 0 || yTiles == 0)
            {
                this.xPixels = xSize;
                this.yPixels = ySize;
            }
            else
            {
                this.xPixels = xSize / xTiles;
                this.yPixels = ySize / yTiles;
            }

            this.minFilter = minFilter;
            this.magFilter = magFilter;
            this.wrapS = wrapS;
            this.wrapT = wrapT;

            offsetX = 1.0f / (float)(2 * xSize);
            offsetY = 1.0f / (float)(2 * ySize);

            Load();
        }
开发者ID:LightningDevStudios,项目名称:CircuitCrawlerEditor,代码行数:28,代码来源:Texture.cs

示例2: Find

		public Texture Find(string file, TextureMagFilter magFilter, TextureMinFilter minFilter, TextureWrapMode wrapModeS, TextureWrapMode wrapModeT)
		{
			try
			{
				string key = string.Format("{0}:{1}:{2}:{3}:{4}", file, magFilter, minFilter, wrapModeS, wrapModeT);
			
				Texture texture;
				if(textures.TryGetValue(key, out texture))return texture;

				TextureLoaderParameters.MagnificationFilter = magFilter;
				TextureLoaderParameters.MinificationFilter = minFilter;
				TextureLoaderParameters.WrapModeS = wrapModeS;
				TextureLoaderParameters.WrapModeT = wrapModeT;
				
				uint handle;
				TextureTarget dimension;
				ImageDDS.LoadFromDisk(file, out handle, out dimension);
				
				texture = new Texture(handle);
				
				textures[key]=texture;
				
				return texture;
			}
			catch
			{
				Console.WriteLine(string.Format("TextureManager: Failed to load texture {0}", file));
				return new Texture(0); // TODO remove
			}
		}
开发者ID:tpb3d,项目名称:TPB3D,代码行数:30,代码来源:TextureManager.cs

示例3: VO64SimpleTexture

        public VO64SimpleTexture(Bitmap texture, TextureWrapMode wrapS, TextureWrapMode wrapT)
        {
            Texture = texture;

            WrapS = wrapS;
            WrapT = wrapT;
        }
开发者ID:mib-f8sm9c,项目名称:Cereal64,代码行数:7,代码来源:VO64SimpleTexture.cs

示例4: SetWrapMode

 /// <summary>
 /// Sets the given wrap mode on all dimensions R, S and T.
 /// </summary>
 /// <param name="wrapMode">The wrap mode to apply.</param>
 public void SetWrapMode(TextureWrapMode wrapMode)
 {
     var mode = (int) wrapMode;
     SetParameter(SamplerParameterName.TextureWrapR, mode);
     SetParameter(SamplerParameterName.TextureWrapS, mode);
     SetParameter(SamplerParameterName.TextureWrapT, mode);
 }
开发者ID:olegbom,项目名称:ObjectTK,代码行数:11,代码来源:Sampler.cs

示例5: GetTextureList

    /// <summary>
    /// Get GIF texture list (This is a possibility of lock up)
    /// </summary>
    /// <param name="bytes">GIF file byte data</param>
    /// <param name="loopCount">out Animation loop count</param>
    /// <param name="width">out GIF image width (px)</param>
    /// <param name="height">out GIF image height (px)</param>
    /// <param name="filterMode">Textures filter mode</param>
    /// <param name="wrapMode">Textures wrap mode</param>
    /// <param name="debugLog">Debug Log Flag</param>
    /// <returns>GIF texture list</returns>
    public static List<GifTexture> GetTextureList (byte[] bytes, out int loopCount, out int width, out int height,
        FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, bool debugLog = false)
    {
        loopCount = -1;
        width = 0;
        height = 0;

        // Set GIF data
        var gifData = new GifData ();
        if (SetGifData (bytes, ref gifData, debugLog) == false) {
            Debug.LogError ("GIF file data set error.");
            return null;
        }

        // Decode to textures from GIF data
        var gifTexList = new List<GifTexture> ();
        if (DecodeTexture (gifData, gifTexList, filterMode, wrapMode) == false) {
            Debug.LogError ("GIF texture decode error.");
            return null;
        }

        loopCount = gifData.appEx.loopCount;
        width = gifData.logicalScreenWidth;
        height = gifData.logicalScreenHeight;
        return gifTexList;
    }
开发者ID:cuidonghuan,项目名称:MiniWeChat-Client,代码行数:37,代码来源:UniGif.cs

示例6: ApplyWrapMode

 private static void ApplyWrapMode(Texture2D lut2D, TextureWrapMode prevWrapMode)
 {
     TextureImporter importer = GetTextureImporter(lut2D);
     importer.wrapMode = prevWrapMode;
     AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(lut2D));
     AssetDatabase.Refresh();
 }
开发者ID:B-LiTE,项目名称:MemeTeam,代码行数:7,代码来源:ColorGrading.cs

示例7: Texture

        /// <summary>
        /// Initializes a new instance of the Texture class. Generates and stores a bitmap in VRAM.
        /// </summary>
        /// <param name="bmp">The bitmap to be copied to VRAM.</param>
        /// <param name="minFilter">A filter applied when the rendered texture is smaller than the texture at 100%.</param>
        /// <param name="magFilter">A filter applied when the rendered texture is larger than the texture at 100%.</param>
        /// <param name="wrapS">The way OpenGL will handle texture coordinates larger than <c>1.0f</c> on the S axis (X axis).</param>
        /// <param name="wrapT">The way OpenGL will handle texture coordinates larger than <c>1.0f</c> on the T axis (Y axis).</param>
        public Texture(Bitmap bmp, TextureMinFilter minFilter, TextureMagFilter magFilter, TextureWrapMode wrapS, TextureWrapMode wrapT)
        {
            this.Size = bmp.Size;

            //Generate a new texture ID
            ID = GL.GenTexture();

            //Texture parameters
            MinFilter = minFilter;
            MagFilter = magFilter;
            WrapS = wrapS;
            WrapT = wrapT;

            //Bind texture
            GL.BindTexture(TextureTarget.Texture2D, ID);

            //Send bitmap data up to VRAM
            bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
            BitmapData bmpData = bmp.LockBits(new Rectangle(new Point(0, 0), Size), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0);
            bmp.UnlockBits(bmpData);

            //unbind texture
            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
开发者ID:Robmaister,项目名称:RoversSpirit,代码行数:33,代码来源:Texture.cs

示例8: TexturePattern

		///<summary>
		/// Create new texture generator
		///</summary>
		///<param name="texture">Texture to use. It must be readable. The texture is read in constructor, so any later changes to it will not affect this generator</param>
		///<param name="wrapMode">Wrapping mode</param>
		public TexturePattern(Texture2D texture, TextureWrapMode wrapMode)
		{
			m_colors = texture.GetPixels();
			m_width = texture.width;
			m_height = texture.height;

			m_wrapMode = wrapMode;
		}
开发者ID:Avatarchik,项目名称:Voxe,代码行数:13,代码来源:TexturePattern.cs

示例9: DecodeTextureCoroutine

    /// <summary>
    /// Decode to textures from GIF data
    /// </summary>
    /// <param name="gifData">GIF data</param>
    /// <param name="gifTexList">GIF texture list</param>
    /// <param name="filterMode">Textures filter mode</param>
    /// <param name="wrapMode">Textures wrap mode</param>
    /// <returns>IEnumerator</returns>
    static IEnumerator DecodeTextureCoroutine(GifData gifData, List<GifTexture> gifTexList, FilterMode filterMode, TextureWrapMode wrapMode)
    {
        if (gifData.imageBlockList == null || gifData.imageBlockList.Count < 1) {
            yield break;
        }

        Color32? bgColor = GetGlobalBgColor (gifData);

        // Disposal Method
        // 0 (No disposal specified)
        // 1 (Do not dispose)
        // 2 (Restore to background color)
        // 3 (Restore to previous)
        ushort disposalMethod = 0;

        int imgBlockIndex = 0;
        foreach (var imgBlock in gifData.imageBlockList) {
            var decodedData = GetDecodedData (imgBlock);

            var colorTable = GetColorTable (gifData, imgBlock, ref bgColor);

            var graphicCtrlEx = GetGraphicCtrlExt (gifData, imgBlockIndex);

            int transparentIndex = GetTransparentIndex (graphicCtrlEx);

            // avoid lock up
            yield return 0;

            bool useBeforeTex = false;
            var tex = CreateTexture2D (gifData, gifTexList, imgBlockIndex, disposalMethod, filterMode, wrapMode, ref useBeforeTex);

            // Set pixel data
            int dataIndex = 0;
            // Reverse set pixels. because GIF data starts from the top left.
            for (int y = tex.height - 1; y >= 0; y--) {
                SetTexturePixelRow (tex, y, imgBlock, decodedData, ref dataIndex, colorTable, bgColor, transparentIndex, useBeforeTex);

                // avoid lock up
                //if (y % 10 == 0) {
                //    yield return 0;
                //}
            }
            tex.Apply ();

            float delaySec = GetDelaySec (graphicCtrlEx);

            // Add to GIF texture list
            gifTexList.Add (new GifTexture (tex, delaySec));

            disposalMethod = GetDisposalMethod (graphicCtrlEx);

            imgBlockIndex++;

            // avoid lock up
            yield return 0;
        }
    }
开发者ID:cuidonghuan,项目名称:MiniWeChat-Client,代码行数:65,代码来源:UniGifDecoder.cs

示例10: Get

 public RenderTexture Get(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, RenderTextureReadWrite rw = RenderTextureReadWrite.Default, FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, string name = "FactoryTempTexture")
 {
     var rt = RenderTexture.GetTemporary(width, height, depthBuffer, format);
     rt.filterMode = filterMode;
     rt.wrapMode = wrapMode;
     rt.name = name;
     m_TemporaryRTs.Add(rt);
     return rt;
 }
开发者ID:Cam582,项目名称:Top-Hats,代码行数:9,代码来源:RenderTextureFactory.cs

示例11: NuajTexture2D

        /// <summary>
        /// Creates a texture instance
        /// </summary>
        /// <param name="_Name"></param>
        /// <param name="_Width"></param>
        /// <param name="_Height"></param>
        /// <param name="_Format"></param>
        /// <param name="_bUseMipMaps">Create mip maps for the texture</param>
        /// <param name="_FilterMode">Filter mode to use to sample the texture</param>
        /// <param name="_WrapMode">Wrap mode to use to address the texture</param>
        /// <returns></returns>
        public NuajTexture2D( string _Name, int _Width, int _Height, TextureFormat _Format, bool _bUseMipMaps, FilterMode _FilterMode, TextureWrapMode _WrapMode )
        {
            Help.LogDebug( "Nuaj.Help.CreateTexture() \"" + _Name + "\" => " + _Width + "x" + _Height + "x" + _Format );
            if ( _Width < 1 || _Height < 1 )
                throw new Exception( "NuajTexture2D.ctor() => Invalid resolution !" );

            m_Texture = new Texture2D( _Width, _Height, _Format, _bUseMipMaps );
            m_Texture.name = _Name;
            m_Texture.filterMode = _FilterMode;
            m_Texture.wrapMode = _WrapMode;
            m_Texture.hideFlags = HideFlags.HideAndDontSave;
        }
开发者ID:deanstanfield,项目名称:test-scene,代码行数:23,代码来源:NuajTexture.cs

示例12: CheckMaterialMode

 public static void CheckMaterialMode(Material aMat, TextureWrapMode aDesiredMode)
 {
     if (aMat != null && aMat.mainTexture != null && aMat.mainTexture.wrapMode != aDesiredMode) {
         if (EditorUtility.DisplayDialog("Ferr2D Terrain", "The Material's texture 'Wrap Mode' generally works best when set to "+aDesiredMode+"! Would you like this texture to be updated?", "Yes", "No")) {
             string          path = AssetDatabase.GetAssetPath(aMat.mainTexture);
             TextureImporter imp  = AssetImporter.GetAtPath   (path) as TextureImporter;
             if (imp != null) {
                 imp.wrapMode = aDesiredMode;
                 AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
             }
         }
     }
 }
开发者ID:OursBleu,项目名称:GameJamStarterKit,代码行数:13,代码来源:Ferr2DT_TerrainMaterialWindow.cs

示例13: MRT

 public MRT(int width, int height, RenderTextureFormat format = RenderTextureFormat.ARGBFloat, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
 {
     RTs = new RenderTexture[3];
     for(int i = 0, n = RTs.Length; i < n; i++) {
         int depth = (i == 0) ? 24 : 0;
         RTs[i] = new RenderTexture(width, height, depth);
         RTs[i].hideFlags = HideFlags.DontSave;
         RTs[i].format = format;
         RTs[i].filterMode = filterMode;
         RTs[i].wrapMode = wrapMode;
         RTs[i].Create();
     }
 }
开发者ID:mattatz,项目名称:unity-mrt-example,代码行数:13,代码来源:MRT.cs

示例14: TextureSlot

 /// <summary>
 /// Constructs a new TextureSlot.
 /// </summary>
 /// <param name="filePath">Texture filepath</param>
 /// <param name="typeSemantic">Texture type semantic</param>
 /// <param name="texIndex">Texture index in the material</param>
 /// <param name="mapping">Texture mapping</param>
 /// <param name="uvIndex">UV channel in mesh that corresponds to this texture</param>
 /// <param name="blendFactor">Blend factor</param>
 /// <param name="texOp">Texture operation</param>
 /// <param name="wrapMode">Texture wrap mode</param>
 /// <param name="flags">Misc flags</param>
 public TextureSlot(String filePath, TextureType typeSemantic, uint texIndex, TextureMapping mapping, uint uvIndex, float blendFactor,
     TextureOperation texOp, TextureWrapMode wrapMode, uint flags)
 {
     _filePath = (filePath == null) ? String.Empty : filePath;
         _type = typeSemantic;
         _index = texIndex;
         _mapping = mapping;
         _uvIndex = uvIndex;
         _blendFactor = blendFactor;
         _texOp = texOp;
         _wrapMode = wrapMode;
         _flags = flags;
 }
开发者ID:dkushner,项目名称:Assimp-Net,代码行数:25,代码来源:TextureSlot.cs

示例15: SamplerStateDesc

        public SamplerStateDesc(SamplerStateTypes type)
        {
            switch (type)
            {
                case SamplerStateTypes.Point_Wrap:
                    filterMin = TextureFilterMode.Nearest;
                    filterMinMiped = TextureFilterMode.Nearest;
                    filterMag = TextureFilterMode.Nearest;
                    addressU = TextureWrapMode.Repeat;
                    addressV = TextureWrapMode.Repeat;
                    addressW = TextureWrapMode.Repeat;
                    break;

                case SamplerStateTypes.Point_Clamp:
                    filterMin = TextureFilterMode.Nearest;
                    filterMinMiped = TextureFilterMode.Nearest;
                    filterMag = TextureFilterMode.Nearest;
                    addressU = TextureWrapMode.ClampToEdge;
                    addressV = TextureWrapMode.ClampToEdge;
                    addressW = TextureWrapMode.ClampToEdge;
                    break;

                case SamplerStateTypes.Linear_Wrap:
                    filterMin = TextureFilterMode.Linear;
                    filterMinMiped = TextureFilterMode.Linear;
                    filterMag = TextureFilterMode.Linear;
                    addressU = TextureWrapMode.Repeat;
                    addressV = TextureWrapMode.Repeat;
                    addressW = TextureWrapMode.Repeat;
                    break;

                case SamplerStateTypes.Linear_Clamp:
                    filterMin = TextureFilterMode.Linear;
                    filterMinMiped = TextureFilterMode.Linear;
                    filterMag = TextureFilterMode.Linear;
                    addressU = TextureWrapMode.ClampToEdge;
                    addressV = TextureWrapMode.ClampToEdge;
                    addressW = TextureWrapMode.ClampToEdge;
                    break;

                default:
                    Debug.ThrowError("SamplerStateDesc", "Unsuported SamplerStateType");
                    break;
            }
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:45,代码来源:SamplerStateDesc.cs


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