You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. ---
  2. sidebar: auto
  3. ---
  4. # 材质属性 🌎
  5. 在真实世界里,每个物体会对光产生不同的反应。钢看起来比陶瓷花瓶更闪闪发光,一个木头箱子不会像钢箱子一样对光产生很强的反射。每个物体对镜面高光也有不同的反应。有些物体不会散射(Scatter)很多光却会反射(Reflect)很多光,结果看起来就有一个较小的高光点(Highlight),有些物体散射了很多,它们就会产生一个半径更大的高光。如果我们想要在 OpenGL 中模拟多种类型的物体,我们必须为每个物体分别定义材质(Material)属性。
  6. ## DC.ColorMaterialProperty
  7. > 颜色材质
  8. ### example
  9. ```js
  10. let material = new DC.ColorMaterialProperty(DC.Color.RED)
  11. ```
  12. ### creation
  13. - **_constructor(color)_**
  14. 构造函数
  15. - 参数
  16. - `{DC.Color} color`:颜色
  17. - 返回值 `material`
  18. ## DC.ImageMaterialProperty
  19. > 图片材质
  20. ### example
  21. ```js
  22. let material = new DC.ImageMaterialProperty({
  23. image: '**/**.png',
  24. transparent: true,
  25. })
  26. ```
  27. ### creation
  28. - **_constructor([options])_**
  29. 构造函数
  30. - 参数
  31. - `{Object} options`:属性
  32. - 返回值 `material`
  33. ```json
  34. // 属性参数(可选)
  35. {
  36. "image": "", // 图片地址
  37. "repeat": { "x": 1, "y": 1 }, // 图片重复
  38. "color": DC.Color.WHITE, // 图片颜色
  39. "transparent": false // 材质是否透明
  40. }
  41. ```
  42. ### properties
  43. - `{String} image`:图片地址
  44. - `{Object} repeat`:图片重复
  45. - `{DC.Color} color`:图片颜色
  46. - `{Boolean} transparent`:材质是否透明
  47. ## DC.CircleBlurMaterialProperty
  48. > 模糊圆材质
  49. ### example
  50. ```js
  51. let material = new DC.CircleBlurMaterialProperty({
  52. color: DC.Color.WHITE,
  53. })
  54. ```
  55. ### creation
  56. - **_constructor([options])_**
  57. 构造函数
  58. - 参数
  59. - `{Object} options`:属性
  60. - 返回值 `materialProperty`
  61. ```json
  62. // 属性参数(可选)
  63. {
  64. "color": DC.Color.WHITE, // 颜色
  65. "speed": 10 // 速度
  66. }
  67. ```
  68. ### properties
  69. - `{DC.Color} color`:颜色
  70. - `{Number} speed`:速度
  71. ## DC.CircleDiffuseMaterialProperty
  72. > 扩散圆材质
  73. ### example
  74. ```js
  75. let material = new DC.CircleDiffuseMaterialProperty({
  76. color: DC.Color.WHITE,
  77. })
  78. ```
  79. ### creation
  80. - **_constructor([options])_**
  81. 构造函数
  82. - 参数
  83. - `{Object} options`:属性
  84. - 返回值 `materialProperty`
  85. ```json
  86. // 属性参数(可选)
  87. {
  88. "color": DC.Color.WHITE, // 颜色
  89. "speed": 10 // 速度
  90. }
  91. ```
  92. ### properties
  93. - `{DC.Color} color`:颜色
  94. - `{Number} speed`:速度
  95. ## DC.CircleFadeMaterialProperty
  96. > 逐渐消逝圆材质
  97. ### example
  98. ```js
  99. let material = new DC.CircleFadeMaterialProperty({
  100. color: DC.Color.WHITE,
  101. })
  102. ```
  103. ### creation
  104. - **_constructor([options])_**
  105. 构造函数
  106. - 参数
  107. - `{Object} options`:属性
  108. - 返回值 `materialProperty`
  109. ```json
  110. // 属性参数(可选)
  111. {
  112. "color": DC.Color.WHITE, // 颜色
  113. "speed": 10 // 速度
  114. }
  115. ```
  116. ### properties
  117. - `{DC.Color} color`:颜色
  118. - `{Number} speed`:速度
  119. ## DC.CirclePulseMaterialProperty
  120. > 脉冲圆材质
  121. ### example
  122. ```js
  123. let material = new DC.CirclePulseMaterialProperty({
  124. color: DC.Color.WHITE,
  125. })
  126. ```
  127. ### creation
  128. - **_constructor([options])_**
  129. 构造函数
  130. - 参数
  131. - `{Object} options`:属性
  132. - 返回值 `materialProperty`
  133. ```json
  134. // 属性参数(可选)
  135. {
  136. "color": DC.Color.WHITE, // 颜色
  137. "speed": 10 // 速度
  138. }
  139. ```
  140. ### properties
  141. - `{DC.Color} color`:颜色
  142. - `{Number} speed`:速度
  143. ## DC.CircleScanMaterialProperty
  144. > 扫描圆材质
  145. ### example
  146. ```js
  147. let material = new DC.CircleScanMaterialProperty({
  148. color: DC.Color.WHITE,
  149. })
  150. ```
  151. ### creation
  152. - **_constructor([options])_**
  153. 构造函数
  154. - 参数
  155. - `{Object} options`:属性
  156. - 返回值 `materialProperty`
  157. ```json
  158. // 属性参数(可选)
  159. {
  160. "color": DC.Color.WHITE, // 颜色
  161. "speed": 10 // 速度
  162. }
  163. ```
  164. ### properties
  165. - `{DC.Color} color`:颜色
  166. - `{Number} speed`:速度
  167. ## DC.CircleSpiralMaterialProperty
  168. > 螺旋圆材质
  169. ### example
  170. ```js
  171. let material = new DC.CircleSpiralMaterialProperty({
  172. color: DC.Color.WHITE,
  173. })
  174. ```
  175. ### creation
  176. - **_constructor([options])_**
  177. 构造函数
  178. - 参数
  179. - `{Object} options`:属性
  180. - 返回值 `materialProperty`
  181. ```json
  182. // 属性参数(可选)
  183. {
  184. "color": DC.Color.WHITE, // 颜色
  185. "speed": 10 // 速度
  186. }
  187. ```
  188. ### properties
  189. - `{DC.Color} color`:颜色
  190. - `{Number} speed`:速度
  191. ## DC.CircleVaryMaterialProperty
  192. > 多彩圆材质
  193. ### example
  194. ```js
  195. let material = new DC.CircleVaryMaterialProperty({
  196. color: DC.Color.WHITE,
  197. })
  198. ```
  199. ### creation
  200. - **_constructor([options])_**
  201. 构造函数
  202. - 参数
  203. - `{Object} options`:属性
  204. - 返回值 `materialProperty`
  205. ```json
  206. // 属性参数(可选)
  207. {
  208. "color": DC.Color.WHITE, // 颜色
  209. "speed": 10 // 速度
  210. }
  211. ```
  212. ### properties
  213. - `{DC.Color} color`:颜色
  214. - `{Number} speed`:速度
  215. ## DC.CircleWaveMaterialProperty
  216. > 波纹圆材质
  217. ### example
  218. ```js
  219. let material = new DC.CircleWaveMaterialProperty({
  220. color: DC.Color.WHITE,
  221. })
  222. ```
  223. ### creation
  224. - **_constructor([options])_**
  225. 构造函数
  226. - 参数
  227. - `{Object} options`:属性
  228. - 返回值 `materialProperty`
  229. ```json
  230. // 属性参数(可选)
  231. {
  232. "color": DC.Color.WHITE, // 颜色
  233. "speed": 10, // 速度
  234. "count": 5, //数量
  235. "gradient": 0.1 //强度
  236. }
  237. ```
  238. ### properties
  239. - `{Color} color`:颜色
  240. - `{Number} speed`:速度
  241. - `{Number} count`:数量
  242. - `{Number} gradient`:强度
  243. ## DC.EllipsoidElectricMaterialProperty
  244. > 电弧球材质
  245. ### example
  246. ```js
  247. let material = new DC.EllipsoidElectricMaterialProperty({
  248. color: DC.Color.WHITE,
  249. })
  250. ```
  251. ### creation
  252. - **_constructor([options])_**
  253. 构造函数
  254. - 参数
  255. - `{Object} options`:属性
  256. - 返回值 `materialProperty`
  257. ```json
  258. // 属性参数(可选)
  259. {
  260. "color": DC.Color.WHITE, // 颜色
  261. "speed": 10 // 速度
  262. }
  263. ```
  264. ### properties
  265. - `{DC.Color} color`:颜色
  266. - `{Number} speed`:速度
  267. ## DC.EllipsoidTrailMaterialProperty
  268. > 轨迹球材质
  269. ### example
  270. ```js
  271. let material = new DC.EllipsoidTrailMaterialProperty({
  272. color: DC.Color.WHITE,
  273. })
  274. ```
  275. ### creation
  276. - **_constructor([options])_**
  277. 构造函数
  278. - 参数
  279. - `{Object} options`:属性
  280. - 返回值 `materialProperty`
  281. ```json
  282. // 属性参数(可选)
  283. {
  284. "color": DC.Color.WHITE, // 颜色
  285. "speed": 10 // 速度
  286. }
  287. ```
  288. ### properties
  289. - `{DC.Color} color`:颜色
  290. - `{Number} speed`:速度
  291. ## DC.PolylineDashMaterialProperty
  292. > 虚线材质
  293. ### example
  294. ```js
  295. let material = new DC.PolylineDashMaterialProperty({
  296. color: DC.Color.WHITE,
  297. })
  298. ```
  299. ### creation
  300. - **_constructor([options])_**
  301. 构造函数
  302. - 参数
  303. - `{Object} options`:属性
  304. - 返回值 `materialProperty`
  305. ```json
  306. // 属性参数(可选)
  307. {
  308. "color": DC.Color.WHITE, // 虚线颜色
  309. "gapColor": DC.Color.TRANSPARENT, // 间隔颜色
  310. "dashLength": 16.0 // 虚线片段长度
  311. }
  312. ```
  313. ### properties
  314. - `{DC.Color} color`:虚线颜色
  315. - `{DC.Color} gapColor`:间隔颜色
  316. - `{Number} dashLength`:虚线片段长度
  317. ## DC.PolylineArrowMaterialProperty
  318. > 箭头材质
  319. ### example
  320. ```js
  321. let material = new DC.PolylineArrowMaterialProperty(DC.Color.WHITE)
  322. ```
  323. ### creation
  324. - **_constructor(color)_**
  325. 构造函数
  326. - 参数
  327. - `{DC.Color} color`:箭头颜色
  328. - 返回值 `materialProperty`
  329. ### properties
  330. - `{DC.Color} color`:箭头颜色
  331. ## DC.PolylineOutlineMaterialProperty
  332. > 边线材质
  333. ### example
  334. ```js
  335. let material = new DC.PolylineOutlineMaterialProperty({
  336. color: DC.Color.WHITE,
  337. outlineColor: DC.Color.BLACK,
  338. })
  339. ```
  340. ### creation
  341. - **_constructor([options])_**
  342. 构造函数
  343. - 参数
  344. - `{Object} options`:属性
  345. - 返回值 `materialProperty`
  346. ```json
  347. // 属性参数(可选)
  348. {
  349. "color": DC.Color.WHITE, // 颜色
  350. "outlineColor": DC.Color.BLACK, // 边线颜色
  351. "outlineWidth": 1 // 边线宽度
  352. }
  353. ```
  354. ### properties
  355. - `{DC.Color} color`:颜色
  356. - `{DC.Color} outlineColor`:边线颜色
  357. - `{Number} outlineWidth`:边线宽度
  358. ## DC.PolylineGlowMaterialProperty
  359. > 光晕材质
  360. ### example
  361. ```js
  362. let material = new DC.PolylineGlowMaterialProperty({
  363. color: DC.Color.WHITE,
  364. glowPower: 0.25,
  365. })
  366. ```
  367. ### creation
  368. - **_constructor([options])_**
  369. 构造函数
  370. - 参数
  371. - `{Object} options`:属性
  372. - 返回值 `materialProperty`
  373. ```json
  374. // 属性参数(可选)
  375. {
  376. "color": DC.Color.WHITE, // 颜色
  377. "glowPower": 0.25, // 发光强度,以总线宽的百分比表示
  378. "taperPower": 1 // 渐缩效果的强度
  379. }
  380. ```
  381. ### properties
  382. - `{DC.Color} color`:颜色
  383. - `{Number} glowPower`:发光强度
  384. - `{Number} taperPower`:渐缩效果的强度
  385. ## DC.PolylineFlickerMaterialProperty
  386. > 闪烁线材质
  387. ### example
  388. ```js
  389. let material = new DC.PolylineFlickerMaterialProperty({
  390. color: DC.Color.WHITE,
  391. })
  392. ```
  393. ### creation
  394. - **_constructor([options])_**
  395. 构造函数
  396. - 参数
  397. - `{Object} options`:属性
  398. - 返回值 `materialProperty`
  399. ```json
  400. // 属性参数(可选)
  401. {
  402. "color": DC.Color.WHITE, // 颜色
  403. "speed": 10 // 速度
  404. }
  405. ```
  406. ### properties
  407. - `{DC.Color} color`:颜色
  408. - `{Number} speed`:速度
  409. ## DC.PolylineFlowMaterialProperty
  410. > 流动线材质
  411. ### example
  412. ```js
  413. let material = new DC.PolylineFlowMaterialProperty({
  414. color: DC.Color.WHITE,
  415. })
  416. ```
  417. ### creation
  418. - **_constructor([options])_**
  419. 构造函数
  420. - 参数
  421. - `{Object} options`:属性
  422. - 返回值 `materialProperty`
  423. ```json
  424. // 属性参数(可选)
  425. {
  426. "color": DC.Color.WHITE, // 颜色
  427. "speed": 10, // 速度,
  428. "percent": 0.3, // 比例
  429. "gradient": 0.1 // 透明程度
  430. }
  431. ```
  432. ### properties
  433. - `{DC.Color} color`:颜色
  434. - `{Number} speed`:速度
  435. - `{Number} percent`:比例,
  436. - `{Number} gradient`:透明程度,
  437. ## DC.PolylineImageTrailMaterialProperty
  438. > 图片轨迹线材质
  439. ### example
  440. ```js
  441. let material = new DC.PolylineImageTrailMaterialProperty({
  442. color: DC.Color.WHITE,
  443. image: '**/*.png',
  444. repeat: { x: 10, y: 1 },
  445. })
  446. ```
  447. ### creation
  448. - **_constructor([options])_**
  449. 构造函数
  450. - 参数
  451. - `{Object} options`:属性
  452. - 返回值 `materialProperty`
  453. ```json
  454. // 属性参数(可选)
  455. {
  456. "color": DC.Color.WHITE, // 颜色
  457. "speed": 10, // 速度
  458. "image": "**/*.png", // 图片地址
  459. "repeat": { "x": 10, "y": 1 } //重复规则
  460. }
  461. ```
  462. ### properties
  463. - `{DC.Color} color`:颜色
  464. - `{Number} speed`:速度
  465. - `{String} image`:图片地址
  466. - `{Object} repeat`:重复规则
  467. ## DC.PolylineLightingMaterialProperty
  468. > 发光线材质
  469. ### example
  470. ```js
  471. let material = new DC.PolylineLightingMaterialProperty({
  472. color: DC.Color.WHITE,
  473. })
  474. ```
  475. ### creation
  476. - **_constructor([options])_**
  477. 构造函数
  478. - 参数
  479. - `{Object} options`:属性
  480. - 返回值 `materialProperty`
  481. ```json
  482. // 属性参数(可选)
  483. {
  484. "color": DC.Color.WHITE // 颜色
  485. }
  486. ```
  487. ### properties
  488. - `{DC.Color} color`:颜色
  489. ## DC.PolylineLightingTrailMaterialProperty
  490. > 颜色轨迹线材质
  491. ### example
  492. ```js
  493. let material = new DC.PolylineLightingTrailMaterialProperty({
  494. color: DC.Color.WHITE,
  495. })
  496. ```
  497. ### creation
  498. - **_constructor([options])_**
  499. 构造函数
  500. - 参数
  501. - `{Object} options`:属性
  502. - 返回值 `materialProperty`
  503. ```json
  504. // 属性参数(可选)
  505. {
  506. "color": DC.Color.WHITE, // 颜色
  507. "speed": 10 // 速度
  508. }
  509. ```
  510. ### properties
  511. - `{DC.Color} color`:颜色
  512. - `{Number} speed`:速度
  513. ## DC.PolylineTrailMaterialProperty
  514. > 颜色轨迹线材质
  515. ### example
  516. ```js
  517. let material = new DC.PolylineTrailMaterialProperty({
  518. color: DC.Color.WHITE,
  519. })
  520. ```
  521. ### creation
  522. - **_constructor([options])_**
  523. 构造函数
  524. - 参数
  525. - `{Object} options`:属性
  526. - 返回值 `materialProperty`
  527. ```json
  528. // 属性参数(可选)
  529. {
  530. "color": DC.Color.WHITE, // 颜色
  531. "speed": 10 // 速度
  532. }
  533. ```
  534. ### properties
  535. - `{DC.Color} color`:颜色
  536. - `{Number} speed`:速度
  537. ## DC.RadarLineMaterialProperty
  538. > 雷达线材质
  539. ### example
  540. ```js
  541. let material = new DC.RadarLineMaterialProperty({
  542. color: DC.Color.WHITE,
  543. })
  544. ```
  545. ### creation
  546. - **_constructor([options])_**
  547. 构造函数
  548. - 参数
  549. - `{Object} options`:属性
  550. - 返回值 `materialProperty`
  551. ```json
  552. // 属性参数(可选)
  553. {
  554. "color": DC.Color.WHITE, // 颜色
  555. "speed": 10 // 速度
  556. }
  557. ```
  558. ### properties
  559. - `{DC.Color} color`:颜色
  560. - `{Number} speed`:速度
  561. ## DC.RadarWaveMaterialProperty
  562. > 波纹雷达材质
  563. ### example
  564. ```js
  565. let material = new DC.RadarWaveMaterialProperty({
  566. color: DC.Color.WHITE,
  567. })
  568. ```
  569. ### creation
  570. - **_constructor([options])_**
  571. 构造函数
  572. - 参数
  573. - `{Object} options`:属性
  574. - 返回值 `materialProperty`
  575. ```json
  576. // 属性参数(可选)
  577. {
  578. "color": DC.Color.WHITE, // 颜色
  579. "speed": 10 // 速度
  580. }
  581. ```
  582. ### properties
  583. - `{DC.Color} color`:颜色
  584. - `{Number} speed`:速度
  585. ## DC.WallImageTrailMaterialProperty
  586. > 图片轨迹墙体材质
  587. ### example
  588. ```js
  589. let material = new DC.WallImageTrailMaterialProperty({
  590. color: DC.Color.WHITE,
  591. image: '**/*.png',
  592. repeat: { x: 10, y: 1 },
  593. })
  594. ```
  595. ### creation
  596. - **_constructor([options])_**
  597. 构造函数
  598. - 参数
  599. - `{Object} options`:属性
  600. - 返回值 `materialProperty`
  601. ```json
  602. // 属性参数(可选)
  603. {
  604. "color": DC.Color.WHITE, // 颜色
  605. "speed": 10, // 速度
  606. "image": "**/*.png", // 图片地址
  607. "repeat": { "x": 10, "y": 1 } //重复规则
  608. }
  609. ```
  610. ### properties
  611. - `{DC.Color} color`:颜色
  612. - `{Number} speed`:速度
  613. - `{String} image`:图片地址
  614. - `{Object} repeat`:重复规则
  615. ## DC.WallTrailMaterialProperty
  616. > 流动墙材质
  617. ### example
  618. ```js
  619. let material = new DC.WallTrailMaterialProperty({
  620. color: DC.Color.WHITE,
  621. })
  622. ```
  623. ### creation
  624. - **_constructor([options])_**
  625. 构造函数
  626. - 参数
  627. - `{Object} options`:属性
  628. - 返回值 `materialProperty`
  629. ```json
  630. // 属性参数(可选)
  631. {
  632. "color": DC.Color.WHITE, // 颜色
  633. "speed": 10 // 速度
  634. }
  635. ```
  636. ### properties
  637. - `{DC.Color} color`:颜色
  638. - `{Number} speed`:速度
  639. ## DC.WaterMaterialProperty
  640. > 流动水材质
  641. ### example
  642. ```js
  643. let material = new DC.WaterMaterialProperty({
  644. baseWaterColor: DC.Color.WHITE,
  645. normalMap: '**/**.png',
  646. })
  647. ```
  648. ### creation
  649. - **_constructor([options])_**
  650. 构造函数
  651. - 参数
  652. - `{Object} options`:属性
  653. - 返回值 `materialProperty`
  654. ```json
  655. // 属性参数(可选)
  656. {
  657. "baseWaterColor": DC.Color.WHITE, // 水体颜色
  658. "blendColor": DC.Color.WHITE, // 混合颜色
  659. "specularMap": "", // 镜面图
  660. "normalMap": "", // 法线图
  661. "frequency": 1000, //波纹数量
  662. "animationSpeed": 0.03, // 动画速度
  663. "amplitude": 10, //水波振幅
  664. "specularIntensity": 10 //镜面反射强度
  665. }
  666. ```
  667. ### properties
  668. - `{DC.Color} baseWaterColor`:颜色
  669. - `{DC.Color} blendColor`:混合颜色
  670. - `{String} normalMap`:法线图
  671. - `{String} specularMap`:镜面图