全部產品
Search
文件中心

PolarDB:SFMESH

更新時間:Jul 06, 2024

sfmesh使用JSON作為WKT的表示方法,包含一些節點資訊,本文介紹相關節點資訊。

  • version:sfmesh的版本,目前為1。
  • srid:空間參考ID。
  • lod:LOD的層級資訊。
  • root:Node的根目錄ID,預設為0。
  • meshgeoms:所有引用到的meshgeom對象的數組,可以為引用對象。
  • meshes:所有基於Node引用導的sfmesh的對象的數組,可以為引用對象。
  • textures:所用的texture的對象數組。
  • materials:所有材質的對象數組。
  • primitives:所有的元組資訊的數組,元組包含兩種:meshgeom和mesh,其中meshgeom可以帶材質資訊,通過material關鍵字進行綁定。
  • nodes:通過node可以定義樹狀結構,進行組織構建。可以包含幾種屬性:
    • primitive: 對應的primitive的資訊。
    • children: 子物件數組
    • matrix: 變換矩陣,採用以下方式進行描述。
      / a b c xoff \ 
      | d e f yoff | 
      | g h i zoff |
      \ 0 0 0   1 / 
    • id: 對象關聯的ID資訊。
{
    "version":1,
    "root":0,
    "meshgeoms":[
        "MESHGEOM(PATCH(TRIANGLESTRIP(0 0,0 10,10 10,10 0)))"
    ],
    "meshes":[
        "MESH(schema(@public@), table(@t_mesh@), column(@the_mesh@), key(@num=1@))"
    ],
    "primitives":[
        {
            "mesh":0
        },
        {
            "meshgeom":0
        }
    ],
    "nodes":[
        {
            "children":[
                1,
                2
            ],
            "id":100
        },
        {
            "primitive":0
        },
        {
            "primitive":1,
            "matrix":[
                2,
                0,
                0,
                1,
                0,
                2,
                0,
                3,
                0,
                0,
                2,
                4,
                0,
                0,
                0,
                1
            ],
            "id":10
        }
    ],
    "materials":[
        {
            "type":"db",
            "attributes":{
                "schema":"public",
                "table":"t_material",
                "column":"the_material",
                "key":"num=1"
            }
        }
    ],
    "textures":[
        {
            "compressionType":"None",
            "format":"JPEG",
            "wrap":"Wrap",
            "type":"Url",
            "depth":3,
            "width":256,
            "height":256,
            "size":15,
            "data":"http://aaa.png"
        }
    ]
}
sfmesh支援對其他sfmesh對象的引用,包含schema、table、column和key 四個關鍵字,其中後三個為必須的內容,字串使用@ 進行包裹。
/*
具體格式如下
MESH(
   schema(@schema_name@),
    table(@table_name@),
    column(@column_name@),
    key(@where_clause@)
   )
*/

  MESH(
   schema(@public@),
    table(@mytable@),
    column(@mycolumn@),
    key(@id=1@)
   )