Permalink
Browse files

PbrMaterial.Load can now load jpg textures.

  • Loading branch information...
blitz-research committed Feb 28, 2018
1 parent 82094b5 commit 7d19290405cb5b647763539eda682336c9a1cc2c
Showing with 16 additions and 8 deletions.
  1. +16 −8 modules/mojo3d/render/materials/pbrmaterial.monkey2
@@ -223,35 +223,34 @@ Class PbrMaterial Extends Material
Local material:=New PbrMaterial
Local texture:=Texture.Load( path+"/color.png",textureFlags )
Local texture:=LoadTexture( path,"color",textureFlags )
If texture
material.ColorTexture=texture
Endif
texture=Texture.Load( path+"/emissive.png",textureFlags )
texture=LoadTexture(path,"emissive",textureFlags )
If texture
material.EmissiveTexture=texture
material.EmissiveFactor=Color.White
Endif
texture=Texture.Load( path+"/metalness.png",textureFlags )
texture=LoadTexture( path,"metalness",textureFlags )
If texture
material.MetalnessTexture=texture
Endif
texture=Texture.Load( path+"/roughness.png",textureFlags )
texture=LoadTexture( path,"roughness",textureFlags )
If texture
material.RoughnessTexture=texture
Print "Loaded roughness:"+path
Endif
texture=Texture.Load( path+"/occlusion.png",textureFlags )
texture=LoadTexture( path,"occlusion",textureFlags )
If texture
material.OcclusionTexture=texture
Endif
texture=Texture.Load( path+"/normal.png",textureFlags )
If Not texture texture=Texture.Load( path+"/unormal.png",textureFlags,True )
texture=LoadTexture( path,"normal",textureFlags )
If Not texture texture=LoadTexture( path,"unormal",textureFlags,True )
If texture
material.NormalTexture=texture
Endif
@@ -279,6 +278,15 @@ Class PbrMaterial Extends Material
Field _dirty:=True
Function LoadTexture:Texture( path:String,name:String,flags:TextureFlags,flipy:Bool=False )
Local texture:=Texture.Load( path+"/"+name+".png",flags,flipy )
If Not texture texture=Texture.Load( path+"/"+name+".jpg",flags,flipy )
Return texture
End
Method ValidateShaders()
If Not _dirty Return

0 comments on commit 7d19290

Please sign in to comment.