/*---------------------------------------------------------------------------*
  Project:  Horizon
  File:     camera_exp_util.h

  Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law.  They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Rev: 36187 $
 *---------------------------------------------------------------------------*/

#ifndef GRAPHICS_H_
#define GRAPHICS_H_

#include <nn.h>
#include <nn/types.h>
#include <nn/camera.h>
#include <nn/y2r.h>

#include "demo.h"
#include "demo/Render/demo_RenderSystemExt.h"

extern demo::RenderSystemExt s_RenderSystem;

// 画面表示モード情報
extern s32 s_DisplayMode;

//==============================================================================
int  InitializeGx( nn::fnd::ExpHeap & heap );
void FinalizeGx( nn::fnd::ExpHeap & heap );

//==============================================================================
/** カメラ画像の表示をカスタマイズする
 *
 *  @arg [in] カメラ画像ではなくRGB画像を表示するか
 *  @arg [in] キャルデータ
 *  @arg [in] チャート上でピントが合うようにするか
 *  @arg [in] チャート上でピントを合わせない場合のピントを合わせる距離
 *  @arg [in] 左カメラが見切れないように画像を右にずらすかどうか
 *  @arg [in] テクスチャにするカメラ画像のフォーマット
 *  @arg [in] テクスチャにするカメラ画像のブロックフォーマット
 */
void SetDrawingStereoCamera(
        bool isDrawRgbImage,
        nn::camera::StereoCameraCalibrationData * p_CalData,
        bool isParallax,
        f32  distance,
        bool isShiftRight,
        nn::y2r::OutputFormat format,
        nn::y2r::BlockAlignment alignment );

//==============================================================================
/** RGB画像を表示する場合のRGB画像をセットする
 *
 *  @arg [in] 右画像
 *  @arg [in] 左画像
 *  @arg [in] 画像データの幅
 *  @arg [in] 画像データの高さ
 *  @arg [in] 画像データに含まれているカメラ画像の幅
 *  @arg [in] 画像データに含まれているカメラ画像の高さ
 */
/*
void SetDrawingRgbImage(
                 u8       * image_R,
                 u8       * image_L,
                 size_t   textureWidth,
                 size_t   textureHeight,
                 size_t   originalWidth,
                 size_t   originalHeight );
*/
//==============================================================================
/** カメラ画像を表示する
 *
 *  @arg [in] テクスチャ番号 (0:右, 1:左)
 *  @arg [in] 左右画像を混ぜて表示するかどうか
 */
void DrawStereoCamera( s32 index, bool isBlend );

//==============================================================================
/** 上画面表示の共通化
 *  特別な表示をしない場合, この関数を使用する
 */
void DrawDisplay0StereoCommon( nn::camera::CameraSelect currentCamera );

//==============================================================================
/** 枠の描画
 */
void DrawLineFrame( const f32 sx, const f32 sy, const f32 width, const f32 height );

//==============================================================================
/** グリッドの描画
 */
//void DrawGrid( const s32 nh, const s32 nv, const f32 width, const f32 height, const f32 lineWidth );

//==============================================================================
/** RenderSystem を使った画像の2D描画
 */

void DrawImage(
    GLuint & textureId, const f32 sx, const f32 sy, const f32 width, const f32 height,
    void * p_Image, const s32 imageWidth, const s32 imageHeight );

#endif //#ifndef GRAPHICS_H_
