Mark Sibly 8 anni fa
parent
commit
5ffe5d12f8

+ 8 - 7
modules/mojo/graphics/indexbuffer.monkey2

@@ -15,8 +15,6 @@ Class IndexBuffer
 		_format=format
 		_capacity=capacity
 		_pitch=_format=IndexFormat.UINT16 ? 2 Else 4
-		_length=0
-		_clean=0
 		_data=New UByte[_capacity*_pitch]
 	End
 	
@@ -26,20 +24,21 @@ Class IndexBuffer
 		_capacity=indices._capacity
 		_pitch=indices._pitch
 		_length=indices._length
-		_clean=0
 		_data=indices._data.Slice( 0 )
 	End
 	
 	Method New( indices:UInt[] )
+		
 		Self.New( IndexFormat.UINT32,indices.Length )
 		
-		libc.memcpy( AddIndices( indices.Length ),indices.Data,_capacity*_pitch )
+		If _capacity libc.memcpy( AddIndices( _capacity ),indices.Data,_capacity*_pitch )
 	End
 	
 	Method New( indices:UShort[] )
+		
 		Self.New( IndexFormat.UINT16,indices.Length )
 		
-		libc.memcpy( AddIndices( indices.Length ),indices.Data,_capacity*_pitch )
+		If _capacity libc.memcpy( AddIndices( _capacity ),indices.Data,_capacity*_pitch )
 	End
 	
 	Property Data:UByte Ptr()
@@ -68,15 +67,18 @@ Class IndexBuffer
 	End
 	
 	Method Clear()
+		
 		_length=0
 		_clean=0
 	End
 	
 	Method Invalidate()
+		
 		_clean=0
 	End
 	
 	Method AddIndices:UByte Ptr( count:Int )
+		
 		Reserve( _length+count )
 		
 		Local p:=_data.Data+_length*_pitch
@@ -137,10 +139,9 @@ Class IndexBuffer
 		
 		Local data:=New UByte[_capacity*_pitch]
 		
-		libc.memcpy( data.Data,_data.Data,_length*_pitch )
+		If _length libc.memcpy( data.Data,_data.Data,_length*_pitch )
 		
 		_data=data
-		
 	End
 
 End

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

@@ -77,10 +77,9 @@ Enum TextureFlags
 	
 	Dynamic=		$00100
 	Cubemap=		$00200
-
-	Skybox=			Filter|Mipmap|Cubemap
-	ColorTarget=	Filter|Dynamic
-	DepthTarget=	Dynamic
+	
+	WrapST=			WrapS|WrapT
+	FilterMipmap=	Filter|Mipmap
 End
 
 #rem monkeydoc @hidden

+ 8 - 5
modules/mojo/graphics/vertexbuffer.monkey2

@@ -15,27 +15,27 @@ End
 Class VertexBuffer
 
 	Method New( format:VertexFormat,capacity:Int )
+		
 		_format=format
 		_capacity=capacity
 		_pitch=_format.Pitch
-		_length=0
-		_clean=0
 		_data=New UByte[_capacity*_pitch]
 	End
 	
 	Method New( vertices:VertexBuffer )
+		
 		_format=vertices._format
 		_capacity=vertices._capacity
 		_pitch=vertices._pitch
 		_length=vertices._length
-		_clean=0
 		_data=vertices._data.Slice( 0 )
 	End
 	
 	Method New( vertices:Vertex3f[] )
+		
 		Self.New( Vertex3fFormat.Instance,vertices.Length )
 		
-		libc.memcpy( AddVertices( vertices.Length ),vertices.Data,_capacity*_pitch )
+		If _capacity libc.memcpy( AddVertices( _capacity ),vertices.Data,_capacity*_pitch )
 	End
 	
 	Property Data:UByte Ptr()
@@ -64,15 +64,18 @@ Class VertexBuffer
 	End
 	
 	Method Clear()
+		
 		_length=0
 		_clean=0
 	End
 	
 	Method Invalidate()
+		
 		_clean=0
 	End
 	
 	Method AddVertices:UByte Ptr( count:Int )
+		
 		Reserve( _length+count )
 
 		Local p:=_data.Data+_length*_pitch
@@ -135,7 +138,7 @@ Class VertexBuffer
 		
 		Local data:=New UByte[_capacity*_pitch]
 		
-		libc.memcpy( data.Data,_data.Data,_length*_pitch )
+		If _length libc.memcpy( data.Data,_data.Data,_length*_pitch )
 		
 		_data=data
 	End