Voxvision  1
Creating and manipulating voxel octrees
Data Structures | Functions
camera.h File Reference

Camera interface. More...

#include "object.h"

Go to the source code of this file.

Data Structures

struct  vox_camera_interface
 A camera user interface. More...
 
struct  vox_camera
 A generic camera class. More...
 

Functions

VOX_EXPORT void vox_use_camera_methods (struct vox_camera *camera, const struct vox_camera_interface *iface)
 Use defined camera methods from another interface implementation. More...
 
VOX_EXPORT void vox_init_camera (struct vox_camera *camera)
 Initialize camera. More...
 
VOX_EXPORT struct vox_camera_interfacevox_camera_methods (const char *name)
 Get camera methods. More...
 

Detailed Description

Camera interface.

See vox_camera_interface structure to get more info on camera interface.

Function Documentation

◆ vox_camera_methods()

VOX_EXPORT struct vox_camera_interface* vox_camera_methods ( const char *  name)

Get camera methods.

If needed, the camera is loaded as a shared object from local or global module directories or from directory specified in VOXVISION_MODULES environment variable. To get a pointer to the camera's methods, a function module_init() is called from that shared object.

Now this function uses generic module mechanism provided in modules.h.

Returns
A pointer to the camera's methods or NULL if no camera module was found.

◆ vox_init_camera()

VOX_EXPORT void vox_init_camera ( struct vox_camera camera)

Initialize camera.

This function allocates space for and initializes camera's iface field with dummy methods, so you do not have to write an implementation for EVERY camera method to implement the interface. You can implement SOME methods and use vox_use_camera_methods to overwrite dummy methods later.

Also, dummy interface implements destroy_camera method that calls free on the caller's iface field and the caller itself.

◆ vox_use_camera_methods()

VOX_EXPORT void vox_use_camera_methods ( struct vox_camera camera,
const struct vox_camera_interface iface 
)

Use defined camera methods from another interface implementation.

This functions overwrites camera methods of the given camera with new methods from interface iface if they are defined (that means they hold non-NULL value).