- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# mudbox.h

Go to the documentation of this file.

    00001
    00002 //**************************************************************************/
    00003 // Copyright (c) 2008 Autodesk, Inc.
    00004 // All rights reserved.
    00005 //
    00006 // Use of this software is subject to the terms of the Autodesk license
    00007 // agreement provided at the time of installation or download, or which
    00008 // otherwise accompanies this software in either electronic or hard copy form.
    00009 //
    00010 //**************************************************************************/
    00011 // DESCRIPTION:
    00012 // CREATED: October 2008
    00013 //**************************************************************************/
    00014
    00015 #ifndef __MUDBOXSDK_MUDBOX_H__
    00016 #define __MUDBOXSDK_MUDBOX_H__
    00017
    00018 #pragma once
    00019
    00020 #ifdef _WIN32
    00021 #pragma warning( disable : 4251 )
    00022 #endif
    00023 /*****
    00024  * System headers
    00025  *
    00026  * Usage:
    00027  *   - Ensure size_t is defined properly.
    00028  */
    00029 #include <stdlib.h>
    00030 #include <stdio.h>
    00031 #ifdef _WIN32
    00032 #include <intrin.h>
    00033 #endif
    00034
    00035 #if defined(JAMBUILD)
    00036 #include <Mudbox/dllinterface.h>
    00037 #else
    00038 #include "dllinterface.h"
    00039 #endif
    00040
    00041 // defines
    00042 #ifdef _DEBUG
    00043 #ifndef MB_DEBUG
    00044 #define MB_DEBUG
    00045 #endif
    00046 #endif
    00047
    00048 // version info, short & simple for, similar to Qt version info
    00049 #define MB_SDK_VERSION_STRING "2.0.0"
    00050
    00051 // MB_SDK_VERSION is (major << 16) + (minor << 8) + patch.
    00052 //
    00053 // Each pair of #s after the x represent a version # (major, minor, patch).
    00054 // Hexadecimal is the base and each digit represents 4 bits, so 16 different
    00055 // combinations.  So since the version takes up 2 digits = 8 bits = 256 possible
    00056 // versions for each group.
    00057 #define MB_SDK_VERSION 0x00020000
    00058 // can be used like #if (MB_SDK_VERSION >= MB_SDK_VERSION_CHECK(1, 1, 0))
    00059 #define MB_SDK_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
    00060
    00061 // Starting with Mudbox 2013, we will be incrementing the major version with
    00062 // each annual release and the minor version with each interim release between
    00063 // annual ones. We don't expect to change the patch number.
    00064
    00065 #ifndef MB_ASSERT
    00066     #if defined(MB_DEBUG)
    00067         #if defined(_WIN32)
    00068             #define MB_ASSERT( condition ) { if (!(condition)&&mudbox::AssertFailed( __FILE__, __LINE__, #condition, "" )) __debugbreak(); }
    00069         #else
    00070             #define MB_ASSERT( condition ) { if (!(condition)) mudbox::AssertFailed( __FILE__, __LINE__, #condition, "" ); }
    00071         #endif
    00072     #else
    00073         #define MB_ASSERT( condition ) {}
    00074     #endif
    00075 #endif
    00076 #ifndef MB_VERIFY
    00077     #ifdef MB_DEBUG
    00078         #define MB_VERIFY( condition ) MB_ASSERT( condition )
    00079     #else
    00080         #define MB_VERIFY( condition ) { bool b___ = condition; b___; }
    00081     #endif
    00082 #endif
    00083
    00084
    00085 #ifndef MB_VERIFY_EQ
    00086     #ifdef MB_DEBUG
    00087         #define MB_VERIFY_EQ( condition_, value_ ) MB_ASSERT( (condition_) == (value_) )
    00088     #else
    00089         #define MB_VERIFY_EQ( condition_, value_ ) (condition_)
    00090     #endif
    00091 #endif
    00092
    00093 #ifndef MB_VERIFY_TRUE
    00094     #ifdef MB_DEBUG
    00095         #define MB_VERIFY_TRUE( condition_ ) MB_ASSERT( (condition_) )
    00096     #else
    00097         #define MB_VERIFY_TRUE( condition_ ) (condition_)
    00098     #endif
    00099 #endif
    00100
    00101 #define MB_ONBUG( condition ) MB_ASSERT( !(condition) ); if ( condition )
    00102 #define MB_SAFELY( condition ) MB_ASSERT( condition ); if ( condition )
    00103
    00104 #ifndef MB_DEBUG
    00105 #define QT_NO_DEBUG_OUTPUT
    00106 #endif
    00107
    00108 #if defined( MB_TEST ) || defined( MB_DEBUG )
    00109
    00110 #if defined(_MSC_VER)
    00111 #define MB_TIMER( name ) static int ____iTimerIndex = -1; mudbox::Timer ____cTimer( __FUNCTION__" - "##name, ____iTimerIndex );
    00112 #else
    00113 #define MB_TIMER( name ) static int ____iTimerIndex = -1; mudbox::Timer ____cTimer( __FILE__ " - " name, ____iTimerIndex );
    00114 #endif
    00115
    00116 #else
    00117 #define MB_TIMER( name ) ;
    00118 #endif
    00119 #if defined(__GNUC__)
    00120 #define MB_ERROR throw (new mudbox::Error( "", mudbox::Error::codeUnspecified, __PRETTY_FUNCTION__, __FILE__, __LINE__ ))->Format
    00121 #define MB_ERRORQ(s) throw new mudbox::Error( s, mudbox::Error::codeUnspecified, __PRETTY_FUNCTION__, __FILE__, __LINE__ )
    00122 #else
    00123 #define MB_ERROR throw (new mudbox::Error( "", mudbox::Error::codeUnspecified, __FUNCTION__, __FILE__, __LINE__ ))->Format
    00124 #define MB_ERRORQ(s) throw new mudbox::Error( s, mudbox::Error::codeUnspecified, __FUNCTION__, __FILE__, __LINE__ )
    00125 #endif
    00126
    00127 #define MB_PLUGIN( name, description, author, url, initializer ) mudbox::Plugin __myplugin( name, description, author, url, __DATE__" "__TIME__, initializer );
    00128
    00129 #if defined(QT_VERSION) || defined(MB_USE_QT)
    00130     // Avoid X11's define clash.
    00131     #include "MudBoxX11Clean.h"
    00132
    00133     //#if QT_VERSION < 0x040200
    00134     //  #error "Mudbox SDK needs Qt version 4.2 or later. Update your Qt or if you dont want custom widgets include mudbox.h before the Qt headers."
    00135     //#endif
    00136     #include <QtCore/QString>
    00137     #include <QtGui/QLabel>
    00138     #include <QtCore/QFileInfoList>
    00139 #endif
    00140
    00141 // get rid of win32 api hacks
    00142 #undef MessageBox
    00143
    00144 #ifndef _MSC_VER
    00145 #ifndef __forceinline
    00146 #define __forceinline inline
    00147 #endif
    00148 #endif
    00149
    00150 #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
    00151 // "Microosft C Compiler" and "Intel C Compiler" supports OpenMP
    00152 #define __MUDBOX_HAS_OPENMP_LIB__ 1
    00153 #endif
    00154
    00155 #if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 2)
    00156 // GCC 4.2 supports OpenMP.
    00157 #define __MUDBOX_HAS_OPENMP_LIB__ 1
    00158 #endif
    00159
    00160 class QColor;
    00161 class QImage;
    00162 class QString;
    00163 class QWidget;
    00164 class XMesh;
    00165 class XSubdivisionLevel;
    00166 class Manipulator;
    00167
    00168 namespace mudbox
    00169 {
    00170     class AttributeWidget;
    00171     class BrushOperation;
    00172
    00173     // types
    00174     typedef long long int64;
    00175     typedef unsigned long long uint64;
    00176
    00177     template <typename type> class Array;
    00178     template <typename type> class Store;
    00179
    00180     // functions
    00181     template < typename type >
    00182     inline type Min( type a, type b ) { return a < b ? a : b; };
    00183     template < typename type >
    00184     inline type Max( type a, type b ) { return a > b ? a : b; };
    00185     bool MBDLL_DECL AssertFailed( const char *sSourceFile, int iSourceLine, const char *sCondition, const char *sMessage );
    00186
    00187     float MBDLL_DECL Modf( float value );
    00188 };
    00189
    00190     // classes
    00191 #if defined(JAMBUILD)
    00192     #include <Mudbox/i18n.h>
    00193     #include <Mudbox/error.h>
    00194     #include <Mudbox/array.h>
    00195     #include <Mudbox/node.h>
    00196     #include <Mudbox/stream.h>
    00197     #include <Mudbox/plugin.h>
    00198     #include <Mudbox/treenode.h>
    00199     #include <Mudbox/math.h>
    00200     #include <Mudbox/topology.h>
    00201     #include <Mudbox/layer.h>
    00202     #include <Mudbox/mesh.h>
    00203     #include <Mudbox/preferences.h>
    00204     #include <Mudbox/quadturtle.h>
    00205     #include <Mudbox/tray.h>
    00206     #include <Mudbox/transformation.h>
    00207     #include <Mudbox/image.h>
    00208     #include <Mudbox/imagePlane.h>
    00209     #include <Mudbox/material.h>
    00210     #include <Mudbox/renderer.h>
    00211     #include <Mudbox/subdivision.h>
    00212     #include <Mudbox/geometry.h>
    00213     #include <Mudbox/light.h>
    00214     #include <Mudbox/camera.h>
    00215     #include <Mudbox/curve.h>
    00216     #include <Mudbox/scene.h>
    00217     #include <Mudbox/interface.h>
    00218     #include <Mudbox/kernel.h>
    00219     #include <Mudbox/importexport.h>
    00220     #include <Mudbox/operation.h>
    00221     #include <Mudbox/viewport.h>
    00222     #include <Mudbox/selectionset.h>
    00223     #include <Mudbox/nurbs.h>
    00224     #include <Mudbox/brush.h>
    00225     #include <Mudbox/brushmask.h>
    00226     #include <Mudbox/ConvolutionKernel.h>
    00227     #include <Mudbox/ImageFilter.h>
    00228     #include <Mudbox/xref.h>
    00229     #include <Mudbox/SSE.h>
    00230     #include <Mudbox/UnitTest.h>
    00231     // #include <Mudbox/UVMapSolver.h>
    00232 #else
    00233     #include "i18n.h"
    00234     #include "error.h"
    00235     #include "array.h"
    00236     #include "node.h"
    00237     #include "stream.h"
    00238     #include "plugin.h"
    00239     #include "treenode.h"
    00240     #include "math.h"
    00241     #include "topology.h"
    00242     #include "layer.h"
    00243     #include "mesh.h"
    00244     #include "preferences.h"
    00245     #include "quadturtle.h"
    00246     #include "tray.h"
    00247     #include "transformation.h"
    00248     #include "image.h"
    00249     #include "imagePlane.h"
    00250     #include "material.h"
    00251     #include "renderer.h"
    00252     #include "subdivision.h"
    00253     #include "geometry.h"
    00254     #include "light.h"
    00255     #include "camera.h"
    00256     #include "curve.h"
    00257     #include "scene.h"
    00258     #include "interface.h"
    00259     #include "kernel.h"
    00260     #include "importexport.h"
    00261     #include "operation.h"
    00262     #include "viewport.h"
    00263     #include "selectionset.h"
    00264     #include "nurbs.h"
    00265     #include "brush.h"
    00266     #include "brushmask.h"
    00267     #include "ConvolutionKernel.h"
    00268     #include "ImageFilter.h"
    00269     #include "xref.h"
    00270     #include "SSE.h"
    00271     #include "UnitTest.h"
    00272     // #include "UVMapSolver.h"
    00273 #endif
    00274
    00275 #ifdef QT_VERSION
    00276 #if defined(JAMBUILD)
    00277 #include <Mudbox/widgets.h>
    00278 #else
    00279 #include "widgets.h"
    00280 #endif
    00281 #endif
    00282
    00283 #ifdef MB_DEBUG
    00284 #define MB_CHECK_GL_ERROR Kernel()->GLCheckError( __FILE__, __FUNCTION__, __LINE__ );
    00285 #define MB_CHECK_GL_STATES Kernel()->GLCheckStates( __FILE__, __FUNCTION__, __LINE__ );
    00286 #define MB_CHECK_CG_ERROR {CGerror error;\
    00287     const char* const lastErrorString = cgGetLastErrorString(&error); \
    00288     if( error != CG_NO_ERROR ) Kernel()->Log(NTRQ("Cg error: '%1'").arg(lastErrorString));}
    00289 #else
    00290 #define MB_CHECK_GL_ERROR
    00291 #define MB_CHECK_GL_STATES
    00292 #define MB_CHECK_CG_ERROR
    00293 #endif
    00294
    00296 #define MB_SDN( a )     if( a ) { delete a; a = 0; };
    00297
    00298 #ifdef PLUGIN
    00299     #undef DLL
    00300     #undef PLUGIN
    00301 #endif
    00302
    00303 #endif