
#ifndef __FORMZ_SREP_API_H
#define __FORMZ_SREP_API_H

#ifdef __cplusplus
extern "C" {
#endif

#include "fzpl_plugin.h"

#include "fz_api.h"	
#include "fz_type_api.h"
#include "fz_iost_api.h"
#include "fz_fuim_api.h"
#include "fz_tmap_api.h"
#include "fz_rmtl_api.h"


/* @doc EXTERNAL MODEL */
/********************************************************************************************************

	@module 
	
	@desc 	formZ Surface Style Representation functions. This includes functions which need to be supplied
			by a plugin to create a Surface Style Representation.<nl>

	@toc	srep_cbak

*********************************************************************************************************/

/********************************************************************************************************

	@def
	
	@desc	The width and height (in pixels) of the preview rendering in the Surface Style Parameters dialog
			
	@avail	6.0.0.2

	@toc	srep_cbak

*********************************************************************************************************/
#define	FZ_SREP_PVIEW_SIZE	/* 96 */ 128

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation name function (Required). This function is called
				at system startup. It is expected to return a name string
				for the Surface Style Representation. The name cannot be longer than 
				max_name.

	@return		error

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_name_func) (
	char		*name,		/*	@parm	<out> |	The name of the Surface Style Representation. */
	fzrt_int		max_name	/*	@parm	<in>  |	The maximum numbers of characters for the name. */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation uuid function (Required). This function is called
				at system startup. It is expected to return a unique identifier
				for the Surface Style Representation.

	@return		error

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_uuid_func) (
	fzrt_UUID_td			uuid 		/*	@parm	<out> |	The uuid of the Surface Style Representation. */
	);


/********************************************************************************************************

	@enum	
	
	@desc	Bit encoded flags for a Surface Style Representation. Used by the flags argument of the
			fz_srep_cbak_info_func callback.
			
	@avail	7.0.0.0
	
	@see	<auto>

	@toc	srep_cbak

*********************************************************************************************************/
typedef enum	fz_srep_flags_enum
{
	FZ_SREP_FLAG_ALLOW_OPGL_PREVIEW		= 0,	/*  @emem	set to TRUE, to add this Surface Style Representation to
															the Shaded Full options. An entry with the Surface Style Representation's
															name will be added to the "Use Surface Style Of" menu, and Shaded Full
															will render this srep as faithful as it can. Note, that the srep
															needs to also implement at least the fz_srep_cbak_generic_parm callback
															function. The next three flags allow the srep plugin to further specify how
															Shaded Full renders the srep. */
	
	FZ_SREP_FLAG_SUPPORT_IMAGE_TEXTURES,		/*  @emem	set to TRUE, if the Surface Style Representation can support
															image based textures (color, transparency or bump). The images are
															derived form a file (i.e. stored in a fz_tmap_ptr). Shaded Full
															will render the textures, as returned by the fz_srep_cbak_generic_parm */
	FZ_SREP_FLAG_SUPPORT_PROCEDURAL_TEXTURES,	/*  @emem	set to TRUE, if the Surface Style Representation can support
															procedural textures (color, transparency or bump). Shaded Full will
															call the fz_srep_cbak_rndr_texture to create rendered textures for this
															srep. */
	FZ_SREP_FLAG_SUPPORT_BUMP_MAPPING,			/*  @emem	set to TRUE, if the Surface Style Representation can support
															bump mapping in general. Shaded Full will render bump mapping
															if set to TRUE */
	FZ_SREP_FLAG_SUPPORT_TRANSPARENCIES,		/*  @emem	set to TRUE, if the Surface Style Representation can support
															transparencies in general. Shaded Full will render transparencies
															if set to TRUE */
	FZ_SREP_FLAG_PREVIEW_NO_WINDEX,			/*  @emem		set to TRUE, if the Surface Style Representation does not need a separate
															windex (project) to render the preview in the Surface Style parameters dialog
															or the preview icon in the palette. This flag affects the callbacks
															fz_srep_cbak_data_iface_pview and fz_srep_cbak_data_icon_pview. if set
															to TRUE, the pview_windex and rmtl arguments to these functions represent
															a separate project and a separate copy of the surface style and srep to be rendered.
															If set to FALSE, these arguments represent the original project and original
															surface style/srep. In other words, if set to FALSE, the srep can rely on the fact
															that thew preview windex is set up with the proper objects, view ... to render
															the preview scene. All it has to do is render it. If set to TRUE, it is
															the srep's responsibily to create a meaningful preview. */
	FZ_SREP_FLAG_SUPPORT_SOLID_TEXTURES,		/*  @emem	set to TRUE, if the Surface Style Representation supports
															solid (3D) textures */
	FZ_SREP_FLAG_SUPPORT_IMAGE_TEXTURES_EMBD,	/*  @emem	set to TRUE, if the Surface Style Representation can support
															image based textures (color, transparency or bump). The images
															are stored as embedded pixels (i.e. stored in fz_tmap_embd_ptr). */
	FZ_SREP_FLAG_MAX

} fz_srep_flags_enum;

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation info function (Required). This function is called
				at system startup. It is expected to return basic information
				about the Surface Style Representation. The info to be returned is :<nl>
				<nl>
				size : the size of the Surface Style Representation data in # of bytes.<nl>
				<nl>
				flags : general information about the Surface Style Representation. The flags are bit encoded.
				The bits are defined in fz_srep_flags_enum.
				*flags = 0;<nl>
				FZ_SETBIT(*flags,XXX);<nl>
				FZ_SETBIT(*flags,XXX);<nl>
				
	@return		error

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_info_func) (
	fzrt_int		*size,			/*	@parm	<out>  |	The size of the Surface Style Representation data in # of bytes. */
	fzrt_int		*flags 			/*	@parm	<out>  |	Bit encoded flags, which tell formZ basic information about the Surface Style Representation. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation init function (Optional). This function is called once
				at system startup. It gives the plugin the opportunity to perform one time
				initialization tasks.
				
	@return		error

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_init_func) (
	void
	);
/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation finit function (Optional). This function is called once
				at system exit. It gives the plugin the opportunity to perform one time
				finalization tasks.
				
	@return		error

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_finit_func) (
	void
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation data io function (Required). This function is called
				whenever the data of a Surface Style Representation is written to or read from file.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_io_func) (
	fzrt_int 					windex, 	/* @parm <in> | project window index */
	fz_iost_ptr				iost, 		/*	@parm	<in> |	The io stream pointer. */
	fz_iost_dir_td_enum		dir,		/*	@parm	<in> |	Reading or writing indicator. */
	fzpl_vers_td * const version, 		/*	@parm	<in_out> |	When reading, this is the version with which the Surface Style Representation was written.
															When writing, the parameter needs to be set to the current version of the Surface Style Representation's
															It is up to the plugin to keep track of the version.   */
	fzrt_unsigned_int 			size,		/*	@parm	<in> |	When reading, this parameter is the size of the data when it was
															written. When writing, this parameter is unused. */
	void					*data		/*	@parm	<in> |	Pointer to the Surface Style Representation data from which to write or to which to read. */
	);
												
/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation data initiailization function (Required). This function is called
				whenever a new Surface Style is created by formZ. It is
				expected to fill in the default values for the content of the Surface Style Representation.
				Note, that formZ allocates the data block for the Surface Style Representation,
				based on the size parameter returned by the fz_srep_cbak_info function.
				In other words, the plugin does not need to allocate / deallocate the
				basic data storage. However, any dyamic memory needed within each instance
				of a Surface Style Representation needs to be allcoated here end deallocated
				in the fz_srep_cbak_finit function.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_data_init_func) (
	fzrt_int					windex,		/*	@parm	<in> |	project window index */
	void					*data		/*	@parm	<in_out> |	Surface Style Representation data. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation finit function (Optional). This function is called
				whenever a Surface Style is deleted. It allows the plugin to
				free any dynamic memory that may be present in a Surface Style Representation.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_data_finit_func) (
	fzrt_int 					windex, 	/*  @parm 	<in> | project window index */
	void					*data		/*	@parm	<in_out> | Surface Style Representation data. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation copy function (Optional). This function is called
				whenever a Surface Style is copied. It allows the plugin to
				copy any dynamic memory that may be present in a Surface Style Representation.
				When this function is called, the actual Surface Style Representation has already
				been copied into dst_data.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_copy_func) (
	fzrt_int					src_windex,		/*	@parm 	<in> | source project window index		*/
	void					*src_data, 		/*	@parm	<in> | The source Surface Style Representation data. 		*/
	fzrt_int					dst_windex,		/*	@parm 	<in> | destination project window index	*/
	void					*dst_data	  	/*	@parm	<in> | The destination Surface Style Representation data. 	*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation compare function (Optional). This function is called
				whenever two Surface Styles are compared to be equal.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_are_equal_func) (
	void					*data1,			/*	@parm	<in> |	The data of Surface Style Representation 1. */
	void					*data2,			/*	@parm	<in> |	The data of Surface Style Representation 2. */
	fzrt_boolean			*are_equal		/*	@parm	<out> |	TRUE, if they are equal, FALSE otherwise. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation dialog function (Required, if 
				fz_srep_cbak_data_iface_tmpl_func2 is not defined). 
				This function is called whenever a Surface Style is edited. It is expected to create the
				dialog template and the editing items to display the content of the Surface Style Representation.
				The  item id of the parent group is passed into this callabck function.
				All dialog items created by this callback function must be a child
				of this item id. Otherwise the items will show up in the wrong place.
				
				Note : use the new callback fz_srep_cbak_data_iface_tmpl_func2 to get
				better control over the layout. The Surface Style Parameters dialog
				(now called Material Parameters) no longer uses tabs for each 
				Surface Style Representation, but builds the dialog new each time the
				Surface Style Representation is switched by the user.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_iface_tmpl_func) (	
	fzrt_int				windex,					/* @parm	<in> | project window index 		*/
	fz_fuim_tmpl_ptr	fuim_tmpl, 				/*	@parm	<in> |	Pointer to the dialog template. 		*/
	fzrt_int				tab_id,					/*	@parm	<in> |	fuim item id of the parent tab. 		*/
	fzrt_ptr			fuim_data				/*	@parm	<in> |	Pointer to the Surface Style Representation data. 			*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation dialog function (Required, if 
				fz_srep_cbak_data_iface_tmpl_func is not defined).
				This callback is the same as fz_srep_cbak_data_iface_tmpl_func but gives
				mroe control over the layout of the dialog. In spcific, it is possible
				to place items on the left of the preview by using gleft as the parent item,
				below the preview by using grite and across the bottom by using gbottom.
				
				This function is called whenever a Material is edited. It is expected to create the
				dialog template and the editing items to display the content of the Surface Style Representation.
				The Material Parameters dialog is constructed new for each Surface Style Representation.
				The user may switch between different represnetations in the dailog by selecting
				is from the list in the dialog.
				
				By default, there is always "Simple", but more may be present (for 
				example RenderZone or other pluing renderers).

	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_iface_tmpl_func2) (	
	fzrt_int				windex,					/* @parm	<in> | project window index 		*/
	fz_fuim_tmpl_ptr	fuim_tmpl, 				/*	@parm	<in> |	Pointer to the dialog template. 		*/
	fzrt_int				gleft,					/*	@parm	<in> |	fuim item id of the group at the top left. 		*/
	fzrt_int				grite,					/*	@parm	<in> |	fuim item id of the group at the top right. 	*/
	fzrt_int				gbottom,				/*	@parm	<in> |	fuim item id of the group at the bottom. 		*/
	fzrt_ptr			fuim_data				/*	@parm	<in> |	Pointer to the Surface Style Representation data. 			*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation preview function (Optional). This function is called
				whenever a Surface Style is edited. It is expected to create the
				preview rendering that show the surface style rendered on a sample
				object. The preview scene is defined as a separate formZ project, whose
				index is passed in as the pview_windex parameter. All project settings
				are defined in such a way, that the plugin can render the scene
				using the view, surface styles, images size ... of that project. Note,
				that this is only the case, if the FZ_SREP_FLAG_PREVIEW_NO_WINDEX flag
				returned by the info callback is set to FALSE. Otherwise, the pview_windex
				and fuim_data argument are the original project and srep data and it is
				the srep's responsibilty to create a meaningful preview.
				
				The action argument tells the preview function, when it is called.
				A value of 0 indicates, that it is called when the dialog is first
				opened by the user. It gives the plugin the opportunity to
				initialize any data necessary for the preview. It is not expected to generate 
				a rendering at that time. A value of 1 indicates, that a new preview rendering
				is needed. It is called as often with that value as the user makes changes.
				A value of 2 indicates that the user closed the dialog. The plugin
				may now finalize any data. No rendering is expected at that time.
				
				The preview function should call the api fz_rmtl_iface_pview_update as
				frequently as possible to allow the user to see the progress of the
				preview rendering in the dialog. A good interval would be, for example,
				once every scanline. The fz_rmtl_iface_pview_update api expects the preview rendering
				to be defined as an rgb pixel buffer of FZ_SREP_PVIEW_SIZE * FZ_SREP_PVIEW_SIZE * 3 bytes.
				This buffer is allocated by formZ and passed to the preview function.
				
				The preview function should also call the api fz_rmtl_iface_pview_interrupt
				frequently. If this api returns TRUE, the preview rendering needs to be
				interrupted and the preview function must return FALSE for the complete
				argument. For example, the user may have selected an dialog item while
				the rendering is executing. In order to do this, the rendering needs to stop,
				controll needs to be returned to the dialog driver, which will handle the
				user's click. If the user changed a setting, the preview function will
				be called again with TRUE for the dirty argument, meaning ,that a new
				image needs to be started. If the user did not make any changes, the
				preview function will be called with FALSE for the dirty argument. The preview
				function may then continue the rendering, where it was previously interrupted.
				If a preview rendering is completed, the complete argument must be 
				returned as TRUE. Again, it is important, that interrupting is handled properly and in
				a responsive manner to allow the user to interact with the dialog while the
				rendering is proceeding.
				
				If this function is not implemented, formZ will display the default
				preview rendering, that is also shown in the Simple tab.

	@return		Error codes

	@avail		6.0.0.2

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_iface_pview_func) (	
	fzrt_int				windex,					/* @parm	<in> |  origin project window index 								*/
	fzrt_int				pview_windex,			/* @parm	<in> |  index of the project window containing the preview scene	*/
	fzrt_int				action,					/* @parm	<in> |  identifies, when the preview function is called.
																	0 : it is called at the beginning. when the dialog is first opened. It is called only once with this value.
																	1 : it is called to generate a new preview rendering. it is called as often as the user makes changes inthe dialog.
																	2 : it is called at the end, when the dialog is closed. It is called only once with this value. */
	fzrt_boolean		dirty,					/* @parm	<in> |  TRUE, if a brand new preview image is required, FALSE, if a previously cancelled rendering may be continued.	*/
	fz_fuim_tmpl_ptr	fuim_tmpl, 				/* @parm	<in> |	Pointer to the dialog template. 							*/
	fzrt_ptr			fuim_data,				/* @parm	<in> |	Pointer to the Surface Style Representation data. 			*/
	unsigned char		*image_buffer,			/* @parm	<in> |	The image buffer to be filled with the preview rendering. It is allocated by formZ and
																	has exactly FZ_SREP_PVIEW_SIZE * FZ_SREP_PVIEW_SIZE * 3 bytes. 													*/
	fzrt_boolean		*complete				/* @parm	<out> |	Return TRUE, if the preview image was completed sucessfully. Return FALSE
																	if the preview rendering was interrupted before completion. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation preview function for icon generation (Recommended). 
				This function is called whenever a Surface Style needs to gerneate the preview 
				icon for the palette. It is expected to create the
				preview rendering that shows the surface style rendered on a sample
				object. The preview scene is defined as a separate formZ project, whose
				index is passed in as the pview_windex parameter. All project settings
				are defined in such a way, that the plugin can render the scene
				using the view, surface styles, images size ... of that project.
				Note, that this is only the case, if the FZ_SREP_FLAG_PREVIEW_NO_WINDEX flag
				returned by the info callback is set to FALSE. Otherwise, the pview_windex,
				rmtl and srep_data arguments are the original project and surface style and it is
				the srep's responsibilty to create a meaningful preview.
				
				If this function is not implemented, formZ will display the default
				preview rendering, that is also shown in the Simple tab.

	@return		Error codes

	@avail		7.0.0.0

	@see		FZ_SREP_FLAG_PREVIEW_NO_WINDEX

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_data_icon_pview_func) (	
	fzrt_int				pview_windex,			/* @parm <in> | index of the project window containing the preview scene	*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | surface style to which the srep belongs 		*/
	void				*srep_data,				/* @parm <in> | The Surface Style Representation data. 			*/
	fzrt_int				res,					/* @parm <in> | The horizontal and vertical resolution at which to render the preview. 			*/
	unsigned char		*image_buffer,			/* @parm <in> |	The image buffer to be filled with the preview rendering. It is allocated by formZ and
																has exactly res * res * 3 bytes. 													*/
	fzrt_boolean		*complete				/* @parm <out> |	Return TRUE, if the preview image was completed sucessfully. Return FALSE
																	if the preview rendering was interrupted before completion. */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation generic get parameter function (Optional). This function is called
				to return the srep parameters in a generic format. This functionality is invoked, for example,
				when rendering the srep in Shaded Full preview, or when exporting.
				All output parameters are optional. It is mandatory, that an output parameter is checked for
				NULL, before it is assigned a value. This function is frequently called with only those
				output parameters requested, which are relevant in a specific calling context. For example,
				this function may be called to only inquire the diffuse reflection factor. In this case.
				the diffuse output parameter would be non NULL and all other parameters NULL.
				
				For color, transparency and bump patterns, this function returns either a solid value
				(a color rgb color for example), a texture map or indicates, that a procedural
				pattern is used. While the solid value and texture map are returned by this function,
				the procedural pattern is not returned. Three addition callback functions exist, that
				can be implemented to render procedural patterns into a texture map. See 
				fz_srep_cbak_rndr_texture_func.

	@return		Error codes

	@avail		7.0.0.0

	@see		fz_tmap_set_floc,fz_tmap_set_crop_rect,fz_srep_cbak_rndr_texture_func,fz_srep_cbak_set_generic_parm_func

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_get_generic_parm_func) (
	fzrt_int						windex,				/* @parm <in> | project window index 							*/
	fz_rmtl_ptr					rmtl,				/* @parm <in> | surface style to which the srep belongs 		*/
	void						*srep_data,			/* @parm <in> | The Surface Style Representation data. 			*/
	
	fz_srep_pattern_type_enum	*col_which,			/* @parm <out_opt> | the type of color pattern. */
	float						*col,				/* @parm <out_opt> | the rgb color. If the pattern type is not a plain color, it shoud be the average of the map or procedural pattern. */
	fz_tmap_embd_ptr			col_tmap,			/* @parm <out_opt> | the image map, if col_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should set the fields of the map with the
																  		 respective api functions, such as fz_tmap_set_floc and fz_tmap_set_crop_rect. */
	fzrt_int						*col_tmap_flags,	/* @parm <out_opt> | bit encoded color map option, if col_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*col_txr_scale,		/* @parm <out_opt> | The scale of the color pattern, if col_which == FZ_SREP_PATTERN_TYPE_MAP or 
																		 col_which == FZ_SREP_PATTERN_TYPE_PROCEDURAL */
	
	fz_srep_shading_type_enum	*refl_which,		/* @parm <out_opt> | The shading type. */
	float		 				*ambient,			/* @parm <out_opt> | The ambient reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float						*diffuse,			/* @parm <out_opt> | The diffuse reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*specular,			/* @parm <out_opt> | The specular reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*spec_expo,			/* @parm <out_opt> | The specular exponent, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*spec_col,			/* @parm <out_opt> | The specular color, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float						*mirr,				/* @parm <out_opt> | The mirror reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*trans_misson,		/* @parm <out_opt> | The glass like transmission factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*refr,				/* @parm <out_opt> | The index of refraction (for glass like transmission), if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*glow,				/* @parm <out_opt> | The glow factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	
	fz_srep_pattern_type_enum	*transp_which,		/* @parm <out_opt> | the type of transparency pattern. */
	float		 				*transp,			/* @parm <out_opt> | the transparency value. If the pattern type is not a simple transparency, it shoud be the average of the map or procedural pattern. */
	fz_tmap_embd_ptr			transp_tmap,		/* @parm <out_opt> | the image map, if transp_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should set the fields of the map with the
																  		 respective api functions, such as fz_tmap_set_floc and fz_tmap_set_crop_rect. */
	fzrt_int						*transp_tmap_flags,	/* @parm <out_opt> | bit encoded transparency map option, if transp_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*trn_txr_scale,		/* @parm <out_opt> | The scale of the transparency pattern, if transp_which == FZ_SREP_PATTERN_TYPE_MAP or 
																		 transp_which == FZ_SREP_PATTERN_TYPE_PROCEDURAL */
	
	fz_srep_pattern_type_enum	*bmp_which,			/* @parm <out_opt> | the type of bump pattern. */
	fz_tmap_embd_ptr			bmp_tmap,			/* @parm <out_opt> | the image map, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should set the fields of the map with the
																  		 respective api functions, such as fz_tmap_set_floc and fz_tmap_set_crop_rect. */
	float						*bmp_amp,			/* @parm <out_opt> | The amplitude of the bump pattern, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP or FZ_SREP_PATTERN_TYPE_PROCEDURAL */
	fzrt_int						*bmp_tmap_flags,	/* @parm <out_opt> | bit encoded bump map option, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*bmp_txr_scale,		/* @parm <out_opt> | The scale of the bump pattern, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP or 
																		 bmp_which == FZ_SREP_PATTERN_TYPE_PROCEDURAL */
	fzrt_int						*parm_mask			/* @parm <out> | Bit mask, that indicates which parameters were actually set.  THis is important, 
																	so that the calling code knows which parameters were actually filled in, and which simply don't apply for the srep. */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation generic set parameter function (Optional). This function is called
				to set the srep parameters in a generic format. This functionality is invoked, for example, when importing.
				All input parameters are optional. It is mandatory, that an input parameter is checked for
				NULL, before it is used. This function may be called with only a subset of the input parameters. For example,
				this function may be called to only set the diffuse reflection factor. In this case.
				the diffuse input parameter would be non NULL and all other parameters NULL. It is up
				to the plugin to use or not use a particular generic parameter.
				
				Unlike the fz_srep_cbak_get_generic_parm_func callback, patterns are only either
				solid values or texture map. Procedural patterns are not set through this function.

	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_get_generic_parm_func

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_set_generic_parm_func) (
	fzrt_int						windex,				/* @parm <in> | project window index 							*/
	fz_rmtl_ptr					rmtl,				/* @parm <in> | surface style to which the srep belongs 		*/
	void						*srep_data,			/* @parm <in> | The Surface Style Representation data. 			*/
	
	fz_srep_pattern_type_enum	*col_which,			/* @parm <in_opt> | the type of color pattern. */
	float						*col,				/* @parm <in_opt> | the rgb color. If col_which == FZ_SREP_PATTERN_TYPE_PLAIN. */
	fz_tmap_embd_ptr			col_tmap,			/* @parm <in_opt> | the image map, if col_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should get the fields of the map with the
																  		 respective api functions, such as fz_tmap_get_floc and fz_tmap_get_crop_rect. */
	fzrt_int						*col_tmap_flags,	/* @parm <in_opt> | bit encoded color map option, if col_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*col_txr_scale,		/* @parm <in_opt> | The scale of the color pattern, if col_which == FZ_SREP_PATTERN_TYPE_MAP */
	
	fz_srep_shading_type_enum	*refl_which,		/* @parm <in_opt> | The shading type. */
	float		 				*ambient,			/* @parm <in_opt> | The ambient reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float						*diffuse,			/* @parm <in_opt> | The diffuse reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*specular,			/* @parm <in_opt> | The specular reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*spec_expo,			/* @parm <in_opt> | The specular exponent, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*spec_col,			/* @parm <in_opt> | The specular color, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float						*mirr,				/* @parm <in_opt> | The mirror reflection factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*trans_misson,		/* @parm <in_opt> | The glass like transmission factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*refr,				/* @parm <in_opt> | The index of refraction (for glass like transmission), if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	float		 				*glow,				/* @parm <in_opt> | The glow factor, if refl_which == FZ_SREP_REFLECTION_TYPE_SHADED. */
	
	fz_srep_pattern_type_enum	*transp_which,		/* @parm <in_opt> | the type of transparency pattern. */
	float		 				*transp,			/* @parm <in_opt> | the transparency value if transp_which == FZ_SREP_PATTERN_TYPE_PLAIN */
	fz_tmap_embd_ptr			transp_tmap,		/* @parm <in_opt> | the image map, if transp_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should get the fields of the map with the
																  		 respective api functions, such as fz_tmap_get_floc and fz_tmap_get_crop_rect. */
	fzrt_int						*transp_tmap_flags,	/* @parm <in_opt> | bit encoded transparency map option, if transp_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*trn_txr_scale,		/* @parm <in_opt> | The scale of the transparency pattern, if transp_which == FZ_SREP_PATTERN_TYPE_MAP */
	
	fz_srep_pattern_type_enum	*bmp_which,			/* @parm <in_opt> | the type of bump pattern. */
	fz_tmap_embd_ptr			bmp_tmap,			/* @parm <in_opt> | the image map, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP. If passed as non NULL, the texture map has been
																  		 allocated by the calling code. The plugin should get the fields of the map with the
																  		 respective api functions, such as fz_tmap_get_floc and fz_tmap_get_crop_rect. */
	float						*bmp_amp,			/* @parm <in_opt> | The amplitude of the bump pattern, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP */
	fzrt_int						*bmp_tmap_flags,	/* @parm <in_opt> | bit encoded bump map option, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP. */
	float						*bmp_txr_scale		/* @parm <in_opt> | The scale of the bump pattern, if bmp_which == FZ_SREP_PATTERN_TYPE_MAP */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Renders a color,transparency or bump pattern into a texture map of a given size. The texture
				map can be returned in a memory buffer of bytes or can be written
				to an image file. To return the texture map in memory, the bytes parameter
				must be passed as non NULL. A bump map may be generated as a height map (single
				channel grayscale) or a normal map (rgb values representing the x, y and z component
				of the disturbed surface normal)
				
				For color and  bump (normal map) textures :
				
				The bytes storage must be allocated by calling code to res * res * 3 bytes.
				Pixel color is stored as unsigned char r g b components.  i.e. 255, 255, 255 is
				white, 0, 0, 0 is black. 
				
				For transparency textures :
				
				The bytes storage must be allocated by calling code to res * res bytes. 
				Pixel transparency is stored as unsigned char .  i.e. 255 is
				opaque (white), 0 is transparent (black). 
				
				For bump (height map) textures :
				
				The bytes storage must be allocated by calling code to res * res bytes. 
				Pixel displacement is stored as an unsigned char.  i.e. from 255 (white) to 0 (black).
				
				Pixels are stored in row major order with the top
				left pixel of the texture in the first three bytes.
				To write the texture map to file, the floc parameter must be passed
				as non NULL and must contain a valid file name and file directory.
				The format reference id parameter, ffmt_id, must identify a file
				format that is capable of writing a bitmap image.
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_rndr_texture_func) (
	fzrt_int				windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | the surface style to which the srep belongs		*/
	void				*srep_data, 			/* @parm <in> | The source Surface Style Representation data. 	*/
	fzrt_int				res,					/* @parm <in> | The desired resolution of the texture. 			*/			
	fzrt_int				num_tiles,				/* @parm <in> | The number of times the pattern is repeated horizontally
																and vertically. */
	unsigned char		*bytes,					/* @parm <in_opt> | If passed in as non NULL, the is the pre allocated byte
																	storage */
	fzrt_floc_ptr		floc,					/* @parm <in_opt> | If passed in as non NULL (and bytes is passed as NULL), the is 
																	file name and location for the saved texture */	
	fz_ffmt_ref_td		ffmt_id					/* @parm <in_opt> | If the texture is written to file, this is the id of the image format */
	);
	
	
/************************************************************************

	@fsfunc_t	

	@desc		Determines if the color, transparency or bump procedural shader of an srep
				are equal. This function should be implemented, if the srep may contain
				procedural shaders (i.e. don't have a solid plain color or use texture maps
				exclusively). This callback function definition is used as a color, transparency and
				bump shader callback. If the sreps passed in are not procedural, an error should 
				be returned.
				The compare should handle the case where the two sreps have different procedural
				shaders, as well as the same shader but with different parameter values.
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_shader_are_equal_func) (
	fzrt_int				windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl1,					/* @parm <in> | the surface style to which the first srep belongs		*/
	void				*srep_data1, 			/* @parm <in> | The first Surface Style Representation data. 	*/
	fz_rmtl_ptr			rmtl2,					/* @parm <in> | the surface style to which the second srep belongs		*/
	void				*srep_data2, 			/* @parm <in> | The second Surface Style Representation data. 	*/
	fzrt_boolean		*are_equal				/* @parm <out> | TRUE, if they are equal, FALSE otherwise. */
	);


/********************************************************************************************************

	@enum	
	
	@desc	Texture map type. used by the fz_srep_cbak_list_tmaps api to return which type of texture
			map is used by a given srep.
			
	@avail	7.0.0.0
	
	@see	<auto>

	@toc	srep_cbak

*********************************************************************************************************/
typedef enum fz_srep_tmap_type_enum
{
	FZ_SREP_TMAP_TYPE_COLOR = 0,
	FZ_SREP_TMAP_TYPE_TRANSP,
	FZ_SREP_TMAP_TYPE_BUMP,
	FZ_SREP_TMAP_TYPE_REFL,
	FZ_SREP_TMAP_TYPE_ENV,
	FZ_SREP_TMAP_TYPE_OTHER,
	
	FZ_SREP_TMAP_TYPE_MAX
	
} fz_srep_tmap_type_enum;

/************************************************************************

	@fsfunc_t	

	@desc		Fils in a list of tmaps (tmap_ptr). This function is called to report to
				formz, how many texture maps (tmaps) are used by a Surface Style Representation,
				and which texture maps they are. The number of texture maps is returned in the
				parameter ntmaps. The tmap_list array is a pre allocated array of texture maps pointers. 
				Note, that either parameter may be passed as NULL, and, if so, must be ignored.
				If the tmap_list parameter is passed in, the callback fucntion should assign the 
				the tmap pointers to their local copies of the tmaps. For example :
				
	@expl			
					fz_tmap_ptr	my_tmap;
					
					fz_tmap_allocate(zone_ptr,&my_tmap);
			
					for(i = 0; i < ntmaps; i++)
					{
						...
						tmap_list[i] = my_tmap;
						...
					
					}
					
					fz_tmap_free(zone_ptr,&my_tmap);
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_list_tmaps_func) (
	fzrt_int				windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | the surface style to which the srep belongs		*/
	void				*srep_data, 			/* @parm <in> | The source Surface Style Representation data. 	*/
	fzrt_int				*ntmaps,				/* @parm <out_opt> | The number of texture maps used by this Surface Style Representation */			
	fz_tmap_ptr			*tmap_list,				/* @parm <out_opt> | If passed in as non NULL this is an array of texture maps. For
																	each texture map, the file location and name must be set via the
																	api call fz_tmap_set_floc. */	
	fz_string_td		*tmap_type_name,		/* @parm <out_opt> | If passed in as non NULL this is an array of names. For
																	each texture map, the name of the type of texture should be set.
																	For example "Color Map" or "Bump Map". It is ok (although not encouraged)
																	to not set the name, in which case formZ assumes a generic 
																	type (i.e. "Texture Map") */		
	fz_srep_tmap_type_enum	*tmap_type			/* @parm <out_opt> | If passed in as non NULL this is an array of texture map types.
																	 This information is used, for example, to substitude an new
																	 texture map from the embedded tmap of the simple srep, if the
																	 linked texture map of this srep is not found */		
	
	
	);


/************************************************************************

	@fsfunc_t	

	@desc		Fils in a list of embedded tmaps (tmap_embd_ptr). This function is called to report to
				formz, how many embedded texture maps (tmaps) are used by a Surface Style Representation,
				and which texture maps they are. The number of texture maps is returned in the
				parameter ntmaps. The tmap_list array is a pre allocated array of texture maps pointers. 
				Note, that either parameter may be passed as NULL, and, if so, must be ignored.
				If the tmap_list parameter is passed in, the callback fucntion should assign the 
				the tmap pointers to their local copies of the tmaps. For example :
				
	@expl			
					fz_tmap_embd_ptr	my_tmap;
					
					fz_tmap_embd_allocate(zone_ptr,&my_tmap);
			
					for(i = 0; i < ntmaps; i++)
					{
						...
						tmap_list[i] = my_tmap;
						...
					
					}
					
					fz_tmap_embd_free(zone_ptr,&my_tmap);
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_list_tmaps_embd_func) (
	fzrt_int				windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | the surface style to which the srep belongs		*/
	void				*srep_data, 			/* @parm <in> | The source Surface Style Representation data. 	*/
	fzrt_int				*ntmaps,				/* @parm <in_opt> | The number of texture maps used by this Surface Style Representation */			
	fz_tmap_embd_ptr	*tmap_list,				/* @parm <in_opt> | If passed in as non NULL this is an array of embedded texture maps pointers */
	fz_string_td		*tmap_type_name			/* @parm <in_opt> | If passed in as non NULL this is an array of names. For
																	each texture map, the name of the type of texture should be set.
																	For example "Color Map" or "Bump Map". It is ok (although not encouraged)
																	to not set the name, in which case formZ assumes a generic 
																	type (i.e. "Texture Map") */		
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		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.
				
					
				
	@expl			
					
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_bake_separate_textures_func) (
	fzrt_int			windex,				/* @parm <in> | project window index 		*/
	fz_objt_ptr		objt,				/* @parm <in> | The object onto which to bake the textures */
	fzrt_int			res,				/* @parm <in> | The horizontal and vertical resolution in pixel at which to render the textures. 	*/
	fzrt_int			mask,				/* @parm <in> | 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	*/
	fzrt_floc_ptr	floc,				/* @parm <in> | The location for the saved textures */	
	fz_ffmt_ref_td	ffmt_id,			/* @parm <in> | The id of the image format */
	fzrt_boolean	*cancelled,			/* @parm <out> | Return TRUE, if the texture baking process was cancelled */
	fzrt_int			*prog_count			/* @parm <out> | 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. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		This callback function allows a plugin to take procedural textures and bake them on the object as
				a single image map. It allows the plugin to place all effects, such as shading, decals, maps
				unique to a renderer into a single image. This method is frequently used by game developers.
				
				
				The callback is responsible for the whole baking process. This usually
				involves the following steps (this is how renderZone does it) :
					
					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 texture.
					
					The necessary effects are rendered into a single image map. 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.
				
					
				
	@expl			
					
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_bake_combined_textures_func) (
	fzrt_int			windex,				/* @parm <in> | project window index 		*/
	fz_objt_ptr		objt,				/* @parm <in> | The object onto which to bake the textures */
	fzrt_int			res,				/* @parm <in> | The horizontal and vertical resolution in pixel at which to render the textures. 	*/
	fzrt_floc_ptr	floc,				/* @parm <in> | The location for the saved textures */	
	fz_ffmt_ref_td	ffmt_id,			/* @parm <in> | The id of the image format */
	fzrt_boolean	*cancelled,			/* @parm <out> | Return TRUE, if the texture baking process was cancelled */
	fzrt_int			*prog_count			/* @parm <out> | 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. */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation parameter count function.
				Returns the number of parameters of the surface style representation.
				
	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_parm_count, fz_srep_cbak_parm_info,
				fz_srep_cbak_parm_state_str, fz_srep_cbak_parm_set, fz_srep_cbak_parm_get

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_parm_count_func) (
	fzrt_int					windex,			/* @parm <in> | project window index */
	void					*srep_data,		/* @parm <in_opt> |	The data of Surface Style Representation. If passed as NULL, the count returned should be all possible parameters. */
	fzrt_int					*count			/* @parm <out> | The number of parameters in the Surface Style Representation data. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation parameter get info function. (Optional).
				Returns information about the nth paramater of the
				surface style representation, identified by "parm_indx".  Pass in NULL for
				information not desired. <nl>
				
				To get information about all parameters, iterate through
				the parameters up until the number of parameters returned
				by the fz_srep_cbak_parm_count function.  <nl>
				
				The uuid in parm_uuid uniquely identifies the parameter, and is
				used in fz_srep_cbak_parm_get and fz_srep_cbak_parm_set to
				identify which parameter is being retrieved or set.
				
				The parm_fuim_item argument defines how to display a parameter
				in a dialog, such as the animation tack edit of the edit dialog
				if it is automatically created by formZ. Note that only certain dialog 
				items can be used for a given data type. (see fz_otyp_cbak_parm_info2 for a list).
				For those dialog items that require additional strings, such as menus
				and sets of radio buttons, the fz_srep_cbak_parm_state_str must
				be implemented to define those strings.<nl><nl>
				
			
	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_parm_count, fz_srep_cbak_parm_info,
				fz_srep_cbak_parm_state_str, fz_srep_cbak_parm_set, fz_srep_cbak_parm_get

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td 	 (FZRT_SPEC *fz_srep_cbak_parm_info_func) (
	fzrt_int						windex,				/* @parm <in> | project window index */
	void						*srep_data,			/* @parm <in> |	The data of Surface Style Representation. If passed as NULL, the index refers to the list of all possible parameters. */
	fzrt_int						parm_indx,			/* @parm <in> | parameter index to retrieve */
	fzrt_UUID_td				parm_uuid,			/* @parm <out_opt> | uuid of parameter */
	fz_string_td				parm_name,			/* @parm <out_opt> | name of parameter */
	fz_type_enum				*parm_type,			/* @parm <out_opt> | data type of parameter */
	fz_fuim_format_int_enum		*parm_format_int,	/* @parm <out_opt> | integer format id of data */
	fz_fuim_format_float_enum	*parm_format_float,	/* @parm <out_opt> | float format id of data */
	fz_fuim_item_type_enum		*parm_item_type,	/* @parm <out_opt> | The type of dialog item with which to display the parameter. Note,
																		 that only certain dialg items can be used for a given data type.  */
	fzrt_int						*parm_range,		/* @parm <out_opt> | bit encoded range flags of data.  (see fz_fuim_range_enum). */
	fz_type_td					*parm_range_min,	/* @parm <out_opt> | minimum range value of data */
	fz_type_td					*parm_range_max,	/* @parm <out_opt> | maximum range value of data */
	fzrt_int						*flags				/* @parm <out_opt> | bit encoded flags.  (see fz_srep_parm_flags_enum). */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation parameter set function (Optional).
				Given a surface style representation, and a parameter identified by its uuid, this
				function sets the data into the surface style representation 
				for the given parameter.
				
	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_parm_count, fz_srep_cbak_parm_info,
				fz_srep_cbak_parm_state_str, fz_srep_cbak_parm_set, fz_srep_cbak_parm_get

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_parm_set_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	void				*srep_data,		/* @parm <in> |	The data of Surface Style Representation. */
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fz_type_td			*data,			/* @parm <in> | data to be stored into the Surface Style Representation for the given parameter */
	fzrt_boolean		*found			/* @parm <out> | TRUE, if the given uuid identified a parameter in this Surface Style Representation. FALSE otherwise. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation parameter get function (Optional).
				Given a surface style representation, and a parameter identified by its uuid, this
				function retrieves the data currently stored
				for the given parameter.
				
	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_parm_count, fz_srep_cbak_parm_info,
				fz_srep_cbak_parm_state_str, fz_srep_cbak_parm_set, fz_srep_cbak_parm_get

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_parm_get_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	void				*srep_data,		/* @parm <in> |	The data of Surface Style Representation. */
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fz_type_td			*data,			/* @parm <out> | data retrieved from the Surface Style Representation for the given parameter */
	fzrt_boolean		*found			/* @parm <out> | TRUE, if the given uuid identified a parameter in this Surface Style Representation. FALSE otherwise. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Surface Style Representation state parameter get string function (Optional).
				Given a parameter identified by its uuid, this
				function returns the nth string associated with the nth state
				of that variable.  This is useful for integer or boolean
				parameters that have various strings associated with their
				values, as opposed to just the raw values.  For example, a
				menu parameter may have strings for each menu item, and these
				would be useful when displaying this parameter data in other
				dialog interface contexts.
				
	@return		Error codes

	@avail		7.0.0.0

	@see		fz_srep_cbak_parm_count, fz_srep_cbak_parm_info,
				fz_srep_cbak_parm_state_str, fz_srep_cbak_parm_set, fz_srep_cbak_parm_get

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_parm_state_str_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	void				*srep_data,		/* @parm <in> |	The data of Surface Style Representation. */
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fzrt_int				which_state,	/* @parm <in> | index of which state string of parameter to retrieve */
	fz_string_td		str,			/* @parm <out> | string of the nth state (i.e. which_state) of the given parameter */
	fzrt_boolean		*found			/* @parm <out> | TRUE, if the given uuid identified a parameter in this Surface Style Representation. FALSE otherwise. */
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Returns the name of the folder in which the default predefined material folders are located. This folder
				is usually installed at the application directory level. For example :
					bonzai3d Folder
						bonzai3d Application 1.0
						bonzai3d Materials				<-- The folder name for the default basic material libraries
							Brick
							Stone
							Metals
							...
						RenderZone Materials			<-- The folder name for the RenderZone material libraries
							Brick
							Plastics
							Glass
							...
				In this case, the RenderZone srep would return the name "RenderZone Materials".
				
	@return		error

	@avail		7.0.0.0

	@see		fz_srep_cbak_pdef_matl_path

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_pdef_matl_folder_name_func) (
	fz_string_td		folder_name		/* @parm <out> | Name of the folder in which the default predefined materials are. */
	);

	
	
/************************************************************************

	@fsfunc_t	

	@desc		flexible version of fz_srep_cbak_list_tmaps that uses flocs for file referneces instead of tmap_ptr
				
	@expl
	
	@return		Error codes

	@avail		8.5.3.0

	@see		fz_srep_cbak_list_tmaps_embd,fz_srep_cbak_list_tmaps


	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_file_list_func) (
	fzrt_int			windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | the surface style to which the srep belongs		*/
	void				*srep_data, 			/* @parm <in> | The source Surface Style Representation data. 	*/
	fzrt_int			*nfiles,				/* @parm <out_opt> | The number of texture maps used by this Surface Style Representation */
	fzrt_floc_ptr		*file_list,				/* @parm <out_opt> | If passed in as non NULL this is an array of texture maps. For
																	each texture map, the file location and name must be set via the
																	api call fz_tmap_set_floc. */	
	fz_string_td		*file_type_name,		/* @parm <out_opt> | If passed in as non NULL this is an array of names. For
																	each texture map, the name of the type of texture should be set.
																	For example "Color Map" or "Bump Map". It is ok (although not encouraged)
																	to not set the name, in which case formZ assumes a generic 
																	type (i.e. "Texture Map") */		
	fz_srep_tmap_type_enum	*tmap_type			/* @parm <out_opt> | If passed in as non NULL this is an array of texture map types.
																	 This information is used, for example, to substitude an new
																	 texture map from the embedded tmap of the simple srep, if the
																	 linked texture map of this srep is not found */		
	
	
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Informs the srep that a refernced file has been updated to new location.
				
	@expl
	
	@return		Error codes

	@avail		8.5.3.0

	@see		fz_srep_cbak_file_list


	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_srep_cbak_file_update_func) (
	fzrt_int			windex,					/* @parm <in> | project window index 		*/
	fz_rmtl_ptr			rmtl,					/* @parm <in> | the surface style to which the srep belongs		*/
	void				*srep_data, 			/* @parm <in> | The source Surface Style Representation data. 	*/
	fzrt_floc_ptr		orig_file,				/* @parm <in> | original file. */
	fzrt_floc_ptr		new_file				/* @parm <in> | new file. */
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Returns floc of the folder in which the default predefined material folders are located.
				This is more general than fz_srep_cbak_pdef_matl_folder_name as it can be any location on the disk
 
	@return		error

	@avail		8.5.8.0

	@see		fz_srep_cbak_pdef_matl_folder_name

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_pdef_matl_path_func) (
	fzrt_floc_ptr		pdef_matl_floc		/* @parm <out> | floc of the folder in which the default predefined materials ar in. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Returns extension of the format for private predefine definitions.
 
	@return		error

	@avail		8.5.8.0

	@see		fz_srep_cbak_pdef_matl_path

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_pdef_matl_extension_func) (
	char		*extension		/* @parm <out> | floc of the folder in which the default predefined materials ar in. */
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Indicates the privte data should be loaded into srep data .
 
	@return		error

	@avail		8.5.8.0

	@see		fz_srep_cbak_pdef_matl_path, fz_srep_cbak_pdef_matl_extension

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_pdef_matl_load_func) (
	fzrt_int 					windex,			/* @parm <in> | project window index */
	fzrt_floc_ptr				pdef_matl_floc,	/* @parm <in> | floc of the prefefined file. */
	void						*data			/* @parm <in> |	Surface Style Representation data. */
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Fills the preview buffer with the image ofr the materil file..
 
	@return		error

	@avail		8.5.8.0

	@see		fz_srep_cbak_pdef_matl_path, fz_srep_cbak_pdef_matl_extension

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_pdef_matl_preview_func) (
	fzrt_floc_ptr				pdef_matl_floc,		/* @parm <in> | floc of the prefefined file. */
	fzrt_int					size,				/* @parm <in_out> |	image size (square). */
	fzrt_ptr					pixels				/* @parm <in_out> |	buffer to fill with image data (RGB). buffer is size*size*3 */
	);
	
/************************************************************************

	@fsfunc_t

	@desc		Retuns a list of dependent  meterials
 
	@return		error

	@avail		9.2.0.0

	@see

	@exfile

	@toc		srep_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_srep_cbak_depends_rmtls_func) (
	fzrt_int					windex,				/* @parm <in> | project window index */
	fz_rmtl_ptr					base_rmtl,			/* @parm <in> |	base rmtl */
	fzrt_int					*nrmtl,				/* @parm <out> |	number of dependedt materais */
	fz_tag_td					*rmtl_tags			/* @parm <out> |	list of of dependedt materais */
	);

/************************************************************************

	@plfset	fz_srep_cbak_fset
	
	@desc	Function set for a Surface Style Representation. The functions in this set need to
			be supplied by the plugin to implement a Surface Style Representation.
			
	@avail	6.0.0.2

	@toc	srep_cbak

 
*************************************************************************/
/* UUID : {35b7ed90-2038-4168-8af0-d0e1542049b8} *//* Reference 145 */
/********************************************************************************************************

	@fsdef	formZ Surface Style Representation callbacks function set id.

*********************************************************************************************************/
#define FZ_SREP_CBAK_FSET_TYPE			"\x32\x30\xbf\xa4\xe7\x4f\x4a\x3e\x88\xa5\x2c\xdf\x3a\x7a\xc2\xa0"	
/********************************************************************************************************

	@fsdef	formZ color shader callbacks function set name.

*********************************************************************************************************/
#define FZ_SREP_CBAK_FSET_NAME			"formZ Surface Style Representation Callbacks"
/********************************************************************************************************

	@fsdef	Surface Style Representation callbacks function set version.

*********************************************************************************************************/
#define FZ_SREP_CBAK_FSET_VERSION		FZPL_VERS_MAKE(9,2,0,0)

typedef struct fz_srep_cbak_fset
{
	fzpl_fset_prvt_data_td						prvt_data;

	fz_srep_cbak_name_func						fz_srep_cbak_name;				/* @fsfunc */
	fz_srep_cbak_uuid_func						fz_srep_cbak_uuid;				/* @fsfunc */
	fz_srep_cbak_info_func						fz_srep_cbak_info;				/* @fsfunc */
	fz_srep_cbak_init_func						fz_srep_cbak_init;				/* @fsfunc */
	
	fz_srep_cbak_data_io_func					fz_srep_cbak_data_io;			/* @fsfunc */
	fz_srep_cbak_data_init_func					fz_srep_cbak_data_init;			/* @fsfunc */
	fz_srep_cbak_data_finit_func				fz_srep_cbak_data_finit;		/* @fsfunc */
	fz_srep_cbak_data_copy_func					fz_srep_cbak_data_copy;			/* @fsfunc */
	fz_srep_cbak_data_are_equal_func			fz_srep_cbak_data_are_equal;	/* @fsfunc */
	fz_srep_cbak_data_iface_tmpl_func			fz_srep_cbak_data_iface_tmpl;	/* @fsfunc */
	fz_srep_cbak_data_iface_pview_func			fz_srep_cbak_data_iface_pview;	/* @fsfunc */
	
	fz_srep_cbak_finit_func						fz_srep_cbak_finit;				/* @fsfunc */
	fz_srep_cbak_get_generic_parm_func			fz_srep_cbak_get_generic_parm;	/* @fsfunc */
	fz_srep_cbak_set_generic_parm_func			fz_srep_cbak_set_generic_parm;	/* @fsfunc */
	fz_srep_cbak_rndr_texture_func				fz_srep_cbak_col_rndr_texture;	/* @fsfunc */
	fz_srep_cbak_rndr_texture_func				fz_srep_cbak_trn_rndr_texture;	/* @fsfunc */
	fz_srep_cbak_rndr_texture_func				fz_srep_cbak_bmp_rndr_texture;	/* @fsfunc */
	fz_srep_cbak_rndr_texture_func				fz_srep_cbak_bmp_norm_rndr_texture;	/* @fsfunc */
	
	fz_srep_cbak_list_tmaps_func				fz_srep_cbak_list_tmaps;			/* @fsfunc */
	fz_srep_cbak_data_icon_pview_func			fz_srep_cbak_data_icon_pview;				/* @fsfunc */
	
	fz_srep_cbak_bake_separate_textures_func	fz_srep_cbak_bake_separate_textures;	/* @fsfunc */
	fz_srep_cbak_bake_combined_textures_func	fz_srep_cbak_bake_combined_textures;	/* @fsfunc */

	fz_srep_cbak_parm_count_func				fz_srep_cbak_parm_count;			/* @fsfunc */
	fz_srep_cbak_parm_info_func					fz_srep_cbak_parm_info;				/* @fsfunc */
	fz_srep_cbak_parm_set_func					fz_srep_cbak_parm_set;				/* @fsfunc */
	fz_srep_cbak_parm_get_func					fz_srep_cbak_parm_get;				/* @fsfunc */
	fz_srep_cbak_parm_state_str_func			fz_srep_cbak_parm_state_str;		/* @fsfunc */

	fz_srep_cbak_data_iface_tmpl_func2			fz_srep_cbak_data_iface_tmpl2;		/* @fsfunc */
	
	fz_srep_cbak_list_tmaps_embd_func			fz_srep_cbak_list_tmas_embd;			/* @fsfunc */
	fz_srep_cbak_shader_are_equal_func			fz_srep_cbak_col_shader_are_equal;		/* @fsfunc */
	fz_srep_cbak_shader_are_equal_func			fz_srep_cbak_trn_shader_are_equal;		/* @fsfunc */
	fz_srep_cbak_shader_are_equal_func			fz_srep_cbak_bmp_shader_are_equal;		/* @fsfunc */
	
	fz_srep_cbak_pdef_matl_folder_name_func		fz_srep_cbak_pdef_matl_folder_name;		/* @fsfunc */
	
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 7.0.0.0 functions.									*
	 *																					*
	 ************************************************************************************/
	
	fz_srep_cbak_file_list_func					fz_srep_cbak_file_list;
	fz_srep_cbak_file_update_func				fz_srep_cbak_file_update;
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 8.5.3.0 functions.									*
	 *																					*
	 ************************************************************************************/
	fz_srep_cbak_pdef_matl_path_func			fz_srep_cbak_pdef_matl_path;
	fz_srep_cbak_pdef_matl_extension_func		fz_srep_cbak_pdef_matl_extension;
	fz_srep_cbak_pdef_matl_load_func			fz_srep_cbak_pdef_matl_load;
	fz_srep_cbak_pdef_matl_preview_func			fz_srep_cbak_pdef_matl_preview;
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 8.5.8.0 functions.									*
	 *																					*
	 ************************************************************************************/

	fz_srep_cbak_depends_rmtls_func				fz_srep_cbak_depends_rmtls;
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 9.2.0.0 functions.									*
	 *																					*
	 ************************************************************************************/

}  fz_srep_cbak_fset;

#ifdef __cplusplus
}
#endif
		
#endif /*__FORMZ_SREP_API_H */

