Visualizzatori3D
Purpose
The Visualizzatori3D collection defines the configuration of 3D viewers used for displaying glasses and variants.
Its purpose is to manage rendering options, camera controls, backgrounds, and viewer state.
This collection includes two main subcollections, Glasses 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",
"background_boolean_image": "boolean",
"background_color": "string",
"background_image": "string",
"brand": "string",
"cameraControls": "boolean",
"cameraOrbit": "string",
"defaultSpeed": "string",
"disableZoom": "boolean",
"fieldOfView": "string",
"hdr": "number",
"id": "string",
"isFirstModelLoaded": "boolean",
"lightExposition": "number",
"lock": "boolean",
"menu_orientation": "number",
"menu_position": "number",
"menu_type": "string",
"modalQr": "boolean",
"model_list": "number",
"password": "string",
"shadowIntensity": "number",
"shadowSmooth": "number",
"state": "string"
}
Subcollection: Glasses
Each viewer can have multiple Glasses documents, representing models linked to the viewer.
Document schema
{
"initial_model": "string",
"lista_varianti": ["string"]
}
Subcollection: variants (optional)
The variants subcollection allows overriding default viewer settings for specific glasses variants.
Document schema
{
"autoRotate": "boolean",
"background_boolean_image": "boolean",
"background_color": "string",
"background_image": "string",
"brand": "string",
"cameraControls": "boolean",
"cameraOrbit": "string",
"defaultSpeed": "string",
"fieldOfView": "string",
"id": "string",
"lock": "boolean",
"menu_orientation": "number",
"menu_position": "number",
"menu_type": "string",
"modalQr": "boolean",
"shadowIntensity": "number",
"shadowSmooth": "number",
"shouldApply": "boolean",
"state": "string"
}
Indexes
- brand is a
stringthat refers to the ID ofBrandcollection; - In Glasses subcollection:
- In variants subcollection:
- brand is a
stringthat refers to the ID ofBrandcollection; - id is a
stringthat refers to the ID of theVisualizzatori3Dcollection.
- brand is a
Query examples
// Fetch the Reference Doc from Firebase
const viewerRef = doc(db, "Visualizzatori3D", viewerId);
// Get the Document Snapshot from the Reference Doc
const viewerSnap = await getDoc(viewerRef);
// Fetch the Document from Glasses subcollection
const glassesDocRef = await getDoc(
doc(collection(db, "Visualizzatori3D", viewerId, "Glasses"), glassesId)
);
// Fetch the Document of the custom configuration from variants subcollection
const variantConfig = await getDoc(
doc(
collection(db, "Visualizzatori3D", viewerId, "Products", glassesId, "variants"),
variantId
)
);