gouraud_pointset.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined GOURAUD_POINTSET_HEADER
00020 #define GOURAUD_POINTSET_HEADER
00021 
00025 
00026 #include "whiptk/pointset.h"
00027 
00028 class WT_File;
00029 
00031 class WHIPTK_API WT_Gouraud_Point_Set_Data : public WT_Point_Set_Data
00032 {
00033         friend class WT_W2D_Class_Factory;
00034 protected:
00035     WT_RGBA32 *                 m_colors; 
00036     WT_Integer32                m_colors_allocated; 
00038 public:
00040     WT_Gouraud_Point_Set_Data()
00041         : WT_Point_Set_Data ()
00042         , m_colors (WD_Null)
00043         , m_colors_allocated(0)
00044     { }
00045 
00047     WT_Gouraud_Point_Set_Data(
00048         int                         count, 
00049         WT_Logical_Point const *    points, 
00050         WT_RGBA32 const *           colors, 
00051         WT_Boolean                  copy 
00052         ) throw(WT_Result);
00053 
00055     virtual ~WT_Gouraud_Point_Set_Data();
00056 
00058     WT_RGBA32 * colors() const
00059     {
00060         return m_colors;
00061     }
00062 
00063 private:
00064 
00065     WT_Gouraud_Point_Set_Data (WT_Gouraud_Point_Set_Data const &)
00066       : WT_Point_Set_Data ()
00067       , m_colors ()
00068       , m_colors_allocated(0)
00069     {
00070         WD_Complain ("cannot copy WT_Gouraud_Point_Set_Data");
00071     } // prohibited
00072 
00073     WT_Gouraud_Point_Set_Data & operator= (WT_Gouraud_Point_Set_Data const &)
00074     {
00075         WD_Complain ("cannot assign WT_Gouraud_Point_Set_Data");
00076         return *this;
00077     } // prohibited
00078 };
00079 
00081 class WHIPTK_API WT_Gouraud_Point_Set : public WT_Gouraud_Point_Set_Data
00082 {
00083         friend class WT_W2D_Class_Factory;
00084 
00085 protected:
00087     enum {
00088         Materialize,
00089         Skip
00090     }                           m_read_mode;
00091 
00093     enum {
00094         Getting_Count,
00095         Getting_Point,
00096         Getting_Color,
00097         Getting_Close_Paren
00098     }                           m_stage;
00099 
00100 public:
00101 
00103     WT_Gouraud_Point_Set()
00104         : WT_Gouraud_Point_Set_Data ()
00105         , m_read_mode (Materialize)
00106         , m_stage (Getting_Count)
00107     {
00108         m_points_materialized  = 0; //inherited members cannot go in member initialization above
00109     }
00110 
00112     WT_Gouraud_Point_Set(
00113         int                         count, 
00114         WT_Logical_Point const *    points, 
00115         WT_RGBA32 const *           colors, 
00116         WT_Boolean                  copy 
00117         ) throw(WT_Result);
00118 
00120     virtual ~WT_Gouraud_Point_Set()
00121     { }
00122     
00124 
00130     virtual WT_Result   serialize(WT_File &  file, 
00131                                   WT_String  opcode_ascii, 
00132                                   WT_Byte    opcode_32bit, 
00133                                   WT_Byte    opcode_16bit 
00134                                   ) const;
00135 
00136     // WT_Point_Set virtual methods
00137     WT_Result    materialize(WT_File & file);
00138     WT_Result    materialize_ascii(WT_File & file);
00139     WT_Result    materialize_16_bit(WT_File & file);
00140     WT_Result    skip_operand(WT_File & file);
00141     WT_Result    skip_operand_16_bit(WT_File & file);
00142     WT_Result    skip_operand_ascii(WT_File & file);
00143 
00144 private:
00145     WT_Result    read_pointset(WT_File & file);
00146     WT_Result    read_pointset_16_bit(WT_File & file);
00147     WT_Result    read_pointset_ascii(WT_File & file);
00148 
00149     WT_Gouraud_Point_Set (WT_Gouraud_Point_Set const &)
00150       : WT_Gouraud_Point_Set_Data ()
00151       , m_read_mode (Materialize)
00152       , m_stage (Getting_Count)
00153     {
00154         WD_Complain ("cannot copy WT_Gouraud_Point_Set");
00155     } // prohibited
00156 
00157     WT_Gouraud_Point_Set & operator= (WT_Gouraud_Point_Set const &)
00158     {
00159         WD_Complain ("cannot assign WT_Gouraud_Point_Set");
00160         return *this;
00161     } // prohibited
00162 };
00163 
00164 
00165 #endif // GOURAUD_POINTSET_HEADER

Generated on Tue Jan 6 22:41:12 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5