I need some help from Eros, but my early tests show good parsing performance of the early implementation - triceratops is already dancing on my screen, woman head will be more complex, as it combines triangles and quads :)
Petr
Printable View
I need some help from Eros, but my early tests show good parsing performance of the early implementation - triceratops is already dancing on my screen, woman head will be more complex, as it combines triangles and quads :)
Petr
I updated the code with gBufferBuilder, which allows to define iteratively a gBuffer. By using this type it is already possible to produce some visible geometry.
Next step is to analyse m15 buffer in order to resolve all submeshes which would be automatically converted to gBuffers of correct type (triangles/quads/polygons).
Petr
With a bit of work, the current version at GitHub allows to render geometry - from memory or from file.
The performance of meshes with uniform type (just triangles/quads) matches the m15DrawModel, but in case of mixed types, it is still slower.
The reason is in the way the gBuffer groups are created - every time a texture or type of polygon changes.
This way it can happen that model such as woman head in this thread ends up having 500+ gBuffers, on which I need to iterate.
So next step will be smarter polygon batching to gBuffers.
If you are interested in first version for testing, please read the first post to learn about the use and where to get the code.
Petr
Hi Petr
i have downloaded your m15 package. and have saved the following m15 viewer code in the folder m15Model which have 9 files. but there is an error msg : Dim type not defined , Dim model As m15Model http://s9.postimg.org/id378qp0f/msg.png
how to edit this viewer code so to work with your new package.
thanks
Code:'#INCLUDE "m15Model.tbasicu"
Uses "TBGL","math"
Dim hWnd As DWord
Global tot, num, flag, indx, wireframe As Long
num = 1
Global v, ro, y2, x2, z2, part As Single
part = 0.99
hWnd = TBGL_CreateWindowEx("press 'W' for wire/solid Frame .... press ESC to quit", 640, 600, 32, 0)
TBGL_ShowWindow
'Dim model As m15Model
TBGL_m15InitModelBuffers 1, 2000
'TBGL_PolygonLook %GL_LINE
TBGL_m15LoadModel "womanhead.m15", "", 1, 0, %TBGL_NORMAL_SMOOTH
TBGL_GetAsyncKeyState(-1) ' Resets status of all keys
Dim gFrameTime As Long
TBGL_UseLighting 1
TBGL_UseLightSource %GL_LIGHT0, 1
gFrameTime = GetTickCount
While TBGL_IsWindow(hWnd)
If TBGL_GetWindowKeyOnce( hWnd, %VK_W) Then
If wireframe = 0 Then
TBGL_PolygonLook %GL_LINE
wireframe = 1
Else
TBGL_PolygonLook %GL_FILL
wireframe = 0
End If
End If
gFrameTime = GetTickCount
TBGL_ClearFrame
TBGL_Camera 0,7,16,0,2,0
'waves()
TBGL_m15RecalcNormals 1, %TBGL_NORMAL_SMOOTH
ro+1
TBGL_Rotate ro-90 , 0, 1, 0
TBGL_m15DrawModel 1
'model.render 1
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
Hi Primo,
good catch! The problem was that GitHub automatically converted the line endings to Unix.
I fixed this issue, and made a new release. Grab it here:
https://github.com/petrSchreiber/m15...ses/tag/v0.1.1
Here is code which works fine with it:
PetrCode:Uses "tbgl", "math"
#INCLUDE "m15Model/m15Model.tbasicu" ' -- can be just m15Model.tbasicu, depends where your code is :]
Long tot, flag, indx, wireframe
Long num = 1
Single v, ro, y2, x2, z2
Single part = 0.99
DWord hWnd = TBGL_CreateWindowEx("press 'W' for wire/solid Frame .... press ESC to quit", 640, 600, 32, 0)
TBGL_ShowWindow
Dim model As m15Model
model.fromFile(APP_SourcePath + "womanhead.m15")
TBGL_ResetKeyState
Long gFrameTime
TBGL_UseLighting TRUE
TBGL_UseLightSource %GL_LIGHT0, 1
gFrameTime = GetTickCount
While TBGL_IsWindow(hWnd)
If TBGL_GetWindowKeyOnce( hWnd, %VK_W) Then
wireframe = Not wireframe
TBGL_PolygonLook IIf(wireframe, %GL_LINE, %GL_FILL)
End If
gFrameTime = GetTickCount
TBGL_ClearFrame
TBGL_Camera 0, 7, 16, 0, 2, 0
ro+1
TBGL_Rotate ro-90 , 0, 1, 0
model.render
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
Thank you Petr, yes it works now with v0.1.1 and also it works with
String memoryBuffer = FILE_Load(APP_SourcePath + "womanhead.m15")
model.FromMemory(memoryBuffer)
even with a slightly more time in the later
also the triceratops.M15 loaded okay
there is an error msg when we load some m15 files such as the Cubes.m15 and aliens(1 to 3).m15 inside the thinbasic folder
"fatal error has occurred program will be aborted
the content is not valid m15 v1.0.0.7"
Hi Primo,
thanks for testing. This message is correct at the time - I am currently supporting just 1.0.0.7, because it has normals present.
I will eventually add support for 1.0.0.6, once I invent some fast way to calculate normals from tB. Probably using Oxygen, will see :)
Petr
I am reaching the state when I can code again, so I optimized the m15Model geometry implementation.
v0.1.1 provided performance approximately 5.5x worse than native tbgl_m15DrawModel
v0.1.2 now provides performance which is on par with native m15 implementation, usually giving a few frames extra of performance
* measurements performed with WomanHead.m15
Previously, womanhead was done in 450+ draw calls, now it is done in single.
How this is achieved? By normalizing the mesh to triangles.
Grab the latest pre-release here:
https://github.com/petrSchreiber/m15Model/releases
Petr
Hi all
Is there a possibility that M15 format can manage animations like .x or .b3d ?
It would be great
Hi,
thank you for your interest! I don't see this happening in near time frame, but what do you think about MD2 format? (quake 2)
I did a module for thinBasic to load these and animate.
Petr