goat3d

annotate libs/openctm/internal.h @ 46:9d911100935b

added install/uninstall targets in goatview added load statistics in goatview
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Dec 2013 03:00:25 +0200
parents
children
rev   line source
nuclear@14 1 //-----------------------------------------------------------------------------
nuclear@14 2 // Product: OpenCTM
nuclear@14 3 // File: internal.h
nuclear@14 4 // Description: Internal (private) declarations, types and function prototypes.
nuclear@14 5 //-----------------------------------------------------------------------------
nuclear@14 6 // Copyright (c) 2009-2010 Marcus Geelnard
nuclear@14 7 //
nuclear@14 8 // This software is provided 'as-is', without any express or implied
nuclear@14 9 // warranty. In no event will the authors be held liable for any damages
nuclear@14 10 // arising from the use of this software.
nuclear@14 11 //
nuclear@14 12 // Permission is granted to anyone to use this software for any purpose,
nuclear@14 13 // including commercial applications, and to alter it and redistribute it
nuclear@14 14 // freely, subject to the following restrictions:
nuclear@14 15 //
nuclear@14 16 // 1. The origin of this software must not be misrepresented; you must not
nuclear@14 17 // claim that you wrote the original software. If you use this software
nuclear@14 18 // in a product, an acknowledgment in the product documentation would be
nuclear@14 19 // appreciated but is not required.
nuclear@14 20 //
nuclear@14 21 // 2. Altered source versions must be plainly marked as such, and must not
nuclear@14 22 // be misrepresented as being the original software.
nuclear@14 23 //
nuclear@14 24 // 3. This notice may not be removed or altered from any source
nuclear@14 25 // distribution.
nuclear@14 26 //-----------------------------------------------------------------------------
nuclear@14 27
nuclear@14 28 #ifndef __OPENCTM_INTERNAL_H_
nuclear@14 29 #define __OPENCTM_INTERNAL_H_
nuclear@14 30
nuclear@14 31 //-----------------------------------------------------------------------------
nuclear@14 32 // Constants
nuclear@14 33 //-----------------------------------------------------------------------------
nuclear@14 34 // OpenCTM file format version (v5).
nuclear@14 35 #define _CTM_FORMAT_VERSION 0x00000005
nuclear@14 36
nuclear@14 37 // Flags for the Mesh flags field of the file header
nuclear@14 38 #define _CTM_HAS_NORMALS_BIT 0x00000001
nuclear@14 39
nuclear@14 40 //-----------------------------------------------------------------------------
nuclear@14 41 // _CTMfloatmap - Internal representation of a floating point based vertex map
nuclear@14 42 // (used for UV maps and attribute maps).
nuclear@14 43 //-----------------------------------------------------------------------------
nuclear@14 44 typedef struct _CTMfloatmap_struct _CTMfloatmap;
nuclear@14 45 struct _CTMfloatmap_struct {
nuclear@14 46 char * mName; // Unique name
nuclear@14 47 char * mFileName; // File name reference (used only for UV maps)
nuclear@14 48 CTMfloat mPrecision; // Precision for this map
nuclear@14 49 CTMfloat * mValues; // Attribute/UV coordinate values (per vertex)
nuclear@14 50 _CTMfloatmap * mNext; // Pointer to the next map in the list (linked list)
nuclear@14 51 };
nuclear@14 52
nuclear@14 53 //-----------------------------------------------------------------------------
nuclear@14 54 // _CTMcontext - Internal CTM context structure.
nuclear@14 55 //-----------------------------------------------------------------------------
nuclear@14 56 typedef struct {
nuclear@14 57 // Context mode (import or export)
nuclear@14 58 CTMenum mMode;
nuclear@14 59
nuclear@14 60 // Vertices
nuclear@14 61 CTMfloat * mVertices;
nuclear@14 62 CTMuint mVertexCount;
nuclear@14 63
nuclear@14 64 // Indices
nuclear@14 65 CTMuint * mIndices;
nuclear@14 66 CTMuint mTriangleCount;
nuclear@14 67
nuclear@14 68 // Normals (optional)
nuclear@14 69 CTMfloat * mNormals;
nuclear@14 70
nuclear@14 71 // Multiple sets of UV coordinate maps (optional)
nuclear@14 72 CTMuint mUVMapCount;
nuclear@14 73 _CTMfloatmap * mUVMaps;
nuclear@14 74
nuclear@14 75 // Multiple sets of custom vertex attribute maps (optional)
nuclear@14 76 CTMuint mAttribMapCount;
nuclear@14 77 _CTMfloatmap * mAttribMaps;
nuclear@14 78
nuclear@14 79 // Last error code
nuclear@14 80 CTMenum mError;
nuclear@14 81
nuclear@14 82 // The selected compression method
nuclear@14 83 CTMenum mMethod;
nuclear@14 84
nuclear@14 85 // The selected compression level
nuclear@14 86 CTMuint mCompressionLevel;
nuclear@14 87
nuclear@14 88 // Vertex coordinate precision
nuclear@14 89 CTMfloat mVertexPrecision;
nuclear@14 90
nuclear@14 91 // Normal precision (angular + magnitude)
nuclear@14 92 CTMfloat mNormalPrecision;
nuclear@14 93
nuclear@14 94 // File comment
nuclear@14 95 char * mFileComment;
nuclear@14 96
nuclear@14 97 // Read() function pointer
nuclear@14 98 CTMreadfn mReadFn;
nuclear@14 99
nuclear@14 100 // Write() function pointer
nuclear@14 101 CTMwritefn mWriteFn;
nuclear@14 102
nuclear@14 103 // User data (for stream read/write - usually the stream handle)
nuclear@14 104 void * mUserData;
nuclear@14 105 } _CTMcontext;
nuclear@14 106
nuclear@14 107 //-----------------------------------------------------------------------------
nuclear@14 108 // Macros
nuclear@14 109 //-----------------------------------------------------------------------------
nuclear@14 110 #define FOURCC(str) (((CTMuint) str[0]) | (((CTMuint) str[1]) << 8) | \
nuclear@14 111 (((CTMuint) str[2]) << 16) | (((CTMuint) str[3]) << 24))
nuclear@14 112
nuclear@14 113 //-----------------------------------------------------------------------------
nuclear@14 114 // Funcion prototypes for stream.c
nuclear@14 115 //-----------------------------------------------------------------------------
nuclear@14 116 CTMuint _ctmStreamRead(_CTMcontext * self, void * aBuf, CTMuint aCount);
nuclear@14 117 CTMuint _ctmStreamWrite(_CTMcontext * self, void * aBuf, CTMuint aCount);
nuclear@14 118 CTMuint _ctmStreamReadUINT(_CTMcontext * self);
nuclear@14 119 void _ctmStreamWriteUINT(_CTMcontext * self, CTMuint aValue);
nuclear@14 120 CTMfloat _ctmStreamReadFLOAT(_CTMcontext * self);
nuclear@14 121 void _ctmStreamWriteFLOAT(_CTMcontext * self, CTMfloat aValue);
nuclear@14 122 void _ctmStreamReadSTRING(_CTMcontext * self, char ** aValue);
nuclear@14 123 void _ctmStreamWriteSTRING(_CTMcontext * self, const char * aValue);
nuclear@14 124 int _ctmStreamReadPackedInts(_CTMcontext * self, CTMint * aData, CTMuint aCount, CTMuint aSize, CTMint aSignedInts);
nuclear@14 125 int _ctmStreamWritePackedInts(_CTMcontext * self, CTMint * aData, CTMuint aCount, CTMuint aSize, CTMint aSignedInts);
nuclear@14 126 int _ctmStreamReadPackedFloats(_CTMcontext * self, CTMfloat * aData, CTMuint aCount, CTMuint aSize);
nuclear@14 127 int _ctmStreamWritePackedFloats(_CTMcontext * self, CTMfloat * aData, CTMuint aCount, CTMuint aSize);
nuclear@14 128
nuclear@14 129 //-----------------------------------------------------------------------------
nuclear@14 130 // Funcion prototypes for compressRAW.c
nuclear@14 131 //-----------------------------------------------------------------------------
nuclear@14 132 int _ctmCompressMesh_RAW(_CTMcontext * self);
nuclear@14 133 int _ctmUncompressMesh_RAW(_CTMcontext * self);
nuclear@14 134
nuclear@14 135 //-----------------------------------------------------------------------------
nuclear@14 136 // Funcion prototypes for compressMG1.c
nuclear@14 137 //-----------------------------------------------------------------------------
nuclear@14 138 int _ctmCompressMesh_MG1(_CTMcontext * self);
nuclear@14 139 int _ctmUncompressMesh_MG1(_CTMcontext * self);
nuclear@14 140
nuclear@14 141 //-----------------------------------------------------------------------------
nuclear@14 142 // Funcion prototypes for compressMG2.c
nuclear@14 143 //-----------------------------------------------------------------------------
nuclear@14 144 int _ctmCompressMesh_MG2(_CTMcontext * self);
nuclear@14 145 int _ctmUncompressMesh_MG2(_CTMcontext * self);
nuclear@14 146
nuclear@14 147 #endif // __OPENCTM_INTERNAL_H_