mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-26 03:38:29 +00:00
1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5540],{3905:function(e,t,n){n.d(t,{Zo:function(){return m},kt:function(){return c}});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=d(n),c=i,k=u["".concat(p,".").concat(c)]||u[c]||s[c]||r;return n?a.createElement(k,l(l({ref:t},m),{},{components:n})):a.createElement(k,l({ref:t},m))}));function c(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var d=2;d<r;d++)l[d]=n[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},30415:function(e,t,n){n.r(t),n.d(t,{assets:function(){return m},contentTitle:function(){return p},default:function(){return c},frontMatter:function(){return o},metadata:function(){return d},toc:function(){return s}});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={sidebar_position:1,description:"\u4e86\u89e3\u5982\u4f55\u624b\u52a8\u7ba1\u7406\u591a\u7eb9\u7406\u6750\u8d28\u3002",toc_max_heading_level:5},p="\u591a\u7eb9\u7406\u6750\u8d28",d={unversionedId:"user-guide/multi-render/multi-material",id:"version-2.3.0/user-guide/multi-render/multi-material",title:"\u591a\u7eb9\u7406\u6750\u8d28",description:"\u4e86\u89e3\u5982\u4f55\u624b\u52a8\u7ba1\u7406\u591a\u7eb9\u7406\u6750\u8d28\u3002",source:"@site/versioned_docs/version-2.3.0/user-guide/multi-render/multi-material.md",sourceDirName:"user-guide/multi-render",slug:"/user-guide/multi-render/multi-material",permalink:"/cocos-enhance-kit/docs/2.3.0/user-guide/multi-render/multi-material",draft:!1,tags:[],version:"2.3.0",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"\u4e86\u89e3\u5982\u4f55\u624b\u52a8\u7ba1\u7406\u591a\u7eb9\u7406\u6750\u8d28\u3002",toc_max_heading_level:5},sidebar:"tutorialSidebar",previous:{title:"\u591a\u7eb9\u7406\u6e32\u67d3",permalink:"/cocos-enhance-kit/docs/2.3.0/user-guide/multi-render/multi-render-intro"},next:{title:"\u591a\u7eb9\u7406\u5408\u6279",permalink:"/cocos-enhance-kit/docs/2.3.0/user-guide/multi-render/multi-batcher"}},m={},s=[{value:"\u521b\u5efa\u591a\u7eb9\u7406\u6750\u8d28",id:"\u521b\u5efa\u591a\u7eb9\u7406\u6750\u8d28",level:2},{value:"\u5728\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28",id:"\u5728\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28",level:2},{value:"\u81ea\u5b9a\u4e49\u591a\u7eb9\u7406\u6750\u8d28",id:"\u81ea\u5b9a\u4e49\u591a\u7eb9\u7406\u6750\u8d28",level:2},{value:"\u901a\u8fc7\u4ee3\u7801\u8bbe\u7f6e\u7eb9\u7406\u63d2\u69fd",id:"\u901a\u8fc7\u4ee3\u7801\u8bbe\u7f6e\u7eb9\u7406\u63d2\u69fd",level:2},{value:"\u5f3a\u5236\u8bbe\u7f6e\u6750\u8d28\u7684\u7c7b\u578b",id:"\u5f3a\u5236\u8bbe\u7f6e\u6750\u8d28\u7684\u7c7b\u578b",level:2}],u={toc:s};function c(e){var t=e.components,o=(0,i.Z)(e,l);return(0,r.kt)("wrapper",(0,a.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"\u591a\u7eb9\u7406\u6750\u8d28"},"\u591a\u7eb9\u7406\u6750\u8d28"),(0,r.kt)("p",null,"\u793e\u533a\u7248\u65b0\u589e\u4e86\u4e00\u4e2a\u7528\u4e8e\u591a\u7eb9\u7406\u6e32\u67d3\u7684\u5185\u7f6e\u7740\u8272\u5668\u8d44\u6e90\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u8be5\u6750\u8d28\u3002"),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"\u521b\u5efa\u591a\u7eb9\u7406\u6750\u8d28"},"\u521b\u5efa\u591a\u7eb9\u7406\u6750\u8d28"),(0,r.kt)("p",null,"\u521b\u5efa\u4e00\u4e2a\u6750\u8d28\uff0cEffect \u9009\u62e9\u5185\u7f6e\u7684\u591a\u7eb9\u7406 Effect \u7740\u8272\u5668 ",(0,r.kt)("inlineCode",{parentName:"p"},"multi-2d-universal"),"\u3002"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"material-settings",src:n(93243).Z,width:"740",height:"1224"})),(0,r.kt)("p",null,"\u52fe\u9009 ",(0,r.kt)("inlineCode",{parentName:"p"},"USE_MULTI_TEXTURE")," \u540e\u53ef\u4ee5\u770b\u5230\u4e0a\u9762\u6709 ",(0,r.kt)("inlineCode",{parentName:"p"},"texture")," - ",(0,r.kt)("inlineCode",{parentName:"p"},"texture8")," \u4e00\u5171 8 \u4e2a\u7eb9\u7406\u63d2\u69fd\uff0c\u5c06\u9700\u8981\u4f7f\u7528\u7684\u7eb9\u7406\u62d6\u5230\u4e0a\u9762\u7684\u63d2\u69fd\u5373\u53ef\u5b8c\u6210\u591a\u7eb9\u7406\u6750\u8d28\u7684\u914d\u7f6e\u3002"),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"\u5728\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28"},"\u5728\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28"),(0,r.kt)("p",null,"\u76f4\u63a5\u62d6\u5230\u7ec4\u4ef6\u7684 ",(0,r.kt)("inlineCode",{parentName:"p"},"Materials")," \u5c5e\u6027\u4e0a\u5373\u53ef\u3002"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"material-comp",src:n(65691).Z,width:"1446",height:"902"})),(0,r.kt)("p",null,"\u6ce8\u610f\u4e0a\u56fe\u4e2d\u5df2\u7ecf\u5728 ",(0,r.kt)("inlineCode",{parentName:"p"},"cc.Sprite")," \u7ec4\u4ef6\u62d6\u5165\u4e86\u521a\u521a\u521b\u5efa\u7684\u591a\u7eb9\u7406\u6750\u8d28\uff0c\u5e76\u4e14\u5176 ",(0,r.kt)("inlineCode",{parentName:"p"},"SpriteFrame")," \u5c5e\u6027\u8bbe\u7f6e\u7684\u662f\u6750\u8d28\u4e2d ",(0,r.kt)("inlineCode",{parentName:"p"},"texture3")," \u63d2\u69fd\u4e2d\u7684\u7eb9\u7406\u3002"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"material-final",src:n(66941).Z,width:"3642",height:"1082"})),(0,r.kt)("p",null,"\u4f60\u4e0d\u9700\u8981\u6307\u5b9a\u7ec4\u4ef6\u8981\u4f7f\u7528\u7684\u7eb9\u7406\u63d2\u69fd id\uff0c\u7ec4\u4ef6\u5185\u90e8\u5728\u6e32\u67d3\u524d\u4f1a\u81ea\u52a8\u67e5\u627e\u7eb9\u7406\u5728\u6750\u8d28\u4e2d\u7684 id\u3002"),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u8b66\u544a")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"\u5982\u679c\u7ec4\u4ef6\u4f7f\u7528\u7684\u7eb9\u7406\u5728\u6750\u8d28\u4e2d\u627e\u4e0d\u5230\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u6b63\u5e38\u6e32\u67d3\uff0c\u4f1a\u5728\u7ec4\u4ef6\u7684\u6750\u8d28\u53d8\u4f53\u4e2d\u5c06\u7eb9\u7406\u8bbe\u7f6e\u5230 ",(0,r.kt)("inlineCode",{parentName:"p"},"texture")," \u63d2\u69fd\u4e2d\u3002"),(0,r.kt)("p",{parentName:"div"},"\u8fd9\u4f1a\u5bfc\u81f4\u8fd9\u4e2a\u7ec4\u4ef6\u7684\u591a\u7eb9\u7406\u6750\u8d28\u53d8\u4f53\u4e4b\u540e\u90fd\u4e0d\u80fd\u6309\u9884\u671f\u8fdb\u884c\u5408\u6279\uff0c\u5c31\u50cf \u201c\u9000\u5316\u201d \u6210\u4e86\u666e\u901a\u6750\u8d28\u3002"),(0,r.kt)("p",{parentName:"div"},"\u6240\u4ee5\u4f7f\u7528\u65f6\u5fc5\u987b\u8981\u786e\u4fdd\u7eb9\u7406\u5728\u6750\u8d28\u4e2d\uff0c\u5047\u5982\u6750\u8d28\u53d8\u4f53\u5df2\u7ecf \u201c\u9000\u5316\u201d \u4e86\uff0c\u90a3\u4f60\u53ef\u4ee5\u901a\u8fc7\u91cd\u65b0\u8bbe\u7f6e\u6750\u8d28\u7684\u65b9\u5f0f\u4f7f\u7ec4\u4ef6\u6301\u6709\u4e00\u4e2a\u65b0\u7684\u6750\u8d28\u53d8\u4f53\u3002"))),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u7279\u522b\u6ce8\u610f")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"Spine \u7ec4\u4ef6\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28\u65f6\u4f1a\u5f3a\u5236\u52fe\u9009 ",(0,r.kt)("inlineCode",{parentName:"p"},"enableBatch"),"\uff0c\u56e0\u4e3a\u4e0d\u5f00\u542f\u5c31\u4e0d\u80fd\u5408\u6279\uff0c\u90a3\u4e5f\u5c31\u6ca1\u5fc5\u8981\u4f7f\u7528\u591a\u7eb9\u7406\u6750\u8d28\u3002"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"\u81ea\u5b9a\u4e49\u591a\u7eb9\u7406\u6750\u8d28"},"\u81ea\u5b9a\u4e49\u591a\u7eb9\u7406\u6750\u8d28"),(0,r.kt)("p",null,"\u4e0a\u9762\u4ecb\u7ecd\u7684\u591a\u7eb9\u7406\u6750\u8d28\u90fd\u662f\u4f7f\u7528\u7684\u5185\u7f6e\u7684\u591a\u7eb9\u7406 Effect \u7740\u8272\u5668\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u5185\u7f6e\u591a\u7eb9\u7406 Effect \u7740\u8272\u5668\u7684\u57fa\u7840\u4e0a\u4fee\u6539\u3002"),(0,r.kt)("p",null,"\u9664\u4e86\u76f4\u63a5\u5728\u5185\u7f6e\u7740\u8272\u5668\u7684\u57fa\u7840\u4e0a\u4fee\u6539\u4e4b\u5916\uff0c\u4efb\u4f55\u7740\u8272\u5668\u4e2d\u5982\u679c\u5b58\u5728\u4e00\u4e2a\u5b8f ",(0,r.kt)("inlineCode",{parentName:"p"},"USE_MULTI_TEXTURE = true"),"\uff0c\u5219\u4f1a\u88ab\u8ba4\u4e3a\u662f\u591a\u7eb9\u7406\u6750\u8d28\u3002"),(0,r.kt)("p",null,"\u6f14\u793a\u9879\u76ee\u4e2d\u6709\u81ea\u5b9a\u4e49\u6750\u8d28\u7684\u793a\u8303\u4ee3\u7801\u53ef\u4ee5\u53c2\u8003\u3002"),(0,r.kt)("div",{className:"admonition admonition-tip alert alert--success"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"\u63d0\u793a")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"\u662f\u5426\u4e3a\u591a\u7eb9\u7406\u6750\u8d28\u7684\u5224\u65ad\u903b\u8f91\u6d41\u7a0b\uff1a"),(0,r.kt)("ol",{parentName:"div"},(0,r.kt)("li",{parentName:"ol"},"\u83b7\u53d6\u6750\u8d28\u5f53\u524d\u4f7f\u7528\u7684 Technique \u4e2d\u7684\u7b2c\u4e00\u4e2a Pass"),(0,r.kt)("li",{parentName:"ol"},"\u5224\u65ad\u8fd9\u4e2a Pass \u662f\u5426 ",(0,r.kt)("inlineCode",{parentName:"li"},"USE_MULTI_TEXTURE = true")),(0,r.kt)("li",{parentName:"ol"},"\u662f\u7684\u8bdd\uff0c\u8fd9\u4e2a\u6750\u8d28\u5373\u4e3a\u591a\u7eb9\u7406\u6750\u8d28")),(0,r.kt)("p",{parentName:"div"},"\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u901a\u8fc7\u4ee3\u7801\u4fee\u6539\u6750\u8d28\u53ef\u80fd\u9700\u8981\u8c03\u7528 ",(0,r.kt)("inlineCode",{parentName:"p"},"material.updateMultiSupport()")," \u6765\u89e6\u53d1\u8fd9\u4e2a\u6d41\u7a0b\u3002"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"\u901a\u8fc7\u4ee3\u7801\u8bbe\u7f6e\u7eb9\u7406\u63d2\u69fd"},"\u901a\u8fc7\u4ee3\u7801\u8bbe\u7f6e\u7eb9\u7406\u63d2\u69fd"),(0,r.kt)("p",null,"\u6bcf\u4e2a\u591a\u7eb9\u7406\u6750\u8d28\u90fd\u5bf9\u5e94\u7740\u4e00\u4e2a\u591a\u7eb9\u7406\u6750\u8d28\u7ba1\u7406\u5668\uff0c\u8fd9\u662f\u793e\u533a\u7248\u65b0\u589e\u7684\u4e00\u4e2a\u5de5\u5177\u7c7b\uff0c\u5176\u4e3b\u8981\u7528\u5904\u662f\u4fbf\u6377\u3001\u9ad8\u6027\u80fd\u5730\u7ba1\u7406\u591a\u7eb9\u7406\u6750\u8d28\u4e0a\u9762\u7684\u7eb9\u7406\u63d2\u69fd\u3002"),(0,r.kt)("p",null,"\u901a\u8fc7 ",(0,r.kt)("inlineCode",{parentName:"p"},"material.getMultiHandler()")," \u53ef\u4ee5\u83b7\u53d6\u5230\u7ba1\u7406\u5668\u5b9e\u4f8b\uff0c\u8bf7\u4f7f\u7528\u8fd9\u4e2a\u5b9e\u4f8b\u6765\u64cd\u4f5c\u591a\u7eb9\u7406\u6750\u8d28\u7684\u7eb9\u7406\u63d2\u69fd\u3002"),(0,r.kt)("p",null,"\u6bd4\u5982\uff1a"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// \u83b7\u53d6\u7ba1\u7406\u5668\u5b9e\u4f8b\nconst handler = material.getMultiHandler();\n\n// \u8bbe\u7f6e `texture` \u7eb9\u7406\u63d2\u69fd\nhandler.setTexture(0, texture);\n\n// \u7f6e\u7a7a `texture2` \u7eb9\u7406\u63d2\u69fd\nhandler.setTexture(1, null);\n\n// \u76f4\u63a5\u79fb\u9664\u6307\u5b9a\u7eb9\u7406\nhandler.removeTexture(texture.getImpl());\n\n// \u5c06\u7eb9\u7406\u81ea\u52a8\u8bbe\u7f6e\u5230\u6750\u8d28\u7684\u7a7a\u63d2\u69fd\nhandler.autoSetTexture(texture);\n")),(0,r.kt)("p",null,"\u4ece\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\u53ef\u4ee5\u770b\u51fa\u64cd\u4f5c\u7eb9\u7406\u63d2\u69fd\u7684\u65f6\u5019\u5e76\u4e0d\u662f\u4f20\u5165\u63d2\u69fd\u7684\u540d\u79f0\uff0c\u800c\u662f\u9700\u8981\u63d0\u4f9b\u4e0b\u6807\u3002"),(0,r.kt)("p",null,"\u4e0b\u6807 ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," - ",(0,r.kt)("inlineCode",{parentName:"p"},"7")," \u5206\u522b\u5bf9\u5e94\u7740\u540d\u79f0\u4e3a ",(0,r.kt)("inlineCode",{parentName:"p"},"texture")," - ",(0,r.kt)("inlineCode",{parentName:"p"},"texture8")," \u7684\u63d2\u69fd\u3002"),(0,r.kt)("p",null,"\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e24\u4e2a\u51fd\u6570\u8fdb\u884c\u8f6c\u6362\uff1a"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},'// index to name\ncc.sp.propertyIndex2Name(0); // return: "texture"\n\n// name to index\ncc.sp.propertyName2Index("texture"); // return: 0\n')),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u6ce8\u610f")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"\u6ce8\u610f\u533a\u5206\u6750\u8d28 ",(0,r.kt)("inlineCode",{parentName:"p"},"cc.Material")," \u4e0e\u6750\u8d28\u53d8\u4f53 ",(0,r.kt)("inlineCode",{parentName:"p"},"cc.MaterialVariant"),"\u3002"))),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u8b66\u544a")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"\u8bf7\u52ff\u76f4\u63a5\u901a\u8fc7\u6750\u8d28\u539f\u59cb\u7684 ",(0,r.kt)("inlineCode",{parentName:"p"},"setProperty")," \u63a5\u53e3\u4fee\u6539\u591a\u7eb9\u7406\u6750\u8d28\u7684\u7eb9\u7406\u63d2\u69fd\u3002"),(0,r.kt)("p",{parentName:"div"},"\u5982\u679c\u4f60\u5fc5\u987b\u8fd9\u4e48\u505a\uff0c\u9700\u8981\u8c03\u7528 ",(0,r.kt)("inlineCode",{parentName:"p"},"material.getMultiHandler().syncTextures()")," \u6765\u540c\u6b65\u63d2\u69fd\u6570\u636e\u5230 ",(0,r.kt)("inlineCode",{parentName:"p"},"MultiHandler")," \u4e0a\u3002"))),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"\u5f3a\u5236\u8bbe\u7f6e\u6750\u8d28\u7684\u7c7b\u578b"},"\u5f3a\u5236\u8bbe\u7f6e\u6750\u8d28\u7684\u7c7b\u578b"),(0,r.kt)("p",null,"\u5982\u679c\u4f60\u60f3\u5c06\u67d0\u4e2a\u6750\u8d28\u5f3a\u5236\u89c6\u4e3a\u591a\u7eb9\u7406\u6750\u8d28\u6216\u975e\u591a\u7eb9\u7406\u6750\u8d28\uff0c\u53ef\u4ee5\uff1a"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// \u89c6\u4e3a\u591a\u7eb9\u7406\u6750\u8d28\nmaterial.setMultiSupport(true);\n\n// \u89c6\u4e3a\u975e\u591a\u7eb9\u7406\u6750\u8d28\nmaterial.setMultiSupport(false);\n")),(0,r.kt)("p",null,"\u6ca1\u6709\u7279\u6b8a\u60c5\u51b5\u4e0d\u9700\u8981\u8fd9\u4e48\u505a\u3002"))}c.isMDXComponent=!0},65691:function(e,t,n){t.Z=n.p+"assets/images/material-comp-f59c86aeb8d92ad635a121ddffd9b0b4.png"},66941:function(e,t,n){t.Z=n.p+"assets/images/material-final-35fbe06248d9d966d8898853fb663fe1.png"},93243:function(e,t,n){t.Z=n.p+"assets/images/material-settings-a3019fbf351b67f8a041d16edc95e2fd.png"}}]); |