- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
PAGE
PAGE #/ 5
PAGE
PAGE # / 5
staticfunctionDrawPreviewTexture(position:
Rect,image:
Texture,mat:
Material=null,scaleMode:
ScaleMode=ScaleMode.StretchToFill,imageAspect:
float = 0):
void
Parameters 参数
position
Rectangle on the screen to draw the texture within.
屏幕上绘制纹理的矩形区域
image
Texture to display. 〃显示的纹理
scaleMode
Howtoscaletheimagewhentheaspectratioofitdoesntfittheaspectratiotobedrawn within.
当纹理的尺寸不适合这个区域时如何缩放
mat
Material to be used when drawing the texture.
当绘制纹理时使用的材质
imageAspect
Aspectratiotouseforthesourceimage.If0(thedefault),theaspectratiofromtheimag e is used.
用于源图片的纵横比。如果为 0(默认),使用源图片的纵横比
Description 描述
Draws the texture within a rectangle.
在矩形内绘制纹理。
Ifmatisnull(thedefault),anappropriatematerialwillbechosenforaRGBMordoubleLDRlig htmap or a normal map and the fallback blit material will be chosen otherwise.
如果mat为空(默认),一个适当的材料将被选择为 RGBM或doubleLDR
lightmap 或者一个正常的贴图和背景材料,否则将使用被选择的材质
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 extendsEditorWindow{
function OnGUI() {
texture = EditorGUI.ObjectField(Rect(3,3,200,20),
Add a Texture:
texture,
Texture);
@MenuItem(Examples/Texture Previewer)
static function Init() {
}var window = GetWindow(EditorGUITextures);
window.position =Rect(0,0,400, 200);
window.Show();
var texture :
Texture2D;
var invertedTexture :
Texture2D;
var showInverted = false;
if(GUI.Button(Rect(208,3, position.width - 210, 20),Process Inverted)) {}
if(texture) {if(invertedTexture)
DestroyImmediate(invertedTexture);
//Copy the new texture
// 复制新的纹理
invertedTexture = newTexture2D(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;
EditorGUI.PrefixLabel(Rect(25,45,100,15),0,GUIContent(Preview:
));
E
文档评论(0)