formZ SDK | 4.0 Call Back Reference | Surface Style Representation

fz_srep_cbak_bake_separate_textures

Description

This callback function allows a plugin to take procedural textures and bake them on the object as image maps. The procedural textures are handled separately. That is, a procedural color pattern is rendered as a color map. The callback is responsible for the whole baking process. This usually involves the following steps (this is how renderZone does it) : The object's surface styles (object and face level) are exampined whether they contain any procedural textures. If not, the callback does not need to do anything.
The object is converted to facetted, if it is a smooth object Any non planar faces are triangulated A new surface style is created, which will assigned to the object. This surface style will be set up by the plugin to contain the rendered textures.
The necessary textures (color, transparency, bump ...) are rendered. It is up to the plugin to decide how to do it. RenderZone places the rendered image of each face into a single map, arranging the face images in a fashion that minimizes waste.
The uv coordinates of the object are set to point into the rendered texture. The texture map control attribute of the object needs to be set to UV Coordinates, using the uv's.
The surface style is updated to use the rendered texture.
The object and its faces are set to use the new surface style.

Plugin Prototype

fzrt_error_td fz_srep_cbak_bake_separate_textures(

fzrt_int

windex,

fz_objt_ptr

objt,

fzrt_int

res,

fzrt_int

mask,

fzrt_floc_ptr

floc,

fz_ffmt_ref_td

ffmt_id,

fzrt_boolean *

cancelled,

fzrt_int *

prog_count )

Parameters

windex [Input]

project window index

objt [Input]

The object onto which to bake the textures

res [Input]

The horizontal and vertical resolution in pixel at which to render the textures.

mask [Input]

A bit encoded mask, which textures are preferred. Bit 0 = color map, if applicable Bit 1 = transparency map, if applicable Bit 2 = bump map, if applicable

floc [Input]

The location for the saved textures

ffmt_id [Input]

The id of the image format

cancelled [Result]

Return TRUE, if the texture baking process was cancelled

prog_count [Result]

The progress of the baking operation as a value from 0 to 100 (i.e. percent done). This output variable is used to drive a progress bar.

Returns

Error codes

Availability

7.0.0.0

Plugin Example

Function Set

fz_srep_cbak_fset


Defined in

fz_srep_api.h