• QQ
  • nahooten@sina.com
  • 常州市九洲新世界花苑15-2

游戏开发

U3D 设置纹理缩放

原创内容,转载请注明原文网址:http://homeqin.cn/a/wenzhangboke/jishutiandi/youxikaifa/2018/1026/132.html

今天我们常州手机App游戏开发培训幻天网络来教大家Material.SetTextureScale 设置纹理缩放

 

function SetTextureScale (propertyName : string, scale : Vector2) : void

Description描述

Sets the placement scale of texture propertyName.

设置纹理propertyName的缩放量。

Common texture names used by Unity's builtin shaders: 
在unity着色器中使用的统一的纹理名称

"_MainTex" is the main diffuse texture .This can also be accessed via mainTextureScale property. 
"_MainTex"是主要的漫反射纹理,也能通过 mainTextureScale 属性访问

"_BumpMap" is the normal map. 
"_BumpMap"是法线贴图

"_Cube" is the reflection cubemap.
"_Cube"是反射cubemap.(盒子贴图)

参见: mainTextureScale 属性, GetTextureScale .

function Update () {

	// Animates main texture scale in a funky way!

	//以独特的方式动画主纹理的缩放!



	var scaleX : float = Mathf.Cos ( Time.time ) * 0.5 + 1;

	var scaleY : float = Mathf.Sin ( Time.time ) * 0.5 + 1;

	renderer.material.SetTextureScale ("_MainTex", Vector2 (scaleX,scaleY));

}


上篇:上一篇:Unity3D 读取Android 本地相册打开相机
下篇:下一篇:Unity3D纹理旋转两种实现方法