PBR materials for o3dv format.
This commit is contained in:
parent
669ab1f8b4
commit
2a71f7d6b5
@ -52,7 +52,7 @@ OV.ImporterO3dv = class extends OV.ImporterBase
|
|||||||
|
|
||||||
ImportMaterial (materialContent)
|
ImportMaterial (materialContent)
|
||||||
{
|
{
|
||||||
let material = new OV.Material (OV.MaterialType.Phong);
|
let material = new OV.Material (OV.MaterialType.Physical);
|
||||||
material.color.Set (255, 255, 255);
|
material.color.Set (255, 255, 255);
|
||||||
if (materialContent.name !== undefined) {
|
if (materialContent.name !== undefined) {
|
||||||
material.name = materialContent.name;
|
material.name = materialContent.name;
|
||||||
@ -60,6 +60,8 @@ OV.ImporterO3dv = class extends OV.ImporterBase
|
|||||||
if (materialContent.color !== undefined) {
|
if (materialContent.color !== undefined) {
|
||||||
material.color = OV.ArrayToColor (materialContent.color);
|
material.color = OV.ArrayToColor (materialContent.color);
|
||||||
}
|
}
|
||||||
|
material.metalness = OV.ValueOrDefault (materialContent.metalness, 0.0);
|
||||||
|
material.roughness = OV.ValueOrDefault (materialContent.roughness, 1.0);
|
||||||
this.model.AddMaterial (material);
|
this.model.AddMaterial (material);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
70
test/testfiles/o3dv/materials.o3dv
Normal file
70
test/testfiles/o3dv/materials.o3dv
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"materials" : [
|
||||||
|
{
|
||||||
|
"name" : "Material 1",
|
||||||
|
"color" : [200, 0, 0],
|
||||||
|
"metalness" : 1.0,
|
||||||
|
"roughness" : 0.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Material 2",
|
||||||
|
"color" : [0, 200, 0],
|
||||||
|
"metalness" : 1.0,
|
||||||
|
"roughness" : 0.25
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Material 3",
|
||||||
|
"color" : [0, 0, 200],
|
||||||
|
"metalness" : 1.0,
|
||||||
|
"roughness" : 0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Material 4",
|
||||||
|
"color" : [200, 200, 0],
|
||||||
|
"metalness" : 1.0,
|
||||||
|
"roughness" : 0.75
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meshes" : [
|
||||||
|
{
|
||||||
|
"type" : "sphere",
|
||||||
|
"parameters" : {
|
||||||
|
"radius" : 0.5
|
||||||
|
},
|
||||||
|
"transformation" : {
|
||||||
|
"translation" : [0.0, 0.0, 0.0]
|
||||||
|
},
|
||||||
|
"material" : 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type" : "sphere",
|
||||||
|
"parameters" : {
|
||||||
|
"radius" : 0.5
|
||||||
|
},
|
||||||
|
"transformation" : {
|
||||||
|
"translation" : [1.5, 0.0, 0.0]
|
||||||
|
},
|
||||||
|
"material" : 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type" : "sphere",
|
||||||
|
"parameters" : {
|
||||||
|
"radius" : 0.5
|
||||||
|
},
|
||||||
|
"transformation" : {
|
||||||
|
"translation" : [3.0, 0.0, 0.0]
|
||||||
|
},
|
||||||
|
"material" : 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type" : "sphere",
|
||||||
|
"parameters" : {
|
||||||
|
"radius" : 0.5
|
||||||
|
},
|
||||||
|
"transformation" : {
|
||||||
|
"translation" : [4.5, 0.0, 0.0]
|
||||||
|
},
|
||||||
|
"material" : 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user