paysages3d/src/rendering/clouds/clo_walking.h

87 lines
2 KiB
C
Raw Normal View History

#ifndef _PAYSAGES_CLOUDS_WALKING_H_
#define _PAYSAGES_CLOUDS_WALKING_H_
#include "public.h"
#include "../tools/euclid.h"
/**
2013-05-26 18:28:44 +00:00
* Functions to walk through a cloud layer.
*/
#ifdef __cplusplus
extern "C"
{
#endif
2013-05-26 18:28:44 +00:00
/**
* Information on a segment yielded by walking.
*/
typedef struct
{
2013-05-26 18:28:44 +00:00
Renderer* renderer;
CloudsLayerDefinition* layer;
double walked_distance;
Vector3 start;
Vector3 end;
double length;
2013-05-26 18:28:44 +00:00
int refined;
int subdivision_level;
double precision_asked;
void* data;
} CloudWalkingInfo;
/**
* Control of the next walking order.
*/
typedef enum
{
CLOUD_WALKING_CONTINUE,
CLOUD_WALKING_STOP,
CLOUD_WALKING_REFINE,
CLOUD_WALKING_SUBDIVIDE
} CloudWalkingOrder;
/**
* Additional info for walking orders.
*/
2013-05-25 13:20:11 +00:00
typedef struct
{
2013-05-26 18:28:44 +00:00
double precision;
int max_segments;
} CloudWalkingOrderInfo;
typedef CloudWalkingOrder(*FuncCloudSegmentCallback)(CloudWalkingInfo* segment, CloudWalkingOrderInfo* order);
2013-05-25 13:20:11 +00:00
/**
* Optimize the search limits in a layer.
*
* @param layer The cloud layer
* @param start Start of the search to optimize
* @param end End of the search to optimize
* @return 0 if the search is useless
*/
int cloudsOptimizeWalkingBounds(CloudsLayerDefinition* layer, Vector3* start, Vector3* end);
/**
2013-05-26 18:28:44 +00:00
* Start walking through a segment.
2013-05-25 13:20:11 +00:00
*
2013-05-26 18:28:44 +00:00
* For better performance, the segment should by optimized using cloudsOptimizeWalkingBounds.
* The callback will be called with each segment found, giving info and asking for desired alteration on walking.
2013-05-25 13:20:11 +00:00
* @param renderer The renderer environment
* @param layer The cloud layer
2013-05-26 18:28:44 +00:00
* @param start Start position of the lookup, already optimized
* @param end End position of the lookup, already optimized
* @param callback Callback to be called with each found segment
* @param data User data that will be passed back in the callback
2013-05-25 13:20:11 +00:00
*/
2013-05-26 18:28:44 +00:00
void cloudsStartWalking(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 start, Vector3 end, FuncCloudSegmentCallback callback, void* data);
2013-05-25 13:20:11 +00:00
#ifdef __cplusplus
}
#endif
#endif