libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moTypes.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moTypes.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 *******************************************************************************/
30 //types definidos
31 #ifndef __MOTYPES_H
32 #define __MOTYPES_H
33 
34 //para evitar warnings sobre funciones obsoletas
35 #pragma once
36 #define _CRT_SECURE_NO_DEPRECATE 1
37 #define _CRT_NONSTDC_NO_DEPRECATE 1
38 
39 /*OS SELECT*/
40 
41 #if defined(__APPLE__)
42 #undef MO_MACOSX
43 #define MO_MACOSX 1
44 #elif defined(macintosh)
45 #undef MO_MACOS
46 #define MO_MACOS 1
47 #endif
48 
49 #if defined(linux) || defined(__linux) || defined(__linux__)
50 #undef MO_LINUX
51 #define MO_LINUX 1
52 #endif
53 
54 #if defined(WIN32) || defined(_WIN32)
55 #undef MO_WIN32
56 #define MO_WIN32 1
57 #endif
58 
59 /*STANDARD LIBRARIES: define here or die*/
60 #ifdef MO_WIN32
61  #ifndef _MSC_VER
62  //atencion, esto se agregó para evitar el conflicto con freeimage en mingw
63  #define NOGDI //comentar esta línea con MinGW64??
64  //#undef _WINDOWS_
65  #define MO_GSTREAMER
66  #define MO_HANDLE HWND
67  #define MO_DISPLAY void*
68 
69  #endif
70 #endif
71 
72 #undef SHADER_CG
73 #define NDEBUG 1
74 
75 
76 #include <math.h>
77 #include <limits.h>
78 #include <iostream>
79 #include <stdio.h>
80 #include <stdlib.h>
81 #include <string.h>
82 #include <float.h>
83 #include <time.h>
84 #include <string.h>
85 #include <vector>
86 #include <fstream>
87 
88 
89 using namespace std;
90 
91 
92 /*MOLDEO SETUP DEFINITIONS*/
93 #ifndef OPENGLESV2
94 #define USE_GL_EXTENSIONS
95 #else
96 #define glFramebufferTexture2DEXT glFramebufferTexture2D
97 #define glCheckFramebufferStatusEXT glCheckFramebufferStatus
98 #define glGenFramebuffersEXT glGenFramebuffers
99 #define glDeleteFramebuffersEXT glDeleteFramebuffers
100 typedef char GLcharARB;
101 typedef unsigned int GLhandleARB;
102 #define glColor4f moColor4f
103 #define glNormal3f moNormal3f
104 #define glColor3f moColor3f
105 #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER
106 #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
107 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
108 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
109 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
110 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT GL_FRAMEBUFFER_UNSUPPORTED
111 #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
112 #define glBindFramebufferEXT glBindFramebuffer
113 #define GL_TEXTURE_RECTANGLE_ARB 0x84F5
114 #define GL_RGBA16F_ARB 0x84F5
115 #define GL_LUMINANCE16F_ARB 0x881E
116 #define GL_RGBA32F_ARB 0x8814
117 #define GL_LUMINANCE32F_ARB 0x8818
118 #define GLEW_EXT_framebuffer_object 1
119 #define GLEW_ARB_multitexture 1
120 #define GLEW_ARB_shader_objects 1
121 #define GLEW_ARB_vertex_shader 1
122 #define GLEW_ARB_fragment_shader 1
123 #define GLEW_ARB_shading_language_100 1
124 #define GLEW_ARB_texture_non_power_of_two 1
125 #define GL_TEXTURE0_ARB GL_TEXTURE0
126 
127 #define GL_VERTEX_SHADER_ARB GL_VERTEX_SHADER
128 #define GL_FRAGMENT_SHADER_ARB GL_FRAGMENT_SHADER
129 #define GL_OBJECT_LINK_STATUS_ARB GL_LINK_STATUS
130 #define glCreateProgramObjectARB glCreateProgram
131 #define glDeleteObjectARB glDeleteShader
132 #define glCreateShaderObjectARB glCreateShader
133 #define glAttachObjectARB glAttachShader
134 #define glDetachObjectARB glDetachShader
135 #define glUseProgramObjectARB glUseProgram
136 #define glGetUniformLocationARB glGetUniformLocation
137 #define glGetAttribLocationARB glGetAttribLocation
138 #define glShaderSourceARB glShaderSource
139 #define glLinkProgramARB glLinkProgram
140 #define glGetObjectParameterivARB glGetShaderiv
141 #define GL_OBJECT_INFO_LOG_LENGTH_ARB GL_INFO_LOG_LENGTH
142 #define glGetInfoLogARB glGetShaderInfoLog
143 #define glCompileShaderARB glCompileShader
144 #define glUniform1fARB glUniform1f
145 #define glUniform2fARB glUniform2f
146 #define glUniform3fARB glUniform3f
147 #define glUniform4fARB glUniform4f
148 #define glUniform1iARB glUniform1i
149 #define glUniform2iARB glUniform2i
150 #define glUniform3iARB glUniform3i
151 #define glUniform4iARB glUniform4i
152 #define glUniformMatrix2fvARB glUniformMatrix2fv
153 #define glUniformMatrix3fvARB glUniformMatrix3fv
154 #define glUniformMatrix4fvARB glUniformMatrix4fv
155 #define glUniform1fvARB glUniform1fv
156 #define glUniform2fvARB glUniform2fv
157 #define glUniform3fvARB glUniform3fv
158 #define glUniform4fvARB glUniform4fv
159 #define glUniform1ivARB glUniform1iv
160 #define glUniform2ivARB glUniform2iv
161 #define glUniform3ivARB glUniform3iv
162 #define glUniform4ivARB glUniform4iv
163 #define glActiveTextureARB glActiveTexture
164 #endif
165 
166 //#define USE_QUICKTIME
167 //#define USE_SDLIMAGE
168 #define USE_FREEIMAGE
169 #define USE_MOTEXT0
170 
171 /*OS DEFINITIONS*/
172 
173 #ifdef MO_WIN32
174  #ifdef LIBMOLDEO_EXPORTS
175  #define LIBMOLDEO_API __declspec(dllexport)
176  #else
177  #define LIBMOLDEO_API __declspec(dllimport)
178  #endif
179 #else
180  #define LIBMOLDEO_API
181 #endif
182 
183 
184 /*OSX*/
185 #ifdef MO_MACOSX
186 
187  //#include <X11/X.h>
188 
189  #define MO_HANDLE void*
190 
191  //revisar esto!!! para Mac OSX
192  #define MO_DISPLAY void*
193  #include "SDL.h"
194  #include "SDL_thread.h"
195  #include "SDL_mutex.h"
196 /*
197  #include "SDL_net.h"
198  #include "SDL_image.h"
199  //#include "QuickTime.h"
200 */
201  #ifdef USE_GL_EXTENSIONS
202  // GLEW provides gl.h, glu.h and glext.h
203  #include <GL/glew.h>
204  #else
205  #include "OpenGL/gl.h"
206  #include "OpenGL/glu.h"
207  #include "OpenGL/glext.h"
208  #endif
209 
210  #include "GLUT/glut.h"
211 
212  #define MO_GSTREAMER 1
213 
214  # ifndef __int64
215  # define __int64 long long
216  # endif
217 
218  # ifndef _int64
219  # define _int64 __int64
220  # endif
221 
222  #define moint64 __int64
223  typedef __int16_t moWord;
224  typedef __int32_t moDWord;
225 
226  #undef assert
227  #define assert(ignore)((void) 0)
228 
229 
230 #endif
231 
232 /*LINUX*/
233 #ifdef MO_LINUX
234 
235  #include "X11/X.h"
236 
237  #define MO_HANDLE Window
238  #define MO_DISPLAY void*
239 
240  #ifdef USE_GL_EXTENSIONS
241  // GLEW provides gl.h, glu.h and glext.h
242  #include <GL/glew.h>
243  #else
244 #ifdef OPENGLESV2
245  //#include <GLES/gl.h>
246  #include <GLES2/gl2.h>
247 #else
248  #include <GL/gl.h>
249  #include <GL/glu.h>
250  #include <GL/glext.h>
251  #include <GL/glut.h>
252 #endif
253  #endif
254 
255 
256 
257  #define MO_GSTREAMER 1
258 
259  # ifndef __int64
260  # define __int64 long long
261  # endif
262 
263  # ifndef _int64
264  # define _int64 __int64
265  # endif
266 
267  #define moint64 __int64
268  typedef __int16_t moWord;
269  typedef __int32_t moDWord;
270 
271  #undef MO_RASPBIAN
272  #define MO_RASPBIAN 1
273 #endif
274 
275 /*WINDOWS*/
276 #ifdef MO_WIN32
277 
278  /*VISUAL C++ COMPILER*/
279  #ifdef _MSC_VER
280 
281  #define MO_HANDLE HWND
282  #define MO_DISPLAY void*
283 
284  #define MO_USING_VC
285  // Microsoft Visual C++ specific pragmas. MSVC6 is version 12.00, MSVC7.0 is
286  // version 13.00, and MSVC7.1 is version 13.10. MSVC8.0 is version 14.00.
287  #if _MSC_VER < 1300
288  #define MO_USING_VC6
289  #elif _MSC_VER < 1310
290  #define MO_USING_VC70
291  #elif _MSC_VER < 1400
292  #define MO_USING_VC71
293  #else
294  #define MO_USING_VC80
295  #endif
296 
297  // Disable the warning "non dll-interface class FOO used as base for
298  // dll-interface class BAR.".
299  //#pragma warning( disable : 4275 )
300 
301  // Disable the warning about truncating the debug names to 255 characters.
302  // This warning shows up often with STL code in MSVC6, but not MSVC7.
303  #pragma warning( disable : 4786 )
304 
305  // This warning is disabled because MSVC6 warns about not finding
306  // implementations for the pure virtual functions that occur in the template
307  // classes 'template <class Real>' when explicitly instantiating the classes.
308  // NOTE: If you create your own template classes that will be explicitly
309  // instantiated, you should re-enable the warning to make sure that in fact
310  // all your member data and functions have been defined and implemented.
311  #pragma warning( disable : 4661 )
312 
313  //#define MO_DIRECTSHOW
314  #define MO_GSTREAMER
315  #undef MO_USING_ALFW
316  //precompiled headers:
317  //#include "StdAfx.h"
318  #endif
319 
320  #define WIN32_LEAN_AND_MEAN
321  #include <windows.h>
322 /*
323  #include <SDL.h>
324  #include <SDL_thread.h>
325  #include <SDL_mutex.h>
326  #include <SDL_syswm.h>
327 */
328  #ifdef USE_QUICKTIME
329  //#define TARGET_API_MAC_CARBON 0
330  //#define TARGET_OS_WIN32 1
331  //#define TARGET_CPU_X86 1
332  //#define FUNCTION_DECLSPEC 1
333  //#define FUNCTION_WIN32CC 1
334  //#define PHYSICAL_ADDRESS LARGE_INTEGER
335  #endif
336 
337  #ifdef USE_GL_EXTENSIONS
338  // GLEW provides gl.h, glu.h and glext.h
339  #include <GL/glew.h>
340  #else
341  #include "GL/gl.h"
342  #include "GL/glu.h"
343  #include "GL/glext.h"
344  #endif
345 
346  //#define GLUT_DISABLE_ATEXIT_HACK
347  //#include "GL/glut.h"
348 
349  //basetyps.h
350  # ifndef _int64
351  # define _int64 __int64
352  # endif
353 
354  #define moint64 __int64
355  typedef __int16 moWord;
356  typedef __int32 moDWord;
357 
358  //#define assert(X) {}
359 #endif
360 
361 
362 
363 /*CONSTANTS DEFINITIONS*/
364 #define MO_PI 3.1415926535897932384626433832795f
365 #define MO_ON 1
366 #define MO_OFF -1
367 #define MO_ACTIVATED 1
368 #define MO_DEACTIVATED -1
369 #define MO_FALSE 0
370 #define MO_TRUE 1
371 #define MO_PRESSED 1
372 #define MO_PULSED 1
373 #define MO_RELEASED 0
374 
375 #define MO_SUCCESS 0
376 #define MO_NOERROR 0
377 #define MO_ERROR 65535
378 #define MO_FAIL 65535
379 #define MO_UNDEFINED -1
380 
381 #define MO_MAX_DEBUG 4096
382 #define MO_MAX_TEXTURAS 512
383 #define MO_MAX_MODELOS 256
384 
385 #define MOboolean unsigned int
386 #define MOswitch signed char
387 #define MOuint unsigned int
388 #define MOint int
389 #define MOint64 moint64
390 #define MOuint64 unsigned moint64
391 #define MOlong long
392 #define MOulong unsigned long
393 #define MOlonglong moint64
394 #define MOulonglong unsigned moint64
395 #define MOword moWord
396 #define MOdword moDWord
397 #define MOchar char
398 #define MOuchar unsigned char
399 #define MOubyte unsigned char
400 #define MObyte char
401 #define MOshort short
402 #define MOushort unsigned short
403 #define MOfloat float
404 #define MOdouble double
405 #define MOtexture unsigned int
406 #define MOefectoid unsigned int
407 
408 
409 #define MOpointer void*
410 
411 #define MOaccion int
412 #define MOdevcode int
413 
414 #define MO_DEF_SCREEN_WIDTH 800
415 #define MO_DEF_SCREEN_HEIGHT 600
416 #define MO_DEF_RENDER_WIDTH 800
417 #define MO_DEF_RENDER_HEIGHT 600
418 #define MO_DEF_SCREEN_DEPTH 32
419 
420 #define MO_RENDER_TEX 0
421 #define MO_SCREEN_TEX 1
422 #define MO_EFFECTS_TEX 2
423 #define MO_FINAL_TEX 3
424 
425 //3D STEREOSCOPIC RENDER
426 #define MO_LEFT_TEX 4
427 #define MO_RIGHT_TEX 5
428 
429 
430 #define MO_MAX_PRESETS 9
431 #define MO_DEBUG
432 
433 #define OLD_CONFIG 0
434 
435 
437 // Parametros mas comunes usados en varios Effects ///
439 
440 #ifndef MO_RED
441 #define MO_RED 0
442 #define MO_GREEN 1
443 #define MO_BLUE 2
444 #define MO_ALPHA 3
445 #endif
446 
448 
464 };
465 
467 
477 };
478 
480 
488 };
489 
491 
493 // Linux compatibility ///
495 
496 #ifdef MO_LINUX
497 //# include "port/getc.h"
498 //# include "port/itoa.h"
499 //# include "port/ptypes.h"
500 # include "moPort.h"
501 #endif
502 
503 #ifdef MO_MACOSX
504 //# include "port/getc.h"
505 //# include "port/itoa.h"
506 //# include "port/ptypes.h"
508 #define stricmp strcasecmp
509 #endif
510 
512 
515 LIBMOLDEO_API void HSVtoRGB(short,short,short,float*,float*,float*);
516 LIBMOLDEO_API void moColor4f(float r, float g, float b, float a);
517 LIBMOLDEO_API void moNormal3f(float x, float y, float z);
518 LIBMOLDEO_API void moColor3f(float r, float g, float b);
519 
521 
535 };
536 
538 
544  public:
545  GLenum target;
547  GLint min_filter;
548  GLint mag_filter;
549  GLint wrap_s;
550  GLint wrap_t;
551 };
552 
553 
555 
563 {
564  GL_TEXTURE_2D,
565  GL_RGBA,
566  GL_LINEAR,
567  GL_LINEAR,
568  GL_REPEAT,
569  GL_REPEAT
570 };
571 
572 
574 
581 {
582  0,
583  MO_UNDEFINED,
584  MO_UNDEFINED,
585  MO_UNDEFINED,
586  MO_UNDEFINED,
587  MO_UNDEFINED
588 };
589 
590 
592 
595 #include "moText.h"
597 
599 
602 #ifndef momax
603 #define momax(a,b) (((a) > (b)) ? (a) : (b))
604 #define momin(a,b) (((a) < (b)) ? (a) : (b))
605 #endif
606 
607 #endif
608 
GLint mag_filter
Definition: moTypes.h:548
Parámetros internos de una textura.
Definition: moTypes.h:543
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
sólo líneas
Definition: moTypes.h:475
aditivo por color
Definition: moTypes.h:460
moStereoSides
Modo estereoscópico.
Definition: moTypes.h:484
GLint internal_format
Definition: moTypes.h:546
sustracción
Definition: moTypes.h:462
#define MO_UNDEFINED
Definition: moTypes.h:379
LIBMOLDEO_API MOint moRand(MOint)
Definition: moTypes.cpp:41
Recursos de datos, objetos, imágenes, videos y funcionalidades múltiples.
Definition: moTypes.h:533
LIBMOLDEO_API moText moGetVersionStr()
Devuelve la versión de libmoldeo.
Definition: moTypes.cpp:159
LIBMOLDEO_API void moColor4f(float r, float g, float b, float a)
Definition: moTypes.cpp:165
Objeto dibujable, efecto-maestro ( puede controlar otros efectos )
Definition: moTypes.h:531
const moTexParam MODefTex2DParams
Parámetros internos predeterminados de una textura.
Definition: moTypes.h:562
saturación
Definition: moTypes.h:463
GLint wrap_t
Definition: moTypes.h:550
Objeto indefinido.
Definition: moTypes.h:527
#define LIBMOLDEO_API
Definition: moTypes.h:180
#define MOfloat
Definition: moTypes.h:403
clase de para manejar textos
Definition: moText.h:75
aditivo según transparencia
Definition: moTypes.h:456
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
Definition: moTypes.h:532
LIBMOLDEO_API void moNormal3f(float x, float y, float z)
Definition: moTypes.cpp:169
LIBMOLDEO_API MOfloat morand()
Definition: moTypes.cpp:36
LIBMOLDEO_API void moColor3f(float r, float g, float b)
Definition: moTypes.cpp:173
#define MOint
Definition: moTypes.h:388
Objeto dibujable, pre-efecto ( primeros efectos en el orden de dibujado )
Definition: moTypes.h:529
Objeto dibujable, efecto ( efectos en el orden de dibujado )
Definition: moTypes.h:528
multipliación
Definition: moTypes.h:458
GLint wrap_s
Definition: moTypes.h:549
const moTexParam MOUndefinedTex
Parámetros internos predeterminados de una textura no identificados.
Definition: moTypes.h:580
Objeto principal de administración y dibujado de objetos de Moldeo.
Definition: moTypes.h:534
GLenum target
Definition: moTypes.h:545
GLint min_filter
Definition: moTypes.h:547
transparencia
Definition: moTypes.h:455
sólo puntos
Definition: moTypes.h:476
LIBMOLDEO_API void HSVtoRGB(short, short, short, float *, float *, float *)
Definition: moTypes.cpp:51
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
Definition: moTypes.h:530
exclusión
Definition: moTypes.h:459
moPolygonModes
Modos de dibujado de polígonos.
Definition: moTypes.h:472
moBlendingModes
Modos de combinación
Definition: moTypes.h:453