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

  PROJECT:
  dPL

  FILE:
  dpl.h

  CONTENTS:
  Public include with function prototypes.

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

#ifndef _DPL_H
#define _DPL_H

/* include type definitions */
#include <dpl/dpltypes.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Create Elements */

extern dpl_ZONE *dpl_NewZone(void);
extern dpl_VIEW *dpl_NewView(void);
extern dpl_DCS *dpl_NewDCS(void);
extern dpl_INSTANCE *dpl_NewInstance(void);
extern dpl_LIGHT *dpl_NewLight(void);
extern dpl_TEXTURE *dpl_NewTexture(void);
extern dpl_TEXMAP *dpl_NewTexmap(void);
extern dpl_MATERIAL *dpl_NewMaterial(void);
extern dpl_OBJECT *dpl_NewObject(void);
extern dpl_LOD *dpl_NewLod(void);
extern dpl_GEOGROUP *dpl_NewGeogroup(void);
extern dpl_GEOMETRY *dpl_NewGeometry(void);
extern dpl_RAMP *dpl_NewRamp(void);

/* Connect Structure */

extern void dpl_AddViewToScene(dpl_VIEW *v);
extern void dpl_AddDCSToScene(dpl_DCS *d);
extern void dpl_AddDCSToDCS(dpl_DCS *parent, dpl_DCS *child);
extern void dpl_AddInstanceToDCS(dpl_DCS *d, dpl_INSTANCE *i);
extern void dpl_AddLodToObject(dpl_OBJECT *o, dpl_LOD *l);
extern void dpl_AddGeogroupToLod(dpl_LOD *l, dpl_GEOGROUP *gg);
extern void dpl_AddGeometryToGeogroup(dpl_GEOGROUP *gg, dpl_GEOMETRY *g);

/* Querry Structure */

extern dpl_VIEW *dpl_GetSceneView(int32 n);
extern dpl_DCS *dpl_GetSceneDCS(int32 n);
extern dpl_DCS *dpl_GetDCSChildDCS(dpl_DCS *parent, int32 n);
extern dpl_DCS *dpl_GetDCSParentDCS(dpl_DCS *child);
extern dpl_INSTANCE *dpl_GetDCSInstance(dpl_DCS *d, int32 n);
extern dpl_LOD *dpl_GetObjectLod(dpl_OBJECT *o, int32 n);
extern dpl_GEOGROUP *dpl_GetLodGeogroup(dpl_LOD *l, int32 n);
extern dpl_GEOMETRY *dpl_GetGeogroupGeometry(dpl_GEOGROUP *gg, int32 n); 

/* Disonnect Structure */

extern void dpl_RemoveViewFromScene(dpl_VIEW *v);
extern void dpl_RemoveDCSFromScene(dpl_DCS *d);
extern void dpl_RemoveDCSFromDCS(dpl_DCS *parent, dpl_DCS *child);
extern void dpl_RemoveInstanceFromDCS(dpl_DCS *d, dpl_INSTANCE *i);
extern void dpl_RemoveLodFromObject(dpl_OBJECT *o, dpl_LOD *lod);
extern void dpl_RemoveGeogroupFromLod(dpl_LOD *l, dpl_GEOGROUP *gg);
extern void dpl_RemoveGeometryFromGeogroup(dpl_GEOGROUP *gg, dpl_GEOMETRY *g);

/* Delete Elements */

extern void dpl_DeleteZone(dpl_ZONE *z);
extern void dpl_DeleteView(dpl_VIEW *v);
extern void dpl_DeleteDCS(dpl_DCS *d);
extern void dpl_DeleteInstance(dpl_INSTANCE *i);
extern void dpl_DeleteLight(dpl_LIGHT *l);
extern void dpl_DeleteTexture(dpl_TEXTURE *t);
extern void dpl_DeleteTexmap(dpl_TEXMAP *tm);
extern void dpl_DeleteMaterial(dpl_MATERIAL *m);
extern void dpl_DeleteObject(dpl_OBJECT *o);
extern void dpl_DeleteLod(dpl_LOD *l);
extern void dpl_DeleteGeogroup(dpl_GEOGROUP *gg);
extern void dpl_DeleteGeometry(dpl_GEOMETRY *g);
extern void dpl_DeleteRamp(dpl_RAMP *);

/* Scene Coherence */

extern void dpl_FlushZone(dpl_ZONE *z);
extern void dpl_FlushView(dpl_VIEW *v);
extern void dpl_FlushDCS(dpl_DCS *d);
extern void dpl_FlushInstance(dpl_INSTANCE *i);
extern void dpl_FlushLight(dpl_LIGHT *l);
extern void dpl_FlushTexture(dpl_TEXTURE *t);
extern void dpl_FlushTexmap(dpl_TEXMAP *tm);
extern void dpl_FlushMaterial(dpl_MATERIAL *m);
extern void dpl_FlushObject(dpl_OBJECT *o);
extern void dpl_FlushLod(dpl_LOD *l);
extern void dpl_FlushGeogroup(dpl_GEOGROUP *gg);
extern void dpl_FlushGeometry(dpl_GEOMETRY *g);
extern void dpl_FlushRamp(dpl_RAMP *);

/* Modal Render Changes */

/* Render modes may be set and querried using these functions, this enables
   modes like; wireframe rendering, single buffered rendering and the
   graphical display of performance information. */

extern void dpl_SetRenderProperty(dpl_RENDER_PROP prp, dpl_RENDER_VALUE val,
	void *data);
extern dpl_RENDER_VALUE dpl_GetRenderProperty(dpl_RENDER_PROP prp,
	void *data);
extern void dpl_SetPipeWindow(int32 pipe,
	int32 x0, int32 y0, int32 x1, int32 y1);
extern void dpl_GetPipeWindow(int32 pipe,
	int32 *x0, int32 *y0, int32 *x1, int32 *y1);
extern void dpl_SetWindowName(int32 pipe, char8 *name);
extern char8 *dpl_GetWindowName(int32 pipe);
extern void dpl_SetDesktopStereo(int32 pipe, int32 mode);
extern int32 dpl_GetDesktopStereo(int32 pipe);
extern void dpl_SetFrameRate(float32 rate);
extern float32 dpl_GetFrameRate(void);

/* Direct Render Calls */

/* These calls render the scene to all views and allow the application to
   lock and therefore synch to the frame rate. In multi processor SGI
   implementations this will lock to the cull rather than the render
   process. */

extern void dpl_DrawScene(void);
extern void dpl_WaitSceneComplete(void);
extern int32 dpl_DrawSceneComplete(void);

/* DCS */

/* Positional information may be set in a DCS in the form of a 4x4 matrix. */

extern void dpl_SetDCSMatrix(dpl_DCS *d, float32 *m);
extern float32 *dpl_GetDCSMatrix(dpl_DCS *d);

/* DCS nodes may be billboarded around any set of axes. This makes them
   automatically orient towards the view reguardless of their position
   relative to the viewpoint.  Multiple axes may be set by adding or bitwise
   oring the axis definitions together. */

extern void dpl_SetDCSReorientAxes(dpl_DCS *d, dpl_REORIENT_AXES a);
extern dpl_REORIENT_AXES dpl_GetDCSReorientAxes(dpl_DCS *d);

/* For switching and lighting model purposes a DCS has an associated zone
   which it occupies. */

extern void dpl_SetDCSZone(dpl_DCS *d, dpl_ZONE *z);
extern dpl_ZONE *dpl_GetDCSZone(dpl_DCS *d);

/* Zone */

/* Zones provide a means of controlling geometry switching on a per view
   basis and may be used to associate groups of light sources with
   particular DCS hierarchies. */

/* Sets rendering of the zone on for all views */
extern void dpl_SetZoneAllViewsOn(dpl_ZONE *z);

/* Sets rendering of the zone off for all views */
extern void dpl_SetZoneAllViewsOff(dpl_ZONE *z);

/* Sets rendering of the zone for the specified view on */
extern void dpl_SetZoneViewOn(dpl_ZONE *z, dpl_VIEW *v);

/* Sets rendering of the zone for the specified view off */
extern void dpl_SetZoneViewOff(dpl_ZONE *z, dpl_VIEW *v);

/* gets the rendering status of the zone in the view */
extern int32 dpl_GetZoneView(dpl_ZONE *z, dpl_VIEW *v);

/* sets all 32 views for this zone based on a bitmask*/
extern void dpl_SetZoneBitmask(dpl_ZONE *z, uint32 m);

/* gets a bitmask of all 32 views for this zone */
extern uint32 dpl_GetZoneBitmask(dpl_ZONE *z);

/* Instance */

/* Instances provide a means of copying an object without explicitly
   recreating it in the database. All instances therefore reference an
   object, any object may be multiply referenced by several instances.
   Material overrides may be applied to all geometry below an instance.
   Any material override applied to an instance will change the material
   of those geosets which have no lock applied to the material or geoset. */

extern void dpl_SetInstanceObject(dpl_INSTANCE *, dpl_OBJECT *);

extern dpl_OBJECT *dpl_GetInstanceObject(dpl_INSTANCE *);

extern void dpl_SetInstanceForceLOD(dpl_INSTANCE *i, dpl_LOD *l);

extern dpl_LOD *dpl_GetInstanceForceLOD(dpl_INSTANCE *i);

extern void dpl_SetInstanceVisibility(dpl_INSTANCE *i, int32 v);

extern int32 dpl_GetInstanceVisibility(dpl_INSTANCE *i);

extern void dpl_SetInstanceIntersect(dpl_INSTANCE *i, dpl_ISECT_MODE m);

extern dpl_ISECT_MODE dpl_GetInstanceIntersect(dpl_INSTANCE *i);

extern void dpl_SetInstanceSectMask(dpl_INSTANCE *i, uint32 mask);

extern uint32 dpl_GetInstanceSectMask(dpl_INSTANCE *i);


/* Object */

/* Objects contain lod nodes which switch according to ranging information
   associated wit the object */

extern void dpl_SetObjectLodRange(dpl_OBJECT *o,
	int32 transition, float32 range);

extern void dpl_InvalidateObjectLodRanges(dpl_OBJECT *o);

extern float32 dpl_GetObjectLodRange(dpl_OBJECT *o, int32 transition);

extern void dpl_SetObjectLodHotSpot(dpl_OBJECT *o,
	float32 x, float32 y, float32 z);

extern void dpl_GetObjectLodHotSpot(dpl_OBJECT *o,
	float32 *x, float32 *y, float32 *z);

extern void dpl_SetObjectLodFadeRange(dpl_OBJECT *o, float32 range);

extern float32 dpl_GetObjectLodFadeRange(dpl_OBJECT *o);

extern void dpl_SetInstanceFrontMaterial(dpl_INSTANCE *i, dpl_MATERIAL *m);
extern void dpl_SetInstanceBackMaterial(dpl_INSTANCE *i, dpl_MATERIAL *m);
extern dpl_MATERIAL *dpl_GetInstanceFrontMaterial(dpl_INSTANCE *i);
extern dpl_MATERIAL *dpl_GetInstanceBackMaterial(dpl_INSTANCE *i);

/* Light */

extern void dpl_SetLightDCS(dpl_LIGHT *, dpl_DCS *);
extern dpl_DCS *dpl_GetLightDCS(dpl_LIGHT *);
extern void dpl_SetLightType(dpl_LIGHT *l, dpl_LIGHT_TYPE t);
extern dpl_LIGHT_TYPE dpl_GetLightType(dpl_LIGHT *l);
extern void dpl_SetLightColor(dpl_LIGHT *l, float32 r, float32 g, float32 b);
extern void dpl_GetLightColor(dpl_LIGHT *l,
	float32 *r, float32 *g, float32 *b);
extern void dpl_SetLightRadii(dpl_LIGHT *l, float32 r0, float32 r1);
extern void dpl_GetLightRadii(dpl_LIGHT *l, float32 *r0,float32 *r1);
extern void dpl_SetLightUmbra(dpl_LIGHT *l, float32 exp, float32 th);
extern void dpl_GetLightUmbra(dpl_LIGHT *l, float32 *exp, float32 *th);

/* View */

extern void dpl_ViewShare(dpl_VIEW *master, dpl_VIEW *slave);
extern void dpl_SetViewDCS(dpl_VIEW *v, dpl_DCS *d);
extern dpl_DCS *dpl_GetViewDCS(dpl_VIEW *v);
extern void dpl_SetViewClipPlanes(dpl_VIEW *v, float32 hither, float32 yon);
extern void dpl_GetViewClipPlanes(dpl_VIEW *v, float32 *hither, float32 *yon);
extern void dpl_SetViewBackGround(dpl_VIEW *v,
	float32 r, float32 g, float32 b);
extern void dpl_GetViewBackGround(dpl_VIEW *v,
	float32 *r, float32 *g, float32 *b);
extern void dpl_SetViewFog(dpl_VIEW *v, dpl_FOG_TYPE enable,
	float32 r, float32 g, float32 b, float32 neer, float32 phar);
extern void dpl_GetViewFog(dpl_VIEW *v, dpl_FOG_TYPE *enable,
	float32 *r, float32 *g, float32 *b, float32 *neer, float32 *phar);
extern void dpl_SetViewPipe(dpl_VIEW *v, int32 pipe);
extern int32 dpl_GetViewPipe(dpl_VIEW *v);
extern void dpl_SetViewPort(dpl_VIEW *v,
	float32 x0, float32 y0, float32 x1, float32 y1);
extern void dpl_GetViewPort(dpl_VIEW *v,
	float32 *x0, float32 *y0, float32 *x1, float32 *y1);
extern void dpl_SetViewProjection(dpl_VIEW *v, float32 x0, float32 y0,
	float32 x1, float32 y1, float32 zeye);
extern void dpl_GetViewProjection(dpl_VIEW *v, float32 *x0, float32 *y0,
	float32 *x1, float32 *y1, float32 *zeye);
extern void dpl_SetViewNumber(dpl_VIEW *v, int32 n);
extern int32 dpl_GetViewNumber(dpl_VIEW *v);
extern void dpl_SetViewZClearOnly(dpl_VIEW *v, int32 mode);
extern int32 dpl_GetViewZClearOnly(dpl_VIEW *v);

/* Material */

/* Various illumination properties of a material may be set independently. */

extern void dpl_SetMaterialAmbient(dpl_MATERIAL *m,
	float32 r, float32 g, float32 b);

extern void dpl_GetMaterialAmbient(dpl_MATERIAL *m,
	float32 *r, float32 *g, float32 *b);

extern void dpl_SetMaterialEmissive(dpl_MATERIAL *m,
	float32 r, float32 g, float32 b);

extern void dpl_GetMaterialEmissive(dpl_MATERIAL *m,
	float32 *r, float32 *g, float32 *b);

extern void dpl_SetMaterialDiffuse(dpl_MATERIAL *m,
	float32 r, float32 g, float32 b);

extern void dpl_GetMaterialDiffuse(dpl_MATERIAL *m,
	float32 *r, float32 *g, float32 *b);

extern void dpl_SetMaterialSpecular(dpl_MATERIAL *m,
	float32 r, float32 g, float32 b, float32 shininess);

extern void dpl_GetMaterialSpecular(dpl_MATERIAL *m,
	float32 *r, float32 *g, float32 *b, float32 *shininess);

extern void dpl_SetMaterialOpacity(dpl_MATERIAL *m,
					float32 r,  float32 g, float32 b);

extern void dpl_GetMaterialOpacity(dpl_MATERIAL *m,
					float32 *r, float32 *g, float32 *b);

extern void dpl_SetMaterialTexture(dpl_MATERIAL *m, dpl_TEXTURE *t);

extern dpl_TEXTURE *dpl_GetMaterialTexture(dpl_MATERIAL *m);

extern void dpl_SetMaterialEnvironment(dpl_MATERIAL *m, dpl_TEXTURE *t);

extern dpl_TEXTURE *dpl_GetMaterialEnvironment(dpl_MATERIAL *m);

extern void dpl_SetMaterialRamp(dpl_MATERIAL *, dpl_RAMP *);

extern dpl_RAMP *dpl_GetMaterialRamp(dpl_MATERIAL *);

/* Texture */
/* Texture manipulation commands allow control over the various modes
   associated with applying texmaps to polygons. Particular importance is
   attached to the dpl_FlushTexture() function listed in a previous section.
   Potentially, many of the mode changes associated with these commands
   require a  prohibitive ammount of time to be applied on some systems.
   With write-back cacheing it is likely that applications will have to
   flush a texture on most platforms before any modifications take effect,
   this should be done as infrequently as possible, prefferably after all
   modifications have been requested. Functions below allow various
   properties to be set to particular parameter values. Hopefully this leads
   to a flexible and extensible interface. For a list of properties see the
   enumerated type definitions earlier in this document. */

extern void dpl_SetTextureProperty(dpl_TEXTURE *t,
	dpl_TEX_PROP prp, dpl_TEX_VALUE val, void *data);

extern dpl_TEX_VALUE dpl_GetTextureProperty(dpl_TEXTURE *t,
	dpl_TEX_PROP prp, void *data);

extern void dpl_SetTextureTexmap(dpl_TEXTURE *t, dpl_TEXMAP *tm);

extern dpl_TEXMAP *dpl_GetTextureTexmap(dpl_TEXTURE *t);

/* Texmap */
/* These functions allow the creation of texmaps both from image files on
   disk and from image data in memory. Using the high level loading
   function eliminates the need to set the texmap dimensions.
   Finally it is important to remember that this may be information used
   to create a texture and not actual texture itself (I think this applies
   to all target platforms & others may make a copy), so the texel memory
   should be freed after the call. */

extern void dpl_SetTexmapEdgeSize(dpl_TEXMAP *, int32, int32);

extern void dpl_GetTexmapEdgeSize(dpl_TEXMAP *tm, int32 *u, int32 *v);

extern void dpl_SetTexmapTexelSize(dpl_TEXMAP *, int32);

extern int32 dpl_GetTexmapTexelSize(dpl_TEXMAP *tm);

extern void dpl_UpdateTexmapTexels2D(dpl_TEXMAP *, uint8 *, int32, int32);

extern void dpl_GetTexmapTexels2D(dpl_TEXMAP *, uint8 *, int32, int32);

/* throws away the texmap and saves some resources */
extern void dpl_InvalidateTexels(dpl_TEXMAP *tm);

/* Geogroup */

/* A material lock may be placed at the level of the geogroup which  will
   prevent material chain operations or override commands affecting its
   material. */

/* set a geogroups front material */
extern void dpl_SetGeogroupFrontMaterial(dpl_GEOGROUP *g, dpl_MATERIAL *m);

/* set a geogroups back material */
extern void dpl_SetGeogroupBackMaterial(dpl_GEOGROUP *g, dpl_MATERIAL *m);

/* get a geogroups front material */
extern dpl_MATERIAL *dpl_GetGeogroupFrontMaterial(dpl_GEOGROUP *g);

/* get a geogroups back material */
extern dpl_MATERIAL *dpl_GetGeogroupBackMaterial(dpl_GEOGROUP *g);

/* lock a geogroups material */
extern void dpl_SetGeogroupMaterialLockOn(dpl_GEOGROUP *m);

/* unlock a geogroups material */
extern void dpl_SetGeogroupMaterialLockOff(dpl_GEOGROUP *m);

/* find out if a geogroups material is locked */
extern int32 dpl_GetGeogroupMaterialLock(dpl_GEOGROUP *m);

/* set decal displace value */
void dpl_SetGeogroupDecalDisplace(dpl_GEOGROUP *, int32);

/* returns decal displace on */
int32 dpl_GetGeogroupDecalDisplace(dpl_GEOGROUP *);

/* set wireframe TRUE or filled FALSE */
void dpl_SetGeogroupWireframe(dpl_GEOGROUP *, int32);

/* return wireframe TRUE or filled FALSE */
int32 dpl_GetGeogroupWireframe(dpl_GEOGROUP *);


/* Geometry */

/* Functions are provided to create renderable database geometry from arrays
   of co-ordinate information and connection lists. This is done by
   specifying which type of geometry is required first. Next the vertex type
   of the geometry is specified, then number of vertices.
   Once this is done the vertices are passed vertice values may be set
   in blocks of arbitrary sizes.
   This information may be followed by an edge connection list or text
   string or nothing depending on the type of geometry. Finally the geometry
   is flushed to greate the requested primitives.  Subsequent reads and
   writes of this geometry information are possible.  Of particular
   importance to the creation of the geometric primitives is the type of
   vertex being sent to the renderer. This determines how the primitive is
   drawn in the scene, (cooked, illuminated, textured), and prepares the dPL
   creation functions to expect vertex information in a particular form.
   Vertex properties which may be set using the type specification function
   above are enumerated as dpl_VERTEX_TYPE. These types may be added or
   bitwise OR'd together to prepare dPL to receive the information. When the
   contiguous block of vertices is passed the dPL uses the vertex type as a
   guide to the size of each vertex and what information it holds. */


/* determine the type of geometry to be held */
extern void dpl_SetGeometryGeoType(dpl_GEOMETRY *g, dpl_GEO_TYPE gt);

/* read the type of geometry held */
extern dpl_GEO_TYPE dpl_GetGeometryGeoType(dpl_GEOMETRY *g);

/* sets vertex type prior to creation, also determines space */
extern void dpl_SetGeometryVertexType(dpl_GEOMETRY *g, dpl_VERTEX_TYPE vt);

/* gets vertex type */
extern dpl_VERTEX_TYPE dpl_GetGeometryVertexType(dpl_GEOMETRY *g);

/* sets the number of vertices in the geometry */
extern void dpl_SetGeometryNumVertices(dpl_GEOMETRY *g, int32 n);

/* obtains the vertex count for geometry */
extern int32 dpl_GetGeometryNumVertices(dpl_GEOMETRY *g);

/* set values in n vertices starting from offset */
extern void dpl_UpdateGeometryVertices(dpl_GEOMETRY *g,
	float32 *v, int32 offset, int32 n);

/* sends an edge connection list for some forms of geometry */
extern void dpl_AddGeometryConnections(dpl_GEOMETRY *g, int32 *c,
	int32 numpolys, int32 polysize);

/* sends a strip connection list. */
extern void dpl_AddGeometryStrip(dpl_GEOMETRY *g, int32 *c,
    int32 numpolys, int32 polysize);

/* sends a text string for display as text by geometry */
extern void dpl_SetGeometryText(dpl_GEOMETRY *g, char8 *text);

/* obtains n geometry vertices starting at offset */
extern void dpl_GetGeometryVertices(dpl_GEOMETRY *g,
	float32 *v, int32 offset, int32 n);

/* gets the text string being displayed by text geometry */
extern char8 *dpl_GetGeometryText(dpl_GEOMETRY *g);

/* optimises and freezes geometry */
extern void dpl_OptimiseGeometry(dpl_GEOMETRY *);

/* set geometry subdivisions */
extern void dpl_SetGeometryDice(dpl_GEOMETRY *, uint16, uint16);

/* querry geometry subdivisions */
extern void dpl_GetGeometryDice(dpl_GEOMETRY *, uint16 *, uint16 *);

/* set the texture for textured font */
void dpl_SetFontTexture(dpl_TEXTURE *);

/* get the texture for textured font */
dpl_TEXTURE *dpl_GetFontTexture(void);

/* Setup & Cleanup */

extern int32 dpl_Init(int32 argc, char8 **argv);

extern void dpl_Config(void);

extern void dpl_Exit(int32 exit_code);

/* Reporting Control */

extern void dpl_SetWarningLevel(dpl_WARN_LEVEL w);

extern int32 dpl_GetWarningLevel(void);

extern char8 *dpl_Version(void);

/* these functions return types with defined contents */

extern dpl_STATISTICS *dpl_Statistics(void);

extern dpl_STATUS *dpl_Status(void);

dpl_CAPABILITY *dpl_GetCapability(void);

/* Frame Store Query */
/* These functions obtain a packed array of 8 bit red, green, blue & alpha
   colour information from the currently displayed frame store associated
   with a dpl_VIEW.  A single pixel from the image is stored in each
   unsigned integer in the hexadecimal form 0xRRGGBBAA, as can be seen the
   high order 8 bits contain red, then green is stored then blue followed
   by alpha information in the lowest order 8 bits. What is written to the
   alpha bits is not specified at this stage but these may ultimately yield
   useful information. Pixels will be written left to right(internal fast
   loop) bottom to top(outside slow loop). The first function will return a
   malloc'd block of packed information and returns it's size based on the
   information in the dpl_VIEW structure, the application should free this
   block when done with the image. The second function expects to be passed
   the memory address of a contiguous block of memory where the write is to
   be made and the dimensions of the required image, specifying the start
   position and image size allows a portion of the frame store to be copied
   to memory. There should be enough information allocated in the memory
   block for an image of the requested size to be written. Values for display
   portions incompatible with the dpl_VIEW information will produce undefined
   results. */

extern uint32 *dpl_GetFrameStore(dpl_VIEW *v, int32 *x, int32 *y);

extern void dpl_ReadFrameStore(dpl_VIEW *v, uint32 *pixels,
	int32 startx, int32 starty, int32 sizex, int32 sizey);

/* Intersection Functions */
/* Intersection functions are used to determine the point of intersection
   between a vector and the database contents. Vectors may be specified in
   world co-ordinates or as a position on the viewport of a dpl_VIEW.
   Depending upon the intersect mode set for the database instance
   intersected,  some of the fields may not return valid values. */

extern dpl_INSTANCE *dpl_SectVector(float32, float32, float32,
		float32, float32, float32, uint32,
		float32 *, float32 *, float32 *,
		dpl_DCS **, dpl_GEOGROUP **, dpl_GEOMETRY **);
extern dpl_INSTANCE *dpl_SectPixel(dpl_VIEW *, float32, float32, uint32,
		float32 *, float32 *, float32 *,
		dpl_DCS **, dpl_GEOGROUP **, dpl_GEOMETRY **);

/* Special Effects */

/* Provision is made for special effects to be requested by an application.
   The idea here is that common rendering effects which might eat bandwidth
   to the renderer or prove difficult to code using dPL can be implemented
   in the renderer and initiated with a single high level dPL request then
   left to look pretty: fire and forget rendering effects. Only explosions
   have been considered so far but this interface may be extended as new
   requirements arise. */

/* request an effect of the desired type and here's the type specific data
   for the effect */

extern void *dpl_Effect(dpl_EFFECT_TYPE e, dpl_DCS *d, void *data);

/* ramp stuff */

extern void dpl_SetRampComponents(dpl_RAMP *ramp,
			   float32 r0, float32 g0, float32 b0,
			   float32 r1, float32 g1, float32 b1);

extern void dpl_GetRampComponents(dpl_RAMP *ramp,
			   float32 *r0, float32 *g0, float32 *b0,
			   float32 *r1, float32 *g1, float32 *b1);

#ifdef __cplusplus
}
#endif

#endif
