Collada geometry mode

From PyMOLWiki
Jump to navigation Jump to search

Collada geometry mode controls the types of geometry elements used in COLLADA output. Different modes can be useful depending on how the output file will be used, as different graphics viewing and editing applications have varying levels of support for the various features of the COLLADA specification.

Values

Currently there are 2 modes implemented for COLLADA geometry export.

  • 0: (default) Use any valid COLLADA 1.4.1 elements, including triangles, trifans, tristrips and polylist, etc. This is the recommended mode for most applications, including Apple's Preview and iBooks/iBooks Author.
  • 1: Blender-compatible mode. Use only polylist elements. This generally results in a larger file size, as polylist elements require explicit data for things like the number of vertices in each polygon (<vcount>), whereas the more specific elements like triangles do not (by definition, each triangle has 3 vertices).

Syntax

set collada_geometry_mode, 0    # Valid COLLADA 1.4.1 (default)
set collada_geometry_mode, 1    # Blender-compatible mode

Example

The following script creates two output files containing a single cylinder, one with the default collada_geometry_mode set to 0 (cgm0.dae) and the other set to 1 (cgm1.dae).

reinitialize
pseudoatom ps1, pos=[-0.5,0,0]
pseudoatom ps2, pos=[0.5,0,0]
hide nonbonded
distance d, ps1, ps2
set dash_round_ends, 0
set dash_gap, 0
hide labels, d
save cgm0.dae
set collada_geometry_mode, 1
save cgm1.dae

Running diff cgm0.dae cgm1.dae on the two output files results in the following output, indicating that for collada_geometry_mode=1, polylist elements were used to create the ends of the cylinder, rather than triangle elements.

70c70
<         <triangles count="8" material="geom0-material">
---
>         <polylist count="8" material="geom0-material">
73a74
>           <vcount>3 3 3 3 3 3 3 3 </vcount>
75,76c76,77
<         </triangles>
<         <triangles count="8" material="geom0-material">
---
>         </polylist>
>         <polylist count="8" material="geom0-material">
79a81
>           <vcount>3 3 3 3 3 3 3 3 </vcount>
81c83
<         </triangles>
---
>         </polylist>

See also