3DViewers
Purpose
The 3DViewers collection defines configuration and display settings for 3D AR viewer instances. Each document specifies parameters such as background, camera controls, lighting, menu options, and other rendering settings for a 3D viewer.
This collection includes two main subcollections, products and variants (optional). These structures allow for flexible and granular control over how products and their variants are displayed in the 3D AR Viewer.
Document schema
{
"autoRotate": "boolean",
"backgroundColor": "string",
"backgroundImage": "string",
"cameraControls": "boolean",
"cameraOrbit": "string",
"catalog": "string",
"defaultSpeed": "string",
"disableZoom": "boolean",
"fieldOfView": "string",
"hdr": "number",
"isBackgroundImage": "boolean",
"isFirstModelLoaded": "boolean",
"lightExposition": "number",
"lock": "boolean",
"menuOrientation": "number",
"menuPosition": "number",
"menuType": "string",
"modalQr": "boolean",
"modelList": "number",
"password": "string",
"shadowIntensity": "number",
"shadowSmooth": "number",
"status": "string"
}
Subcollection: Products
The Products subcollection stores product-specific settings for the 3D viewer. Each document links to a product and lists its available variants.
Document schema
{
"id": "string",
"initialModel": "string",
"list_variants": ["string"]
}
Subcollection: variants (optional)
The variants subcollection stores variant-specific overrides for the 3D viewer configuration. If the shouldApply field is set to true, the viewer uses these settings for the specific variant instead of the default ones from the main 3DViewers document.
Document schema
{
"autoRotate": "boolean",
"backgroundColor": "string",
"backgroundImage": "string",
"cameraControls": "boolean",
"cameraOrbit": "string",
"catalog": "string",
"defaultSpeed": "string",
"fieldOfView": "string",
"id": "string",
"isBackgroundImage": "boolean",
"lock": "boolean",
"menuOrientation": "number",
"menuPosition": "number",
"menuType": "string",
"modalQr": "boolean",
"shadowIntensity": "number",
"shadowSmooth": "number",
"shouldApply": "boolean",
"status": "string"
}
Indexes
- catalog is a
stringthat refers to the ID ofCataloguescollection; - In products subcollection:
- id is a
stringthat refers to the ID of theCataloguesProductscollection; - initialModel is a
stringthat refers to the ID of theCataloguesVariantscollection; - list_variants is a
[]ofstrings that refer to the IDs of theCataloguesVariantscollection;
- id is a
- In variants subcollection:
- catalog is a
stringthat refers to the ID ofCataloguescollection; - id is a
stringthat refers to the ID of the3DViewerscollection.
- catalog is a
Query examples
// Fetch the Reference Doc from Firebase
const viewerRef = doc(db, "3DViewers", viewerId);
// Get the Document Snapshot from the Reference Doc
const viewerSnap = await getDoc(viewerRef);
// Fetch the Document from products subcollection
const productDocRef = await getDoc(
doc(collection(db, "3DViewers", viewerId, "Products"), productId)
);
// Fetch the Document of the custom configuration from variants subcollection
const variantConfig = await getDoc(
doc(
collection(db, "3DViewers", viewerId, "Products", productId, "variants"),
variantId
)
);