本文整理汇总了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);
}
}
示例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();
}
}
示例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;
}
示例4: Contains
public bool Contains( String name, TextureType type )
{
if ( type == TextureType.Diffuse )
return myDiffuseTextures.ContainsKey( name );
else
return myMaskTextures.ContainsKey( name );
}
示例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;
}
示例6: Create
public void Create(TextureType type, Geometry2D.Integer.Size size)
{
this.SetFormat(type, size);
this.Use();
this.Create(IntPtr.Zero);
this.UnUse();
}
示例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);
}
示例8: Create
public override Texture Create(string name, TextureType type)
{
GLTexture texture = new GLTexture(name, type);
texture.Enable32Bit(is32Bit);
return texture;
}
示例9: GetTexture
public Texture2D GetTexture( TextureType type )
{
if ( this.textures.ContainsKey( type ) ) {
return this.textures[ type ];
}
return null;
}
示例10: ReflectionMap
public ReflectionMap()
{
this.maskMapSamplerIndex = 0;
this.reflectionMapSamplerIndex = 0;
this.reflectionMapType = TextureType.TwoD;
this.reflectionPowerChanged = true;
this.reflectionPowerValue = 0.05f;
}
示例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;
}
示例12:
public Texture2D this[String name, TextureType type]
{
get
{
if ( type == TextureType.Diffuse )
return myDiffuseTextures[ name ];
else
return myMaskTextures[ name ];
}
}
示例13: CreateTexture
public ITexture CreateTexture(TextureType type)
{
switch (type)
{
case TextureType.BaseTexture:
return new Texture();
default:
throw new ArgumentOutOfRangeException("type");
}
}
示例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;
}
示例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;
}