@@ -297,7 +297,7 @@ private static Vector4 GetColor(Vertex vertex, MaterialBuilder materialBuilder)
297
297
{
298
298
return paintBuilder . VertexPaint switch
299
299
{
300
- true => vertex . Color ! . Value ,
300
+ true => vertex . Color ?? new Vector4 ( 0 , 0 , 0 , 0 ) ,
301
301
false => new Vector4 ( 1 , 1 , 1 , 1 )
302
302
} ;
303
303
}
@@ -356,15 +356,15 @@ private static IVertexMaterial CreateMaterialParamCache(Vertex vertex, Type type
356
356
if ( type == typeof ( VertexColor1Texture3 ) )
357
357
{
358
358
var texCoord = ToVec2 ( vertex . TexCoord ! . Value ) ;
359
- var texCoord2 = ToVec2 ( vertex . TexCoord2 ! . Value ) ;
360
- return new VertexColor1Texture3 ( GetColor ( vertex , materialBuilder ) , texCoord . XY , texCoord . ZW , texCoord2 . XY ) ;
359
+ ( Vector2 xy , Vector2 zw ) texCoord2 = vertex . TexCoord2 != null ? ToVec2 ( vertex . TexCoord2 ! . Value ) : ( Vector2 . Zero , Vector2 . Zero ) ;
360
+ return new VertexColor1Texture3 ( GetColor ( vertex , materialBuilder ) , texCoord . XY , texCoord . ZW , texCoord2 . xy ) ;
361
361
}
362
362
363
363
if ( type == typeof ( VertexColor1Texture4 ) )
364
364
{
365
365
var texCoord = ToVec2 ( vertex . TexCoord ! . Value ) ;
366
- var texCoord2 = ToVec2 ( vertex . TexCoord2 ! . Value ) ;
367
- return new VertexColor1Texture4 ( GetColor ( vertex , materialBuilder ) , texCoord . XY , texCoord . ZW , texCoord2 . XY , texCoord2 . ZW ) ;
366
+ ( Vector2 xy , Vector2 zw ) texCoord2 = vertex . TexCoord2 != null ? ToVec2 ( vertex . TexCoord2 ! . Value ) : ( Vector2 . Zero , Vector2 . Zero ) ;
367
+ return new VertexColor1Texture4 ( GetColor ( vertex , materialBuilder ) , texCoord . XY , texCoord . ZW , texCoord2 . xy , texCoord2 . zw ) ;
368
368
}
369
369
370
370
if ( type == typeof ( VertexTexture1 ) )
@@ -381,15 +381,16 @@ private static IVertexMaterial CreateMaterialParamCache(Vertex vertex, Type type
381
381
if ( type == typeof ( VertexTexture3 ) )
382
382
{
383
383
var texCoord = ToVec2 ( vertex . TexCoord ! . Value ) ;
384
- var texCoord2 = ToVec2 ( vertex . TexCoord2 ! . Value ) ;
385
- return new VertexTexture3 ( texCoord . XY , texCoord . ZW , texCoord2 . XY ) ;
384
+ ( Vector2 xy , Vector2 zw ) texCoord2 = vertex . TexCoord2 != null ? ToVec2 ( vertex . TexCoord2 ! . Value ) : ( Vector2 . Zero , Vector2 . Zero ) ;
385
+ return new VertexTexture3 ( texCoord . XY , texCoord . ZW , texCoord2 . xy ) ;
386
386
}
387
387
388
388
if ( type == typeof ( VertexTexture4 ) )
389
389
{
390
390
var texCoord = ToVec2 ( vertex . TexCoord ! . Value ) ;
391
- var texCoord2 = ToVec2 ( vertex . TexCoord2 ! . Value ) ;
392
- return new VertexTexture4 ( texCoord . XY , texCoord . ZW , texCoord2 . XY , texCoord2 . ZW ) ;
391
+
392
+ ( Vector2 xy , Vector2 zw ) texCoord2 = vertex . TexCoord2 != null ? ToVec2 ( vertex . TexCoord2 ! . Value ) : ( Vector2 . Zero , Vector2 . Zero ) ;
393
+ return new VertexTexture4 ( texCoord . XY , texCoord . ZW , texCoord2 . xy , texCoord2 . zw ) ;
393
394
}
394
395
395
396
return new VertexEmpty ( ) ;
0 commit comments