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


C# TextureType类代码示例

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


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

示例1: ApplyTexture

 internal static void ApplyTexture(Body b, TextureType textureType)
 {
     foreach (Fixture f in b.FixtureList)
     {
         ApplyTexture(f, textureType);
     }
 }
开发者ID:guozanhua,项目名称:KinectRagdoll,代码行数:7,代码来源:FarseerTextures.cs

示例2: OnGUI

	void OnGUI () {
		GUILayout.Label ("Image to Export", EditorStyles.boldLabel);
		exportImg = (UPAImage)EditorGUILayout.ObjectField (exportImg, typeof(UPAImage), false);
		
		GUILayout.Label ("Export Settings", EditorStyles.boldLabel);
		texExtension = (TextureExtension)EditorGUILayout.EnumPopup("Save As:", texExtension);
		if (texExtension == TextureExtension.JPG) {
			#if UNITY_4_2
			GUILayout.Label ("Error: Export to JPG requires Unity 4.5+");
			#elif UNITY_4_3
			GUILayout.Label ("Error: Export to JPG requires Unity 4.5+");
			#endif
			
			GUILayout.Label ("Warning: JPG files will lose transparency.");
		}
		texType = (TextureType)EditorGUILayout.EnumPopup("Texture Type:", texType);
		
		EditorGUILayout.Space ();
		
		if ( GUILayout.Button ("Export", GUILayout.Height(30)) ) {
			
			if (exportImg == null) {
				EditorUtility.DisplayDialog(
					"Select Image",
					"You Must Select an Image first!",
					"Ok");
				return;
			}	
			
			bool succes = UPASession.ExportImage ( exportImg, texType, texExtension );
			if (succes)
				this.Close();
			UPAEditorWindow.window.Repaint();
		}
	}
开发者ID:Jordan-Mark,项目名称:BlackoutGame,代码行数:35,代码来源:UPAExportWindow.cs

示例3: ExportImage

    public static bool ExportImage(UPAImage img, TextureType type, TextureExtension extension)
    {
        string path = EditorUtility.SaveFilePanel(
            "Export image as " + extension.ToString(),
            "Assets/",
            img.name + "." + extension.ToString().ToLower(),
            extension.ToString().ToLower());

        if (path.Length == 0)
            return false;

        byte[] bytes;
        if (extension == TextureExtension.PNG) {
            // Encode texture into PNG
            bytes = img.GetFinalImage(true).EncodeToPNG();
        } else {
            // Encode texture into JPG

            #if UNITY_4_2
            bytes = img.GetFinalImage(true).EncodeToPNG();
            #elif UNITY_4_3
            bytes = img.GetFinalImage(true).EncodeToPNG();
            #elif UNITY_4_5
            bytes = img.GetFinalImage(true).EncodeToJPG();
            #else
            bytes = img.GetFinalImage(true).EncodeToJPG();
            #endif
        }

        path = FileUtil.GetProjectRelativePath(path);

        //Write to a file in the project folder
        File.WriteAllBytes(path, bytes);
        AssetDatabase.Refresh();

        TextureImporter texImp = AssetImporter.GetAtPath(path) as TextureImporter;

        if (type == TextureType.texture)
            texImp.textureType = TextureImporterType.Image;
        else if (type == TextureType.sprite) {
            texImp.textureType = TextureImporterType.Sprite;

            #if UNITY_4_2
            texImp.spritePixelsToUnits = 10;
            #elif UNITY_4_3
            texImp.spritePixelsToUnits = 10;
            #elif UNITY_4_5
            texImp.spritePixelsToUnits = 10;
            #else
            texImp.spritePixelsPerUnit = 10;
            #endif
        }

        texImp.filterMode = FilterMode.Point;
        texImp.textureFormat = TextureImporterFormat.AutomaticTruecolor;

        AssetDatabase.ImportAsset(path);

        return true;
    }
开发者ID:B1sounours,项目名称:UPAToolkit,代码行数:60,代码来源:UPASession.cs

示例4: Contains

 public bool Contains( String name, TextureType type )
 {
     if ( type == TextureType.Diffuse )
         return myDiffuseTextures.ContainsKey( name );
     else
         return myMaskTextures.ContainsKey( name );
 }
开发者ID:vashage,项目名称:SA-World-Viewer,代码行数:7,代码来源:TextureDictionary.cs

示例5: HasTexture

        /// <summary>
        /// Determines whether this model has the specified texture type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        ///   <c>true</c> if the specified type has texture; otherwise, <c>false</c>.
        /// </returns>
        public bool HasTexture(TextureType type)
        {

            if (type == TextureType.ENVIRONMENT)
            {
                return textureInformation.getCubeTexture(TextureType.ENVIRONMENT) != null;
            }
            if (type == TextureType.DIFFUSE)
            {
                return textureInformation.getTexture(TextureType.DIFFUSE) != null;
            }
            else if (type == TextureType.BUMP)
            {
                return textureInformation.getTexture(TextureType.BUMP) != null;
            }
            else if (type == TextureType.SPECULAR)
            {
                return textureInformation.getTexture(TextureType.SPECULAR) != null;
            }
            else if (type == TextureType.GLOW)
            {
                return textureInformation.getTexture(TextureType.GLOW) != null;
            }
            else if (type == TextureType.PARALAX)
            {
                return textureInformation.getTexture(TextureType.PARALAX) != null;
            }
            return false;
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:36,代码来源:IModelLoader.cs

示例6: Create

		public void Create(TextureType type, Geometry2D.Integer.Size size)
		{
			this.SetFormat(type, size);
			this.Use();
			this.Create(IntPtr.Zero);
			this.UnUse();
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:7,代码来源:Texture.cs

示例7: GetRightTexture

 private static SFML.Graphics.Texture GetRightTexture(string name, TextureType type)
 {
     if (type == TextureType.SFML)
         return TextureManager.GetTexture(name);
     else
         return FramedTextureManager.GetTexture(name);
 }
开发者ID:Chiheb2013,项目名称:GameLibs,代码行数:7,代码来源:GeneralTextureManager.cs

示例8: Create

        public override Texture Create(string name, TextureType type)
        {
            GLTexture texture = new GLTexture(name, type);

            texture.Enable32Bit(is32Bit);

            return texture;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:GLTextureManager.cs

示例9: GetTexture

        public Texture2D GetTexture( TextureType type )
        {
            if ( this.textures.ContainsKey( type ) ) {
                return this.textures[ type ];
            }

            return null;
        }
开发者ID:cooty125,项目名称:Pico3D,代码行数:8,代码来源:Material.cs

示例10: ReflectionMap

		public ReflectionMap()
		{
			this.maskMapSamplerIndex = 0;
			this.reflectionMapSamplerIndex = 0;
			this.reflectionMapType = TextureType.TwoD;
			this.reflectionPowerChanged = true;
			this.reflectionPowerValue = 0.05f;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:8,代码来源:ReflectionMap.cs

示例11: GetTexture

 public static Texture2D GetTexture(TextureType type, object id)
 {
     List<TextureEntity> entities = new List<TextureEntity>();
     if (type == TextureType.Menu)
     {
         entities = textureEntities;
     }
     return entities[(int) id].Texture;
 }
开发者ID:ikkedus,项目名称:Basic-2D-Game-Components,代码行数:9,代码来源:TextureManager.cs

示例12:

 public Texture2D this[String name, TextureType type]
 {
     get
     {
         if ( type == TextureType.Diffuse )
             return myDiffuseTextures[ name ];
         else
             return myMaskTextures[ name ];
     }
 }
开发者ID:vashage,项目名称:SA-World-Viewer,代码行数:10,代码来源:TextureDictionary.cs

示例13: CreateTexture

 public ITexture CreateTexture(TextureType type)
 {
   switch (type)
   {
     case TextureType.BaseTexture:
       return new Texture();
     default:
       throw new ArgumentOutOfRangeException("type");
   }
 }
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:10,代码来源:TextureFactory.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: ContainsTexture

        public static bool ContainsTexture(string name, out TextureType type)
        {
            type = TextureType.SFML; //if in collections, type's not dummy
                                    //if not in collection : type's dummy to respect 'out'

            if (CollectionHelper.DictionaryContains<SFML.Graphics.Texture>(TextureManager.Textures, name))
                return true;
            else if (CollectionHelper.DictionaryContains<FramedTexture>(FramedTextureManager.Textures, name))
            {
                type = TextureType.Framed;
                return true;
            }
            return false;
        }
开发者ID:Chiheb2013,项目名称:GameLibs,代码行数:14,代码来源:GeneralTextureManager.cs


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