Menu

export GLScene to 3D-PDF (IDTF file format, TGLIDTFVectorFile)

Help
Dirk C
2017-05-12
2017-05-12
  • Dirk C

    Dirk C - 2017-05-12

    Hello,

    I'm looking forward to export a Scene to a 3D PDF. The valid formats are U3D and PRC, for U3D creation there is a converter available (Universal 3D Sample Software on SF). The input format is IDTF (intermediate text format). So basic workflow is

    glScene -> IDTF -> U3DConverter -> U3D data stream -> embedding in 3D PDF annotation.

    Meshlab can already save this format (nice for comparing) but i want to do it in Delphi.
    I made a custom filer derived from TGLVectorFile but i'm not so firm in converting the MeshObjects to IDTF.
    I can export the FACE/VERTICIES but e.g not the MODEL_NORMAL_LIST.
    I made a Delphi XE 10 sample and uploaded it here:

    https://drive.google.com/open?id=0Bx84-peUdIgZeUZWX0Z6YU0taUE

    Can anybody help me in saving the meshobjects to IDTF?
    Thanks & best regards
    Dirk

    Basic structure of IDTF: Simple ASCII format, for a pyramid it looks like this:

    FILE_FORMAT "IDTF"
    FORMAT_VERSION 100
    
    NODE "MODEL" {
        NODE_NAME "VcgMesh01"
        PARENT_LIST {
            PARENT_COUNT 1
            PARENT 0 {
                PARENT_NAME "<NULL>"
                PARENT_TM {
                    1.000000 0.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000 0.000000
                    0.000000 0.000000 1.000000 0.000000
                    0.000000 0.000000 0.000000 1.000000
                }
            }
        }
        RESOURCE_NAME "MyVcgMesh01"
    }
    
    RESOURCE_LIST "MODEL" {
        RESOURCE_COUNT 1
        RESOURCE 0 {
            RESOURCE_NAME "MyVcgMesh01"
            MODEL_TYPE "MESH"
            MESH {
                FACE_COUNT 8
                MODEL_POSITION_COUNT 4
                MODEL_NORMAL_COUNT 24
                MODEL_DIFFUSE_COLOR_COUNT 0
                MODEL_SPECULAR_COLOR_COUNT 0
                MODEL_TEXTURE_COORD_COUNT 0
                MODEL_BONE_COUNT 0
                MODEL_SHADING_COUNT 1
                MODEL_SHADING_DESCRIPTION_LIST {
                    SHADING_DESCRIPTION 0 {
                        TEXTURE_LAYER_COUNT 0
                        SHADER_ID 0
                    }
                }
                MESH_FACE_POSITION_LIST {
                    0 1 2
                    2 1 0
                    2 3 0
                    0 3 2
                    3 1 0
                    0 1 3
                    3 2 1
                    1 2 3
                }
                MESH_FACE_NORMAL_LIST {
                    0 1 2
                    3 4 5
                    6 7 8
                    9 10 11
                    12 13 14
                    15 16 17
                    18 19 20
                    21 22 23
                }
                MESH_FACE_SHADING_LIST {
                    0
                    0
                    0
                    0
                    0
                    0
                    0
                    0
                }
                MODEL_POSITION_LIST {
                    -39.999969 547.999878 0.000000
                    -39.999969 647.999878 0.000000
                    -39.999969 547.999878 100.000000
                    -140.000000 547.999878 0.000000
                }
                MODEL_NORMAL_LIST {
                    1.000000 0.000000 0.000000
                    1.000000 0.000000 0.000000
                    1.000000 0.000000 0.000000
                    -1.000000 0.000000 0.000000
                    -1.000000 0.000000 0.000000
                    -1.000000 0.000000 0.000000
                    -0.000000 -1.000000 0.000000
                    -0.000000 -1.000000 0.000000
                    -0.000000 -1.000000 0.000000
                    -0.000000 1.000000 0.000000
                    -0.000000 1.000000 0.000000
                    -0.000000 1.000000 0.000000
                    -0.000000 0.000000 -1.000000
                    -0.000000 0.000000 -1.000000
                    -0.000000 0.000000 -1.000000
                    -0.000000 0.000000 1.000000
                    -0.000000 0.000000 1.000000
                    -0.000000 0.000000 1.000000
                    -0.577350 0.577350 0.577350
                    -0.577350 0.577350 0.577350
                    -0.577350 0.577350 0.577350
                    0.577350 -0.577350 -0.577350
                    0.577350 -0.577350 -0.577350
                    0.577350 -0.577350 -0.577350
                }
            }
        }
    }
    
     

    Last edit: Dirk C 2017-05-12
  • Dirk C

    Dirk C - 2017-05-12

    Sorry, i posted the wrong link to sample project, corrected now:
    https://drive.google.com/open?id=0Bx84-peUdIgZeUZWX0Z6YU0taUE

     
  • Jerome.D (BeanzMaster)

    Hello Dirk, nice thanks will include to the SVN as soon as possible

    Cheers

     

    Last edit: Jerome.D (BeanzMaster) 2017-05-17
  • Dirk C

    Dirk C - 2017-05-18

    Hi Jerome,
    thank's! Feel free to integrate the IDTF/U3D vectorfile into GLScene!
    I made some progress and now i can create valid PDF 3D files. I want to refactor some methods and will setup a github account. Currently some parts missing like initial view (camera position), materials/shadings. What is the best way to sync development and allow others to contribute?

    Best regards
    Dirk

     
  • Jerome.D (BeanzMaster)

    Hi Dirk, yes with Pavel will can give an access to the SVN. I'll send you private mail this week end i'll have more time.

     
  • Dirk C

    Dirk C - 2017-05-18

    Hi Jerome, that sounds good! Looking forward,
    Dirk

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2017-05-18

    Dirk,
    I've included your GLFile3DPDF unit. Thanks. But what about IDTFConverter dlls. Do they necessary to export and need to be included in externals libs too? And may be you have also a code to import/export glTF for GLScene like a converter in https://github.com/KhronosGroup/glTF#converters or loader https://github.com/KhronosGroup/glTF-CSharp-Loader.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.