全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
static function DrawPreviewTexture (position : Rect, image : Texture, mat : Material = null, scaleMode : ScaleMode = ScaleMode.StretchToFill, imageAspect : float = 0) : void Parameters参数 positionRectangle on the screen to draw the texture within.屏幕上绘制纹理的矩形区域 imageTexture to display. / 显示的纹理 scaleModeHow to scale the image when the aspect ratio of it doesnt fit the aspect ratio to be drawn within.当纹理的尺寸不适合这个区域时如何缩放 matMaterial to be used when drawing the texture. 当绘制纹理时使用的材质 imageAspectAspect ratio to use for the source image. If 0 (the default), the aspect ratio from the image is used. 用于源图片的纵横比。如果为0(默认),使用源图片的纵横比 Description描述Draws the texture within a rectangle.在矩形内绘制纹理。If mat is null (the default), an appropriate material will be chosen for a RGBM or doubleLDR lightmap or a normal map and the fallback blit material will be chosen otherwise. 如果mat为空(默认),一个适当的材料将被选择为RGBM或doubleLDRlightmap或者一个正常的贴图和背景材料,否则将使用被选择的材质Preview Texture in an Editor Window. 编辑器中的预览纹理。/ Load a texture, display the texture, display its alpha channel and/ show a preview of the inverted texture/加载并这个纹理,显示其Alpha通道,并显示该纹理的反向预览【狗刨学习网】class EditorGUITextures extends EditorWindow var texture : Texture2D;var invertedTexture : Texture2D;var showInverted = false;MenuItem(Examples/Texture Previewer)static function Init() var window = GetWindow(EditorGUITextures);window.position = Rect(0,0,400, 200);window.Show();function OnGUI() texture = EditorGUI.ObjectField(Rect(3,3,200,20),Add a Texture:,texture,Texture);if(GUI.Button(Rect(208,3, position.width - 210, 20),Process Inverted) if(invertedTexture)DestroyImmediate(invertedTexture);/Copy the new texture/复制新的纹理invertedTexture = new Texture2D(texture.width,texture.height,texture.format,(texture.mipmapCount != 0);for (var m : int = 0; m texture.mipmapCount; m+)invertedTexture.SetPixels(texture.GetPixels(m), m);InvertColors();showInverted = true;if(texture) EditorGUI.PrefixLabel(Rect(25,45,100,15),0,GUIContent(Preview:);EditorGUI.DrawPreviewTexture(Rect(25,60,100,100),texture);EditorGUI.PrefixLabel(Rect(150,45,100,15),0,GUIContent(Alpha:);EditorGUI.DrawTextureAlpha(Rect(150,60,100,100),texture);EditorGUI.PrefixLabel(Rect(275,45,100,15),0,GUIContent(Inverted:);if(showInverted)EditorGUI.DrawPreviewTexture(Rect(275,60,100,100),invertedTexture);if(GUI.Button(Rect(3,position.height - 25, position.width-6,20),Clear texture) texture = EditorGUIUtility.whiteTexture;showInverted = false; else EditorGUI.PrefixLabel(Rect(3,position.height - 25,position.width - 6, 20),0,GUIContent(No texture found);function InvertColors() for (var m : int = 0; m invertedTexture.mipmapCount; m+) var c : Color = invertedTexture.GetPixels(m);for (var i : int = 0 ;i c.Length; i+) c
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年建筑材料库存管理协议
- 天门职业学院《智能建筑技术》2024-2025学年第一学期期末试卷
- 云南工程职业学院《画法几何》2024-2025学年第一学期期末试卷
- 西藏林芝二中2026届生物高一上期末教学质量检测模拟试题含解析
- 肾膨结线虫病的护理
- 亚低温治疗的神经外科护理配合
- 2026年高考数学一轮复习:幂函数与二次函数(讲义)解析版
- 医学生基础医学 动力性腹泻护理课件
- 2026年高考数学一轮复习:函数与方程(讲义)原卷版
- Unit 3 Better you better me单词讲解和练习(解析版)
- 感术行动培训课件
- 2025重庆市云阳县辅警考试试卷真题带答案
- 村党支部换届工作报告
- 宫颈上皮内肿瘤变
- 南通市启东市医疗卫生单位招聘事业编制人员笔试真题2024
- 祖坟修缮协议书
- 白术种植技术与栽培管理
- 2025阀门装配工艺规程
- 2025年人文知识竞赛试题库及答案
- 基础教育改革方向与重点问题研究
- 2025年春季高考复习必背英语考纲词汇单词
评论
0/150
提交评论