Using Color2Texture

PDF3D SDK PRO contains PDF3DColor2Texture class which replaces colors by generated texture and texture coordinates.

PDF3DColor2Texture class converts the input PDF3DIntermediateScene scene to the corresponding output PDF3DIntermediateScene scene where all triangle mesh models which use color per vertex (old mode) are converted to triangle meshes which use texture per triangle vertex (new optimized mode).

This class modifies only triangle meshes and doesn’t touch any other type of models (line sets, point sets, grouping nodes, NURBS, etc.).

Sample code.

PDF3DIntermediateScene input_scene = PDF3DIntermediateScene::CreateNewScene();
PDF3DIntermediateScene result_scene = PDF3DIntermediateScene::CreateNewScene();
PDF3DColor2Texture::Converter converter(result_scene);
converter.SetColorTolerance(PDF3D_D4V(2.0));
converter.Apply(input_scene);
// Use result_scene object instance

XML:

<ColorToTexture alphaTolerance="0.5"
 fragmentMaxSize="16"
 fragmentMinSize="4"
 morphAxesMode="None"
 usePngCompression="true">

  <ColorTolerance x="0.5" y="0.5" z="0.5"/>

</ColorToTexture>