').addClass ('ov_navigator_tree_panel').addClass ('ov_thin_scrollbar').appendTo (parentDiv);
@@ -315,16 +310,16 @@ OV.Navigator = class
{
let obj = this;
if (this.selection === null) {
- let modelInfo = this.callbacks.getModelInformation ();
- this.infoPanel.FillWithModelInfo (modelInfo, {
+ let usedMaterial = this.callbacks.getMaterialsForModel ();
+ this.infoPanel.FillWithModelInfo (usedMaterial, {
onMaterialSelect : function (materialIndex) {
obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
}
});
} else {
if (this.selection.type === OV.SelectionType.Material) {
- let materialInfo = this.callbacks.getMaterialInformation (this.selection.index);
- this.infoPanel.FillWithMaterialInfo (materialInfo, {
+ let usedByMeshes = this.callbacks.getMeshesForMaterial (this.selection.index);
+ this.infoPanel.FillWithMaterialInfo (usedByMeshes, {
onMeshHover : function (meshIndex) {
obj.SetTempSelectedMeshIndex (meshIndex);
},
@@ -333,8 +328,8 @@ OV.Navigator = class
}
});
} else if (this.selection.type === OV.SelectionType.Mesh) {
- let meshInfo = this.callbacks.getMeshInformation (this.selection.index);
- this.infoPanel.FillWithModelInfo (meshInfo, {
+ let usedByMeshes = this.callbacks.getMaterialsForMesh (this.selection.index);
+ this.infoPanel.FillWithModelInfo (usedByMeshes, {
onMaterialSelect : function (materialIndex) {
obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
}
diff --git a/website/o3dv/sidebar.js b/website/o3dv/sidebar.js
index 539157e..3a0c5ef 100644
--- a/website/o3dv/sidebar.js
+++ b/website/o3dv/sidebar.js
@@ -1,3 +1,8 @@
+OV.PropertyType =
+{
+ Text : 1
+};
+
OV.Sidebar = class
{
constructor (parentDiv)
@@ -5,5 +10,8 @@ OV.Sidebar = class
this.parentDiv = parentDiv;
this.titleDiv = $('
').addClass ('ov_sidebar_title').addClass ('ov_thin_scrollbar').appendTo (parentDiv);
this.titleDiv.html ('Details');
+ this.contentDiv = $('
').appendTo (parentDiv);
}
+
+
};
diff --git a/website/o3dv/website.js b/website/o3dv/website.js
index 2e40a78..042f29f 100644
--- a/website/o3dv/website.js
+++ b/website/o3dv/website.js
@@ -7,8 +7,8 @@ OV.Website = class
this.hashHandler = new OV.HashHandler ();
this.cookieHandler = new OV.CookieHandler ();
this.toolbar = new OV.Toolbar (this.parameters.toolbarDiv);
- this.navigator = new OV.Navigator (this.parameters.navigatorDiv);
this.sidebar = new OV.Sidebar (this.parameters.sidebarDiv);
+ this.navigator = new OV.Navigator (this.parameters.navigatorDiv, this.sidebar);
this.importSettings = new OV.ImportSettings ();
this.modelLoader = new OV.ThreeModelLoader ();
this.highlightMaterial = new THREE.MeshPhongMaterial ({
@@ -372,58 +372,19 @@ OV.Website = class
return userData;
}
- function GetBoundingBoxInfo (boundingBox)
+ function GetMeshesForMaterial (viewer, model, materialIndex)
{
- if (boundingBox === null) {
- return null;
- }
- return {
- min : new OV.Coord3D (boundingBox.min.x, boundingBox.min.y, boundingBox.min.z),
- max : new OV.Coord3D (boundingBox.max.x, boundingBox.max.y, boundingBox.max.z)
- };
- }
-
- function GetMaterialInfo (viewer, model, materialIndex)
- {
- function AddTexture (textureNames, type, texture)
- {
- if (texture === null) {
- return;
- }
- textureNames.push ({
- type : type,
- name : OV.GetFileName (texture.name),
- path : texture.name
- });
- }
-
- let material = model.GetMaterial (materialIndex);
- let materialInfo = {
- name : material.name,
- ambient : material.ambient.Clone (),
- diffuse : material.diffuse.Clone (),
- specular : material.specular.Clone (),
- opacity : material.opacity,
- textureNames : [],
- usedByMeshes : []
- };
-
- AddTexture (materialInfo.textureNames, 'Base', material.diffuseMap);
- AddTexture (materialInfo.textureNames, 'Specular', material.specularMap);
- AddTexture (materialInfo.textureNames, 'Bump', material.bumpMap);
- AddTexture (materialInfo.textureNames, 'Normal', material.normalMap);
- AddTexture (materialInfo.textureNames, 'Emissive', material.emissiveMap);
-
+ let usedByMeshes = [];
viewer.EnumerateMeshesUserData (function (meshUserData) {
if (meshUserData.originalMaterials.indexOf (materialIndex) !== -1) {
const mesh = model.GetMesh (meshUserData.originalMeshIndex);
- materialInfo.usedByMeshes.push ({
+ usedByMeshes.push ({
index : meshUserData.originalMeshIndex,
name : mesh.GetName ()
});
}
});
- return materialInfo;
+ return usedByMeshes;
}
function GetMaterialReferenceInfo (model, materialIndex)
@@ -436,50 +397,27 @@ OV.Website = class
};
}
- function GetMeshInfo (viewer, model, meshIndex)
+ function GetMaterialsForMesh (viewer, model, meshIndex)
{
- let result = {
- element : null,
- usedMaterials : null,
- boundingBox : null
- };
-
- let mesh = model.GetMesh (meshIndex);
- result.element = mesh;
-
+ let usedMaterials = [];
let userData = GetMeshUserData (viewer, meshIndex);
- result.usedMaterials = [];
for (let i = 0; i < userData.originalMaterials.length; i++) {
const materialIndex = userData.originalMaterials[i];
- result.usedMaterials.push (GetMaterialReferenceInfo (model, materialIndex));
+ usedMaterials.push (GetMaterialReferenceInfo (model, materialIndex));
}
- result.usedMaterials.sort (function (a, b) {
+ usedMaterials.sort (function (a, b) {
return a.index - b.index;
});
-
- let boundingBox = viewer.GetBoundingBox (function (meshUserData) {
- return meshUserData.originalMeshIndex === meshIndex;
- });
- result.boundingBox = GetBoundingBoxInfo (boundingBox);
- return result;
+ return usedMaterials;
}
- function GetModelInfo (model, viewer)
+ function GetMaterialsForModel (model)
{
- let result = {
- element : model,
- usedMaterials : null,
- boundingBox : null
- };
- let boundingBox = viewer.GetBoundingBox (function (meshUserData) {
- return true;
- });
- result.usedMaterials = [];
+ let usedMaterials = [];
for (let materialIndex = 0; materialIndex < model.MaterialCount (); materialIndex++) {
- result.usedMaterials.push (GetMaterialReferenceInfo (model, materialIndex));
+ usedMaterials.push (GetMaterialReferenceInfo (model, materialIndex));
}
- result.boundingBox = GetBoundingBoxInfo (boundingBox);
- return result;
+ return usedMaterials;
}
let obj = this;
@@ -496,14 +434,14 @@ OV.Website = class
fitMeshToWindow : function (meshIndex) {
obj.FitMeshToWindow (meshIndex);
},
- getMaterialInformation : function (materialIndex) {
- return GetMaterialInfo (obj.viewer, obj.model, materialIndex);
+ getMeshesForMaterial : function (materialIndex) {
+ return GetMeshesForMaterial (obj.viewer, obj.model, materialIndex);
},
- getMeshInformation : function (meshIndex) {
- return GetMeshInfo (obj.viewer, obj.model, meshIndex);
+ getMaterialsForMesh : function (meshIndex) {
+ return GetMaterialsForMesh (obj.viewer, obj.model, meshIndex);
},
- getModelInformation : function () {
- return GetModelInfo (obj.model, obj.viewer);
+ getMaterialsForModel : function () {
+ return GetMaterialsForModel (obj.model);
}
});
}