Mudbox/mudbox.h Source File

mudbox.h
Go to the documentation of this file.
1 
2 //**************************************************************************/
3 // Copyright (c) 2008 Autodesk, Inc.
4 // All rights reserved.
5 //
6 // Use of this software is subject to the terms of the Autodesk license
7 // agreement provided at the time of installation or download, or which
8 // otherwise accompanies this software in either electronic or hard copy form.
9 //
10 //**************************************************************************/
11 // DESCRIPTION:
12 // CREATED: October 2008
13 //**************************************************************************/
14 
15 #ifndef __MUDBOXSDK_MUDBOX_H__
16 #define __MUDBOXSDK_MUDBOX_H__
17 
18 #pragma once
19 
20 #ifdef _WIN32
21 #pragma warning( disable : 4251 )
22 #endif
23 /*****
24  * System headers
25  *
26  * Usage:
27  * - Ensure size_t is defined properly.
28  */
29 #include <stdlib.h>
30 #include <stdio.h>
31 #ifdef _WIN32
32 #include <intrin.h>
33 #endif
34 
35 #if defined(JAMBUILD)
36 #include <Mudbox/dllinterface.h>
37 #else
38 #include "dllinterface.h"
39 #endif
40 
41 // defines
42 #ifdef _DEBUG
43 #ifndef MB_DEBUG
44 #define MB_DEBUG
45 #endif
46 #endif
47 
48 // version info, short & simple for, similar to Qt version info
49 #define MB_SDK_VERSION_STRING "7.0.0"
50 
51 // MB_SDK_VERSION is (major << 16) + (minor << 8) + patch.
52 //
53 // Each pair of #s after the x represent a version # (major, minor, patch).
54 // Hexadecimal is the base and each digit represents 4 bits, so 16 different
55 // combinations. So since the version takes up 2 digits = 8 bits = 256 possible
56 // versions for each group.
57 #define MB_SDK_VERSION 0x00070000
58 // can be used like #if (MB_SDK_VERSION >= MB_SDK_VERSION_CHECK(1, 1, 0))
59 #define MB_SDK_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
60 
61 // Starting with Mudbox 2013, we will be incrementing the major version with
62 // each annual release and the minor version with each interim release between
63 // annual ones. We don't expect to change the patch number.
64 
65 #ifndef MB_ASSERT
66  #if defined(MB_DEBUG)
67  #if defined(_WIN32)
68  #define MB_ASSERT( condition ) { static bool bShow = true; if (!(condition)&&mudbox::AssertFailed( __FILE__, __LINE__, #condition, "", &bShow )) __debugbreak(); }
69  #else
70  #define MB_ASSERT( condition ) { static bool bShow = true; if (!(condition)) mudbox::AssertFailed( __FILE__, __LINE__, #condition, "", &bShow); }
71  #endif
72  #else
73  #define MB_ASSERT( condition ) {}
74  #endif
75 #endif
76 #ifndef MB_VERIFY
77  #ifdef MB_DEBUG
78  #define MB_VERIFY( condition ) MB_ASSERT( condition )
79  #else
80  #define MB_VERIFY( condition ) { bool b___ = condition; b___; }
81  #endif
82 #endif
83 
84 
85 #ifndef MB_VERIFY_EQ
86  #ifdef MB_DEBUG
87  #define MB_VERIFY_EQ( condition_, value_ ) MB_ASSERT( (condition_) == (value_) )
88  #else
89  #define MB_VERIFY_EQ( condition_, value_ ) (condition_)
90  #endif
91 #endif
92 
93 #ifndef MB_VERIFY_TRUE
94  #ifdef MB_DEBUG
95  #define MB_VERIFY_TRUE( condition_ ) MB_ASSERT( (condition_) )
96  #else
97  #define MB_VERIFY_TRUE( condition_ ) (condition_)
98  #endif
99 #endif
100 
101 #define MB_ONBUG( condition ) MB_ASSERT( !(condition) ); if ( condition )
102 #define MB_SAFELY( condition ) MB_ASSERT( condition ); if ( condition )
103 
104 #ifndef MB_DEBUG
105 #define QT_NO_DEBUG_OUTPUT
106 #endif
107 
108 #if defined( MB_TEST ) || defined( MB_DEBUG )
109 
110 #if defined(_MSC_VER)
111 #define MB_TIMER( name ) static int ____iTimerIndex = -1; mudbox::Timer ____cTimer( __FUNCTION__" - "##name, ____iTimerIndex );
112 #else
113 #define MB_TIMER( name ) static int ____iTimerIndex = -1; mudbox::Timer ____cTimer( __FILE__ " - " name, ____iTimerIndex );
114 #endif
115 
116 #else
117 #define MB_TIMER( name ) ;
118 #endif
119 #if defined(__GNUC__)
120 #define MB_ERROR throw (new mudbox::Error( "", mudbox::Error::codeUnspecified, __PRETTY_FUNCTION__, __FILE__, __LINE__ ))->Format
121 #define MB_ERRORQ(s) throw new mudbox::Error( s, mudbox::Error::codeUnspecified, __PRETTY_FUNCTION__, __FILE__, __LINE__ )
122 #else
123 #define MB_ERROR throw (new mudbox::Error( "", mudbox::Error::codeUnspecified, __FUNCTION__, __FILE__, __LINE__ ))->Format
124 #define MB_ERRORQ(s) throw new mudbox::Error( s, mudbox::Error::codeUnspecified, __FUNCTION__, __FILE__, __LINE__ )
125 #endif
126 
127 #define MB_PLUGIN( name, description, author, url, initializer ) mudbox::Plugin __myplugin( name, description, author, url, __DATE__" "__TIME__, initializer );
128 
129 #if defined(QT_VERSION) || defined(MB_USE_QT)
130  // Avoid X11's define clash.
131  #include "MudBoxX11Clean.h"
132 
133  //#if QT_VERSION < 0x040200
134  // #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."
135  //#endif
136  #include <QtCore/QString>
137  #include <QtGui/QLabel>
138  #include <QtCore/QFileInfoList>
139 #endif
140 
141 // get rid of win32 api hacks
142 #undef MessageBox
143 
144 #ifndef _MSC_VER
145 #ifndef __forceinline
146 #define __forceinline inline
147 #endif
148 #endif
149 
150 #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
151 // "Microosft C Compiler" and "Intel C Compiler" supports OpenMP
152 #define __MUDBOX_HAS_OPENMP_LIB__ 1
153 #endif
154 
155 #if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 2)
156 // GCC 4.2 supports OpenMP.
157 #define __MUDBOX_HAS_OPENMP_LIB__ 1
158 #endif
159 
160 class QMenu;
161 class QColor;
162 class QImage;
163 class QString;
164 class QWidget;
165 class QAction;
166 class XMesh;
167 class XSubdivisionLevel;
168 class Manipulator;
169 
170 namespace mudbox
171 {
172  class AttributeWidget;
174 
175  // types
176  typedef long long int64;
177  typedef unsigned long long uint64;
178 
179  template <typename type> class Array;
180  template <typename type> class Store;
181 
182  // functions
183  template < typename type >
184  inline type Min( type a, type b ) { return a < b ? a : b; };
185  template < typename type >
186  inline type Max( type a, type b ) { return a > b ? a : b; };
187  bool MBDLL_DECL AssertFailed( const char *sSourceFile, int iSourceLine, const char *sCondition, const char *sMessage, bool *bShow );
188 
189  float MBDLL_DECL Modf( float value );
190 };
191 
192  // classes
193 #if defined(JAMBUILD)
194  #include <Mudbox/i18n.h>
195  #include <Mudbox/error.h>
196  #include <Mudbox/array.h>
197  #include <Mudbox/node.h>
198  #include <Mudbox/stream.h>
199  #include <Mudbox/plugin.h>
200  #include <Mudbox/treenode.h>
201  #include <Mudbox/math.h>
202  #include <Mudbox/topology.h>
203  #include <Mudbox/layer.h>
204  #include <Mudbox/mesh.h>
205  #include <Mudbox/preferences.h>
206  #include <Mudbox/quadturtle.h>
207  #include <Mudbox/tray.h>
208  #include <Mudbox/transformation.h>
209  #include <Mudbox/image.h>
210  #include <Mudbox/imagePlane.h>
211  #include <Mudbox/material.h>
212  #include <Mudbox/renderer.h>
213  #include <Mudbox/subdivision.h>
214  #include <Mudbox/geometry.h>
215  #include <Mudbox/light.h>
216  #include <Mudbox/camera.h>
217  #include <Mudbox/curve.h>
218  #include <Mudbox/scene.h>
219  #include <Mudbox/interface.h>
220  #include <Mudbox/kernel.h>
221  #include <Mudbox/importexport.h>
222  #include <Mudbox/operation.h>
223  #include <Mudbox/generaloperations.h>
224  #include <Mudbox/viewport.h>
225  #include <Mudbox/selectionset.h>
226  #include <Mudbox/nurbs.h>
227  #include <Mudbox/brush.h>
228  #include <Mudbox/brushmask.h>
229  #include <Mudbox/ConvolutionKernel.h>
230  #include <Mudbox/ImageFilter.h>
231  #include <Mudbox/xref.h>
232  #include <Mudbox/SSE.h>
233  #include <Mudbox/UnitTest.h>
234  // #include <Mudbox/UVMapSolver.h>
235 #else
236  #include "i18n.h"
237  #include "error.h"
238  #include "array.h"
239  #include "node.h"
240  #include "stream.h"
241  #include "plugin.h"
242  #include "treenode.h"
243  #include "math.h"
244  #include "topology.h"
245  #include "layer.h"
246  #include "mesh.h"
247  #include "preferences.h"
248  #include "quadturtle.h"
249  #include "tray.h"
250  #include "transformation.h"
251  #include "image.h"
252  #include "imagePlane.h"
253  #include "material.h"
254  #include "renderer.h"
255  #include "subdivision.h"
256  #include "geometry.h"
257  #include "light.h"
258  #include "camera.h"
259  #include "curve.h"
260  #include "scene.h"
261  #include "interface.h"
262  #include "kernel.h"
263  #include "importexport.h"
264  #include "operation.h"
265  #include "generaloperations.h"
266  #include "viewport.h"
267  #include "selectionset.h"
268  #include "nurbs.h"
269  #include "brush.h"
270  #include "brushmask.h"
271  #include "ConvolutionKernel.h"
272  #include "ImageFilter.h"
273  #include "xref.h"
274  #include "SSE.h"
275  #include "UnitTest.h"
276  // #include "UVMapSolver.h"
277 #endif
278 
279 #ifdef QT_VERSION
280 #if defined(JAMBUILD)
281 #include <Mudbox/widgets.h>
282 #else
283 #include "widgets.h"
284 #endif
285 #endif
286 
287 #ifdef MB_DEBUG
288 #define MB_CHECK_GL_ERROR Kernel()->GLCheckError( __FILE__, __FUNCTION__, __LINE__ );
289 #define MB_CHECK_GL_STATES Kernel()->GLCheckStates( __FILE__, __FUNCTION__, __LINE__ );
290 #define MB_CHECK_CG_ERROR {CGerror error;\
291  const char* const lastErrorString = cgGetLastErrorString(&error); \
292  if( error != CG_NO_ERROR ) Kernel()->Log(NTRQ("Cg error: '%1'").arg(lastErrorString));}
293 #else
294 #define MB_CHECK_GL_ERROR
295 #define MB_CHECK_GL_STATES
296 #define MB_CHECK_CG_ERROR
297 #endif
298 
300 #define MB_SDN( a ) if( a ) { delete a; a = 0; };
301 
302 #ifdef PLUGIN
303  #undef DLL
304  #undef PLUGIN
305 #endif
306 
307 #endif
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
Simple array class.
Definition: array.h:334
Definition: qcolor.h:67
type Min(type a, type b)
Definition: mudbox.h:184
unsigned long long uint64
Definition: mudbox.h:177
long long int64
Definition: mudbox.h:173
An internal helper class, representing an array. Use the Store class instead.
Definition: array.h:65
Definition: qimage.h:87
Definition: qmenu.h:72
GLubyte GLubyte b
Definition: GLee.h:5404
GLsizei const GLfloat * value
Definition: GLee.h:1742
float MBDLL_DECL Modf(float value)
bool MBDLL_DECL AssertFailed(const char *sSourceFile, int iSourceLine, const char *sCondition, const char *sMessage, bool *bShow)
Class: ConvolutionKernel.
Definition: array.h:15
GLubyte GLubyte GLubyte a
Definition: GLee.h:5404
The BrushOperation class is the base class for brush functionality.
Definition: brush.h:267
type Max(type a, type b)
Definition: mudbox.h:186
#define MBDLL_DECL
Definition: dllinterface.h:35