///////////////////////////////////////////////////////////////////////  
//  MyTgaLoader.h
//
//  All source files prefixed with "My" indicate an example implementation, 
//  meant to detail what an application might (and, in most cases, should)
//  do when interfacing with the SpeedTree SDK.  These files constitute 
//  the bulk of the SpeedTree Reference Application and are not part
//  of the official SDK, but merely example or "reference" implementations.
//
//  *** INTERACTIVE DATA VISUALIZATION (IDV) CONFIDENTIAL AND PROPRIETARY INFORMATION ***
//
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Interactive Data Visualization, Inc. and
//  may not be copied, disclosed, or exploited except in accordance with 
//  the terms of that agreement.
//
//      Copyright (c) 2003-2013 IDV, Inc.
//      All rights reserved in all media.
//
//      IDV, Inc.
//      http://www.idvinc.com


///////////////////////////////////////////////////////////////////////  
//  Preprocessor

#pragma once
#include "Core/Types.h"


///////////////////////////////////////////////////////////////////////  
//  All SpeedTree SDK classes and variables are under the namespace "SpeedTree"

namespace makOsgSpeedTree
{


    ///////////////////////////////////////////////////////////////////////  
    //  Class CMyTgaLoader

    class TgaLoader
    {
    public:
                            TgaLoader(void);
                            TgaLoader(SpeedTree::st_uchar* pImageData, SpeedTree::st_int32 nWidth, SpeedTree::st_int32 nHeight, SpeedTree::st_int32 nDepth, SpeedTree::st_bool bCopyData = true);
                            ~TgaLoader(void);

            bool            Read(const char* pFilename);
                            
            SpeedTree::st_int32        GetWidth(void) const            { return m_nWidth; }
            SpeedTree::st_int32        GetHeight(void) const           { return m_nHeight; }
            SpeedTree::st_int32        GetDepth(void) const            { return m_nDepth; } // in bytes (3 = RGB, 4 = RGBA)
            SpeedTree::st_uchar*       GetRawData(void) const          { return m_pImageData; }

            SpeedTree::st_uchar*       GetPixel(SpeedTree::st_int32 nWidth, SpeedTree::st_int32 nHeight) const;
            void								SetPixel(const SpeedTree::st_uchar* pValue, SpeedTree::st_int32 nWidth, SpeedTree::st_int32 nHeight);

    private:
            SpeedTree::st_int32        m_nHeight;          // in pixels
            SpeedTree::st_int32        m_nWidth;           // in pixels
            SpeedTree::st_int32        m_nDepth;           // in bytes (3 = RGB, 4 = RGBA)
            SpeedTree::st_uchar*       m_pImageData;
            SpeedTree::st_bool         m_bDeleteData;
    };

} // end namespace SpeedTree


