@@ -18,6 +18,7 @@ function CreateTestModel ()
18
18
19
19
let phongMaterial = new OV . PhongMaterial ( ) ;
20
20
phongMaterial . name = 'Phong Material' ;
21
+ phongMaterial . color = new OV . RGBColor ( 0 , 0 , 0 ) ;
21
22
phongMaterial . emissive = new OV . RGBColor ( 1 , 1 , 1 ) ;
22
23
phongMaterial . opacity = 0.1 ;
23
24
phongMaterial . transparent = true ;
@@ -30,6 +31,7 @@ function CreateTestModel ()
30
31
31
32
let phongMaterialTexture = new OV . PhongMaterial ( ) ;
32
33
phongMaterialTexture . name = 'Phong Material With Texture' ;
34
+ phongMaterialTexture . color = new OV . RGBColor ( 0 , 0 , 0 ) ;
33
35
phongMaterialTexture . emissive = new OV . RGBColor ( 1 , 1 , 1 ) ;
34
36
phongMaterialTexture . opacity = 0.1 ;
35
37
phongMaterialTexture . transparent = true ;
@@ -47,6 +49,7 @@ function CreateTestModel ()
47
49
48
50
let physicalMaterialTexture = new OV . PhysicalMaterial ( ) ;
49
51
physicalMaterialTexture . name = 'Phong Material With Texture' ;
52
+ physicalMaterialTexture . color = new OV . RGBColor ( 0 , 0 , 0 ) ;
50
53
physicalMaterialTexture . emissive = new OV . RGBColor ( 1 , 1 , 1 ) ;
51
54
physicalMaterialTexture . opacity = 0.1 ;
52
55
physicalMaterialTexture . transparent = true ;
@@ -108,6 +111,39 @@ function CreateTestModel ()
108
111
return model ;
109
112
}
110
113
114
+ function CreateTestModelWithLines ( )
115
+ {
116
+ let model = new OV . Model ( ) ;
117
+
118
+ let phongMaterial = new OV . PhongMaterial ( ) ;
119
+ phongMaterial . name = 'Material' ;
120
+ phongMaterial . color = new OV . RGBColor ( 0 , 0 , 0 ) ;
121
+ model . AddMaterial ( phongMaterial ) ;
122
+
123
+ let meshOnly = new OV . Mesh ( ) ;
124
+ meshOnly . SetName ( 'Mesh Only' ) ;
125
+ meshOnly . AddVertex ( new OV . Coord3D ( 0.0 , 0.0 , 0.0 ) ) ;
126
+ meshOnly . AddVertex ( new OV . Coord3D ( 1.0 , 0.0 , 0.0 ) ) ;
127
+ meshOnly . AddVertex ( new OV . Coord3D ( 0.0 , 1.0 , 0.0 ) ) ;
128
+ meshOnly . AddTriangle ( new OV . Triangle ( 0 , 1 , 2 ) . SetMaterial ( 0 ) ) ;
129
+ model . AddMeshToRootNode ( meshOnly ) ;
130
+
131
+ let meshAndLines = new OV . Mesh ( ) ;
132
+ meshAndLines . SetName ( 'Meshes and Lines' ) ;
133
+ meshAndLines . AddVertex ( new OV . Coord3D ( 0.0 , 0.0 , 0.0 ) ) ;
134
+ meshAndLines . AddVertex ( new OV . Coord3D ( 1.0 , 0.0 , 0.0 ) ) ;
135
+ meshAndLines . AddVertex ( new OV . Coord3D ( 0.0 , 1.0 , 0.0 ) ) ;
136
+ meshAndLines . AddTriangle ( new OV . Triangle ( 0 , 1 , 2 ) . SetMaterial ( 0 ) ) ;
137
+ meshAndLines . AddVertex ( new OV . Coord3D ( 0.0 , 0.0 , 1.0 ) ) ;
138
+ meshAndLines . AddVertex ( new OV . Coord3D ( 1.0 , 0.0 , 1.0 ) ) ;
139
+ meshAndLines . AddVertex ( new OV . Coord3D ( 0.0 , 1.0 , 1.0 ) ) ;
140
+ meshAndLines . AddLine ( new OV . Line ( [ 3 , 4 , 5 ] ) . SetMaterial ( 0 ) ) ;
141
+ model . AddMeshToRootNode ( meshAndLines ) ;
142
+
143
+ OV . FinalizeModel ( model ) ;
144
+ return model ;
145
+ }
146
+
111
147
function ExportImport ( model , format , extension , onReady )
112
148
{
113
149
let exporter = new OV . Exporter ( ) ;
@@ -172,6 +208,14 @@ describe ('Export-Import Test', function () {
172
208
} ) ;
173
209
} ) ;
174
210
211
+ it ( 'Export-Import Obj with Lines' , function ( done ) {
212
+ let model = CreateTestModelWithLines ( ) ;
213
+ ExportImport ( model , OV . FileFormat . Text , 'obj' , ( model2 ) => {
214
+ CheckModel ( model , model2 ) ;
215
+ done ( ) ;
216
+ } ) ;
217
+ } ) ;
218
+
175
219
it ( 'Export-Import Stl Ascii' , function ( done ) {
176
220
let model = CreateTestModel ( ) ;
177
221
ExportImport ( model , OV . FileFormat . Text , 'stl' , ( model2 ) => {
0 commit comments