graphf-scene

graphf-scene —

Synopsis




struct      GraphfScenePoint;
struct      GraphfSceneLine;
struct      GraphfSceneTriangle;
struct      GraphfSceneLight;
struct      GraphfScene;
struct      GraphfSceneImageData;
struct      GraphfSceneImage;
void        graphf_scene_init               (GraphfScene *scene);
void        graphf_scene_get_triangle_normal
                                            (GraphfScene *scene,
                                             unsigned     tri_index,
                                             double *normal_out);
gboolean    graphf_scene_get_is_underside   (GraphfScene *scene,
                                             unsigned     tri_index,
                                             const double *camera_relative_normal,
                                             const double *camera_relative_tri_center);
void        graphf_scene_get_triangle_color (GraphfScene *scene,
                                             unsigned     tri_index,
                                             const double *normal,
                                             gboolean is_underside,
                                             float *rgb_out);

Description

Details

struct GraphfScenePoint

struct GraphfScenePoint {

  gdouble x, y, z;
};


struct GraphfSceneLine

struct GraphfSceneLine {

  guint vertices[2];
  guint32 color;
  double fudge;
};


struct GraphfSceneTriangle

struct GraphfSceneTriangle {

  guint vertices[3];
  guint32 emissive_color;
  guint32 front_color;
  guint32 back_color;
  gdouble fudge;
};


struct GraphfSceneLight

struct GraphfSceneLight;


struct GraphfScene

struct GraphfScene {

  Graphf3DCamera camera;

  guint n_points;
  GraphfScenePoint *points;

  guint n_tris;
  GraphfSceneTriangle *tris;

  guint n_lines;
  GraphfSceneLine *lines;

  guint n_lights;
  Graphf3DLight *lights;

  guint n_image_data;
  GraphfSceneImageData *image_data;

  guint n_images;
  GraphfSceneImage *images;

  guint32 background_color;

  guint ambient_light;

  double clip_z;
};


struct GraphfSceneImageData

struct GraphfSceneImageData {

  guint width, height;
  /* you may assume (width+7)/8 bytes per row in 'is_opaque'.
     if NULL, the image is completely opaque. */
  guint8 *is_opaque;

  guint8 *rgb_data;
  gint rowstride;

  GraphfSceneImageData *next_resolution;
};


struct GraphfSceneImage

struct GraphfSceneImage {

  guint which_image;

  /* where is 0,0 in the image */
  double origin[3];

  /* this covers the extent of the image along
     its width in real coordinate. */
  double x[3];
  /* likewise for height */
  double y[3];
};


graphf_scene_init ()

void        graphf_scene_init               (GraphfScene *scene);

scene:

graphf_scene_get_triangle_normal ()

void        graphf_scene_get_triangle_normal
                                            (GraphfScene *scene,
                                             unsigned     tri_index,
                                             double *normal_out);

scene:
Param2:
normal_out:

graphf_scene_get_is_underside ()

gboolean    graphf_scene_get_is_underside   (GraphfScene *scene,
                                             unsigned     tri_index,
                                             const double *camera_relative_normal,
                                             const double *camera_relative_tri_center);

scene:
Param2:
camera_relative_normal:
camera_relative_tri_center:
Returns :

graphf_scene_get_triangle_color ()

void        graphf_scene_get_triangle_color (GraphfScene *scene,
                                             unsigned     tri_index,
                                             const double *normal,
                                             gboolean is_underside,
                                             float *rgb_out);

scene:
Param2:
normal:
is_underside:
rgb_out: