//
// AIBO3D.h
//
// Copyright 2004 Sony Corporation
//


#if !defined(AFX_AIBO3D_H__6DD71FC9_85E8_42D4_9D42_AC19F8B73790__INCLUDED_)
#define AFX_AIBO3D_H__6DD71FC9_85E8_42D4_9D42_AC19F8B73790__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef uchar
    #define uchar   unsigned char
#endif
#ifndef ushort
    #define ushort  unsigned short
#endif
#ifndef ulong
    #define ulong   unsigned long
#endif

// Error code
#define     AIBO3D_NOERROR      0       // No Error
#define     AIBO3D_ERRGFILE     -1      // Cannot read graphics data
#define     AIBO3D_ERRMFILE     -2      // Cannot read motion file
#define     AIBO3D_NOMFILE      -3      // Cannot find motion file
#define     AIBO3D_ERRCREATE    -4      // Cannot create
#define     AIBO3D_NOCREATE     -5      // There is no object
#define     AIBO3D_UNSUPPORTED  -6      // Unsupported
#define     AIBO3D_EXECERR      -7      // Cannot execute

// Posture parameter for Set3DPosture
enum{
    POSE_3D_NORMAL,
    POSE_3D_LIE,
    POSE_3D_STANDUP,
    POSE_3D_SITDOWN,
    POSE_3D_WALKING,
    POSE_3D_SHUTDOWN,
    POSE_3D_HOLDUP,
    POSE_3D_STATION
};

#define     MAX_COPYMODEL   ( 10 )      // MAX copy model can display

class CAibo3DEX;

#ifdef _AIBO3D_DLLEXPORT
class __declspec( dllexport ) CAIBO3D
#else
class __declspec( dllimport ) CAIBO3D
#endif // _AIBO3D_DLLEXPORT 
{
public:

    CAIBO3D();
    virtual ~CAIBO3D();

public:

    // Initialize 
    int     Create3D( DWORD model,char *path,HWND hWndParent,RECT &rect,COLORREF bkColor,COLORREF fColor );

    // 3D model
    int     Show( BOOL showF = TRUE );
    int     HomePosition( void );
    int     RotateBody( float pitch,float yaw,float roll,BOOL redraw = TRUE );
    int     GetBodyAngle( float *pitch,float *yaw,float *roll );
    void    Set3DPosture( int posture );

    // Animation
    int     MoveAIBOAnimation( BOOL startF, float speed );
    int     RotateAIBOAnimation( float dYaw, BOOL now = false );
    int     PlayAnimation( int repeat = 0,BOOL bodyOnlyF = FALSE,DWORD delay = 0 );
    int     StopAnimation( void );
    int     ClearTrack( BOOL resetF = TRUE );
    int     DrawTrack( BOOL drawF );

    // Object
    int     RotateJoint( int joint,float angle,BOOL redraw = TRUE );
    int     RotateJoint( int *jointL,float *angleL,int num,BOOL redraw = TRUE );
    int     SetColor( int joint,COLORREF rgb,BOOL redrawF = TRUE );
    int     SetColor( int joint,COLORREF rgb,float angle,BOOL redrawF = TRUE );
    COLORREF    GetColor( int joint );

    // Camera
    int     MoveCamera( float x,float y );
    int     ZoomCamera( float zoom );
    int     RotateCamera( float pitch,float yaw );
    int     GetCameraPos( float *x,float *y,float *z );
    int     GetCameraAngle( float *pitch,float *yaw );

    // Background
    void    SetLight( COLORREF directLight, COLORREF pointLight, COLORREF ambient );
    void    SetFloorTexture( char* strFile );
    void    SetFloorTexture( int nID );
    void    SetBackTexture( char* strFile );
    void    SetBackTexture( int nID );
    void    DeleteFloorTexture();
    void    DeleteBackTexture();

    // Local coordinate
    void    SetLocalRotationX( float fX, BOOL redraw = false );
    void    SetLocalRotationY( float fY, BOOL redraw = false );
    void    SetLocalRotationZ( float fZ, BOOL redraw = false );
    void    SetLocalRotation( float fX, float fY, float fZ, BOOL redraw = false );
    void    SetLocalTransfer( float fX, float fY, float fZ, BOOL redraw = false );
    void    GetLocalRotation( float* pX, float* pY, float* pZ );
    void    GetLocalTransfer( float* pX, float* pY, float* pZ );

    // Copy model
    void    ShowCopyModel( int nIdx, BOOL isShow, BOOL redraw = false );
    void    SetCopyModelRotationX( int nIdx, float fX, BOOL redraw = false );
    void    SetCopyModelRotationY( int nIdx, float fY, BOOL redraw = false );
    void    SetCopyModelRotationZ( int nIdx, float fZ, BOOL redraw = false );
    void    SetCopyModelRotation( int nIdx, float fX, float fY, float fZ, BOOL redraw = false );
    void    SetCopyModelTransfer( int nIdx, float fX, float fY, float fZ, BOOL redraw = false );
    BOOL    IsShowCopyModel( int nIdx );
    void    GetCopyModelRotation( int nIdx, float* pX, float* pY, float* pZ );
    void    GetCopyModelTransfer( int nIdx, float* pX, float* pY, float* pZ );

    // Draw text
    // 2D 
    BOOL    IsShowDrawText2D();
    void    ShowDrawText2D( BOOL isShow );
    BOOL    CreateDrawText2DSurface( int nWidth, int nHeight );
    void    SetDrawText2DString( char* strText );
    void    SetDrawText2DFont( HFONT hFont );
    void    SetDrawText2DColor( COLORREF color );
    void    SetDrawText2DBackColor( COLORREF color );
    void    SetDrawText2DBackTransparent( BOOL isTransparent );
    void    SetDrawText2DDrawArea( int nSx, int nSy, int nWidth, int nHeight );
    // 3D 
    BOOL    IsShowDrawText3D();
    void    ShowDrawText3D( BOOL isShow );
    BOOL    CreateDrawText3DSurface( int nWidth, int nHeight );
    void    SetDrawText3DString( char* strText );
    void    SetDrawText3DFont( HFONT hFont );
    void    SetDrawText3DColor( COLORREF color );
    void    SetDrawText3DBackColor( COLORREF color );
    void    SetDrawText3DBackTransparent( BOOL isTransparent );
    void    SetDrawText3DBasePoint( float fX, float fY, float fZ );
    void    SetDrawText3DDrawArea( float fBaseX, float fBaseY, float fWidth, float fHeight );

    void    GetVersion( char *verString );

// Internal use only
private:
    CAibo3DEX       *m_aibo3D;

};

#endif // !defined(AFX_AIBO3D_H__6DD71FC9_85E8_42D4_9D42_AC19F8B73790__INCLUDED_)
