FilterMode









How do I use Filter Mode
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: ReorderableListResources.cs Copy
147         public static Texture2D CreatePixelTexture( string name, Color color )
148         {
149             var tex = new Texture2D( 1, 1, TextureFormat.ARGB32, false, true );
150             tex.name = name;
151             tex.hideFlags = HideFlags.HideAndDontSave;
152             tex.filterMode = FilterMode.Point;
153             tex.SetPixel( 0, 0, color );
154             tex.Apply();
155             return tex;
156         }
File name: ReorderableListResources.cs Copy
168         private static void LoadResourceAssets()
169         {
170             var skin = EditorGUIUtility.isProSkin ? s_DarkSkin : s_LightSkin;
171             s_Cached = new Texture2D[ skin.Length ];
172
173             for( int i = 0; i < s_Cached.Length; ++i )
174             {
175                 // Get image data (PNG) from base64 encoded strings.
176                 byte[] imageData = Convert.FromBase64String( skin[ i ] );
177
178                 // Gather image size from image data.
179                 int texWidth, texHeight;
180                 GetImageSize( imageData, out texWidth, out texHeight );
181
182                 // Generate texture asset.
183                 var tex = new Texture2D( texWidth, texHeight, TextureFormat.ARGB32, false, true );
184                 tex.hideFlags = HideFlags.HideAndDontSave;
185                 tex.name = "(Generated) ReorderableList:" + i;
186                 tex.filterMode = FilterMode.Point;
187                 tex.LoadImage( imageData );
188
189                 s_Cached[ i ] = tex;
190             }
191
192             s_LightSkin = null;
193             s_DarkSkin = null;
194         }
File name: TiledAssetPostProcessor.cs Copy
150         private void OnPreprocessTexture()
151         {
152             if (!UseThisImporter())
153                 return;
154
155             TextureImporter textureImporter = this.assetImporter as TextureImporter;
156             textureImporter.textureType = TextureImporterType.Default;
157             textureImporter.npotScale = TextureImporterNPOTScale.None;
158             textureImporter.convertToNormalmap = false;
159             textureImporter.lightmap = false;
160             textureImporter.alphaIsTransparency = true;
161             textureImporter.grayscaleToAlpha = false;
162             textureImporter.linearTexture = false;
163             textureImporter.spriteImportMode = SpriteImportMode.None;
164             textureImporter.mipmapEnabled = false;
165             textureImporter.generateCubemap = TextureImporterGenerateCubemap.None;
166             textureImporter.filterMode = FilterMode.Point;
167             textureImporter.wrapMode = TextureWrapMode.Clamp;
168             textureImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor;
169         }

FilterMode 170 lượt xem

Gõ tìm kiếm nhanh...