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