Skip to content

Commit 89452f1

Browse files
Embed color adjustment script
The color adjustment script for the 3D models is now automatically built into the documentation and doesn't need to to be declared every time
1 parent cb800cc commit 89452f1

File tree

5 files changed

+16
-51
lines changed

5 files changed

+16
-51
lines changed

docs/javascript/3d-color_adjust.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const modelViewer = document.querySelectorAll("model-viewer");
2+
// To debug in console
3+
// let material = modelViewer.model.materials;
4+
5+
for (const iteration of modelViewer) {
6+
iteration.addEventListener('load', () => {
7+
const material = iteration.model.materials;
8+
// material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 49/255, 29/255]); //SparkFun Red: #E0311D
9+
material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 0, 0]); // #E00000
10+
material[material.length-1].pbrMetallicRoughness.setMetallicFactor(.8);
11+
material[material.length-1].pbrMetallicRoughness.setRoughnessFactor(.7);
12+
});
13+
};

docs/system_overview.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@ Below are two generic examples of a GNSS Flex *module* and *carrier* board.
1717
<!-- Import the component -->
1818
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js"></script>
1919

20-
<!-- Material color adjustment (for soldermask) -->
21-
<script type="module" >
22-
const modelViewer = document.querySelectorAll("model-viewer");
23-
// To debug in console
24-
// let material = modelViewer.model.materials;
25-
26-
for (const iteration of modelViewer) {
27-
iteration.addEventListener('load', () => {
28-
const material = iteration.model.materials;
29-
// material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 49/255, 29/255]); //SparkFun Red: #E0311D
30-
material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 0, 0]); // #E00000
31-
material[material.length-1].pbrMetallicRoughness.setMetallicFactor(.8);
32-
material[material.length-1].pbrMetallicRoughness.setRoughnessFactor(.7);
33-
});
34-
};
35-
</script>
36-
3720

3821
<div class="grid cards" align="center" markdown>
3922

flex_boards/SparkPNT_GNSS_Flex_Module_LG290P/docs/hardware_overview.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,6 @@ The built-in NIC anti-jamming unit provides professional-grade interference sign
1515
<!-- Import the component -->
1616
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js"></script>
1717

18-
<!-- Material color adjustment (for soldermask) -->
19-
<script type="module" >
20-
const modelViewer = document.querySelectorAll("model-viewer");
21-
// To debug in console
22-
// let material = modelViewer.model.materials;
23-
24-
for (const iteration of modelViewer) {
25-
iteration.addEventListener('load', () => {
26-
const material = iteration.model.materials;
27-
// material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 49/255, 29/255]); // #E0311D
28-
material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 0, 0]); // #E00000
29-
material[material.length-1].pbrMetallicRoughness.setMetallicFactor(.8);
30-
material[material.length-1].pbrMetallicRoughness.setRoughnessFactor(.7);
31-
});
32-
};
33-
</script>
34-
3518

3619
<div class="grid cards desc" markdown>
3720

flex_boards/SparkPNT_GNSS_Flex_Module_mosaic-X5/docs/hardware_overview.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,6 @@ For the users who prefer a command-line interface, Septentrio has you covered. U
209209
<!-- Import the component -->
210210
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js"></script>
211211

212-
<!-- Material color adjustment (for soldermask) -->
213-
<script type="module" >
214-
const modelViewer = document.querySelectorAll("model-viewer");
215-
// To debug in console
216-
// let material = modelViewer.model.materials;
217-
218-
for (const iteration of modelViewer) {
219-
iteration.addEventListener('load', () => {
220-
const material = iteration.model.materials;
221-
// material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 49/255, 29/255]); // #E0311D
222-
material[material.length-1].pbrMetallicRoughness.setBaseColorFactor([224/255, 0, 0]); // #E00000
223-
material[material.length-1].pbrMetallicRoughness.setMetallicFactor(.8);
224-
material[material.length-1].pbrMetallicRoughness.setRoughnessFactor(.7);
225-
});
226-
};
227-
</script>
228-
229212

230213
<div class="grid cards desc" markdown>
231214

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ extra_css:
390390

391391
# Enables support for rendering block and inline block equations through MathJax and KaTeX
392392
extra_javascript:
393+
# Enables script to adjust PCB color of 3D models
394+
- javascript/3d-color_adjust.js
395+
393396
# Enables support for MathJax
394397
- javascript/mathjax.js
395398
# - https://polyfill.io/v3/polyfill.min.js?features=es6

0 commit comments

Comments
 (0)