Browse Source

Cleanups.

Mark Sibly 8 years ago
parent
commit
99f54134ae
2 changed files with 9 additions and 37 deletions
  1. 5 29
      modules/mojo/graphics/image.monkey2
  2. 4 8
      modules/mojo/graphics/texture.monkey2

+ 5 - 29
modules/mojo/graphics/image.monkey2

@@ -27,13 +27,6 @@ Images also have several properties that affect how they are rendered, including
 #end
 #end
 Class Image Extends Resource
 Class Image Extends Resource
 
 
-	#rem Default texture flags
-	
-	Default texture flags to use when TextureFlags.UseDefaults is specified as a parameter.
-	
-	#end
-	Global DefaultTextureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap
-
 	#rem monkeydoc Creates a new Image.
 	#rem monkeydoc Creates a new Image.
 	
 	
 	New( pixmap,... ) Creates an image from an existing pixmap.
 	New( pixmap,... ) Creates an image from an existing pixmap.
@@ -59,9 +52,7 @@ Class Image Extends Resource
 	@param width,height Image size.
 	@param width,height Image size.
 	
 	
 	#end	
 	#end	
-	Method New( pixmap:Pixmap,textureFlags:TextureFlags=TextureFlags.UseDefault,shader:Shader=Null )
-	
-		If textureFlags=TextureFlags.UseDefault textureFlags=DefaultTextureFlags
+	Method New( pixmap:Pixmap,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	
 	
 		Local texture:=New Texture( pixmap,textureFlags )
 		Local texture:=New Texture( pixmap,textureFlags )
 		
 		
@@ -70,22 +61,9 @@ Class Image Extends Resource
 		AddDependancy( texture )
 		AddDependancy( texture )
 	End
 	End
 
 
-	Method New( width:Int,height:Int,textureFlags:TextureFlags=TextureFlags.UseDefault,shader:Shader=Null )
-	
-		If textureFlags=TextureFlags.UseDefault textureFlags=DefaultTextureFlags
+	Method New( width:Int,height:Int,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	
 	
-		Local texture:=New Texture( width,height,PixelFormat.RGBA32,textureFlags )
-		
-		Init( texture,shader )
-		
-		AddDependancy( texture )
-	End
-
-	Method New( width:Int,height:Int,format:PixelFormat,textureFlags:TextureFlags=TextureFlags.UseDefault,shader:Shader=Null )
-	
-		If textureFlags=TextureFlags.UseDefault textureFlags=DefaultTextureFlags
-	
-		Local texture:=New Texture( width,height,format,textureFlags )
+		Local texture:=New Texture( width,height,PixelFormat.RGBA8,textureFlags )
 		
 		
 		Init( texture,shader )
 		Init( texture,shader )
 		
 		
@@ -332,7 +310,7 @@ Class Image Extends Resource
 		_material.SetTexture( "ImageTexture"+index,texture )
 		_material.SetTexture( "ImageTexture"+index,texture )
 	End
 	End
 	
 	
-	#rem monkeydoc @hidden gets an image texture.
+	#rem monkeydoc @hidden gets an image's texture.
 	#end	
 	#end	
 	Method GetTexture:Texture( index:Int )
 	Method GetTexture:Texture( index:Int )
 	
 	
@@ -341,10 +319,8 @@ Class Image Extends Resource
 	
 	
 	#rem monkeydoc Loads an image from file.
 	#rem monkeydoc Loads an image from file.
 	#end
 	#end
-	Function Load:Image( path:String,shader:Shader=Null,textureFlags:TextureFlags=TextureFlags.UseDefault )
+	Function Load:Image( path:String,shader:Shader=Null,textureFlags:TextureFlags=Null )
 		
 		
-		If textureFlags=TextureFlags.UseDefault textureFlags=DefaultTextureFlags
-	
 		Local pixmap:=Pixmap.Load( path,Null,True )
 		Local pixmap:=Pixmap.Load( path,Null,True )
 		If Not pixmap Return Null
 		If Not pixmap Return Null
 
 

+ 4 - 8
modules/mojo/graphics/texture.monkey2

@@ -74,8 +74,8 @@ Enum TextureFlags
 	Cubemap=		$0020
 	Cubemap=		$0020
 	
 	
 	Skybox=			Filter|Mipmap|Cubemap
 	Skybox=			Filter|Mipmap|Cubemap
-	
-	UseDefault=		$ffff
+	ColorTarget=	Filter|Dynamic
+	DepthTarget=	Dynamic
 End
 End
 
 
 Enum TextureFilter
 Enum TextureFilter
@@ -87,10 +87,8 @@ End
 #end
 #end
 Class Texture Extends Resource
 Class Texture Extends Resource
 	
 	
-	Method New( pixmap:Pixmap,flags:TextureFlags=TextureFlags.UseDefault )
+	Method New( pixmap:Pixmap,flags:TextureFlags )
 
 
-		If flags=TextureFlags.UseDefault flags=TextureFlags.Filter|TextureFlags.Mipmap
-			
 		_managed=pixmap
 		_managed=pixmap
 		_size=New Vec2i( pixmap.Width,pixmap.Height )
 		_size=New Vec2i( pixmap.Width,pixmap.Height )
 		_format=pixmap.Format
 		_format=pixmap.Format
@@ -122,10 +120,8 @@ Class Texture Extends Resource
 		Endif
 		Endif
 	End
 	End
 	
 	
-	Method New( width:Int,height:Int,format:PixelFormat,flags:TextureFlags=TextureFlags.UseDefault )
+	Method New( width:Int,height:Int,format:PixelFormat,flags:TextureFlags )
 
 
-		If flags=TextureFlags.UseDefault flags=TextureFlags.Filter|TextureFlags.Dynamic
-		
 		_managed=Null
 		_managed=Null
 		_size=New Vec2i( width,height )
 		_size=New Vec2i( width,height )
 		_format=format
 		_format=format