/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "../libs.h"
#include "vncharacter.h"
#include "conversation/vnconversation.h"
#include "ui/vntextbox.h"
#include "../display/camera.h"
#include "../display/shader.h"
#include "../display/animation/timeline.h"
#include "../display/animation/easing.h"
#include "../util/math.h"

/** Maximum number of Visual Novel Characters the scene can support */
#define VN_SCENE_CHARACTERS_MAX 6
#define VN_SCENE_DISTANCE_DEFAULT -8.0f

typedef struct {
  timeline_t timeline;

  // Camera Targets
  cameralookat_t cameraLook;

  /** Camera used for rendering, updated frequently */
  camera_t camera;

  /** Internal conversation element */
  vnconversation_t conversation;

  /** Character array */
  vncharacter_t characters[VN_SCENE_CHARACTERS_MAX];
  uint8_t characterCount;
} vnscene_t;

void vnSceneInit(vnscene_t *scene, font_t *font, texture_t *text);

void vnSceneUpdate(vnscene_t *scene, engine_t *engine);

void vnSceneDispose(vnscene_t *scene);

void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader);

void vnSceneRenderCharacters(vnscene_t *scene, shader_t *shader);

void vnSceneRenderGui(vnscene_t *scene, engine_t *engine, shader_t *shader);

void vnSceneLookAt(vnscene_t *scene,
  float x, float y, float z, float lookX, float lookY, float lookZ
);

void vnSceneLookAtCharacter(vnscene_t *scene, uint8_t c, float distance);