• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TextureType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LoadTexture

 public static void LoadTexture(String name, ref Texture texture, TextureType type)
 {
     Game.PrintChat(name.ToLower());
     if ((type == TextureType.Default) && MyResources.ContainsKey(name.ToLower()))
     {
         try
         {
             texture = Texture.FromMemory(Drawing.Direct3DDevice, MyResources[name.ToLower()]);
         }
         catch (Exception ex)
         {
             Console.WriteLine("SAwarness: Couldn't load texture: " + name + "\n Ex: " + ex);
         }
     }
 }
开发者ID:AwkwardDev,项目名称:LeagueSharp2,代码行数:15,代码来源:Utils.cs


示例17: LoadTextureEntities

        private static List<TextureEntity> LoadTextureEntities(ContentManager content ,TextureType type,params string[] filename)
        {
            var entities = new List<TextureEntity>();

            foreach (string entry in filename)
            {
                string formatted = string.Format("{0}/{1}", type.ToString(), entry);

                TextureEntity entity = new TextureEntity()
                {
                    Key = entry,
                    Texture = content.Load<Texture2D>(formatted)
                };
                entities.Add(entity);
            }
            return entities;
        }
开发者ID:ikkedus,项目名称:Basic-2D-Game-Components,代码行数:17,代码来源:TextureManager.cs


示例18: GetNativeFormat

		public override Axiom.Media.PixelFormat GetNativeFormat( TextureType ttype, PixelFormat format, TextureUsage usage )
		{
			// Basic filtering
			var d3dPF = D3D9Helper.ConvertEnum( D3D9Helper.GetClosestSupported( format ) );

			// Calculate usage
			var d3dusage = D3D9.Usage.None;
			var pool = D3D9.Pool.Managed;
			if ( ( usage & TextureUsage.RenderTarget ) != 0 )
			{
				d3dusage |= D3D9.Usage.RenderTarget;
				pool = D3D9.Pool.Default;
			}
			if ( ( usage & TextureUsage.Dynamic ) != 0 )
			{
				d3dusage |= D3D9.Usage.Dynamic;
				pool = D3D9.Pool.Default;
			}

			var curDevice = D3D9RenderSystem.ActiveD3D9Device;

			// Use D3DX to adjust pixel format
			switch ( ttype )
			{
				case TextureType.OneD:
				case TextureType.TwoD:
					var tReqs = D3D9.Texture.CheckRequirements( curDevice, 0, 0, 0, d3dusage, D3D9Helper.ConvertEnum( format ), pool );
					d3dPF = tReqs.Format;
					break;

				case TextureType.ThreeD:
					var volReqs = D3D9.VolumeTexture.CheckRequirements( curDevice, 0, 0, 0, 0, d3dusage,
					                                                    D3D9Helper.ConvertEnum( format ), pool );
					d3dPF = volReqs.Format;
					break;

				case TextureType.CubeMap:
					var cubeReqs = D3D9.CubeTexture.CheckRequirements( curDevice, 0, 0, d3dusage, D3D9Helper.ConvertEnum( format ),
					                                                   pool );
					d3dPF = cubeReqs.Format;
					break;
			}

			return D3D9Helper.ConvertEnum( d3dPF );
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:45,代码来源:D3D9TextureManager.cs


示例19: GetTexture

        /// <summary>
        /// Set the texture that the mesh use
        /// </summary>
        /// <param name="texturePath">Where on disk the texture is saved</param>
        /// <param name="textType"></param>
        public FXResourceVariable GetTexture(TextureType textType)
        {
            switch (textType)
            {
                case TextureType.Diffuse:
                   return m_TextureDiffuse;
                case TextureType.Bump:
                   return m_TextureBump;
                case TextureType.Normal:
                   return m_TextureNormal;
                case TextureType.Lightmap:
                   return m_TextureLightmap;
                case TextureType.Heightmap:
                   return m_TextureHighmap;

            }

            return null;
        }
开发者ID:fxbit,项目名称:FxGraphicsEngine,代码行数:24,代码来源:ShaderSimple.cs


示例20: SetFormat

		protected override void SetFormat(TextureType type, Geometry2D.Integer.Size size)
		{
			switch (this.Type = type)
			{
				default:
				case TextureType.Rgba:
					this.InternalFormat = OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba;
					this.Format = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
					break;
				case TextureType.Rgb:
					this.InternalFormat = OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgb;
					this.Format = OpenTK.Graphics.OpenGL.PixelFormat.Bgr;
					break;
				case TextureType.Monochrome:
					this.InternalFormat = OpenTK.Graphics.OpenGL.PixelInternalFormat.Luminance;
					this.Format = OpenTK.Graphics.OpenGL.PixelFormat.Luminance;
					break;
			}
			this.Size = this.Context.ClampTextureSize(size);
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:20,代码来源:Texture.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextureUnit类代码示例发布时间:2022-05-24
下一篇:
C# TextureTarget类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap