GLTF Writer 类参考GLB Writer 类参考GLB/GLTF模型格式下载

详细说明

将场景导出为 GLTF 2.0 格式。 咱们可先去GLB官方下载glb模型 glbxz.com

vtkGLTFWriter 是 vtkWriter 的具体子类,用于写入 GLTF 2.0 文件。其输入是由 CityGML 读取器生成的多块数据集。数据集包含建筑物列表、网格或点云。 对于建筑物,每个建筑物都由多个部分(多边形数据)组成,每个部分可能具有多个纹理。网格输入与一栋建筑相同。点云输入与网格输入相同,但使用 Verts 单元而不是 Polys。 材质(包括纹理)在 polydata 中被描述为字段。如果 InlineData 为 false,则我们只引用数据中引用的纹理文件,否则我们读取纹理并将其编码保存在文件中。 另请参阅vtkCityGMLReader vtkPolyData测试:vtkGLTFWriter (测试)在文件 vtkGLTFWriter.h 的第 40 行定义。

成员 Typedef 文档

◆超类

typedef vtkWriter vtkGLTFWriter::Superclass

文件 vtkGLTFWriter.h 第 44 行的定义。

构造函数和析构函数文档

◆vtkGLTFWriter()

vtkGLTFWriter::vtkGLTFWriter

(

)

◆~vtkGLTFWriter()

vtkGLTFWriter::~vtkGLTFWriter

(

)

成员函数文档

◆新()

static vtkGLTFWriter * vtkGLTFWriter::新

(

)

◆IsTypeOf()

static vtkTypeBool vtkGLTFWriter::IsTypeOf

(

const 字符 *

类型

)

◆IsA()

虚拟 vtkTypeBool vtkGLTFWriter::IsA

(

const 字符 *

名字

)

如果此类是命名类的相同类型(或子类),则返回 1。 否则返回 0。此方法与 vtkSetGet.h 中的 vtkTypeMacro 结合使用。 从 vtkWriter 重新实现。

◆SafeDownCast()

static vtkGLTFWriter * vtkGLTFWriter::SafeDownCast

(

vtkObjectBase *

o

)

◆NewInstanceInternal()

虚拟 vtkObjectBase * vtkGLTFWriter::NewInstanceInternal

(

)

常量

从 vtkWriter 重新实现。

◆新实例()

vtkGLTFWriter​vtk.org/doc/nightly/html/classvtkGLTFWriter.html

◆ PrintSelf()

void vtkGLTFWriter::PrintSelf

(

ostream &

os,

vtkIndent

indent

)

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkAlgorithm.

◆ SetFileName()

虚拟无效 vtkGLTFWriter::SetFileName

(

const 字符 *

)

指定要写入的 GLTF 文件的名称。

◆GetFileName()

虚拟字符 * vtkGLTFWriter::GetFileName

(

)

指定要写入的 GLTF 文件的名称。

◆SetTextureBaseDirectory() (设置纹理基础目录)

虚拟无效 vtkGLTFWriter::SetTextureBaseDirectory

(

const 字符 *

)

指定纹理文件的基目录。

◆GetTextureBaseDirectory()

虚拟字符 * vtkGLTFWriter::GetTextureBaseDirectory

(

)

指定纹理文件的基目录。

◆SetPropertyTextureFile() (设置属性纹理文件)

虚拟 void vtkGLTFWriter::SetPropertyTextureFile

(

const 字符 *

)

指定属性 texture file。 这是 https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadatahttps://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata 描述的 json 文件

◆GetPropertyTextureFile()

虚拟字符 * vtkGLTFWriter::GetPropertyTextureFile

(

)

指定属性 texture file。 这是 https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadatahttps://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata 描述的 json 文件

◆GetInlineData()

virtual bool vtkGLTFWriter::GetInlineData

(

)

二进制数据是否应作为 base64 字符串包含在 json 文件中。

◆SetInlineData()

virtual void vtkGLTFWriter::SetInlineData

(

布尔

)

二进制数据是否应作为 base64 字符串包含在 json 文件中。

◆InlineDataOn()

虚拟 void vtkGLTFWriter::InlineDataOn

(

)

二进制数据是否应作为 base64 字符串包含在 json 文件中。

◆InlineDataOff()

virtual void vtkGLTFWriter::InlineDataOff

(

)

二进制数据是否应作为 base64 字符串包含在 json 文件中。

◆GetSaveNormal()

virtual bool vtkGLTFWriter::GetSaveNormal

(

)

它会查找法线点属性并将其保存在 GLTF 文件中(如果找到名称为 NORMAL),则 Cesium 需要此属性才能在没有纹理的情况下正确渲染建筑物。

◆SetSaveNormal()

虚拟 void vtkGLTFWriter::SetSaveNormal

(

布尔

)

它会查找法线点属性并将其保存在 GLTF 文件中(如果找到名称为 NORMAL),则 Cesium 需要此属性才能在没有纹理的情况下正确渲染建筑物。

◆SaveNormalOn() (保存法线)

虚拟无效 vtkGLTFWriter::SaveNormalOn

(

)

它会查找法线点属性并将其保存在 GLTF 文件中(如果找到名称为 NORMAL),则 Cesium 需要此属性才能在没有纹理的情况下正确渲染建筑物。

◆SaveNormalOff() (保存法线关闭)

虚拟 void vtkGLTFWriter::SaveNormalOff

(

)

它会查找法线点属性并将其保存在 GLTF 文件中(如果找到名称为 NORMAL),则 Cesium 需要此属性才能在没有纹理的情况下正确渲染建筑物。

◆获取 SaveBatchId()

virtual bool vtkGLTFWriter::GetSaveBatchId

(

)

它会在数据中查找名为 _BATCHID 的点数组,如果找到,则将其保存在 GLTF 文件中。 _BATCHID 是 3D Tiles b3dm 格式中使用的索引。此格式存储具有多个对象(建筑物)的网格的二进制 gltf。对象的索引范围从 0 到对象数 - 1,对象的所有点都具有相同的索引。这些索引值存储在 _BATCHID

◆SetSaveBatchId()

虚拟 void vtkGLTFWriter::SetSaveBatchId

(

布尔

)

它会在数据中查找名为 _BATCHID 的点数组,如果找到,则将其保存在 GLTF 文件中。 _BATCHID 是 3D Tiles b3dm 格式中使用的索引。此格式存储具有多个对象(建筑物)的网格的二进制 gltf。对象的索引范围从 0 到对象数 - 1,对象的所有点都具有相同的索引。这些索引值存储在 _BATCHID

◆SaveBatchIdOn()

virtual void vtkGLTFWriter::SaveBatchIdOn

(

)

它会在数据中查找名为 _BATCHID 的点数组,如果找到,则将其保存在 GLTF 文件中。 _BATCHID 是 3D Tiles b3dm 格式中使用的索引。此格式存储具有多个对象(建筑物)的网格的二进制 gltf。对象的索引范围从 0 到对象数 - 1,对象的所有点都具有相同的索引。这些索引值存储在 _BATCHID

◆SaveBatchIdOff()

虚拟 void vtkGLTFWriter::SaveBatchIdOff

(

)

它会在数据中查找名为 _BATCHID 的点数组,如果找到,则将其保存在 GLTF 文件中。 _BATCHID 是 3D Tiles b3dm 格式中使用的索引。此格式存储具有多个对象(建筑物)的网格的二进制 gltf。对象的索引范围从 0 到对象数 - 1,对象的所有点都具有相同的索引。这些索引值存储在 _BATCHID

◆GetSaveTextures()

虚拟 bool vtkGLTFWriter::GetSaveTextures

(

)

如果为 true (默认),我们将保存纹理。 除非 CopyTextures 为 true,或者您希望使用 InlineData 在 json 文件中包含二进制数据,否则我们只包含对纹理文件的引用,在这种情况下,我们必须将纹理加载到内存中,并将其编码保存在 json 文件中。 另请参阅TextureBaseDirectory (纹理基础目录)

◆SetSaveTextures() (设置保存纹理)

虚拟 void vtkGLTFWriter::SetSaveTextures

(

布尔

)

如果为 true (默认),我们将保存纹理。 除非 CopyTextures 为 true,或者您希望使用 InlineData 在 json 文件中包含二进制数据,否则我们只包含对纹理文件的引用,在这种情况下,我们必须将纹理加载到内存中,并将其编码保存在 json 文件中。 另请参阅TextureBaseDirectory (纹理基础目录)

◆SaveTexturesOn() (保存纹理)

虚拟 void vtkGLTFWriter::SaveTexturesOn

(

)

如果为 true (默认),我们将保存纹理。 除非 CopyTextures 为 true,或者您希望使用 InlineData 在 json 文件中包含二进制数据,否则我们只包含对纹理文件的引用,在这种情况下,我们必须将纹理加载到内存中,并将其编码保存在 json 文件中。 另请参阅TextureBaseDirectory (纹理基础目录)

◆SaveTexturesOff() (保存纹理关闭)

虚拟虚空 vtkGLTFWriter::SaveTexturesOff

(

)

如果为 true (默认),我们将保存纹理。 除非 CopyTextures 为 true,或者您希望使用 InlineData 在 json 文件中包含二进制数据,否则我们只包含对纹理文件的引用,在这种情况下,我们必须将纹理加载到内存中,并将其编码保存在 json 文件中。 另请参阅TextureBaseDirectory (纹理基础目录)

◆GetCopyTextures()

虚拟 bool vtkGLTFWriter::GetCopyTextures

(

)

如果为 true,我们将纹理复制到保存 FileName 的同一目录。 默认值为 false。 另请参阅TextureBaseDirectory

◆ SetCopyTextures()

virtual void vtkGLTFWriter::SetCopyTextures

(

bool

)

If true we copy the textures the the same directory where FileName is saved. Default is false. See alsoTextureBaseDirectory

◆ CopyTexturesOn()

virtual void vtkGLTFWriter::CopyTexturesOn

(

)

If true we copy the textures the the same directory where FileName is saved. Default is false. See alsoTextureBaseDirectory

◆ CopyTexturesOff()

virtual void vtkGLTFWriter::CopyTexturesOff

(

)

If true we copy the textures the the same directory where FileName is saved. Default is false. See alsoTextureBaseDirectory

◆ GetSaveActivePointColor()

virtual bool vtkGLTFWriter::GetSaveActivePointColor

(

)

If true, the writer looks at the active scalar and if it finds a 3 or 4 component, float, unsigned char or unsigned short it stores a RGB or RGBA attribute called COLOR_0 in the GLTF file. The default is false. Note a float component has to be bewtween [0, 1] while the unsigned chars and unsigned short are OpenGL normalized integers (are either between [0, 255] for unsigned char, they are between [0, 65536] for unsigned short - they are used to quantize a float between [0, 1]).

◆ SetSaveActivePointColor()

virtual void vtkGLTFWriter::SetSaveActivePointColor

(

bool

)

If true, the writer looks at the active scalar and if it finds a 3 or 4 component, float, unsigned char or unsigned short it stores a RGB or RGBA attribute called COLOR_0 in the GLTF file. The default is false. Note a float component has to be bewtween [0, 1] while the unsigned chars and unsigned short are OpenGL normalized integers (are either between [0, 255] for unsigned char, they are between [0, 65536] for unsigned short - they are used to quantize a float between [0, 1]).

◆ SaveActivePointColorOn()

virtual void vtkGLTFWriter::SaveActivePointColorOn

(

)

If true, the writer looks at the active scalar and if it finds a 3 or 4 component, float, unsigned char or unsigned short it stores a RGB or RGBA attribute called COLOR_0 in the GLTF file. The default is false. Note a float component has to be bewtween [0, 1] while the unsigned chars and unsigned short are OpenGL normalized integers (are either between [0, 255] for unsigned char, they are between [0, 65536] for unsigned short - they are used to quantize a float between [0, 1]).

◆ SaveActivePointColorOff()

virtual void vtkGLTFWriter::SaveActivePointColorOff

(

)

If true, the writer looks at the active scalar and if it finds a 3 or 4 component, float, unsigned char or unsigned short it stores a RGB or RGBA attribute called COLOR_0 in the GLTF file. The default is false. Note a float component has to be bewtween [0, 1] while the unsigned chars and unsigned short are OpenGL normalized integers (are either between [0, 255] for unsigned char, they are between [0, 65536] for unsigned short - they are used to quantize a float between [0, 1]).

◆ GetRelativeCoordinates()

virtual bool vtkGLTFWriter::GetRelativeCoordinates

(

)

Save mesh point coordinates relative to the bounding box origin and add the corresponding translation to the root node. This is especially important for 3D Tiles as points are stored as cartesian coordinates relative to the earth center so they are stored as doubles. As GLTF can only store floats not setting this variable on results in a loss of precision of about a meter. Note that the translation information is stored in json which can store doubles.

◆ SetRelativeCoordinates()

virtual void vtkGLTFWriter::SetRelativeCoordinates

(

bool

)

Save mesh point coordinates relative to the bounding box origin and add the corresponding translation to the root node. This is especially important for 3D Tiles as points are stored as cartesian coordinates relative to the earth center so they are stored as doubles. As GLTF can only store floats not setting this variable on results in a loss of precision of about a meter. Note that the translation information is stored in json which can store doubles.

◆ RelativeCoordinatesOn()

virtual void vtkGLTFWriter::RelativeCoordinatesOn

(

)

Save mesh point coordinates relative to the bounding box origin and add the corresponding translation to the root node. This is especially important for 3D Tiles as points are stored as cartesian coordinates relative to the earth center so they are stored as doubles. As GLTF can only store floats not setting this variable on results in a loss of precision of about a meter. Note that the translation information is stored in json which can store doubles.

◆ RelativeCoordinatesOff()

virtual void vtkGLTFWriter::RelativeCoordinatesOff

(

)

Save mesh point coordinates relative to the bounding box origin and add the corresponding translation to the root node. This is especially important for 3D Tiles as points are stored as cartesian coordinates relative to the earth center so they are stored as doubles. As GLTF can only store floats not setting this variable on results in a loss of precision of about a meter. Note that the translation information is stored in json which can store doubles.

◆ GetBinary()

virtual bool vtkGLTFWriter::GetBinary

(

)

如果为 true,则另存为 GLB (二进制 GLTF)。 这是通过对 FileName 使用 .glb 扩展名和对任何其他扩展名(通常为 .gltf)取消设置来设置的

◆WriteToString()

std::string vtkGLTFWriter::WriteToString

(

)

将结果写入字符串而不是文件。

◆写入流()

无效 vtkGLTFWriter::WriteToStream

(

ostream &

out、

vtkDataObject 对象 *

)

将结果写入提供的 ostream。

◆GetFieldAsStringVector()

static std::vector< std::string > vtkGLTFWriter::GetFieldAsStringVector

(

vtkDataObject 对象 *

对象 /

const 字符 *

名字

)

posted @ 2025-04-23 10:34  吃饭不忘  阅读(41)  评论(0)    收藏  举报