BOpcodeShell.h

Go to the documentation of this file.
00001 
00002 //
00003 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00004 // The information contained herein is confidential and proprietary to
00005 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00006 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00007 // and criminal remedies in the event of unauthorized use or misappropriation
00008 // of its trade secrets.  Use of this information by anyone other than
00009 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00010 // written non-disclosure agreement, expressly prescribing the scope and
00011 // manner of such use.
00012 //
00013 //
00014 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00015 //
00016 //  By using this code, you are agreeing to the terms and conditions of
00017 //  the License Agreement included in the documentation for this code.
00018 //
00019 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00020 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00021 //  WORKS WHICH INCORPORATE IT.
00022 //
00023 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00024 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00025 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00026 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00027 //
00028 //  Use, duplication, or disclosure by the U.S. Government is subject to
00029 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00030 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00031 //  Data and Computer Software), as applicable.
00032 //
00033 // $Header: //DWF/Working_Area/Willie.Zhu/w3dtk/BOpcodeShell.h#1 $
00034 //
00035 
00036 #ifndef BBINFILETK_SHELL
00037 #define BBINFILETK_SHELL
00038 
00042 
00043 #include "dwf/w3dtk/BOpcodeHandler.h"
00044 #include "dwf/w3dtk/BPolyhedron.h"
00045 
00046 
00047 
00049 
00055 class BBINFILETK_API TK_Shell : public TK_Polyhedron {
00056     private:
00057         TK_Shell(const TK_Shell&);
00058         TK_Shell& operator=(const TK_Shell&);
00059 
00060     private:
00061         virtual TK_Status read_advanced (BStreamFileToolkit & tk) alter;
00062         virtual TK_Status read_uncompressed_points (BStreamFileToolkit & tk) alter;
00063         virtual TK_Status read_uncompressed_faces (BStreamFileToolkit & tk) alter;
00064         virtual TK_Status read_bounding (BStreamFileToolkit & tk) alter;
00065 
00066 
00067 
00068 
00069                 virtual TK_Status read_advanced_ascii (BStreamFileToolkit & tk) alter;
00070         virtual TK_Status read_uncompressed_points_ascii (BStreamFileToolkit & tk) alter;
00071         virtual TK_Status read_uncompressed_faces_ascii (BStreamFileToolkit & tk) alter;
00072         virtual TK_Status read_bounding_ascii (BStreamFileToolkit & tk) alter;
00073 
00074 
00075         virtual TK_Status compute_advanced (BStreamFileToolkit & tk) alter;
00076         virtual TK_Status write_advanced (BStreamFileToolkit & tk) alter;
00077         virtual TK_Status write_uncompressed_points (BStreamFileToolkit & tk) alter;
00078         virtual TK_Status write_uncompressed_faces (BStreamFileToolkit & tk) alter;
00079         virtual TK_Status write_bounding (BStreamFileToolkit & tk) alter;
00080         TK_Status write_null (BStreamFileToolkit & tk) alter;
00081 
00082 
00083 
00084 
00085 
00086                 virtual TK_Status write_advanced_ascii (BStreamFileToolkit & tk) alter;
00087         virtual TK_Status write_uncompressed_points_ascii (BStreamFileToolkit & tk) alter;
00088         virtual TK_Status write_uncompressed_faces_ascii (BStreamFileToolkit & tk) alter;
00089         virtual TK_Status write_bounding_ascii (BStreamFileToolkit & tk) alter;
00090         TK_Status write_null_ascii (BStreamFileToolkit & tk) alter;
00091                 TK_Status compute_advanced_ascii(BStreamFileToolkit & tk) alter ;
00092 
00093 
00094     protected:
00095         int             m_substage;     
00096         unsigned char   m_compression_scheme; 
00097         int             m_flistlen;      
00098         int             *m_flist;        
00099         char            m_lodlevel;      
00101     public:
00139         TK_Status SetFaces( int length, int const *face_list = 0 ) alter;
00141         TK_Status SetLodLevel( int level ) alter { m_lodlevel = (char)level; return TK_Normal; };
00143         int const *GetFaces() const { return m_flist; };
00145         int GetFacesLength() const { return m_flistlen; };
00147         int GetLodLevel() const { return m_lodlevel; };
00150         TK_Status EnumerateEdges(); 
00151 
00155         virtual void serialize( const void* pTag = NULL )
00156             throw( DWFException );
00157 
00176         void optimize( bool    bOptimize = true,
00177                        double  nVertexTolerance = 0.0,
00178                        double  nVertexNormalsTolerance = 0.0,
00179                        double  nTextureParametersTolerance = 0.0 )
00180         {
00181             _bOptimizeThisShell = bOptimize;
00182             _nOptimizeVertexTolerance = nVertexTolerance;
00183             _nOptimizeVertexNormalsTolerance = nVertexNormalsTolerance;
00184             _nOptimizeTextureParametersTolerance = nTextureParametersTolerance;
00185         }
00186 
00187 
00188     public:
00189         TK_Shell ();
00190         ~TK_Shell ();
00191 
00193         void    set_flist (int count, int const * list = 0) alter { SetFaces( count, list ); };
00194 
00195         TK_Status   Read (BStreamFileToolkit & tk) alter;
00196         TK_Status   Write (BStreamFileToolkit & tk) alter;
00197 
00198 
00199         TK_Status   ReadAscii (BStreamFileToolkit & tk) alter;
00200         TK_Status   WriteAscii(BStreamFileToolkit & tk) alter;
00201 
00202         void        Reset (void) alter;
00203 
00204     private:
00205 
00206         void _optimizeThisShell()
00207             throw( DWFException );
00208 
00209         void _optimizeVertexNormals();
00210 
00211     private:
00212 
00213         bool    _bOptimizeThisShell;
00214         double  _nOptimizeVertexTolerance;
00215         double  _nOptimizeVertexNormalsTolerance;
00216         double  _nOptimizeTextureParametersTolerance;
00217 
00218 }; //end declaration of class TK_Shell
00219 
00220 
00221 
00222 /*
00223  * SOME UTILITY MACROS
00224  */
00225 #define SEMI_PROTECT(x) do {x} while (0)
00226 
00227 //warning: implicitly references the BStreamFileToolkit &, tk
00228 #define ENSURE_ALLOCATED(var,type,count) SEMI_PROTECT( \
00229     delete [] (var); \
00230     (var) = new type[(count)]; \
00231     if( (var) == 0 ) \
00232         return tk.Error(); \
00233 )
00234 
00235 //warning: implicitly references the BStreamFileToolkit &, tk
00236 #define ENSURE_ALLOCATED_CLEAR(var,type,count) SEMI_PROTECT( \
00237     delete [] (var); \
00238     (var) = new type[(count)]; \
00239     if( (var) == 0 ) \
00240         return tk.Error(); \
00241     memset (var, 0, (count) * sizeof(type)); \
00242 )
00243 
00244 #endif

Generated on Tue Jan 6 22:41:37 2009 for Autodesk DWF 3D Toolkit by  doxygen 1.4.5