實現: 高亮一張texture上相同顏色的色塊。原理:使用step進行rgb的對比即可。
shader "unlit/choosecontinent"
_switchcolor("switchcolor",int) = 0 //高光還是直接返回
_highlightcolor("highlightcolor",color) = (0.498,1,0,0.3)//高光顏色
_chooser("chooser",int) = 255//點選選擇的顏色值
_chooseg("chooseg",int) = 255
_chooseb("chooseb",int) = 255
_thresholdvalue("thresholdvalue",int) = 10//判斷範圍的閥值
_vertexoffset("vertexoffset",vector) = (5,-15,0,0)//頂點偏移
} subshader
cull back
lighting off
zwrite off
ztest off
blend srcalpha oneminussrcalpha
pass
; struct v2f
; float4 _vertexoffset;
sampler2d _maintex;
float _switchcolor;
float _alpha;
float4 _choosecolor;
float4 _highlightcolor;
int _chooser;
int _chooseg;
int _chooseb;
int _thresholdvalue;
float4 frag(v2f in) : sv_target
// sample the texture
float4 col = tex2d(_maintex, in.texcoord);
return step(
3 , step(abs(_chooser - col.r * 255), _thresholdvalue)
+ step(abs(_chooseg - col.g * 255), _thresholdvalue)
+ step(abs(_chooseb - col.b * 255), _thresholdvalue)
)*_highlightcolor;
} endcg
} }
}
easyui 選中指定行
var rowindex 1 定義全域性變數,選中行索引 function pagination true,分頁 pagesize 15,預設選擇的分頁是每頁5行資料 pagelist 15,20,25,30 可以選擇的分頁集合 rownumbers true,行數 onloadsuccess fu...
ztree選中指定節點
var treeobj fn.ztree.getztreeobj bookcatalogtreelist 樹形結構的元素的id值 var snodes treeobj.getselectednodes var a treeobj.getnodebyparam gid 10 選中的那個元素的gid 1...
自動選中指定GameObject
自動選中指定gameobject,並在inspector面板顯示其屬性,如果已經在project檢視搜尋框輸入搜尋關鍵字,清除關鍵字可以先呼叫editorguiutility.pingobject方法。object o assetdatabase.loadassetatpath path edito...