unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理

unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理

ID:17546685

大小:16.77 KB

页数:4页

时间:2018-09-03

unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理_第1页
unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理_第2页
unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理_第3页
unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理_第4页
资源描述:

《unity3d技术之editorgui.drawpreviewtexture 绘制预览纹理》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、staticfunctionDrawPreviewTexture(position:Rect,image:Texture,mat:Material=null,scaleMode:ScaleMode=ScaleMode.StretchToFill,imageAspect:float=0):voidParameters参数·positionRectangleonthescreentodrawthetexturewithin.屏幕上绘制纹理的矩形区域·imageTexturetodisplay.//显

2、示的纹理·scaleModeHowtoscaletheimagewhentheaspectratioofitdoesn'tfittheaspectratiotobedrawnwithin.当纹理的尺寸不适合这个区域时如何缩放·matMaterialtobeusedwhendrawingthetexture.当绘制纹理时使用的材质·imageAspectAspectratiotouseforthesourceimage.If0(thedefault),theaspectratiofromtheim

3、ageisused.用于源图片的纵横比。如果为0(默认),使用源图片的纵横比Description描述Drawsthetexturewithinarectangle.在矩形内绘制纹理。Ifmatisnull(thedefault),anappropriatematerialwillbechosenforaRGBMordoubleLDRlightmaporanormalmapandthefallbackblitmaterialwillbechosenotherwise.如果mat为空(默认),一个

4、适当的材料将被选择为RGBM或doubleLDR  lightmap或者一个正常的贴图和背景材料,否则将使用被选择的材质PreviewTextureinanEditorWindow.编辑器中的预览纹理。//Loadatexture,displaythetexture,displayitsalphachanneland//showapreviewoftheinvertedtexture//加载并这个纹理,显示其Alpha通道,并显示该纹理的反向预览【狗刨学习网】classEditorGUIText

5、uresextendsEditorWindow{vartexture:Texture2D;varinvertedTexture:Texture2D;varshowInverted=false;@MenuItem("Examples/TexturePreviewer")staticfunctionInit(){varwindow=GetWindow(EditorGUITextures);window.position=Rect(0,0,400,200);window.Show();}functio

6、nOnGUI(){texture=EditorGUI.ObjectField(Rect(3,3,200,20),"AddaTexture:",texture,Texture);if(GUI.Button(Rect(208,3,position.width-210,20),"ProcessInverted")){if(invertedTexture)DestroyImmediate(invertedTexture);//Copythenewtexture//复制新的纹理invertedTextur

7、e=newTexture2D(texture.width,texture.height,texture.format,(texture.mipmapCount!=0));for(varm:int=0;m

8、5,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

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。