1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphics_plat/m3g_core_api/inc/M3G/m3g_core.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1013 @@
1.4 +/*
1.5 +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: M3G core API public interface
1.18 +*
1.19 +*/
1.20 +
1.21 +#ifndef __M3G_CORE_H__
1.22 +#define __M3G_CORE_H__
1.23 +
1.24 +#if defined(__cplusplus)
1.25 +extern "C" {
1.26 +#endif
1.27 +
1.28 +/*!
1.29 + * \file
1.30 + * \brief Public interface to the M3G core library
1.31 + *
1.32 + * This can be overlaid by an additional layer providing the actual
1.33 + * API for different languages; for the JSR184 API, this is the Java
1.34 + * binding layer.
1.35 + */
1.36 +
1.37 +#if (__ARMCC_VERSION >= 220000)
1.38 +# if defined(M3G_BUILD_DLL)
1.39 +# define M3G_API __declspec(dllexport)
1.40 +# else
1.41 +# define M3G_API __declspec(dllimport)
1.42 +# endif
1.43 +#else
1.44 +# if defined(M3G_BUILD_DLL)
1.45 +# define M3G_API __declspec(dllexport)
1.46 +# else
1.47 +# define M3G_API
1.48 +# endif
1.49 +#endif
1.50 +
1.51 +/*----------------------------------------------------------------------
1.52 + * Enumerated constants
1.53 + *--------------------------------------------------------------------*/
1.54 +
1.55 +/*javax.microedition.m3g.AnimationTrack*/
1.56 +#define M3G_ANIM_ALPHA 256
1.57 +#define M3G_ANIM_AMBIENT_COLOR 257
1.58 +#define M3G_ANIM_COLOR 258
1.59 +#define M3G_ANIM_CROP 259
1.60 +#define M3G_ANIM_DENSITY 260
1.61 +#define M3G_ANIM_DIFFUSE_COLOR 261
1.62 +#define M3G_ANIM_EMISSIVE_COLOR 262
1.63 +#define M3G_ANIM_FAR_DISTANCE 263
1.64 +#define M3G_ANIM_FIELD_OF_VIEW 264
1.65 +#define M3G_ANIM_INTENSITY 265
1.66 +#define M3G_ANIM_MORPH_WEIGHTS 266
1.67 +#define M3G_ANIM_NEAR_DISTANCE 267
1.68 +#define M3G_ANIM_ORIENTATION 268
1.69 +#define M3G_ANIM_PICKABILITY 269
1.70 +#define M3G_ANIM_SCALE 270
1.71 +#define M3G_ANIM_SHININESS 271
1.72 +#define M3G_ANIM_SPECULAR_COLOR 272
1.73 +#define M3G_ANIM_SPOT_ANGLE 273
1.74 +#define M3G_ANIM_SPOT_EXPONENT 274
1.75 +#define M3G_ANIM_TRANSLATION 275
1.76 +#define M3G_ANIM_VISIBILITY 276
1.77 +
1.78 +/*javax.microedition.m3g.Background*/
1.79 +#define M3G_BORDER 32
1.80 +#define M3G_REPEAT 33
1.81 +
1.82 +/*javax.microedition.m3g.Camera*/
1.83 +#define M3G_GENERIC 48
1.84 +#define M3G_PARALLEL 49
1.85 +#define M3G_PERSPECTIVE 50
1.86 +
1.87 +/*javax.microedition.m3g.CompositingMode*/
1.88 +#define M3G_ALPHA_BLEND 64
1.89 +#define M3G_ALPHA_ADD 65
1.90 +#define M3G_MODULATE 66
1.91 +#define M3G_MODULATE_X2 67
1.92 +#define M3G_REPLACE 68
1.93 +
1.94 +/*javax.microedition.m3g.Fog*/
1.95 +#define M3G_EXPONENTIAL_FOG 80
1.96 +#define M3G_LINEAR_FOG 81
1.97 +
1.98 +/*javax.microedition.m3g.Graphics3D*/
1.99 +#define M3G_ANTIALIAS_BIT 2
1.100 +#define M3G_DITHER_BIT 4
1.101 +#define M3G_TRUECOLOR_BIT 8
1.102 +#define M3G_OVERWRITE_BIT 16
1.103 +
1.104 +/*javax.microedition.m3g.Image2D*/
1.105 +typedef enum
1.106 +{
1.107 + M3G_ALPHA = 96,
1.108 + M3G_LUMINANCE = 97,
1.109 + M3G_LUMINANCE_ALPHA = 98,
1.110 + M3G_RGB = 99,
1.111 + M3G_RGBA = 100
1.112 +} M3GImageFormat;
1.113 +
1.114 +/*javax.microedition.m3g.KeyframeSequence*/
1.115 +#define M3G_LINEAR 176
1.116 +#define M3G_SLERP 177
1.117 +#define M3G_SPLINE 178
1.118 +#define M3G_SQUAD 179
1.119 +#define M3G_STEP 180
1.120 +#define M3G_CONSTANT 192
1.121 +#define M3G_LOOP 193
1.122 +
1.123 +/*javax.microedition.m3g.Light*/
1.124 +#define M3G_AMBIENT 128
1.125 +#define M3G_DIRECTIONAL 129
1.126 +#define M3G_OMNI 130
1.127 +#define M3G_SPOT 131
1.128 +
1.129 +/*javax.microedition.m3g.Material*/
1.130 +#define M3G_AMBIENT_BIT 1024
1.131 +#define M3G_DIFFUSE_BIT 2048
1.132 +#define M3G_EMISSIVE_BIT 4096
1.133 +#define M3G_SPECULAR_BIT 8192
1.134 +
1.135 +/*javax.microedition.m3g.Node*/
1.136 +#define M3G_NONE 144
1.137 +#define M3G_ORIGIN 145
1.138 +#define M3G_X_AXIS 146
1.139 +#define M3G_Y_AXIS 147
1.140 +#define M3G_Z_AXIS 148
1.141 +
1.142 +/*javax.microedition.m3g.Object3D*/
1.143 +typedef enum {
1.144 + M3G_CLASS_ANIMATION_CONTROLLER = 1,
1.145 + M3G_CLASS_ANIMATION_TRACK = 2,
1.146 + M3G_CLASS_APPEARANCE = 3,
1.147 + M3G_CLASS_BACKGROUND = 4,
1.148 + M3G_CLASS_CAMERA = 5,
1.149 + M3G_CLASS_COMPOSITING_MODE = 6,
1.150 + M3G_CLASS_FOG = 7,
1.151 + M3G_CLASS_GROUP = 8,
1.152 + M3G_CLASS_IMAGE = 9,
1.153 + M3G_CLASS_INDEX_BUFFER = 10,
1.154 + M3G_CLASS_KEYFRAME_SEQUENCE = 11,
1.155 + M3G_CLASS_LIGHT = 12,
1.156 + M3G_CLASS_LOADER = 13,
1.157 + M3G_CLASS_MATERIAL = 14,
1.158 + M3G_CLASS_MESH = 15,
1.159 + M3G_CLASS_MORPHING_MESH = 16,
1.160 + M3G_CLASS_POLYGON_MODE = 17,
1.161 + M3G_CLASS_RENDER_CONTEXT = 18,
1.162 + M3G_CLASS_SKINNED_MESH = 19,
1.163 + M3G_CLASS_SPRITE = 20,
1.164 + M3G_CLASS_TEXTURE = 21,
1.165 + M3G_CLASS_VERTEX_ARRAY = 22,
1.166 + M3G_CLASS_VERTEX_BUFFER = 23,
1.167 + M3G_CLASS_WORLD = 24,
1.168 + /* extra enumeration used for abstract classes */
1.169 + M3G_ABSTRACT_CLASS = 0
1.170 +} M3GClass;
1.171 +
1.172 +/*javax.microedition.m3g.PolygonMode*/
1.173 +#define M3G_CULL_BACK 160
1.174 +#define M3G_CULL_FRONT 161
1.175 +#define M3G_CULL_NONE 162
1.176 +#define M3G_SHADE_FLAT 164
1.177 +#define M3G_SHADE_SMOOTH 165
1.178 +#define M3G_WINDING_CCW 168
1.179 +#define M3G_WINDING_CW 169
1.180 +
1.181 +/*javax.microedition.m3g.Texture2D*/
1.182 +#define M3G_FILTER_BASE_LEVEL 208
1.183 +#define M3G_FILTER_LINEAR 209
1.184 +#define M3G_FILTER_NEAREST 210
1.185 +#define M3G_FUNC_ADD 224
1.186 +#define M3G_FUNC_BLEND 225
1.187 +#define M3G_FUNC_DECAL 226
1.188 +#define M3G_FUNC_MODULATE 227
1.189 +#define M3G_FUNC_REPLACE 228
1.190 +#define M3G_WRAP_CLAMP 240
1.191 +#define M3G_WRAP_REPEAT 241
1.192 +
1.193 +/*javax.microedition.m3g.Defs*/
1.194 +#define M3G_GET_POSITIONS 0
1.195 +#define M3G_GET_NORMALS 1
1.196 +#define M3G_GET_COLORS 2
1.197 +#define M3G_GET_TEXCOORDS0 3
1.198 +#define M3G_GET_CROPX 0
1.199 +#define M3G_GET_CROPY 1
1.200 +#define M3G_GET_CROPWIDTH 2
1.201 +#define M3G_GET_CROPHEIGHT 3
1.202 +#define M3G_GET_MODEX 0
1.203 +#define M3G_GET_MODEY 1
1.204 +#define M3G_SETGET_COLORCLEAR 0
1.205 +#define M3G_SETGET_DEPTHCLEAR 1
1.206 +#define M3G_GET_NEAR 0
1.207 +#define M3G_GET_FAR 1
1.208 +#define M3G_SETGET_RENDERING 0
1.209 +#define M3G_SETGET_PICKING 1
1.210 +#define M3G_GET_CONSTANT 0
1.211 +#define M3G_GET_LINEAR 1
1.212 +#define M3G_GET_QUADRATIC 2
1.213 +
1.214 +/*--------------------------------------------------------------------*/
1.215 +/* Object usage flag bits
1.216 + *
1.217 + * Currently only used for Image
1.218 + */
1.219 +
1.220 +/*! \brief Specifies that an object can be written to at any time */
1.221 +#define M3G_DYNAMIC 0x0001
1.222 +/*! \brief Specifies that an object can only be written to prior to
1.223 + * its first use (default) */
1.224 +#define M3G_STATIC 0x0002
1.225 +/*! \brief Specifies that an Image can be rendered to (implies
1.226 + * M3G_DYNAMIC) */
1.227 +#define M3G_RENDERING_TARGET 0x0004
1.228 +/*!
1.229 + * \brief Specifies that an Image is paletted
1.230 + */
1.231 +#define M3G_PALETTED 0x0008
1.232 +
1.233 +
1.234 +/*--------------------------------------------------------------------*/
1.235 +/* Buffer bit constants */
1.236 +#define M3G_COLOR_BUFFER_BIT 0x0001
1.237 +#define M3G_DEPTH_BUFFER_BIT 0x0002
1.238 +#define M3G_STENCIL_BUFFER_BIT 0x0004
1.239 +#define M3G_MULTISAMPLE_BUFFER_BIT 0x0008
1.240 +
1.241 +/*--------------------------------------------------------------------*/
1.242 +/* Pixel (output/texture) formats
1.243 + */
1.244 +typedef enum {
1.245 + M3G_L8,
1.246 + M3G_A8,
1.247 + M3G_LA8,
1.248 + M3G_LA4,
1.249 + M3G_RGB8,
1.250 + M3G_RGB8_32,
1.251 + M3G_BGR8_32,
1.252 + M3G_RGB4,
1.253 + M3G_RGB565,
1.254 + M3G_RGBA8,
1.255 + M3G_BGRA8,
1.256 + M3G_ARGB8,
1.257 + M3G_RGBA4,
1.258 + M3G_RGB5A1,
1.259 + M3G_PALETTE8_RGB8,
1.260 + M3G_PALETTE8_RGB8_32,
1.261 + M3G_PALETTE8_RGBA8,
1.262 + M3G_NO_FORMAT
1.263 +} M3GPixelFormat;
1.264 +
1.265 +/* Errors */
1.266 +typedef enum {
1.267 + M3G_NO_ERROR = 0x00,
1.268 + M3G_INVALID_VALUE,
1.269 + M3G_INVALID_ENUM,
1.270 + M3G_INVALID_OPERATION,
1.271 + M3G_INVALID_OBJECT,
1.272 + M3G_INVALID_INDEX,
1.273 + M3G_OUT_OF_MEMORY,
1.274 + M3G_NULL_POINTER,
1.275 + M3G_ARITHMETIC_ERROR,
1.276 + M3G_IO_ERROR
1.277 +} M3GError;
1.278 +
1.279 +/* Supported types of rendering primitives
1.280 + *
1.281 + * These match GL enums directly.
1.282 + */
1.283 +typedef enum {
1.284 + M3G_TRIANGLE_STRIPS = 0x05
1.285 + /*M3G_TRIANGLES,
1.286 + M3G_TRIANGLE_FANS*/
1.287 +} M3Gprimitive;
1.288 +
1.289 +/*--------------------------------------------------------------------*/
1.290 +/*! \brief Supported input data types
1.291 + *
1.292 + * These can be converted to/from OpengGL type enums by adding 0x1400.
1.293 + */
1.294 +typedef enum {
1.295 + M3G_BYTE = 0x00,
1.296 + M3G_UBYTE,
1.297 + M3G_SHORT,
1.298 + M3G_USHORT,
1.299 + M3G_INT,
1.300 + M3G_UINT,
1.301 + M3G_FLOAT
1.302 +} M3Gdatatype;
1.303 +
1.304 +/*--------------------------------------------------------------------*/
1.305 +/*! \brief Profiling statistics */
1.306 +typedef enum {
1.307 + M3G_STAT_CULLING_TESTS,
1.308 + M3G_STAT_FLOPS,
1.309 + M3G_STAT_MEMORY_ALLOCS,
1.310 + M3G_STAT_MEMORY_LOCKS,
1.311 + M3G_STAT_RENDER_NODES,
1.312 + M3G_STAT_RENDER_NODES_CULLED,
1.313 + M3G_STAT_RENDER_NODES_DRAWN,
1.314 + M3G_STAT_TCACHE_COMPOSITE_COLLISIONS,
1.315 + M3G_STAT_TCACHE_COMPOSITE_HITS,
1.316 + M3G_STAT_TCACHE_COMPOSITE_INSERTS,
1.317 + M3G_STAT_TCACHE_COMPOSITE_MISSES,
1.318 + M3G_STAT_TCACHE_PATH_COLLISIONS,
1.319 + M3G_STAT_TCACHE_PATH_FLUSHES,
1.320 + M3G_STAT_TCACHE_PATH_HITS,
1.321 + M3G_STAT_TCACHE_PATH_INSERTS,
1.322 + M3G_STAT_TCACHE_PATH_MISSES,
1.323 + M3G_PROFILE_ALIGN,
1.324 + M3G_PROFILE_ANIM,
1.325 + M3G_PROFILE_BINDTORELEASE,
1.326 + M3G_PROFILE_COMMIT,
1.327 + M3G_PROFILE_LOADER_DECODE,
1.328 + M3G_PROFILE_MORPH,
1.329 + M3G_PROFILE_NGL_DRAW,
1.330 + M3G_PROFILE_PICK,
1.331 + M3G_PROFILE_RELEASETOBIND,
1.332 + M3G_PROFILE_SETUP,
1.333 + M3G_PROFILE_SETUP_SORT,
1.334 + M3G_PROFILE_SETUP_TRANSFORMS,
1.335 + M3G_PROFILE_SKIN,
1.336 + M3G_PROFILE_TCACHE,
1.337 + M3G_PROFILE_TRANSFORM_INVERT,
1.338 + M3G_PROFILE_TRANSFORM_TO,
1.339 + M3G_PROFILE_VALIDATE,
1.340 + M3G_PROFILE_VFC_TEST,
1.341 + M3G_PROFILE_VFC_UPDATE,
1.342 + /*----------------*/
1.343 + M3G_STAT_CUMULATIVE, /* the rest are not cleared automatically */
1.344 + /*----------------*/
1.345 + M3G_STAT_BOUNDING_BOXES,
1.346 + M3G_STAT_MEMORY_ALLOCATED,
1.347 + M3G_STAT_MEMORY_MALLOC_BYTES,
1.348 + M3G_STAT_MEMORY_MALLOC_PEAK,
1.349 + M3G_STAT_MEMORY_OBJECT_BYTES,
1.350 + M3G_STAT_MEMORY_OBJECT_PEAK,
1.351 + M3G_STAT_MEMORY_PEAK,
1.352 + M3G_STAT_OBJECTS,
1.353 + M3G_STAT_RENDERABLES,
1.354 + M3G_STAT_RENDERQUEUE_SIZE,
1.355 + M3G_STAT_TCACHE_COMPOSITE_LOAD,
1.356 + M3G_STAT_TCACHE_PATH_LOAD,
1.357 + /*----------------*/
1.358 + M3G_STAT_MAX
1.359 +} M3Gstatistic;
1.360 +
1.361 +#define MIN_PROFILE_STAT M3G_PROFILE_ALIGN
1.362 +
1.363 +/*----------------------------------------------------------------------
1.364 + * Portable numeric types
1.365 + *--------------------------------------------------------------------*/
1.366 +
1.367 +typedef int M3Gint; /*!< \brief 32-bit signed integer */
1.368 +typedef short M3Gshort; /*!< \brief 16-bit signed integer */
1.369 +typedef signed char M3Gbyte; /*!< \brief 8-bit signed integer */
1.370 +typedef unsigned M3Guint; /*!< \brief 32-bit unsigned integer */
1.371 +typedef unsigned short M3Gushort; /*!< \brief 16-bit unsigned integer */
1.372 +typedef unsigned char M3Gubyte; /*!< \brief 8-bit unsigned integer */
1.373 +typedef float M3Gfloat; /*!< \brief 32-bit IEEE float */
1.374 +
1.375 +typedef M3Gint M3Genum;
1.376 +typedef M3Guint M3Gbitmask;
1.377 +typedef M3Guint M3Gbool;
1.378 +
1.379 +typedef M3Gint M3Gsizei;
1.380 +
1.381 +/* Boolean values */
1.382 +#define M3G_TRUE ((M3Gbool)1)
1.383 +#define M3G_FALSE ((M3Gbool)0)
1.384 +
1.385 +/*----------------------------------------------------------------------
1.386 + * Object handle types
1.387 + *--------------------------------------------------------------------*/
1.388 +
1.389 +typedef struct M3GInterfaceImpl *M3GInterface;
1.390 +typedef struct M3GLoaderImpl *M3GLoader;
1.391 +typedef struct M3GObjectImpl *M3GObject;
1.392 + typedef struct M3GAnimationControllerImpl *M3GAnimationController;
1.393 + typedef struct M3GAnimationTrackImpl *M3GAnimationTrack;
1.394 + typedef struct M3GAppearanceImpl *M3GAppearance;
1.395 + typedef struct M3GBackgroundImpl *M3GBackground;
1.396 + typedef struct M3GCompositingModeImpl *M3GCompositingMode;
1.397 + typedef struct M3GFogImpl *M3GFog;
1.398 + typedef struct M3GImageImpl *M3GImage;
1.399 + typedef struct M3GIndexBufferImpl *M3GIndexBuffer;
1.400 + typedef struct M3GKeyframeSequenceImpl *M3GKeyframeSequence;
1.401 + typedef struct M3GMaterialImpl *M3GMaterial;
1.402 + typedef struct M3GTransformableImpl *M3GTransformable;
1.403 + typedef struct M3GNodeImpl *M3GNode;
1.404 + typedef struct M3GCameraImpl *M3GCamera;
1.405 + typedef struct M3GGroupImpl *M3GGroup;
1.406 + typedef struct M3GWorldImpl *M3GWorld;
1.407 + typedef struct M3GLightImpl *M3GLight;
1.408 + typedef struct M3GMeshImpl *M3GMesh;
1.409 + typedef struct M3GMorphingMeshImpl *M3GMorphingMesh;
1.410 + typedef struct M3GSkinnedMeshImpl *M3GSkinnedMesh;
1.411 + typedef struct M3GSpriteImpl *M3GSprite;
1.412 + typedef struct M3GTextureImpl *M3GTexture;
1.413 + typedef struct M3GPolygonModeImpl *M3GPolygonMode;
1.414 + typedef struct M3GRenderContextImpl *M3GRenderContext;
1.415 + typedef struct M3GVertexArrayImpl *M3GVertexArray;
1.416 + typedef struct M3GVertexBufferImpl *M3GVertexBuffer;
1.417 +
1.418 +typedef /*@abstract@*/ M3Gint M3GMemObject;
1.419 +
1.420 +/*----------------------------------------------------------------------
1.421 + * Abstracted OpenGL rendering target types
1.422 + *--------------------------------------------------------------------*/
1.423 +
1.424 +typedef /*@abstract@*/ M3Guint M3GNativeBitmap;
1.425 +typedef /*@abstract@*/ M3Guint M3GNativeWindow;
1.426 +typedef /*@abstract@*/ M3Guint M3GEGLSurface;
1.427 +
1.428 +/*----------------------------------------------------------------------
1.429 + * Math API
1.430 + *--------------------------------------------------------------------*/
1.431 +
1.432 +/* -------- Data types -------- */
1.433 +
1.434 +/*!
1.435 + * \brief An optimized 4x4 matrix class.
1.436 + *
1.437 + * \note This is an abstract type, and only declared here so that it
1.438 + * can be instantiated on the stack. The internal format may change
1.439 + * in the future.
1.440 + */
1.441 +typedef struct
1.442 +{
1.443 + /* If you change this struct be sure to check the
1.444 + * structure size against the array size in Transform.java!! */
1.445 + M3Gfloat elem[16];
1.446 + M3Guint mask;
1.447 + M3Guint classified : 1;
1.448 + M3Guint complete : 1;
1.449 +} M3GMatrix;
1.450 +
1.451 +/*!
1.452 + * \brief A 3-vector class
1.453 + */
1.454 +typedef struct {
1.455 + M3Gfloat x, y, z;
1.456 +} M3GVec3;
1.457 +
1.458 +/*!
1.459 + * \brief A 4-vector class
1.460 + */
1.461 +typedef struct {
1.462 + M3Gfloat x, y, z, w;
1.463 +} M3GVec4;
1.464 +
1.465 +/*!
1.466 + * \brief A quaternion class
1.467 + */
1.468 +typedef struct {
1.469 + M3Gfloat x, y, z, w;
1.470 +} M3GQuat;
1.471 +
1.472 +/*!
1.473 + * \brief A rectangle
1.474 + */
1.475 +typedef struct {
1.476 + M3Gint x;
1.477 + M3Gint y;
1.478 + M3Gint width;
1.479 + M3Gint height;
1.480 +} M3GRectangle;
1.481 +
1.482 +/* -------- Interpolation -------- */
1.483 +
1.484 +M3G_API void m3gLerp (M3Gint size,
1.485 + M3Gfloat *vec,
1.486 + M3Gfloat s,
1.487 + const M3Gfloat *start, const M3Gfloat *end);
1.488 +M3G_API void m3gHermite (M3Gint size,
1.489 + M3Gfloat *vec,
1.490 + M3Gfloat s,
1.491 + const M3Gfloat *start, const M3Gfloat *end,
1.492 + const M3Gfloat *tStart, const M3Gfloat *tEnd);
1.493 +M3G_API void m3gSlerpQuat(M3GQuat *quat,
1.494 + M3Gfloat s,
1.495 + const M3GQuat *q0, const M3GQuat *q1);
1.496 +M3G_API void m3gSquadQuat(M3GQuat *quat,
1.497 + M3Gfloat s,
1.498 + const M3GQuat *q0, const M3GQuat *a,
1.499 + const M3GQuat *b, const M3GQuat *q1);
1.500 +
1.501 +/* -------- Matrix, vector & quaternion operations -------- */
1.502 +
1.503 +/* Matrix */
1.504 +
1.505 +/* shorthand names for the OpenGL style functions */
1.506 +#define m3gRotateMatrix m3gPostRotateMatrix
1.507 +#define m3gRotateMatrixQuat m3gPostRotateMatrixQuat
1.508 +#define m3gTranslateMatrix m3gPostTranslateMatrix
1.509 +#define m3gScaleMatrix m3gPostScaleMatrix
1.510 +#define m3gMulMatrix m3gPostMultiplyMatrix
1.511 +
1.512 +/* ...and second names for the matrix-matrix multipliers */
1.513 +#define m3gLeftMulMatrix m3gPreMultiplyMatrix
1.514 +#define m3gRightMulMatrix m3gPostMultiplyMatrix
1.515 +
1.516 +M3G_API void m3gCopyMatrix (M3GMatrix *dst, const M3GMatrix *src);
1.517 +M3G_API void m3gGetMatrixColumn (const M3GMatrix *mtx, M3Gint col, M3GVec4 *dst);
1.518 +M3G_API void m3gGetMatrixColumns (const M3GMatrix *mtx, M3Gfloat *dst);
1.519 +M3G_API void m3gGetMatrixRow (const M3GMatrix *mtx, M3Gint row, M3GVec4 *dst);
1.520 +M3G_API void m3gGetMatrixRows (const M3GMatrix *mtx, M3Gfloat *dst);
1.521 +M3G_API void m3gIdentityMatrix (M3GMatrix *mtx);
1.522 +M3G_API M3Gbool m3gInvertMatrix (M3GMatrix *mtx);
1.523 +M3G_API M3Gbool m3gMatrixInverse (M3GMatrix *mtx, const M3GMatrix *other);
1.524 +M3G_API void m3gMatrixTranspose (M3GMatrix *mtx, const M3GMatrix *other);
1.525 +M3G_API M3Gbool m3gInverseTranspose (M3GMatrix *mtx, const M3GMatrix *other);
1.526 +M3G_API void m3gMatrixProduct (M3GMatrix *dst, const M3GMatrix *left, const M3GMatrix *right);
1.527 +M3G_API void m3gPostMultiplyMatrix (M3GMatrix *mtx, const M3GMatrix *other);
1.528 +M3G_API void m3gPostRotateMatrix (M3GMatrix *mtx, M3Gfloat angle, M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.529 +M3G_API void m3gPostRotateMatrixQuat (M3GMatrix *mtx, const M3GQuat *quat);
1.530 +M3G_API void m3gPostScaleMatrix (M3GMatrix *mtx, M3Gfloat sx, M3Gfloat sy, M3Gfloat sz);
1.531 +M3G_API void m3gPostTranslateMatrix (M3GMatrix *mtx, M3Gfloat tx, M3Gfloat ty, M3Gfloat tz);
1.532 +M3G_API void m3gPreMultiplyMatrix (M3GMatrix *mtx, const M3GMatrix *other);
1.533 +M3G_API void m3gPreRotateMatrix (M3GMatrix *mtx, M3Gfloat angle, M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.534 +M3G_API void m3gPreRotateMatrixQuat (M3GMatrix *mtx, const M3GQuat *quat);
1.535 +M3G_API void m3gPreScaleMatrix (M3GMatrix *mtx, M3Gfloat sx, M3Gfloat sy, M3Gfloat sz);
1.536 +M3G_API void m3gPreTranslateMatrix (M3GMatrix *mtx, M3Gfloat tx, M3Gfloat ty, M3Gfloat tz);
1.537 +M3G_API void m3gScalingMatrix (M3GMatrix *mtx, const M3Gfloat sx, const M3Gfloat sy, const M3Gfloat sz);
1.538 +M3G_API void m3gSetMatrixColumns (M3GMatrix *mtx, const M3Gfloat *src);
1.539 +M3G_API void m3gSetMatrixRows (M3GMatrix *mtx, const M3Gfloat *src);
1.540 +M3G_API void m3gTranslationMatrix (M3GMatrix *mtx, const M3Gfloat tx, const M3Gfloat ty, const M3Gfloat tz);
1.541 +
1.542 +/* Vec3/4 */
1.543 +
1.544 +M3G_API void m3gAddVec3 (M3GVec3 *vec, const M3GVec3 *other);
1.545 +M3G_API void m3gAddVec4 (M3GVec4 *vec, const M3GVec4 *other);
1.546 +M3G_API void m3gCross (M3GVec3 *dst, const M3GVec3 *a, const M3GVec3 *b);
1.547 +M3G_API M3Gfloat m3gDot3 (const M3GVec3 *a, const M3GVec3 *b);
1.548 +M3G_API M3Gfloat m3gDot4 (const M3GVec4 *a, const M3GVec4 *b);
1.549 +M3G_API M3Gfloat m3gLengthVec3 (const M3GVec3 *vec);
1.550 +M3G_API void m3gNormalizeVec3 (M3GVec3 *vec);
1.551 +M3G_API void m3gNormalizeVec4 (M3GVec4 *vec);
1.552 +M3G_API void m3gScaleVec3 (M3GVec3 *vec, const M3Gfloat s);
1.553 +M3G_API void m3gScaleVec4 (M3GVec4 *vec, const M3Gfloat s);
1.554 +M3G_API void m3gSetVec3 (M3GVec3 *v, M3Gfloat x, M3Gfloat y, M3Gfloat z);
1.555 +M3G_API void m3gSetVec4 (M3GVec4 *v, M3Gfloat x, M3Gfloat y, M3Gfloat z, M3Gfloat w);
1.556 +M3G_API void m3gSubVec3 (M3GVec3 *vec, const M3GVec3 *other);
1.557 +M3G_API void m3gSubVec4 (M3GVec4 *vec, const M3GVec4 *other);
1.558 +M3G_API void m3gTransformVec4 (const M3GMatrix *mtx, M3GVec4 *vec);
1.559 +
1.560 +/* Quat */
1.561 +
1.562 +M3G_API void m3gGetAngleAxis (const M3GQuat *quat,
1.563 + M3Gfloat *angle, M3GVec3 *axis);
1.564 +M3G_API void m3gIdentityQuat (M3GQuat *quat);
1.565 +M3G_API void m3gMulQuat (M3GQuat *quat, const M3GQuat *other);
1.566 +M3G_API void m3gNormalizeQuat (M3GQuat *quat);
1.567 +M3G_API void m3gQuatMatrix (M3GMatrix *mtx, const M3GQuat *quat);
1.568 +M3G_API void m3gSetAngleAxis (M3GQuat *quat,
1.569 + M3Gfloat angle,
1.570 + M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.571 +M3G_API void m3gSetAngleAxisRad (M3GQuat *quat,
1.572 + M3Gfloat angleRad,
1.573 + M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.574 +M3G_API void m3gSetQuat (M3GQuat *quat, const M3Gfloat *vec);
1.575 +M3G_API void m3gSetQuatRotation (M3GQuat *quat, const M3GVec3 *from, const M3GVec3 *to);
1.576 +
1.577 +/*----------------------------------------------------------------------
1.578 + * Interface callback types
1.579 + *--------------------------------------------------------------------*/
1.580 +
1.581 +typedef /*@only@*//*@null@*/ void* (m3gMallocFunc) (M3Guint bytes);
1.582 +
1.583 +typedef void (m3gFreeFunc) (/*@only@*//*@null@*//*@out@*/ void *ptr);
1.584 +
1.585 +typedef M3GMemObject (m3gObjectAllocator) (M3Guint bytes);
1.586 +typedef /*@dependent@*/ void* (m3gObjectResolver) (M3GMemObject handle);
1.587 +typedef void (m3gObjectDeallocator)(M3GMemObject handle);
1.588 +
1.589 +typedef void (m3gErrorHandler)(M3Genum errorCode, M3GInterface hInterface);
1.590 +
1.591 +typedef void* (m3gBeginRenderFunc)(M3Guint userTarget);
1.592 +typedef void (m3gEndRenderFunc)(M3Guint userTarget);
1.593 +typedef void (m3gReleaseTargetFunc)(M3Guint userTarget);
1.594 +
1.595 +/*!
1.596 + * \brief M3G interface initialization structure
1.597 + *
1.598 + *
1.599 + */
1.600 +typedef struct {
1.601 + /*@shared@*/ m3gMallocFunc *mallocFunc;
1.602 + /*@shared@*/ m3gFreeFunc *freeFunc;
1.603 + /*@shared@*/ m3gObjectAllocator *objAllocFunc;
1.604 + /*@shared@*/ m3gObjectResolver *objResolveFunc;
1.605 + /*@shared@*/ m3gObjectDeallocator *objFreeFunc;
1.606 + /*@shared@*/ m3gErrorHandler *errorFunc;
1.607 + /*@shared@*/ m3gBeginRenderFunc *beginRenderFunc;
1.608 + /*@shared@*/ m3gEndRenderFunc *endRenderFunc;
1.609 + /*@shared@*/ m3gReleaseTargetFunc *releaseTargetFunc;
1.610 + /*@shared@*/ void *userContext;
1.611 +} M3Gparams;
1.612 +
1.613 +/*----------------------------------------------------------------------
1.614 + * API functions
1.615 + *--------------------------------------------------------------------*/
1.616 +
1.617 +/* -------- AnimationTrack -------- */
1.618 +
1.619 +M3G_API M3GAnimationTrack m3gCreateAnimationTrack (M3GInterface hInterface, M3GKeyframeSequence hSequence, M3Gint property);
1.620 +M3G_API void m3gSetController (M3GAnimationTrack hTrack, M3GAnimationController hController);
1.621 +M3G_API M3GAnimationController m3gGetController (M3GAnimationTrack hTrack);
1.622 +M3G_API M3GKeyframeSequence m3gGetSequence (M3GAnimationTrack hTrack);
1.623 +M3G_API M3Gint m3gGetTargetProperty (M3GAnimationTrack hTrack);
1.624 +
1.625 +
1.626 +/* -------- AnimationController -------- */
1.627 +
1.628 +M3G_API M3GAnimationController m3gCreateAnimationController(M3GInterface hInterface);
1.629 +M3G_API void m3gSetActiveInterval (M3GAnimationController hController, M3Gint worldTimeMin, M3Gint worldTimeMax);
1.630 +M3G_API M3Gint m3gGetActiveIntervalStart (M3GAnimationController hController);
1.631 +M3G_API M3Gint m3gGetActiveIntervalEnd (M3GAnimationController hController);
1.632 +M3G_API void m3gSetSpeed (M3GAnimationController hController, M3Gfloat factor, M3Gint worldTime);
1.633 +M3G_API M3Gfloat m3gGetSpeed (M3GAnimationController hController);
1.634 +M3G_API void m3gSetPosition (M3GAnimationController hController, M3Gfloat sequenceTime, M3Gint worldTime);
1.635 +M3G_API M3Gfloat m3gGetPosition (M3GAnimationController hController, M3Gint worldTime);
1.636 +M3G_API void m3gSetWeight (M3GAnimationController hController, M3Gfloat weight);
1.637 +M3G_API M3Gfloat m3gGetWeight (M3GAnimationController hController);
1.638 +M3G_API M3Gint m3gGetRefWorldTime (M3GAnimationController hController);
1.639 +
1.640 +/* -------- Appearance -------- */
1.641 +
1.642 +M3G_API M3GAppearance m3gCreateAppearance (M3GInterface hInterface);
1.643 +M3G_API M3GCompositingMode m3gGetCompositingMode(M3GAppearance hApp);
1.644 +M3G_API M3GFog m3gGetFog (M3GAppearance hApp);
1.645 +M3G_API M3Gint m3gGetLayer (M3GAppearance hApp);
1.646 +M3G_API M3GMaterial m3gGetMaterial (M3GAppearance hApp);
1.647 +M3G_API M3GPolygonMode m3gGetPolygonMode (M3GAppearance hApp);
1.648 +M3G_API M3GTexture m3gGetTexture (M3GAppearance hApp, M3Gint unit);
1.649 +M3G_API void m3gSetCompositingMode (M3GAppearance hApp, M3GCompositingMode hMode);
1.650 +M3G_API void m3gSetFog (M3GAppearance hApp, M3GFog hFog);
1.651 +M3G_API void m3gSetLayer (M3GAppearance hApp, M3Gint layer);
1.652 +M3G_API void m3gSetPolygonMode (M3GAppearance hApp, M3GPolygonMode hMode);
1.653 +M3G_API void m3gSetMaterial (M3GAppearance hApp, M3GMaterial hMaterial);
1.654 +M3G_API void m3gSetTexture (M3GAppearance hAppearance, M3Gint unit, M3GTexture hTexture);
1.655 +
1.656 +
1.657 +/* -------- Background -------- */
1.658 +
1.659 +M3G_API M3GBackground m3gCreateBackground (M3GInterface hInterface);
1.660 +M3G_API void m3gSetBgColor (M3GBackground handle, M3Guint ARGB);
1.661 +M3G_API void m3gSetBgMode (M3GBackground handle, M3Gint modeX, M3Gint modeY);
1.662 +M3G_API void m3gSetBgCrop (M3GBackground handle, M3Gint cropX, M3Gint cropY, M3Gint width, M3Gint height);
1.663 +M3G_API void m3gSetBgImage (M3GBackground handle, M3GImage hImage);
1.664 +M3G_API M3GImage m3gGetBgImage (M3GBackground handle);
1.665 +M3G_API M3Guint m3gGetBgColor (M3GBackground handle);
1.666 +M3G_API M3Gint m3gGetBgMode (M3GBackground handle, M3Gint which);
1.667 +M3G_API M3Gint m3gGetBgCrop (M3GBackground handle, M3Gint which);
1.668 +M3G_API void m3gSetBgEnable (M3GBackground handle, M3Gint which, M3Gbool enable);
1.669 +M3G_API M3Gbool m3gIsBgEnabled (M3GBackground handle, M3Gint which);
1.670 +
1.671 +
1.672 +/* -------- Camera -------- */
1.673 +
1.674 +M3G_API M3GCamera m3gCreateCamera (M3GInterface hInterface);
1.675 +M3G_API void m3gSetParallel (M3GCamera handle, M3Gfloat height, M3Gfloat aspectRatio, M3Gfloat clipNear, M3Gfloat clipFar);
1.676 +M3G_API void m3gSetPerspective (M3GCamera handle, M3Gfloat fovy, M3Gfloat aspectRatio, M3Gfloat clipNear, M3Gfloat clipFar);
1.677 +M3G_API void m3gSetProjectionMatrix (M3GCamera handle, const M3GMatrix *transform);
1.678 +M3G_API M3Gint m3gGetProjectionAsMatrix(M3GCamera handle, M3GMatrix *transform);
1.679 +M3G_API M3Gint m3gGetProjectionAsParams(M3GCamera handle, M3Gfloat *params);
1.680 +
1.681 +
1.682 +/* -------- CompositingMode -------- */
1.683 +
1.684 +M3G_API M3GCompositingMode m3gCreateCompositingMode(M3GInterface m3g);
1.685 +
1.686 +M3G_API void m3gSetBlending (M3GCompositingMode compositingMode, M3Genum mode);
1.687 +M3G_API M3Genum m3gGetBlending (M3GCompositingMode compositingMode);
1.688 +M3G_API void m3gSetAlphaThreshold (M3GCompositingMode compositingMode, M3Gfloat threshold);
1.689 +M3G_API M3Gfloat m3gGetAlphaThreshold (M3GCompositingMode compositingMode);
1.690 +M3G_API void m3gEnableDepthTest (M3GCompositingMode compositingMode, M3Gbool enable);
1.691 +M3G_API void m3gEnableDepthWrite (M3GCompositingMode compositingMode, M3Gbool enable);
1.692 +M3G_API void m3gEnableColorWrite (M3GCompositingMode compositingMode, M3Gbool enable);
1.693 +M3G_API void m3gSetDepthOffset (M3GCompositingMode compositingMode, M3Gfloat factor, M3Gfloat units);
1.694 +M3G_API M3Gfloat m3gGetDepthOffsetFactor (M3GCompositingMode compositingMode);
1.695 +M3G_API M3Gfloat m3gGetDepthOffsetUnits (M3GCompositingMode compositingMode);
1.696 +M3G_API M3Gbool m3gIsAlphaWriteEnabled (M3GCompositingMode handle);
1.697 +M3G_API M3Gbool m3gIsColorWriteEnabled (M3GCompositingMode handle);
1.698 +M3G_API M3Gbool m3gIsDepthTestEnabled (M3GCompositingMode handle);
1.699 +M3G_API M3Gbool m3gIsDepthWriteEnabled (M3GCompositingMode handle);
1.700 +M3G_API void m3gSetAlphaWriteEnable (M3GCompositingMode handle, M3Gbool enable);
1.701 +
1.702 +
1.703 +/* -------- Fog -------- */
1.704 +
1.705 +M3G_API M3GFog m3gCreateFog (M3GInterface hInterface);
1.706 +M3G_API void m3gSetFogMode (M3GFog handle, M3Gint mode);
1.707 +M3G_API M3Gint m3gGetFogMode (M3GFog handle);
1.708 +M3G_API void m3gSetFogLinear (M3GFog handle, M3Gfloat fogNear, M3Gfloat fogFar);
1.709 +M3G_API M3Gfloat m3gGetFogDistance(M3GFog handle, M3Genum which);
1.710 +M3G_API void m3gSetFogDensity(M3GFog handle, M3Gfloat density);
1.711 +M3G_API M3Gfloat m3gGetFogDensity(M3GFog handle);
1.712 +M3G_API void m3gSetFogColor (M3GFog handle, M3Guint rgb);
1.713 +M3G_API M3Guint m3gGetFogColor (M3GFog handle);
1.714 +
1.715 +
1.716 +/* -------- Group -------- */
1.717 +
1.718 +M3G_API M3GGroup m3gCreateGroup (M3GInterface m3g);
1.719 +M3G_API void m3gAddChild (M3GGroup handle, M3GNode hNode);
1.720 +M3G_API void m3gRemoveChild (M3GGroup handle, M3GNode hNode);
1.721 +M3G_API M3GNode m3gPick3D (M3GGroup handle, M3Gint mask, M3Gfloat *ray, M3Gfloat *result);
1.722 +M3G_API M3GNode m3gPick2D (M3GGroup handle, M3Gint mask, M3Gfloat x, M3Gfloat y, M3GCamera hCamera, M3Gfloat *result);
1.723 +M3G_API M3GNode m3gGetChild (M3GGroup handle, M3Gint idx);
1.724 +M3G_API M3Gint m3gGetChildCount(M3GGroup handle);
1.725 +
1.726 +
1.727 +/* -------- Image -------- */
1.728 +
1.729 +M3G_API M3GImage m3gCreateImage (M3GInterface m3g, M3GImageFormat format, M3Gint width, M3Gint height, M3Gbitmask flags);
1.730 +M3G_API void m3gSetImage (M3GImage hImage, const void *pixels);
1.731 +M3G_API void m3gSetImagePalette (M3GImage hImage, M3Gint paletteLength, const void *palette);
1.732 +M3G_API void m3gSetImageScanline (M3GImage hImage, M3Gint line, M3Gbool trueAlpha, const M3Guint *pixels);
1.733 +M3G_API void m3gSetSubImage (M3GImage hImage, M3Gint x, M3Gint y, M3Gint width, M3Gint height, M3Gint length, const void *pixels);
1.734 +M3G_API M3Gbool m3gIsMutable (M3GImage hImage);
1.735 +M3G_API M3GImageFormat m3gGetFormat (M3GImage hImage);
1.736 +M3G_API M3Gint m3gGetWidth (M3GImage hImage);
1.737 +M3G_API M3Gint m3gGetHeight (M3GImage hImage);
1.738 +M3G_API void m3gGetImageARGB (M3GImage hImage, M3Guint *pixels);
1.739 +M3G_API void m3gCommitImage (M3GImage hImage);
1.740 +
1.741 +/* -------- IndexBuffer -------- */
1.742 +
1.743 +M3G_API M3GIndexBuffer m3gCreateStripBuffer (M3GInterface m3g, M3Gprimitive primitive, M3Gsizei stripCount, const M3Gsizei *stripLengths, M3Gdatatype type, M3Gsizei indicesCount, const void *stripIndices);
1.744 +M3G_API M3GIndexBuffer m3gCreateImplicitStripBuffer (M3GInterface hInterface, M3Gsizei stripCount, const M3Gsizei *stripLengths, M3Gint firstIndex);
1.745 +M3G_API M3Gint m3gGetBatchCount(M3GIndexBuffer buffer);
1.746 +M3G_API M3Gbool m3gGetBatchIndices(M3GIndexBuffer buffer, M3Gint batchIndex, M3Gint *indices);
1.747 +M3G_API M3Gint m3gGetBatchSize(M3GIndexBuffer buffer, M3Gint batchIndex);
1.748 +M3G_API M3Gprimitive m3gGetPrimitive(M3GIndexBuffer buffer);
1.749 +
1.750 +/* -------- Interface -------- */
1.751 +
1.752 +M3G_API M3GInterface m3gCreateInterface (const M3Gparams *params);
1.753 +M3G_API void m3gDeleteInterface (M3GInterface m3g);
1.754 +M3G_API void m3gGarbageCollect (M3GInterface hInterface);
1.755 +M3G_API M3Genum m3gGetError (M3GInterface m3g);
1.756 +M3G_API M3Gint m3gGetStatistic (M3GInterface hInterface,
1.757 + M3Gstatistic stat);
1.758 +M3G_API void * m3gGetUserContext (M3GInterface m3g);
1.759 +M3G_API M3Gbool m3gIsAntialiasingSupported(M3GInterface interface);
1.760 +
1.761 +/* -------- KeyframeSequence -------- */
1.762 +
1.763 +M3G_API M3GKeyframeSequence m3gCreateKeyframeSequence(M3GInterface hInterface, M3Gint numKeyframes, M3Gint numComponents, M3Gint interpolation);
1.764 +M3G_API void m3gSetValidRange(M3GKeyframeSequence handle, M3Gint first, M3Gint last);
1.765 +M3G_API void m3gSetKeyframe (M3GKeyframeSequence handle, M3Gint ind, M3Gint time, M3Gint valueSize, const M3Gfloat *value);
1.766 +M3G_API void m3gSetDuration (M3GKeyframeSequence handle, M3Gint duration);
1.767 +M3G_API M3Gint m3gGetDuration (M3GKeyframeSequence handle);
1.768 +M3G_API void m3gSetRepeatMode(M3GKeyframeSequence handle, M3Genum mode);
1.769 +M3G_API M3Genum m3gGetRepeatMode(M3GKeyframeSequence handle);
1.770 +M3G_API M3Gint m3gGetComponentCount(M3GKeyframeSequence handle);
1.771 +M3G_API M3Gint m3gGetInterpolationType(M3GKeyframeSequence handle);
1.772 +M3G_API M3Gint m3gGetKeyframe (M3GKeyframeSequence handle, M3Gint frameIndex, M3Gfloat *value);
1.773 +M3G_API M3Gint m3gGetKeyframeCount(M3GKeyframeSequence handle);
1.774 +M3G_API void m3gGetValidRange(M3GKeyframeSequence handle, M3Gint *first, M3Gint *last);
1.775 +
1.776 +/* -------- Light -------- */
1.777 +
1.778 +M3G_API M3GLight m3gCreateLight (M3GInterface hInterface);
1.779 +M3G_API void m3gSetIntensity (M3GLight handle, M3Gfloat intensity);
1.780 +M3G_API void m3gSetLightColor (M3GLight handle, M3Guint rgb);
1.781 +M3G_API void m3gSetLightMode (M3GLight handle, M3Genum mode);
1.782 +M3G_API void m3gSetSpotAngle (M3GLight handle, M3Gfloat angle);
1.783 +M3G_API void m3gSetSpotExponent (M3GLight handle, M3Gfloat exponent);
1.784 +M3G_API void m3gSetAttenuation (M3GLight handle, M3Gfloat constant, M3Gfloat linear, M3Gfloat quadratic);
1.785 +M3G_API M3Gfloat m3gGetIntensity (M3GLight handle);
1.786 +M3G_API M3Guint m3gGetLightColor (M3GLight handle);
1.787 +M3G_API M3Gint m3gGetLightMode (M3GLight handle);
1.788 +M3G_API M3Gfloat m3gGetSpotAngle (M3GLight handle);
1.789 +M3G_API M3Gfloat m3gGetSpotExponent (M3GLight handle);
1.790 +M3G_API M3Gfloat m3gGetAttenuation (M3GLight handle, M3Genum type);
1.791 +M3G_API M3Gint m3gGetScopeMask (M3GLight handle);
1.792 +
1.793 +
1.794 +/* -------- Loader -------- */
1.795 +
1.796 +M3G_API M3GLoader m3gCreateLoader(M3GInterface m3g);
1.797 +M3G_API M3Gsizei m3gDecodeData(M3GLoader loader, M3Gsizei bytes, const M3Gubyte *data);
1.798 +M3G_API M3Gint m3gGetLoadedObjects(M3GLoader loader, M3GObject *buffer);
1.799 +M3G_API void m3gImportObjects(M3GLoader loader, M3Gint n, M3GObject *refs);
1.800 +M3G_API M3Gint m3gGetObjectsWithUserParameters(M3GLoader loader, M3GObject *objects);
1.801 +M3G_API M3Gint m3gGetNumUserParameters(M3GLoader loader, M3Gint object);
1.802 +M3G_API M3Gint m3gGetUserParameter(M3GLoader loader, M3Gint object, M3Gint index, M3Gbyte *buffer);
1.803 +M3G_API void m3gSetConstraints(M3GLoader loader, M3Gint triConstraint);
1.804 +
1.805 +/* -------- Material -------- */
1.806 +
1.807 +M3G_API M3GMaterial m3gCreateMaterial (M3GInterface m3g);
1.808 +M3G_API void m3gSetColor (M3GMaterial material, M3Genum target, M3Guint ARGB);
1.809 +M3G_API M3Guint m3gGetColor (M3GMaterial material, M3Genum target);
1.810 +M3G_API void m3gSetShininess (M3GMaterial material, M3Gfloat shininess);
1.811 +M3G_API M3Gfloat m3gGetShininess (M3GMaterial material);
1.812 +M3G_API void m3gSetVertexColorTrackingEnable (M3GMaterial material, M3Gbool enable);
1.813 +M3G_API M3Gbool m3gIsVertexColorTrackingEnabled (M3GMaterial material);
1.814 +
1.815 +
1.816 +/* -------- Mesh -------- */
1.817 +
1.818 +M3G_API M3GMesh m3gCreateMesh (M3GInterface hInterface, M3GVertexBuffer hVertices, M3GIndexBuffer *hTriangles, M3GAppearance *hAppearances, M3Gint trianglePatchCount);
1.819 +M3G_API void m3gSetAppearance (M3GMesh handle, M3Gint appearanceIndex, M3GAppearance hAppearance);
1.820 +M3G_API M3GAppearance m3gGetAppearance (M3GMesh handle, M3Gint idx);
1.821 +M3G_API M3GIndexBuffer m3gGetIndexBuffer (M3GMesh handle, M3Gint idx);
1.822 +M3G_API M3GVertexBuffer m3gGetVertexBuffer (M3GMesh handle);
1.823 +M3G_API M3Gint m3gGetSubmeshCount (M3GMesh handle);
1.824 +
1.825 +
1.826 +/* -------- MorphingMesh -------- */
1.827 +
1.828 +M3G_API M3GMorphingMesh m3gCreateMorphingMesh (M3GInterface hInterface, M3GVertexBuffer hVertices, M3GVertexBuffer *hTargets, M3GIndexBuffer *hTriangles, M3GAppearance *hAppearances, M3Gint trianglePatchCount, M3Gint targetCount);
1.829 +M3G_API void m3gSetWeights (M3GMorphingMesh handle, M3Gfloat *weights, M3Gint numWeights);
1.830 +M3G_API void m3gGetWeights (M3GMorphingMesh handle, M3Gfloat *weights, M3Gint numWeights);
1.831 +M3G_API M3GVertexBuffer m3gGetMorphTarget (M3GMorphingMesh handle, M3Gint idx);
1.832 +M3G_API M3Gint m3gGetMorphTargetCount (M3GMorphingMesh handle);
1.833 +
1.834 +
1.835 +/* -------- Node -------- */
1.836 +
1.837 +M3G_API void m3gAlignNode (M3GNode hNode, M3GNode hReference);
1.838 +M3G_API M3Gbool m3gGetTransformTo (M3GNode handle, M3GNode hTarget, M3GMatrix *transform);
1.839 +M3G_API void m3gSetAlignment (M3GNode handle, M3GNode hZReference, M3Gint zTarget, M3GNode hYReference, M3Gint yTarget);
1.840 +M3G_API void m3gSetAlphaFactor (M3GNode handle, M3Gfloat alphaFactor);
1.841 +M3G_API M3Gfloat m3gGetAlphaFactor (M3GNode handle);
1.842 +M3G_API void m3gEnable (M3GNode handle, M3Gint which, M3Gbool enable);
1.843 +M3G_API M3Gint m3gIsEnabled (M3GNode handle, M3Gint which);
1.844 +M3G_API void m3gSetScope (M3GNode handle, M3Gint id);
1.845 +M3G_API M3Gint m3gGetScope (M3GNode handle);
1.846 +M3G_API M3GNode m3gGetParent (M3GNode handle);
1.847 +M3G_API M3GNode m3gGetZRef (M3GNode handle);
1.848 +M3G_API M3GNode m3gGetYRef (M3GNode handle);
1.849 +M3G_API M3Gint m3gGetSubtreeSize (M3GNode handle);
1.850 +M3G_API M3Gint m3gGetAlignmentTarget(M3GNode handle, M3Gint axis);
1.851 +
1.852 +/* -------- Object -------- */
1.853 +
1.854 +M3G_API void m3gAddRef (M3GObject hObject);
1.855 +M3G_API void m3gDeleteObject (M3GObject hObject);
1.856 +M3G_API void m3gDeleteRef (M3GObject hObject);
1.857 +M3G_API M3GClass m3gGetClass (M3GObject hObject);
1.858 +M3G_API M3Gint m3gAddAnimationTrack (M3GObject hObject, M3GAnimationTrack hAnimationTrack);
1.859 +M3G_API void m3gRemoveAnimationTrack (M3GObject hObject, M3GAnimationTrack hAnimationTrack);
1.860 +M3G_API M3Gint m3gGetAnimationTrackCount(M3GObject hObject);
1.861 +M3G_API M3Gint m3gAnimate (M3GObject hObject, M3Gint time);
1.862 +M3G_API void m3gSetUserID (M3GObject hObject, M3Gint userID);
1.863 +M3G_API M3Gint m3gGetUserID (M3GObject hObject);
1.864 +M3G_API M3GAnimationTrack m3gGetAnimationTrack (M3GObject hObject, M3Gint idx);
1.865 +M3G_API M3GObject m3gDuplicate (M3GObject hObject, M3GObject *hReferences);
1.866 +M3G_API M3GInterface m3gGetObjectInterface (M3GObject hObject);
1.867 +M3G_API M3Gint m3gGetReferences (M3GObject hObject, M3GObject *references, M3Gint length);
1.868 +M3G_API M3GObject m3gFind (M3GObject hObject, M3Gint userID);
1.869 +
1.870 +#define m3gGetInterface(obj) m3gGetObjectInterface((M3GObject)(obj))
1.871 +
1.872 +/* -------- PolygonMode -------- */
1.873 +
1.874 +M3G_API M3GPolygonMode m3gCreatePolygonMode (M3GInterface m3g);
1.875 +M3G_API void m3gSetCulling (M3GPolygonMode handle, M3Gint mode);
1.876 +M3G_API M3Gint m3gGetCulling (M3GPolygonMode handle);
1.877 +M3G_API void m3gSetWinding (M3GPolygonMode handle, M3Gint mode);
1.878 +M3G_API M3Gint m3gGetWinding (M3GPolygonMode handle);
1.879 +M3G_API void m3gSetShading (M3GPolygonMode handle, M3Gint mode);
1.880 +M3G_API M3Gint m3gGetShading (M3GPolygonMode handle);
1.881 +M3G_API void m3gSetTwoSidedLightingEnable(M3GPolygonMode handle, M3Gbool enable);
1.882 +M3G_API M3Gbool m3gIsTwoSidedLightingEnabled(M3GPolygonMode handle);
1.883 +M3G_API void m3gSetLocalCameraLightingEnable(M3GPolygonMode polygonMode, M3Gbool enable);
1.884 +M3G_API void m3gSetPerspectiveCorrectionEnable(M3GPolygonMode polygonMode, M3Gbool enable);
1.885 +M3G_API M3Gbool m3gIsLocalCameraLightingEnabled(M3GPolygonMode handle);
1.886 +M3G_API M3Gbool m3gIsPerspectiveCorrectionEnabled(M3GPolygonMode handle);
1.887 +
1.888 +/* -------- RenderContext -------- */
1.889 +
1.890 +M3G_API M3GRenderContext m3gCreateContext(M3GInterface m3g);
1.891 +
1.892 +M3G_API M3Gint m3gAddLight (M3GRenderContext ctx, M3GLight light, const M3GMatrix *transform);
1.893 +M3G_API void m3gBindBitmapTarget (M3GRenderContext ctx, M3GNativeBitmap hBitmap);
1.894 +M3G_API void m3gBindImageTarget (M3GRenderContext ctx, M3GImage hImage);
1.895 +M3G_API void m3gBindEGLSurfaceTarget (M3GRenderContext context, M3GEGLSurface surface);
1.896 +M3G_API void m3gBindMemoryTarget (M3GRenderContext context, void *pixels, M3Guint width, M3Guint height, M3GPixelFormat format, M3Guint stride, M3Guint userContext);
1.897 +M3G_API void m3gBindWindowTarget (M3GRenderContext ctx, M3GNativeWindow hWindow);
1.898 +M3G_API void m3gClear (M3GRenderContext context, M3GBackground hBackground);
1.899 +M3G_API void m3gClearLights (M3GRenderContext context);
1.900 +M3G_API M3Guint m3gGetUserHandle (M3GRenderContext hCtx);
1.901 +M3G_API void m3gInvalidateBitmapTarget(M3GRenderContext ctx, M3GNativeBitmap hBitmap);
1.902 +M3G_API void m3gInvalidateWindowTarget(M3GRenderContext ctx, M3GNativeWindow hWindow);
1.903 +M3G_API void m3gInvalidateMemoryTarget(M3GRenderContext ctx, void *pixels);
1.904 +M3G_API void m3gReleaseTarget (M3GRenderContext ctx);
1.905 +M3G_API void m3gRender (M3GRenderContext ctx, M3GVertexBuffer hVertices, M3GIndexBuffer hIndices, M3GAppearance hAppearance, const M3GMatrix *transform, M3Gfloat alphaFactor, M3Gint scope);
1.906 +M3G_API void m3gRenderWorld (M3GRenderContext context, M3GWorld hWorld);
1.907 +M3G_API void m3gRenderNode (M3GRenderContext context, M3GNode hNode, const M3GMatrix *transform);
1.908 +M3G_API M3Gbool m3gSetRenderBuffers (M3GRenderContext hCtx, M3Gbitmask bufferBits);
1.909 +M3G_API M3Gbool m3gSetRenderHints (M3GRenderContext hCtx, M3Gbitmask hintBits);
1.910 +M3G_API void m3gSetCamera (M3GRenderContext context, M3GCamera hCamera, M3GMatrix *transform);
1.911 +M3G_API void m3gSetDepthRange (M3GRenderContext hCtx, M3Gfloat depthNear, M3Gfloat depthFar);
1.912 +M3G_API void m3gSetLight (M3GRenderContext context, M3Gint lightIndex, M3GLight hLight, const M3GMatrix *transform);
1.913 +M3G_API void m3gSetClipRect (M3GRenderContext ctx, M3Gint x, M3Gint y, M3Gint width, M3Gint height);
1.914 +M3G_API void m3gSetDisplayArea(M3GRenderContext hCtx, M3Gint width, M3Gint height);
1.915 +M3G_API void m3gSetViewport (M3GRenderContext ctx, M3Gint x, M3Gint y, M3Gint width, M3Gint height);
1.916 +M3G_API void m3gGetViewport (M3GRenderContext hCtx, M3Gint *x, M3Gint *y, M3Gint *width, M3Gint *height);
1.917 +M3G_API void m3gGetDepthRange (M3GRenderContext hCtx, M3Gfloat *depthNear, M3Gfloat *depthFar);
1.918 +M3G_API void m3gGetViewTransform (M3GRenderContext hCtx, M3GMatrix *transform);
1.919 +M3G_API M3GLight m3gGetLightTransform (M3GRenderContext hCtx, M3Gint lightIndex, M3GMatrix *transform);
1.920 +M3G_API M3Gsizei m3gGetLightCount (M3GRenderContext hCtx);
1.921 +M3G_API M3GCamera m3gGetCamera (M3GRenderContext hCtx);
1.922 +M3G_API void m3gSetAlphaWrite (M3GRenderContext ctx, M3Gbool enable);
1.923 +M3G_API M3Gbool m3gGetAlphaWrite (M3GRenderContext ctx);
1.924 +M3G_API void m3gFreeGLESResources (M3GRenderContext ctx);
1.925 +
1.926 +/* -------- SkinnedMesh -------- */
1.927 +
1.928 +M3G_API M3GSkinnedMesh m3gCreateSkinnedMesh (M3GInterface hInterface, M3GVertexBuffer hVertices, M3GIndexBuffer *hTriangles, M3GAppearance *hAppearances, M3Gint trianglePatchCount, M3GGroup hSkeleton);
1.929 +M3G_API void m3gAddTransform (M3GSkinnedMesh handle, M3GNode hBone, M3Gint weight, M3Gint firstVertex, M3Gint numVertices);
1.930 +M3G_API M3GGroup m3gGetSkeleton (M3GSkinnedMesh handle);
1.931 +M3G_API void m3gGetBoneTransform (M3GSkinnedMesh handle, M3GNode hBone, M3GMatrix *transform);
1.932 +M3G_API M3Gint m3gGetBoneVertices (M3GSkinnedMesh handle, M3GNode hBone, M3Gint *indices, M3Gfloat *weights);
1.933 +
1.934 +
1.935 +/* -------- Sprite -------- */
1.936 +
1.937 +M3G_API M3GSprite m3gCreateSprite (M3GInterface hInterface, M3Gbool scaled, M3GImage hImage, M3GAppearance hAppearance);
1.938 +M3G_API M3Gbool m3gIsScaledSprite (M3GSprite handle);
1.939 +M3G_API void m3gSetSpriteAppearance (M3GSprite handle, M3GAppearance hAppearance);
1.940 +M3G_API M3Gbool m3gSetSpriteImage (M3GSprite handle, M3GImage hImage);
1.941 +M3G_API void m3gSetCrop (M3GSprite handle, M3Gint cropX, M3Gint cropY, M3Gint width, M3Gint height);
1.942 +M3G_API M3Gint m3gGetCrop (M3GSprite handle, M3Gint which);
1.943 +M3G_API M3GAppearance m3gGetSpriteAppearance (M3GSprite handle);
1.944 +M3G_API M3GImage m3gGetSpriteImage (M3GSprite handle);
1.945 +
1.946 +
1.947 +/* -------- Texture -------- */
1.948 +
1.949 +M3G_API M3GTexture m3gCreateTexture (M3GInterface m3g, M3GImage hImage);
1.950 +M3G_API M3GImage m3gGetTextureImage (M3GTexture hTexture);
1.951 +M3G_API void m3gSetTextureImage (M3GTexture hTexture, M3GImage hImage);
1.952 +M3G_API void m3gSetTextureTransform (M3GTexture hTexture, M3GMatrix *mtx);
1.953 +M3G_API void m3gSetFiltering (M3GTexture hTexture, M3Genum levelFilter, M3Genum imageFilter);
1.954 +M3G_API void m3gSetWrapping (M3GTexture hTexture, M3Genum wrapS, M3Genum wrapT);
1.955 +M3G_API int m3gGetWrappingS (M3GTexture hTexture);
1.956 +M3G_API int m3gGetWrappingT (M3GTexture hTexture);
1.957 +M3G_API void m3gTextureSetBlending (M3GTexture hTexture, M3Genum func);
1.958 +M3G_API int m3gTextureGetBlending (M3GTexture hTexture);
1.959 +M3G_API void m3gSetBlendColor (M3GTexture hTexture, M3Guint RGB);
1.960 +M3G_API M3Guint m3gGetBlendColor (M3GTexture hTexture);
1.961 +M3G_API void m3gTransformSetTransform(M3GTexture hTexture, const M3GMatrix *transform);
1.962 +M3G_API void m3gTransformGetTransform(M3GTexture hTexture, M3GMatrix *transform);
1.963 +M3G_API void m3gGetFiltering (M3GTexture hTexture, M3Gint *levelFilter, M3Gint *imageFilter);
1.964 +
1.965 +/* -------- Transformable -------- */
1.966 +
1.967 +M3G_API void m3gSetOrientation (M3GTransformable handle, M3Gfloat angle, M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.968 +M3G_API void m3gPostRotate (M3GTransformable handle, M3Gfloat angle, M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.969 +M3G_API void m3gPreRotate (M3GTransformable handle, M3Gfloat angle, M3Gfloat ax, M3Gfloat ay, M3Gfloat az);
1.970 +M3G_API void m3gGetOrientation (M3GTransformable handle, M3Gfloat *angleAxis);
1.971 +M3G_API void m3gSetScale (M3GTransformable handle, M3Gfloat sx, M3Gfloat sy, M3Gfloat sz);
1.972 +M3G_API void m3gScale (M3GTransformable handle, M3Gfloat sx, M3Gfloat sy, M3Gfloat sz);
1.973 +M3G_API void m3gGetScale (M3GTransformable handle, M3Gfloat *scale);
1.974 +M3G_API void m3gSetTranslation (M3GTransformable handle, M3Gfloat tx, M3Gfloat ty, M3Gfloat tz);
1.975 +M3G_API void m3gTranslate (M3GTransformable handle, M3Gfloat tx, M3Gfloat ty, M3Gfloat tz);
1.976 +M3G_API void m3gGetTranslation (M3GTransformable handle, M3Gfloat *translation);
1.977 +M3G_API void m3gSetTransform (M3GTransformable handle, const M3GMatrix *transform);
1.978 +M3G_API void m3gGetTransform (M3GTransformable handle, M3GMatrix *transform);
1.979 +M3G_API void m3gGetCompositeTransform(M3GTransformable handle, M3GMatrix *transform);
1.980 +
1.981 +/* -------- VertexArray -------- */
1.982 +
1.983 +M3G_API M3GVertexArray m3gCreateVertexArray (M3GInterface m3g, M3Gsizei count, M3Gint size, M3Gdatatype type);
1.984 +M3G_API void m3gGetVertexArrayParams (M3GVertexArray handle, M3Gsizei *count, M3Gint *size, M3Gdatatype *type, M3Gsizei *stride);
1.985 +M3G_API void * m3gMapVertexArray (M3GVertexArray handle);
1.986 +M3G_API const void * m3gMapVertexArrayReadOnly(M3GVertexArray handle);
1.987 +M3G_API void m3gSetVertexArrayElements(M3GVertexArray handle, M3Gint first, M3Gsizei count, M3Gsizei srcLength, M3Gdatatype type, const void *src);
1.988 +M3G_API void m3gTransformArray (M3GVertexArray handle, M3GMatrix *transform, M3Gfloat *out, M3Gint outLength, M3Gbool w);
1.989 +M3G_API void m3gUnmapVertexArray (M3GVertexArray handle);
1.990 +M3G_API void m3gGetVertexArrayElements(M3GVertexArray handle, M3Gint first, M3Gsizei count, M3Gsizei dstLength, M3Gdatatype type, void *dst);
1.991 +
1.992 +/* -------- VertexBuffer -------- */
1.993 +
1.994 +M3G_API M3GVertexBuffer m3gCreateVertexBuffer (M3GInterface m3g);
1.995 +M3G_API M3Gint m3gGetVertexCount (M3GVertexBuffer hBuffer);
1.996 +M3G_API M3GVertexArray m3gGetVertexArray (M3GVertexBuffer handle, M3Gint which, M3Gfloat *scaleBias, M3Gint sbLength);
1.997 +M3G_API void m3gSetColorArray (M3GVertexBuffer hBuffer, M3GVertexArray hArray);
1.998 +M3G_API void m3gSetNormalArray (M3GVertexBuffer hBuffer, M3GVertexArray hArray);
1.999 +M3G_API void m3gSetTexCoordArray (M3GVertexBuffer hBuffer, M3Gint unit, M3GVertexArray hArray, M3Gfloat scale, M3Gfloat *bias, M3Gint biasLength);
1.1000 +M3G_API void m3gSetVertexDefaultColor(M3GVertexBuffer hBuffer, M3Guint ARGB);
1.1001 +M3G_API M3Guint m3gGetVertexDefaultColor(M3GVertexBuffer hBuffer);
1.1002 +M3G_API void m3gSetVertexArray (M3GVertexBuffer hBuffer, M3GVertexArray hArray, M3Gfloat scale, M3Gfloat *bias, M3Gint biasLength);
1.1003 +
1.1004 +/* -------- World -------- */
1.1005 +
1.1006 +M3G_API M3GWorld m3gCreateWorld (M3GInterface hInterface);
1.1007 +M3G_API void m3gSetActiveCamera (M3GWorld handle, M3GCamera hCamera);
1.1008 +M3G_API void m3gSetBackground (M3GWorld handle, M3GBackground hBackground);
1.1009 +M3G_API M3GBackground m3gGetBackground (M3GWorld handle);
1.1010 +M3G_API M3GCamera m3gGetActiveCamera (M3GWorld handle);
1.1011 +
1.1012 +#if defined(__cplusplus)
1.1013 +} /* extern "C" */
1.1014 +#endif
1.1015 +
1.1016 +#endif /*__M3G_CORE_H__*/