This commit is contained in:
2020-03-20 18:06:55 +01:00
parent 68f034ab8a
commit 1ff542a821

View File

@@ -49,7 +49,9 @@ Namespace RenderingN
Private Function ColorToTexture(color As Color) As Image Private Function ColorToTexture(color As Color) As Image
Dim tex As New Bitmap(1, 1) Dim tex As New Bitmap(1, 1)
tex.MakeTransparent()
tex.SetPixel(0, 0, color) tex.SetPixel(0, 0, color)
Console.WriteLine(tex.GetPixel(0, 0).ToString & vbTab & color.ToString)
Return tex Return tex
End Function End Function
@@ -308,14 +310,24 @@ Namespace RenderingN
GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndicesBuffers(mesh)(i)) GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndicesBuffers(mesh)(i))
Dim texID As Integer
Dim isEmptyTexture As Boolean = l.Material?.Image Is Nothing Dim isEmptyTexture As Boolean = l.Material?.Image Is Nothing
Dim isEmptyColor As Boolean = l.Material?.Color Is Nothing Dim isEmptyColor As Boolean = l.Material?.Color Is Nothing
If (mode And RenderMode.Fill) = RenderMode.Fill Then Dim setMaterialTextureOrColor =
texID = If(isEmptyTexture, If(isEmptyColor, dicTextureIDs(emptyTexture), dicColorIDs(l.Material.Color)), dicTextureIDs(l.Material.Image)) Sub()
Dim texID As Integer
If Not isEmptyTexture Then
texID = dicTextureIDs(l.Material.Image)
ElseIf Not isEmptyColor Then
texID = dicColorIDs(l.Material.Color)
Else
texID = dicTextureIDs(emptyTexture)
End If
GL.BindTexture(TextureTarget.Texture2D, texID)
End Sub
GL.BindTexture(TextureTarget.Texture2D, texID) If (mode And RenderMode.Fill) = RenderMode.Fill Then
setMaterialTextureOrColor()
If Not isEmptyTexture Then If Not isEmptyTexture Then
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, l.Material.Wrap.X) GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, l.Material.Wrap.X)
@@ -332,11 +344,9 @@ Namespace RenderingN
If (mode And RenderMode.Outline) = RenderMode.Outline Then If (mode And RenderMode.Outline) = RenderMode.Outline Then
If (mode And RenderMode.Fill) = RenderMode.Fill Then If (mode And RenderMode.Fill) = RenderMode.Fill Then
texID = dicTextureIDs(lineTexture) GL.BindTexture(TextureTarget.Texture2D, dicTextureIDs(lineTexture))
GL.BindTexture(TextureTarget.Texture2D, texID)
Else Else
texID = If(isEmptyTexture, If(isEmptyColor, dicTextureIDs(emptyTexture), dicColorIDs(l.Material.Color)), dicTextureIDs(l.Material.Image)) setMaterialTextureOrColor()
GL.BindTexture(TextureTarget.Texture2D, texID)
If Not isEmptyTexture Then If Not isEmptyTexture Then
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, l.Material.Wrap.X) GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, l.Material.Wrap.X)