Browse Source

Added material "alphaMode" support to gltf.

Mark Sibly 7 years ago
parent
commit
c9c2b1a1e1
2 changed files with 6 additions and 0 deletions
  1. 2 0
      modules/mojo3d/loader/gltf2.monkey2
  2. 4 0
      modules/mojo3d/loader/gltf2loader.monkey2

+ 2 - 0
modules/mojo3d/loader/gltf2.monkey2

@@ -75,6 +75,7 @@ Class Gltf2Material
 	Field emissiveFactor:Vec3f=New Vec3f(0)
 	Field occlusionTexture:Gltf2Texture
 	Field normalTexture:Gltf2Texture
+	Field alphaMode:String
 End
 
 #rem monkeydoc @hidden
@@ -419,6 +420,7 @@ Class Gltf2Asset
 			If jobj
 				material.normalTexture=textures[jobj.GetNumber( "index" )]
 			Endif
+			material.alphaMode=jmaterial.GetString( "alphaMode" )
 
 		Next
 		

+ 4 - 0
modules/mojo3d/loader/gltf2loader.monkey2

@@ -211,6 +211,10 @@ Class Gltf2Loader
 			
 		If normalTexture mat.NormalTexture=normalTexture
 			
+		Select material.alphaMode
+		Case "BLEND" mat.BlendMode=BlendMode.Alpha
+		End
+			
 		_materialCache[material]=mat
 		Return mat
 	End