Results 1 to 5 of 5

Thread: TBGL-Ideas

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,533
    Rep Power
    171

    Lightbulb TBGL-Ideas

    I still have some wishes to improve TBGL-Entity-System - especially when it comes to fast-loading data directly to entity/display-list.

    A dream of sweet cream would be, if there were a native Entity-File-Format that supports both: vertex-colors and materials. So OBJ-format is out of question because does not support vertex-colors - perhaps M15 could be improved by adding some extra material-file - similar as OBJ has - wich holds Material-Data for the single layers - or even better would be some new, simple format that will be read in alike GBufferDefineFromArray from file to some Displaylist-Slot or Entity.

    However, the Entity-System of my dreams would do a couple of things:

    - manage a Textures-Pool ( maybe occupy slots 1 to 768 ) so every texture gets just loaded once,
    - Textures be part of Material (already possible) but mandatory for Entities loaded/saved the way below,
    - TBGL_EntityBindMaterial-functionality - or call it TBGL_EntitySetMaterial - whatever...
    - support PNG-Format also - to have one compressed that allows alpha
    ( I know that needs Windows somewhat above Win95 but I think a Win95-PC never would have the needed graphics hardware to run Entities anyway)



    this just how I imagine to write data:

    Header
    ' -----------
    numTextures
    Texture() ' means this is array of numTextures elements with following properties:
        Filename
        AnisoLevel
        Filtering
        TranspColor
        ' if numTextures > 1 then here would follow again Filename, AnisoLevel, Filtering, TranspColor
    ' -----------
    numMaterials
    Material()
        Ambient R, G, B, A
        Diffuse R, G, B, A
        Emissive R, G, B, A
        Specular R, G, B, A
        SpecExp E
        TextureIndex ' points to a Texture() above or 0 if none
        BlendFunc
        AlphaFunc
    ' -----------
    
    ParentEntity
        MaterialID  ' points to a Material() above 
        Rotate X, Y, Z
        Scale X, Y, Z
        Translate X, Y, Z
      
        PolyType '  TBGL_BeginPoly-Equates 
        VertexType ' see Vertex-Format-Equates below - somehow needs a way to specify this in advance
    
        numVertices
        Vertex()
            X, Y, Z [, nX, nY, nZ][,tU, tV][, R, G, B[, A]]
    
        numChildren
        ChildEntity()
            MaterialID
            Rotate X, Y, Z
            Scale X, Y, Z
            Translate X, Y, Z
      
            PolyType
            VertexType 
    
            numVertices
            Vertex()
                   X, Y, Z [, nX, nY, nZ][, tU, tV][, R, G, B[, A]]
            numChildren
            ChildEntity() '- here would follow a child of first child if one
        '...  
        ChildEntity() '- while this is second child of parent-entity
    
    '...EOF somewhere here
    ' ----------------------------------------
    
    
    ' Vertex-Format-Equates:
    
    %Vertex_hasPosition       =  0 ' X, Y, Z are always available
    %Vertex_hasNormals        =  1 ' X, Y, Z, nX, nY, nZ 
    %Vertex_hasTexcoords      =  2 ' X, Y, Z, tU, tV
    %Vertex_hasNormalTex      =  3 ' X, Y, Z, nX, nY, nZ, tU, tV   
    %Vertex_hasColor          =  4 ' X, Y, Z, R, G, B      
    %Vertex_hasNormalColor    =  5 ' X, Y, Z, nX, nY, nZ, R, G, B
    %Vertex_hasTexColor       =  6 ' X, Y, Z, tU, tV, R, G, B
    %Vertex_hasTexNormalColor =  7 ' X, Y, Z, nX, nY, nZ, tU, tV, R, G, B
    %Vertex_hasAlpha          =  8 ' X, Y, Z, R, G, B, A  
    %Vertex_hasNormalAlpha    =  9 ' X, Y, Z, nX, nY, nZ, R, G, B, A
    %Vertex_hasTexAlpha       = 10 ' X, Y, Z, tU, tV, R, G, B, A
    %Vertex_hasNormalTexAlpha = 11 ' X, Y, Z, nX, nY, nZ, tU, tV, R, G, B, A
    
    Edit: this way could just return top-level-parent-ID on load
    Helpful could be using Entity-Name-Property where names get composed on load like ParentName+ChildNames alike "RobotsGroin_Torso_LeftArm_Hand_Thumb" and some function that lists Children-IDs or vice versa: retrieve EntityID from Scene+Name-parameters
    Last edited by ReneMiner; 25-09-2013 at 11:30.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    Hi Rene,

    thanks for your deep thought suggestions.

    Regarding file formats - I think the M15 file format is slowly getting obsolete, I designed it at high school and it looks like that. What I like about specific format that we can create validated exporters, which work around issues of imported formats. Have a look at OBJ - simple ASCII format, yet the OBJ2M15 tool contains 5 checks to fix various errors produced by programs.

    Entity loading
    Having special fileformat for Entity loading sounds good to me. For better flexibility I am strongly considering XML, or better, binary XML. It allows easy "growth" of the format for future.

    Textures be part of Material (already possible) but mandatory for Entities loaded/saved the way below
    Is there some specific reason why do you like the textures to be mandatory?

    Texture formats
    PNG and JPG textures would be nice to have and both of these can be added by using GDIPlus Windows library. The only catch is that it is from Windows XP up. That is why I have this feature planned for ThinBASIC 2.x version.

    TBGL_EntitySetMaterial
    I like this.

    I am currently doing big plans on restructuralization of TBGL for ThinBASIC 2.x, that (and work load at ... work) is why my activity on current branch is not that great. Once I have it put together in structured form, I would like to consult it with most active TBGL users. I have planned to publish design document at Q1 2014.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,533
    Rep Power
    171
    OK, I re-thought a little.

    First your question: Mandatory supposed to mean just every Entity-File-Material has to have a Material- incl. Textures -Property. And if that texture-property within Material-property says 0, then it's just none. Only: It has to be specified - if used or not.

    But now back to the thought I just had: it could be probably better to enumerate/index just the raw "DisplayList-Blocks" as these
    PolyType
    VertexType
     
    numVertices
    Vertex()
       X, Y, Z [, nX, nY, nZ][, tU, tV][, R, G, B[, A]]
    
    and write the hierarchy thereafter and have just the DL-Block-Index between Translate and numChildren. So Mesh-files can be much smaller if they use the same shape more than once within the mesh - just translated, rotated or scaled, using different material etc. at another place just as their properties say.

    But leave you time to think about - I don't know exactly how xml works - I just know how to use it to change the Intellisense-Text of some Microsoft products as MS Small Basic etc. and when I check tB-help it leads me to some of my beloved MS-Sites where I can't not find nothing telling me anything...and I would not like it if I had to learn that stuff to load and save meshes.
    Last edited by ReneMiner; 25-09-2013 at 22:58.
    I think there are missing some Forum-sections as beta-testing and support

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    Hehe,

    yes, MS docs are legendary, they use their own dialect of english. The format will be very simple, not necessarily classic XML, but tag based most probably.
    It would be done in way easy for users, like EntitySave, so user does not have to learn the format at all in typical case.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    +1 to PNG textures. Definitely. And for an ASC file format instead a binary one.

Similar Threads

  1. OOP ideas
    By ErosOlmi in forum Suggestions/Ideas discussions
    Replies: 13
    Last Post: 26-08-2013, 20:26
  2. More Ideas
    By peter in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 3
    Last Post: 27-10-2012, 14:47
  3. Few ideas on the game
    By Petr Schreiber in forum CM contest 2009
    Replies: 21
    Last Post: 15-10-2008, 12:40

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •