/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
#ifndef LIBGLTF_H
#define LIBGLTF_H
#include <stddef.h>
#include "Common.h"
using namespace glTF;
 
/** Initialize the glTF renderer - using the content of the .json file 
jsonfile: parse this file, and return a glTFHandle which contain the infomations of files which will be use to draw 3D model by OpenGL.
*/
extern "C"
glTFHandle* gltf_renderer_init(const glTFFile* jsonfile);

/** Set various file contents 
handle: It should contain all the buffers of the files and the viewport when call this function.
*/
extern "C"
void gltf_renderer_set_content(glTFHandle *handle);

/** Drawing the 3D model to the current openGLcontext. */
extern "C"
void gltf_renderer(glTFHandle* handle);

/**Release the data of 3D model.*/
extern "C"
void gltf_renderer_release(glTFHandle* handle);

/*get camera position information*/
extern "C"
void gltf_get_camera_pos(glm::vec3 *pos,glm::vec3 *view,glm::vec3 *up);

/** Update camera position, in the timeframe of 'time' */
extern "C"
void gltf_renderer_move_camera(double x, double y, double z,double time);

/** Update camera rotation, in the timeframe of 'time' */
extern "C"
void gltf_renderer_rotate_camera(double horizontal, double vertical,
   double planar, double time);
   
/** Get a bitmap of the screen in the given point in time. */
extern "C"
void gltf_renderer_get_bitmap(glTFHandle *handle, double time,
    char* buffer, long width, long height);

/** Start playing the glTF animation to the current openGLcontext. */
extern "C"
void gltf_animation_start(glTFHandle *handle);

/** Stop playing the glTF animation. */
extern "C"
void gltf_animation_stop(glTFHandle *handle);

/** Return the state of the glTF animation. */
extern "C"
int gltf_animation_is_playing(glTFHandle *handle);

/** Set the animation to loop. */
extern "C"
void gltf_animation_set_looping(glTFHandle *handle, int loop);

/** Is the animation looping? */
extern "C"
int gltf_animation_get_looping(glTFHandle *handle);

/** Return amount of seconds this glTF animation takes. */
extern "C"
double gltf_animation_get_duration(glTFHandle *handle);

/** Fast forward / rewind to the given point in time. */
extern "C"
void gltf_animation_set_time(glTFHandle *handle, double time);

/** Query where exactly the animation is, in seconds. */
extern "C"
double gltf_animation_get_time(glTFHandle *handle);
#endif