Initial version of geometry compiler.

This commit is contained in:
bkaradzic
2012-12-28 17:09:34 -08:00
parent 9473fb1ffd
commit 1bc2ec8015
385 changed files with 143032 additions and 284996 deletions

13
3rdparty/forsyth-too/LICENSE.md vendored Normal file
View File

@@ -0,0 +1,13 @@
This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
Optimization" algorithm as described here:
http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
This code was authored and released into the public domain by
Adrian Stone (stone@gameangst.com).
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,350 @@
//-----------------------------------------------------------------------------
// This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
// Optimization" algorithm as described here:
// http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
//
// This code was authored and released into the public domain by
// Adrian Stone (stone@gameangst.com).
//
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
// LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include <assert.h>
#include <math.h>
#include <vector>
#include <limits>
#include <algorithm>
namespace Forsyth
{
typedef unsigned int uint;
typedef unsigned short uint16;
typedef unsigned char byte;
//-----------------------------------------------------------------------------
// OptimizeFaces
//-----------------------------------------------------------------------------
// Parameters:
// indexList
// input index list
// indexCount
// the number of indices in the list
// vertexCount
// the largest index value in indexList
// newIndexList
// a pointer to a preallocated buffer the same size as indexList to
// hold the optimized index list
// lruCacheSize
// the size of the simulated post-transform cache (max:64)
//-----------------------------------------------------------------------------
void OptimizeFaces(const uint16* indexList, uint indexCount, uint vertexCount, uint16* newIndexList, uint16 lruCacheSize);
namespace
{
// code for computing vertex score was taken, as much as possible
// directly from the original publication.
float ComputeVertexCacheScore(int cachePosition, int vertexCacheSize)
{
const float FindVertexScore_CacheDecayPower = 1.5f;
const float FindVertexScore_LastTriScore = 0.75f;
float score = 0.0f;
if ( cachePosition < 0 )
{
// Vertex is not in FIFO cache - no score.
}
else
{
if ( cachePosition < 3 )
{
// This vertex was used in the last triangle,
// so it has a fixed score, whichever of the three
// it's in. Otherwise, you can get very different
// answers depending on whether you add
// the triangle 1,2,3 or 3,1,2 - which is silly.
score = FindVertexScore_LastTriScore;
}
else
{
assert ( cachePosition < vertexCacheSize );
// Points for being high in the cache.
const float scaler = 1.0f / ( vertexCacheSize - 3 );
score = 1.0f - ( cachePosition - 3 ) * scaler;
score = powf ( score, FindVertexScore_CacheDecayPower );
}
}
return score;
}
float ComputeVertexValenceScore(uint numActiveFaces)
{
const float FindVertexScore_ValenceBoostScale = 2.0f;
const float FindVertexScore_ValenceBoostPower = 0.5f;
float score = 0.f;
// Bonus points for having a low number of tris still to
// use the vert, so we get rid of lone verts quickly.
float valenceBoost = powf ( static_cast<float>(numActiveFaces),
-FindVertexScore_ValenceBoostPower );
score += FindVertexScore_ValenceBoostScale * valenceBoost;
return score;
}
const uint kMaxVertexCacheSize = 64;
const uint kMaxPrecomputedVertexValenceScores = 64;
float s_vertexCacheScores[kMaxVertexCacheSize+1][kMaxVertexCacheSize];
float s_vertexValenceScores[kMaxPrecomputedVertexValenceScores];
bool ComputeVertexScores()
{
for (int cacheSize=0; cacheSize<=kMaxVertexCacheSize; ++cacheSize)
{
for (int cachePos=0; cachePos<cacheSize; ++cachePos)
{
s_vertexCacheScores[cacheSize][cachePos] = ComputeVertexCacheScore(cachePos, cacheSize);
}
}
for (uint valence=0; valence<kMaxPrecomputedVertexValenceScores; ++valence)
{
s_vertexValenceScores[valence] = ComputeVertexValenceScore(valence);
}
return true;
}
bool s_vertexScoresComputed = ComputeVertexScores();
inline float FindVertexCacheScore(uint cachePosition, uint maxSizeVertexCache)
{
return s_vertexCacheScores[maxSizeVertexCache][cachePosition];
}
inline float FindVertexValenceScore(uint numActiveTris)
{
return s_vertexValenceScores[numActiveTris];
}
float FindVertexScore(uint numActiveFaces, uint cachePosition, uint vertexCacheSize)
{
assert(s_vertexScoresComputed);
if ( numActiveFaces == 0 )
{
// No tri needs this vertex!
return -1.0f;
}
float score = 0.f;
if (cachePosition < vertexCacheSize)
{
score += s_vertexCacheScores[vertexCacheSize][cachePosition];
}
if (numActiveFaces < kMaxPrecomputedVertexValenceScores)
{
score += s_vertexValenceScores[numActiveFaces];
}
else
{
score += ComputeVertexValenceScore(numActiveFaces);
}
return score;
}
struct OptimizeVertexData
{
float score;
uint activeFaceListStart;
uint activeFaceListSize;
uint16 cachePos0;
uint16 cachePos1;
OptimizeVertexData() : score(0.f), activeFaceListStart(0), activeFaceListSize(0), cachePos0(0), cachePos1(0) { }
};
}
void OptimizeFaces(const uint16* indexList, uint indexCount, uint vertexCount, uint16* newIndexList, uint16 lruCacheSize)
{
std::vector<OptimizeVertexData> vertexDataList;
vertexDataList.resize(vertexCount);
// compute face count per vertex
for (uint i=0; i<indexCount; ++i)
{
uint16 index = indexList[i];
assert(index < vertexCount);
OptimizeVertexData& vertexData = vertexDataList[index];
vertexData.activeFaceListSize++;
}
std::vector<uint> activeFaceList;
const uint16 kEvictedCacheIndex = std::numeric_limits<uint16>::max();
{
// allocate face list per vertex
uint curActiveFaceListPos = 0;
for (uint i=0; i<vertexCount; ++i)
{
OptimizeVertexData& vertexData = vertexDataList[i];
vertexData.cachePos0 = kEvictedCacheIndex;
vertexData.cachePos1 = kEvictedCacheIndex;
vertexData.activeFaceListStart = curActiveFaceListPos;
curActiveFaceListPos += vertexData.activeFaceListSize;
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos0, lruCacheSize);
vertexData.activeFaceListSize = 0;
}
activeFaceList.resize(curActiveFaceListPos);
}
// fill out face list per vertex
for (uint i=0; i<indexCount; i+=3)
{
for (uint j=0; j<3; ++j)
{
uint16 index = indexList[i+j];
OptimizeVertexData& vertexData = vertexDataList[index];
activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize] = i;
vertexData.activeFaceListSize++;
}
}
std::vector<byte> processedFaceList;
processedFaceList.resize(indexCount);
uint16 vertexCacheBuffer[(kMaxVertexCacheSize+3)*2];
uint16* cache0 = vertexCacheBuffer;
uint16* cache1 = vertexCacheBuffer+(kMaxVertexCacheSize+3);
uint16 entriesInCache0 = 0;
uint bestFace = 0;
float bestScore = -1.f;
const float maxValenceScore = FindVertexScore(1, kEvictedCacheIndex, lruCacheSize) * 3.f;
for (uint i = 0; i < indexCount; i += 3)
{
if (bestScore < 0.f)
{
// no verts in the cache are used by any unprocessed faces so
// search all unprocessed faces for a new starting point
for (uint j = 0; j < indexCount; j += 3)
{
if (processedFaceList[j] == 0)
{
uint face = j;
float faceScore = 0.f;
for (uint k=0; k<3; ++k)
{
uint16 index = indexList[face+k];
OptimizeVertexData& vertexData = vertexDataList[index];
assert(vertexData.activeFaceListSize > 0);
assert(vertexData.cachePos0 >= lruCacheSize);
faceScore += vertexData.score;
}
if (faceScore > bestScore)
{
bestScore = faceScore;
bestFace = face;
assert(bestScore <= maxValenceScore);
if (bestScore >= maxValenceScore)
{
break;
}
}
}
}
assert(bestScore >= 0.f);
}
processedFaceList[bestFace] = 1;
uint16 entriesInCache1 = 0;
// add bestFace to LRU cache and to newIndexList
for (uint v = 0; v < 3; ++v)
{
uint16 index = indexList[bestFace+v];
newIndexList[i+v] = index;
OptimizeVertexData& vertexData = vertexDataList[index];
if (vertexData.cachePos1 >= entriesInCache1)
{
vertexData.cachePos1 = entriesInCache1;
cache1[entriesInCache1++] = index;
if (vertexData.activeFaceListSize == 1)
{
--vertexData.activeFaceListSize;
continue;
}
}
assert(vertexData.activeFaceListSize > 0);
uint* begin = &activeFaceList[vertexData.activeFaceListStart];
uint* end = &activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize];
uint* it = std::find(begin, end, bestFace);
assert(it != end);
std::swap(*it, *(end-1));
--vertexData.activeFaceListSize;
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos1, lruCacheSize);
}
// move the rest of the old verts in the cache down and compute their new scores
for (uint c0 = 0; c0 < entriesInCache0; ++c0)
{
uint16 index = cache0[c0];
OptimizeVertexData& vertexData = vertexDataList[index];
if (vertexData.cachePos1 >= entriesInCache1)
{
vertexData.cachePos1 = entriesInCache1;
cache1[entriesInCache1++] = index;
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos1, lruCacheSize);
}
}
// find the best scoring triangle in the current cache (including up to 3 that were just evicted)
bestScore = -1.f;
for (uint c1 = 0; c1 < entriesInCache1; ++c1)
{
uint16 index = cache1[c1];
OptimizeVertexData& vertexData = vertexDataList[index];
vertexData.cachePos0 = vertexData.cachePos1;
vertexData.cachePos1 = kEvictedCacheIndex;
for (uint j=0; j<vertexData.activeFaceListSize; ++j)
{
uint face = activeFaceList[vertexData.activeFaceListStart+j];
float faceScore = 0.f;
for (uint v=0; v<3; v++)
{
uint16 faceIndex = indexList[face+v];
OptimizeVertexData& faceVertexData = vertexDataList[faceIndex];
faceScore += faceVertexData.score;
}
if (faceScore > bestScore)
{
bestScore = faceScore;
bestFace = face;
}
}
}
std::swap(cache0, cache1);
entriesInCache0 = std::min(entriesInCache1, lruCacheSize);
}
}
} // namespace Forsyth

View File

@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
// Optimization" algorithm as described here:
// http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
//
// This code was authored and released into the public domain by
// Adrian Stone (stone@gameangst.com).
//
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
// LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef __FORSYTH_TRIANGLE_REORDER__
#define __FORSYTH_TRIANGLE_REORDER__
#include <stdint.h>
namespace Forsyth
{
//-----------------------------------------------------------------------------
// OptimizeFaces
//-----------------------------------------------------------------------------
// Parameters:
// indexList
// input index list
// indexCount
// the number of indices in the list
// vertexCount
// the largest index value in indexList
// newIndexList
// a pointer to a preallocated buffer the same size as indexList to
// hold the optimized index list
// lruCacheSize
// the size of the simulated post-transform cache (max:64)
//-----------------------------------------------------------------------------
void OptimizeFaces(const uint16_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint16_t* newIndexList, uint16_t lruCacheSize);
} // namespace Forsyth
#endif // __FORSYTH_TRIANGLE_REORDER__

View File

@@ -1,100 +0,0 @@
1. PREREQUISITES
================
In order to compile the OpenCTM shared library, all you need is a supported
compiler and it should compile right out of the box.
In order to compile the entire OpenCTM package, including documentation and the
tools, there are some extra dependencies:
- To build all the tools, you need GLUT, and for Un*x/X11 you also need
GTK+ 2.0 (Ubuntu: sudo apt-get install libgtk2.0-dev).
- To build the documentation you need Doxygen (www.doxygen.org), a full
LaTeX installation (see TeX Live - http://www.tug.org/texlive/), and Groff
(Windows: http://gnuwin32.sourceforge.net/packages/groff.htm,
Mac OS X: preinstalled, Ubuntu: sudo apt-get install groff).
2. COMPILING
============
There are a few makefiles for different systems and compilers. Just pick the
one that fits your system, and run "make" on the corresponding file. Here are
a few specific instructions:
2.1 Windows, MinGW32
--------------------
mingw32-make -f Makefile.mingw
2.2 Windows, MS Visual Studio (Express) 2008
--------------------------------------------
nmake /f Makefile.msvc
2.3 Mac OS X
------------
make -f Makefile.macosx
2.4 Linux
---------
make -f Makefile.linux
2.5 OpenSolaris
---------------
gmake -f Makefile.linux
3. BUILD TARGETS
================
By default, the OpenCTM shared library and the OpenCTM tools are compiled when
make is run. To select what is built, use one of the following build targets
(just append it to the end of the make command line):
openctm (the shared library)
toolset (the tools)
documentation (the HTML and PDF documentation)
all (openctm + toolset + documentation)
clean (clean all the built files - start from scratch)
For instance, to just build the OpenCTM shared library under Windows with
MS Visual Studio, type:
nmake /f Makefile.msvc openctm
4. INSTALLATION
===============
For Linux and Mac OS X, it is possible to make a system wide installation by
using the "install" build target. The installation process will install the
following:
- OpenCTM shared library
- OpenCTM C/C++ headers (inlcude files)
- ctmconv and ctmviewer tools
- Man pages
Just make sure that the Makefile contains the correct (and desired)
installation paths. Also, you need to have root privileges to make a system
wide installation.
For instance, to compile and install OpenCTM under Ubuntu, do:
make -f Makefile.linux
sudo make -f Makefile.linux install
...and to compile and install OpenCTM under Mac OS X, do:
make -f Makefile.macosx
sudo make -f Makefile.macosx install

View File

@@ -1,20 +0,0 @@
Copyright (c) 2009-2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

View File

@@ -1,65 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.linux
# Description: Top level makefile for Linux systems (should work on most
# Un*x-like systems with gcc, e.g. OpenSolaris).
###############################################################################
# Copyright (c) 2009 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.phony: default all openctm toolset documentation install clean
default: openctm toolset
all: openctm toolset documentation
clean:
cd lib && $(MAKE) -f Makefile.linux clean && cd ..
cd tools && $(MAKE) -f Makefile.linux clean && cd ..
cd doc && $(MAKE) -f Makefile.linux clean && cd ..
openctm:
cd lib && $(MAKE) -f Makefile.linux -j2 && cd ..
toolset:
cd tools && $(MAKE) -f Makefile.linux -j2 && cd ..
documentation:
cd doc && $(MAKE) -f Makefile.linux -j2 && cd ..
# Installation settings
LIBDIR = /usr/lib/
INCDIR = /usr/local/include/
BINDIR = /usr/local/bin/
MAN1DIR = /usr/local/share/man/man1/
CP = cp
MKDIR = mkdir -p
install:
$(CP) lib/libopenctm.so $(LIBDIR)
$(CP) lib/openctm.h $(INCDIR)
$(CP) lib/openctmpp.h $(INCDIR)
$(CP) tools/ctmconv $(BINDIR)
$(CP) tools/ctmviewer $(BINDIR)
$(MKDIR) $(MAN1DIR)
$(CP) doc/ctmconv.1 $(MAN1DIR)
$(CP) doc/ctmviewer.1 $(MAN1DIR)

View File

@@ -1,64 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.macosx
# Description: Top level makefile for Mac OS X.
###############################################################################
# Copyright (c) 2009 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.phony: default all openctm toolset documentation clean
default: openctm toolset
all: openctm toolset documentation
clean:
cd lib && $(MAKE) -f Makefile.macosx clean && cd ..
cd tools && $(MAKE) -f Makefile.macosx clean && cd ..
cd doc && $(MAKE) -f Makefile.macosx clean && cd ..
openctm:
cd lib && $(MAKE) -f Makefile.macosx -j2 && cd ..
toolset:
cd tools && $(MAKE) -f Makefile.macosx -j2 && cd ..
documentation:
cd doc && $(MAKE) -f Makefile.macosx -j2 && cd ..
# Installation settings
LIBDIR = /usr/local/lib/
INCDIR = /usr/local/include/
BINDIR = /usr/local/bin/
MAN1DIR = /usr/local/share/man/man1/
CP = cp
MKDIR = mkdir -p
install:
$(CP) lib/libopenctm.dylib $(LIBDIR)
$(CP) lib/openctm.h $(INCDIR)
$(CP) lib/openctmpp.h $(INCDIR)
$(CP) tools/ctmconv $(BINDIR)
$(CP) tools/ctmviewer $(BINDIR)
$(MKDIR) $(MAN1DIR)
$(CP) doc/ctmconv.1 $(MAN1DIR)
$(CP) doc/ctmviewer.1 $(MAN1DIR)

View File

@@ -1,45 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.mingw
# Description: Top level makefile for Windows / MinGW32.
###############################################################################
# Copyright (c) 2009 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.phony: default all openctm toolset documentation clean
default: openctm toolset
all: openctm toolset documentation
clean:
cd lib && $(MAKE) -f Makefile.mingw clean && cd ..
cd tools && $(MAKE) -f Makefile.mingw clean && cd ..
cd doc && $(MAKE) -f Makefile.win clean && cd ..
openctm:
cd lib && $(MAKE) -f Makefile.mingw -j2 && cd ..
toolset:
cd tools && $(MAKE) -f Makefile.mingw -j2 && cd ..
documentation:
cd doc && $(MAKE) -f Makefile.win -j2 && cd ..

View File

@@ -1,45 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.msvc
# Description: Top level makefile for Windows / MS Visual Studio 2008.
###############################################################################
# Copyright (c) 2009 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.PHONY: default all openctm toolset documentation clean
default: openctm toolset
all: openctm toolset documentation
clean:
cd lib && $(MAKE) /nologo /f Makefile.msvc clean && cd ..
cd tools && $(MAKE) /nologo /f Makefile.msvc clean && cd ..
cd doc && $(MAKE) /nologo /f Makefile.win clean && cd ..
openctm:
cd lib && $(MAKE) /nologo /f Makefile.msvc && cd ..
toolset:
cd tools && $(MAKE) /nologo /f Makefile.msvc && cd ..
documentation:
cd doc && $(MAKE) /nologo /f Makefile.win && cd ..

View File

@@ -1,152 +0,0 @@
1. INTRODUCTION
===============
Welcome to OpenCTM!
OpenCTM is a file format, a software library and a tool set for compression of
3D triangle meshes. The geometry is compressed to a fraction of comparable file
formats (3DS, STL, COLLADA, VRML...), and the format is easily accessible
through a simple, portable API.
The library is written in portable C (C99), and should compile nicely on any
32/64-bit system regardless of endianity (big endian or little endian).
2. LICENSE
==========
The OpenCTM API and the OpenCTM tools are released under the zlib/libpng
license (see LICENSE.txt).
3. CREDITS
==========
Many people have helped out in the development process of OpenCTM, with
valuable feedback, programming efforts, test models and conceptual ideas.
Also, OpenCTM relies heavily on many other open source projects.
Here is an incomplete list of persons that deserve credit:
- Igor Pavlov (LZMA library)
- Jonas Innala (COLLADA importer, Maya exporter plugin)
- Ilian Dinev (help with the OpenCTM file format design and the LWO loader)
- Lee Thomason (TinyXML)
- Diego Nehab (RPly - for loading PLY files)
- Lev Povalahev, Marcelo E. Magallon, Milan Ikits (GLEW)
- Thomas G. Lane, Guido Vollbeding (libjpeg)
- Jean-loup Gailly, Mark Adler (zlib)
- Daniel Karling (pnglite)
During the development of OpenCTM, the following software has been used
extensively:
- Ubuntu (www.ubuntu.com)
- Blender (www.blender.org)
- GCC (gcc.gnu.org)
- SciTE (www.scintilla.org/SciTE.html)
- Notepad++ (notepad-plus.sourceforge.net)
- Smultron (smultron.sourceforge.net)
Legal notices:
- This software is based in part on the work of the Independent JPEG Group.
4. CHANGES
==========
v1.0.3 - 2010.01.15
-------------------
- Added support for PNG format textures (ctmviewer).
- Added support for LightWave LWO files (ctmconv and ctmviewer).
- Added support for Geomview OFF files, e.g. as used by the Princeton Shape
Benchmark (ctmconv and ctmviewer).
- Improved the OBJ file loader (ctmviewer and ctmconv).
- Experimental support for VRML 2.0 files - export only (ctmconv and ctmviewer).
- Made it possible to run ctmviewer without command line arguments.
- Improved the normal calculation algorithm (ctmviewer and ctmconv).
- Normals are no longer exported if no normals were present in the input file
(ctmviewer).
v1.0.2 - 2009.12.13
-------------------
- Added an OpenCTM exporter plugin for Maya [Jonas Innala].
- Added the possiblity to save and load files from ctmviewer, effectively
turning it into a quick and simple converter tool (without all the options
in the ctmconv program, though).
- Added a function to load texture files from ctmviewer.
- Improved the camera control in ctmviewer (panning with the right mouse
button, zooming with the middle mouse button and the mouse wheel, feature
focusing by double clicking, Y/Z up axis selection and "fit to screen"
function).
- Added a GUI dialog for showing errors in ctmviewer (this is especially useful
under Windows, where console output is disabeled).
- Added an option for calculating the normals in ctmconv (if the input file
does not have normals).
- Added options for turning off normals, texture coordinates and/or vertex
colors for the output file in ctmconv.
- Added manuals for ctmviewer and ctmconv (man pages).
- Added a "make install" build target for Mac OS X and Linux for simple system
wide installation (see COMPILING.txt).
- NOTE: The Linux/X11 version of ctmviewer now reqires GTK+ 2.0.
v1.0.1 - 2009.11.15
-------------------
- Notable reduction of the memory footprint by tuning of the LZMA compression
parameters.
- Added a Wavefront OBJ file importer/exporter.
- Some improvements to ctmviewer and ctmconv.
- Some directory structure and build system cleanups.
v1.0 - 2009.11.09
-----------------
- Added a COLLADA converter module to the ctmconv program [Jonas Innala].
- Added Python bindings and a demo Python program.
- Improved the internal mesh integrity checking, to minimize the risk of invalid
data processing.
- Improved the file format specification document.
v0.8 (beta) - 2009.09.14
------------------------
- Introduced a new API function for controlling the compression level
(ctmCompressionLevel), and set the default compression level to 5 (rather
than 9, which would eat a lot of memory, usally without much difference).
- Changed the name "texture map" in the API to "UV map" (and all
corresponding constant and function names). This is more in line with
the nomenclature of most 3D authoring software, and avoids the confusion
with the term texture mapping in 3D hardware (which is not limited to
2D UV mapping coordinates).
- A few updates to the documentation.
v0.7 (beta) - 2009.08.29
------------------------
- This was the first public release of OpenCTM.

View File

@@ -1,189 +0,0 @@
unit OpenCTM;
//------------------------------------------------------------------------------
// Product: OpenCTM
// File: OpenCTM.pas
// Description: Delphi API bindings.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//------------------------------------------------------------------------------
interface
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
type
// Basic types
TCTMfloat = Single;
TCTMint = Integer;
TCTMuint = Cardinal;
TCTMcontext = Pointer;
TCTMenum = Cardinal;
// Pointer types
PCTMfloat = ^TCTMfloat;
PCTMint = ^TCTMint;
PCTMuint = ^TCTMuint;
// Callback function pointer types
TCTMreadfn = function (ABuf: Pointer; ACount: TCTMuint; AUserData: Pointer): TCTMuint; stdcall;
TCTMwritefn = function (ABuf: Pointer; ACount: TCTMuint; AUserData: Pointer): TCTMuint; stdcall;
//------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------
const
CTM_API_VERSION = $00000100;
CTM_TRUE = 1;
CTM_FALSE = 0;
// TCTMenum
CTM_NONE = $0000;
CTM_INVALID_CONTEXT = $0001;
CTM_INVALID_ARGUMENT = $0002;
CTM_INVALID_OPERATION = $0003;
CTM_INVALID_MESH = $0004;
CTM_OUT_OF_MEMORY = $0005;
CTM_FILE_ERROR = $0006;
CTM_BAD_FORMAT = $0007;
CTM_LZMA_ERROR = $0008;
CTM_INTERNAL_ERROR = $0009;
CTM_UNSUPPORTED_FORMAT_VERSION = $000A;
CTM_IMPORT = $0101;
CTM_EXPORT = $0102;
CTM_METHOD_RAW = $0201;
CTM_METHOD_MG1 = $0202;
CTM_METHOD_MG2 = $0203;
CTM_VERTEX_COUNT = $0301;
CTM_TRIANGLE_COUNT = $0302;
CTM_HAS_NORMALS = $0303;
CTM_UV_MAP_COUNT = $0304;
CTM_ATTRIB_MAP_COUNT = $0305;
CTM_VERTEX_PRECISION = $0306;
CTM_NORMAL_PRECISION = $0307;
CTM_COMPRESSION_METHOD = $0308;
CTM_FILE_COMMENT = $0309;
CTM_NAME = $0501;
CTM_FILE_NAME = $0502;
CTM_PRECISION = $0503;
CTM_INDICES = $0601;
CTM_VERTICES = $0602;
CTM_NORMALS = $0603;
CTM_UV_MAP_1 = $0700;
CTM_UV_MAP_2 = $0701;
CTM_UV_MAP_3 = $0702;
CTM_UV_MAP_4 = $0703;
CTM_UV_MAP_5 = $0704;
CTM_UV_MAP_6 = $0705;
CTM_UV_MAP_7 = $0706;
CTM_UV_MAP_8 = $0707;
CTM_ATTRIB_MAP_1 = $0800;
CTM_ATTRIB_MAP_2 = $0801;
CTM_ATTRIB_MAP_3 = $0802;
CTM_ATTRIB_MAP_4 = $0803;
CTM_ATTRIB_MAP_5 = $0804;
CTM_ATTRIB_MAP_6 = $0805;
CTM_ATTRIB_MAP_7 = $0806;
CTM_ATTRIB_MAP_8 = $0807;
//------------------------------------------------------------------------------
// Function prototypes
//------------------------------------------------------------------------------
function ctmNewContext(AMode: TCTMenum): TCTMcontext; stdcall;
procedure ctmFreeContext(AContext: TCTMcontext); stdcall;
function ctmGetError(AContext: TCTMcontext): TCTMenum; stdcall;
function ctmErrorString(AError: TCTMenum): PChar; stdcall;
function ctmGetInteger(AContext: TCTMcontext; AProperty: TCTMenum): TCTMuint; stdcall;
function ctmGetFloat(AContext: TCTMcontext; AProperty: TCTMenum): TCTMfloat; stdcall;
function ctmGetIntegerArray(AContext: TCTMcontext; AProperty: TCTMenum): PCTMuint; stdcall;
function ctmGetFloatArray(AContext: TCTMcontext; AProperty: TCTMenum): PCTMfloat; stdcall;
function ctmGetNamedUVMap(AContext: TCTMcontext; AName: PChar): TCTMenum; stdcall;
function ctmGetUVMapString(AContext: TCTMcontext; AUVMap: TCTMenum; AProperty: TCTMenum): PChar; stdcall;
function ctmGetUVMapFloat(AContext: TCTMcontext; AUVMap: TCTMenum; AProperty: TCTMenum): TCTMfloat; stdcall;
function ctmGetNamedAttribMap(AContext: TCTMcontext; AName: PChar): TCTMenum; stdcall;
function ctmGetAttribMapString(AContext: TCTMcontext; AAttribMap: TCTMenum; AProperty: TCTMenum): PChar; stdcall;
function ctmGetAttribMapFloat(AContext: TCTMcontext; AAttribMap: TCTMenum; AProperty: TCTMenum): TCTMfloat; stdcall;
function ctmGetString(AContext: TCTMcontext; AProperty: TCTMenum): PChar; stdcall;
procedure ctmCompressionMethod(AContext: TCTMcontext; AMethod: TCTMenum); stdcall;
procedure ctmCompressionLevel(AContext: TCTMcontext; ALevel: TCTMuint); stdcall;
procedure ctmVertexPrecision(AContext: TCTMcontext; APrecision: TCTMfloat); stdcall;
procedure ctmVertexPrecisionRel(AContext: TCTMcontext; ARelPrecision: TCTMfloat); stdcall;
procedure ctmNormalPrecision(AContext: TCTMcontext; APrecision: TCTMfloat); stdcall;
procedure ctmUVCoordPrecision(AContext: TCTMcontext; AUVMap: TCTMenum; APrecision: TCTMfloat); stdcall;
procedure ctmAttribPrecision(AContext: TCTMcontext; AAttribMap: TCTMenum; APrecision: TCTMfloat); stdcall;
procedure ctmFileComment(AContext: TCTMcontext; AFileComment: PChar); stdcall;
procedure ctmDefineMesh(AContext: TCTMcontext; AVertices: PCTMfloat; AVertexCount: TCTMuint; AIndices: PCTMuint; ATriangleCount: TCTMuint; ANormals: PCTMfloat); stdcall;
function ctmAddUVMap(AContext: TCTMcontext; AUVCoords: PCTMfloat; AName: PChar; AFileName: PChar): TCTMenum; stdcall;
function ctmAddAttribMap(AContext: TCTMcontext; AAttribValues: PCTMfloat; AName: PChar): TCTMenum; stdcall;
procedure ctmLoad(AContext: TCTMcontext; AFileName: PChar); stdcall;
procedure ctmLoadCustom(AContext: TCTMcontext; AReadFn: TCTMreadfn; AUserData: Pointer); stdcall;
procedure ctmSave(AContext: TCTMcontext; AFileName: PChar); stdcall;
procedure ctmSaveCustom(AContext: TCTMcontext; AWriteFn: TCTMwritefn; AUserData: Pointer); stdcall;
implementation
//------------------------------------------------------------------------------
// DLL interface
//------------------------------------------------------------------------------
const
DLLNAME = 'openctm.dll';
function ctmNewContext; external DLLNAME;
procedure ctmFreeContext; external DLLNAME;
function ctmGetError; external DLLNAME;
function ctmErrorString; external DLLNAME;
function ctmGetInteger; external DLLNAME;
function ctmGetFloat; external DLLNAME;
function ctmGetIntegerArray; external DLLNAME;
function ctmGetFloatArray; external DLLNAME;
function ctmGetNamedUVMap; external DLLNAME;
function ctmGetUVMapString; external DLLNAME;
function ctmGetUVMapFloat; external DLLNAME;
function ctmGetNamedAttribMap; external DLLNAME;
function ctmGetAttribMapString; external DLLNAME;
function ctmGetAttribMapFloat; external DLLNAME;
function ctmGetString; external DLLNAME;
procedure ctmCompressionMethod; external DLLNAME;
procedure ctmCompressionLevel; external DLLNAME;
procedure ctmVertexPrecision; external DLLNAME;
procedure ctmVertexPrecisionRel; external DLLNAME;
procedure ctmNormalPrecision; external DLLNAME;
procedure ctmUVCoordPrecision; external DLLNAME;
procedure ctmAttribPrecision; external DLLNAME;
procedure ctmFileComment; external DLLNAME;
procedure ctmDefineMesh; external DLLNAME;
function ctmAddUVMap; external DLLNAME;
function ctmAddAttribMap; external DLLNAME;
procedure ctmLoad; external DLLNAME;
procedure ctmLoadCustom; external DLLNAME;
procedure ctmSave; external DLLNAME;
procedure ctmSaveCustom; external DLLNAME;
end.

View File

@@ -1,61 +0,0 @@
#! /usr/bin/env python
#------------------------------------------------------------------------------
# Program: ctminfo.py
# Description: Show information about an OpenCTM file
# License: Public domain
#------------------------------------------------------------------------------
import sys
import openctm
from openctm import *
# Check arguments
if len(sys.argv) != 2:
print("Usage: " + sys.argv[0] + " file")
sys.exit()
# Create an OpenCTM context, and load the file
ctm = ctmNewContext(CTM_IMPORT)
ctmLoad(ctm, sys.argv[1])
err = ctmGetError(ctm)
if err != CTM_NONE:
print("Error loading file: " + str(ctmErrorString(err)))
sys.exit()
# Interpret information
if ctmGetInteger(ctm, CTM_HAS_NORMALS) == CTM_TRUE:
hasNormals = "yes"
else:
hasNormals = "no";
method = ctmGetInteger(ctm, CTM_COMPRESSION_METHOD)
if method == CTM_METHOD_RAW:
methodStr = "RAW"
elif method == CTM_METHOD_MG1:
methodStr = "MG1"
elif method == CTM_METHOD_MG2:
methodStr = "MG2"
else:
methodStr = "Unknown"
# Print information
print(" File: " + sys.argv[1])
print(" Comment: " + str(ctmGetString(ctm, CTM_FILE_COMMENT)))
print("Triangle count: " + str(ctmGetInteger(ctm, CTM_TRIANGLE_COUNT)))
print(" Vertex count: " + str(ctmGetInteger(ctm, CTM_VERTEX_COUNT)))
print(" Has normals: " + hasNormals)
print(" Method: " + methodStr)
# List UV maps
uvMapCount = ctmGetInteger(ctm, CTM_UV_MAP_COUNT)
print(" UV maps: " + str(uvMapCount))
for i in range(uvMapCount):
print(" CTM_UV_MAP_" + str(i+1) + ": \"" + str(ctmGetUVMapString(ctm, CTM_UV_MAP_1 + i, CTM_NAME)) + "\", ref = \"" + str(ctmGetUVMapString(ctm, CTM_UV_MAP_1 + i, CTM_FILE_NAME)) + "\"")
# List attrib maps
attribMapCount = ctmGetInteger(ctm, CTM_ATTRIB_MAP_COUNT)
print("Attribute maps: " + str(attribMapCount))
for i in range(attribMapCount):
print(" CTM_ATTRIB_MAP_" + str(i+1) + ": \"" + str(ctmGetAttribMapString(ctm, CTM_ATTRIB_MAP_1 + i, CTM_NAME)) + "\"")
# Free the OpenCTM context
ctmFreeContext(ctm)

View File

@@ -1,204 +0,0 @@
#------------------------------------------------------------------------------
# Product: OpenCTM
# File: openctm.py
# Description: Python API bindings (tested with Python 2.5.2 and Python 3.0)
#------------------------------------------------------------------------------
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
#------------------------------------------------------------------------------
import os
import ctypes
from ctypes import *
from ctypes.util import find_library
# Types
CTMfloat = c_float
CTMint = c_int32
CTMuint = c_uint32
CTMcontext = c_void_p
CTMenum = c_uint32
# Constants
CTM_API_VERSION = 0x00000100
CTM_TRUE = 1
CTM_FALSE = 0
# CTMenum
CTM_NONE = 0x0000
CTM_INVALID_CONTEXT = 0x0001
CTM_INVALID_ARGUMENT = 0x0002
CTM_INVALID_OPERATION = 0x0003
CTM_INVALID_MESH = 0x0004
CTM_OUT_OF_MEMORY = 0x0005
CTM_FILE_ERROR = 0x0006
CTM_BAD_FORMAT = 0x0007
CTM_LZMA_ERROR = 0x0008
CTM_INTERNAL_ERROR = 0x0009
CTM_UNSUPPORTED_FORMAT_VERSION = 0x000A
CTM_IMPORT = 0x0101
CTM_EXPORT = 0x0102
CTM_METHOD_RAW = 0x0201
CTM_METHOD_MG1 = 0x0202
CTM_METHOD_MG2 = 0x0203
CTM_VERTEX_COUNT = 0x0301
CTM_TRIANGLE_COUNT = 0x0302
CTM_HAS_NORMALS = 0x0303
CTM_UV_MAP_COUNT = 0x0304
CTM_ATTRIB_MAP_COUNT = 0x0305
CTM_VERTEX_PRECISION = 0x0306
CTM_NORMAL_PRECISION = 0x0307
CTM_COMPRESSION_METHOD = 0x0308
CTM_FILE_COMMENT = 0x0309
CTM_NAME = 0x0501
CTM_FILE_NAME = 0x0502
CTM_PRECISION = 0x0503
CTM_INDICES = 0x0601
CTM_VERTICES = 0x0602
CTM_NORMALS = 0x0603
CTM_UV_MAP_1 = 0x0700
CTM_UV_MAP_2 = 0x0701
CTM_UV_MAP_3 = 0x0702
CTM_UV_MAP_4 = 0x0703
CTM_UV_MAP_5 = 0x0704
CTM_UV_MAP_6 = 0x0705
CTM_UV_MAP_7 = 0x0706
CTM_UV_MAP_8 = 0x0707
CTM_ATTRIB_MAP_1 = 0x0800
CTM_ATTRIB_MAP_2 = 0x0801
CTM_ATTRIB_MAP_3 = 0x0802
CTM_ATTRIB_MAP_4 = 0x0803
CTM_ATTRIB_MAP_5 = 0x0804
CTM_ATTRIB_MAP_6 = 0x0805
CTM_ATTRIB_MAP_7 = 0x0806
CTM_ATTRIB_MAP_8 = 0x0807
# Load the OpenCTM shared library
if os.name == 'nt':
_lib = WinDLL('openctm.dll')
else:
_libName = find_library('openctm')
if not _libName:
raise Exception('Could not find the OpenCTM shared library.')
_lib = CDLL(_libName)
if not _lib:
raise Exception('Could not open the OpenCTM shared library.')
# Functions
ctmNewContext = _lib.ctmNewContext
ctmNewContext.argtypes = [CTMenum]
ctmNewContext.restype = CTMcontext
ctmFreeContext = _lib.ctmFreeContext
ctmFreeContext.argtypes = [CTMcontext]
ctmGetError = _lib.ctmGetError
ctmGetError.argtypes = [CTMcontext]
ctmGetError.restype = CTMenum
ctmErrorString = _lib.ctmErrorString
ctmErrorString.argtypes = [CTMenum]
ctmErrorString.restype = c_char_p
ctmGetInteger = _lib.ctmGetInteger
ctmGetInteger.argtypes = [CTMcontext, CTMenum]
ctmGetInteger.restype = CTMint
ctmGetFloat = _lib.ctmGetFloat
ctmGetFloat.argtypes = [CTMcontext, CTMenum]
ctmGetFloat.restype = CTMfloat
ctmGetIntegerArray = _lib.ctmGetIntegerArray
ctmGetIntegerArray.argtypes = [CTMcontext, CTMenum]
ctmGetIntegerArray.restype = POINTER(CTMuint)
ctmGetFloatArray = _lib.ctmGetFloatArray
ctmGetFloatArray.argtypes = [CTMcontext, CTMenum]
ctmGetFloatArray.restype = POINTER(CTMfloat)
ctmGetNamedUVMap = _lib.ctmGetNamedUVMap
ctmGetNamedUVMap.argtypes = [CTMcontext, c_char_p]
ctmGetNamedUVMap.restype = CTMenum
ctmGetUVMapString = _lib.ctmGetUVMapString
ctmGetUVMapString.argtypes = [CTMcontext, CTMenum, CTMenum]
ctmGetUVMapString.restype = c_char_p
ctmGetUVMapFloat = _lib.ctmGetUVMapFloat
ctmGetUVMapFloat.argtypes = [CTMcontext, CTMenum, CTMenum]
ctmGetUVMapFloat.restype = CTMfloat
ctmGetNamedAttribMap = _lib.ctmGetNamedAttribMap
ctmGetNamedAttribMap.argtypes = [CTMcontext, c_char_p]
ctmGetNamedAttribMap.restype = CTMenum
ctmGetAttribMapString = _lib.ctmGetAttribMapString
ctmGetAttribMapString.argtypes = [CTMcontext, CTMenum, CTMenum]
ctmGetAttribMapString.restype = c_char_p
ctmGetAttribMapFloat = _lib.ctmGetAttribMapFloat
ctmGetAttribMapFloat.argtypes = [CTMcontext, CTMenum, CTMenum]
ctmGetAttribMapFloat.restype = CTMfloat
ctmGetString = _lib.ctmGetString
ctmGetString.argtypes = [CTMcontext, CTMenum]
ctmGetString.restype = c_char_p
ctmCompressionMethod = _lib.ctmCompressionMethod
ctmCompressionMethod.argtypes = [CTMcontext, CTMenum]
ctmCompressionLevel = _lib.ctmCompressionLevel
ctmCompressionLevel.argtypes = [CTMcontext, CTMuint]
ctmVertexPrecision = _lib.ctmVertexPrecision
ctmVertexPrecision.argtypes = [CTMcontext, CTMfloat]
ctmVertexPrecisionRel = _lib.ctmVertexPrecisionRel
ctmVertexPrecisionRel.argtypes = [CTMcontext, CTMfloat]
ctmNormalPrecision = _lib.ctmNormalPrecision
ctmNormalPrecision.argtypes = [CTMcontext, CTMfloat]
ctmUVCoordPrecision = _lib.ctmUVCoordPrecision
ctmUVCoordPrecision.argtypes = [CTMcontext, CTMenum, CTMfloat]
ctmAttribPrecision = _lib.ctmAttribPrecision
ctmAttribPrecision.argtypes = [CTMcontext, CTMenum, CTMfloat]
ctmFileComment = _lib.ctmFileComment
ctmFileComment.argtypes = [CTMcontext, c_char_p]
ctmDefineMesh = _lib.ctmDefineMesh
ctmDefineMesh.argtypes = [CTMcontext, POINTER(CTMfloat), CTMuint, POINTER(CTMuint), CTMuint, POINTER(CTMfloat)]
ctmAddUVMap = _lib.ctmAddUVMap
ctmAddUVMap.argtypes = [CTMcontext, POINTER(CTMfloat), c_char_p, c_char_p]
ctmAddUVMap.restype = CTMenum
ctmAddAttribMap = _lib.ctmAddAttribMap
ctmAddAttribMap.argtypes = [CTMcontext, POINTER(CTMfloat), c_char_p]
ctmAddAttribMap.restype = CTMenum
ctmLoad = _lib.ctmLoad
ctmLoad.argtypes = [CTMcontext, c_char_p]
ctmSave = _lib.ctmSave
ctmSave.argtypes = [CTMcontext, c_char_p]

View File

@@ -1,77 +0,0 @@
#!/bin/bash
# Name of the distribution
distname=OpenCTM-1.0.3
# Clean the source directories
echo Cleaning up...
make -f Makefile.linux clean
# Build all the necessary files
echo Building documentation...
make -f Makefile.linux documentation
# Set up a temporary directory
tmproot=/tmp/openctm-$USER-$$
mkdir $tmproot
tmpdir=$tmproot/$distname
mkdir $tmpdir
# Copy files
echo Copying files to $tmpdir...
cp Makefile* *.txt $tmpdir/
mkdir $tmpdir/lib
cp lib/*.c lib/*.h lib/*.rc lib/*.def lib/Makefile* $tmpdir/lib/
mkdir $tmpdir/lib/liblzma
cp lib/liblzma/* $tmpdir/lib/liblzma/
mkdir $tmpdir/tools
cp tools/*.cpp tools/*.mm tools/*.h tools/*.vert tools/*.frag tools/*.rc tools/Makefile* $tmpdir/tools/
mkdir $tmpdir/tools/icons
cp tools/icons/* $tmpdir/tools/icons/
mkdir $tmpdir/tools/jpeg
cp tools/jpeg/* $tmpdir/tools/jpeg/
mkdir $tmpdir/tools/rply
cp tools/rply/* $tmpdir/tools/rply/
mkdir $tmpdir/tools/glew
cp tools/glew/* $tmpdir/tools/glew/
mkdir $tmpdir/tools/glew/GL
cp tools/glew/GL/* $tmpdir/tools/glew/GL/
mkdir $tmpdir/tools/tinyxml
cp tools/tinyxml/* $tmpdir/tools/tinyxml/
mkdir $tmpdir/tools/zlib
cp tools/zlib/* $tmpdir/tools/zlib/
mkdir $tmpdir/tools/pnglite
cp tools/pnglite/* $tmpdir/tools/pnglite/
mkdir $tmpdir/doc
cp doc/DevelopersManual.pdf $tmpdir/doc/
cp doc/FormatSpecification.pdf $tmpdir/doc/
cp doc/ctmconv.1 $tmpdir/doc/
cp doc/ctmviewer.1 $tmpdir/doc/
mkdir $tmpdir/doc/APIReference
cp doc/APIReference/* $tmpdir/doc/APIReference/
mkdir $tmpdir/plugins
mkdir $tmpdir/plugins/blender
cp plugins/blender/* $tmpdir/plugins/blender/
mkdir $tmpdir/plugins/maya
cp plugins/maya/* $tmpdir/plugins/maya/
mkdir $tmpdir/bindings
mkdir $tmpdir/bindings/delphi
cp bindings/delphi/* $tmpdir/bindings/delphi/
mkdir $tmpdir/bindings/python
cp bindings/python/* $tmpdir/bindings/python/
# Create archives
olddir=`pwd`
cd $tmproot
tar -cvf $distname-src.tar $distname
bzip2 -9 $distname-src.tar
zip -9r $distname-src.zip $distname
cd $olddir
cp $tmproot/*.bz2 $tmproot/*.zip ./
# Remove temporary directory
rm -rf $tmproot

View File

@@ -1,678 +0,0 @@
%-------------------------------------------------------------------------------
% Document: OpenCTM Developers Manual
% Author: Marcus Geelnard
% Compile: pdflatex DevelopersManual.tex
%-------------------------------------------------------------------------------
% Note: You need a LaTeX environment to build this document as PDF. The
% recommended way is to install TeX Live (http://www.tug.org/texlive/) and
% a decent LaTeX editor (e.g. texmaker, LEd, etc).
%
% Ubuntu: sudo apt-get install texlive-full
% Mac OS X: http://www.tug.org/mactex/ (MacTeX.mpkg.zip)
%
% To build the PDF document, run pdflatex twice on this .tex file (in order to
% correctly build the TOC).
%-------------------------------------------------------------------------------
% Use the OpenCTM TeX style
\input{openctm-tex.sty}
% Document properties
\author{Marcus Geelnard}
\title{OpenCTM Developers Manual}
% PDF specific document properties
\hypersetup{pdftitle={OpenCTM Developers Manual}}
\hypersetup{pdfauthor={Marcus Geelnard}}
\hypersetup{pdfkeywords={OpenCTM,manual}}
% Document contents
\begin{document}
%--[ Title page ]---------------------------------------------------------------
\begin{titlepage}
\begin{center}
~
\vspace{5cm}
\includegraphics[width=10.0cm]{logo.pdf}
\vspace{0.4cm}
{\large Software Library version 1.0.3}
\vspace{1.0cm}
{\Large Developers Manual}
\vspace{1.5cm}
Copyright \copyright \ 2009-2010 Marcus Geelnard
\end{center}
\end{titlepage}
%--[ Table of contents ]--------------------------------------------------------
\tableofcontents
%-------------------------------------------------------------------------------
\chapter{Introduction}
The OpenCTM file format is an open format for storing 3D triangle meshes.
One of the main advantages over other similar file formats is its ability
to losslessly compress the triangle geometry to a fraction of the corresponding
raw data size.
This document describes how to use the OpenCTM API to load and save OpenCTM
format files. It is mostly written for C/C++ users, but should be useful for
other programming languages too, since the concepts and function calls are
virtually identical regardless of programming language.
For a complete reference to the OpenCTM API, please use the Doxygen generated
OpenCTM API Reference, which describes all API functions, types, constants etc.
%-------------------------------------------------------------------------------
\chapter{Concepts}
\section{The OpenCTM API}
The OpenCTM API makes it easy to read and write OpenCTM format files. The API is
implemented in the form of a software library that an application can be linked
to in order to access the OpenCTM API.
The software library itself is written in standard, portable C language, but
can be used from many other programming languages (writing language bindings
for new languages should be fairly straight forward, since the API was written
with cross-language portability in mind).
\section{The triangle mesh}
The triangle mesh, in OpenCTM terms, is managed in a format that is well suited
for a modern 3D rendering pipeline, such as OpenGL.
At a glance, the OpenCTM mesh has the following properties:
\begin{itemize}
\item A vertex is a set of attributes that uniquely identify the vertex.
This includes: vertex coordinate, normal, UV coordinate(s) and
custom vertex attribute(s) (such as color, weight, etc).
\item A triangle is described by three vertex indices.
\item In the OpenCTM API, these mesh data are treated as arrays (an integer
array for the triangle indices, and floating point arrays for the
vertex data).
\item All vertex data arrays in a mesh must have the same number of elements
(for instance, there is exactly one normal associated with each
vertex coordinate).
\item All mesh data are optional, except for the triangle indices and the
vertex coordinates. For instance, it is possible to leave out the
normal information.
\end{itemize}
For an example of the mesh data structure see table \ref{tab:MeshVert} (vertex
data) and table \ref{tab:MeshTri} (triangle data).
\begin{table}[p]
\centering
\begin{tabular}{|l|l|l|l|l|l|l|l|}\hline
\textbf{Index} & 0 & 1 & 2 & 3 & 4 & \textellipsis & N\\ \hline
\textbf{Vertex} & $v_0$ & $v_1$ & $v_2$ & $v_3$ & $v_4$ & \textellipsis & $v_N$\\ \hline
\textbf{Normal} & $n_0$ & $n_1$ & $n_2$ & $n_3$ & $n_4$ & \textellipsis & $n_N$\\ \hline
\textbf{UVCoord1} & $t1_0$ & $t1_1$ & $t1_2$ & $t1_3$ & $t1_4$ & \textellipsis & $t1_N$\\ \hline
\textbf{UVCoord2} & $t2_0$ & $t2_1$ & $t2_2$ & $t2_3$ & $t2_4$ & \textellipsis & $t2_N$\\ \hline
\textbf{Attrib1} & $a1_0$ & $a1_1$ & $a1_2$ & $a1_3$ & $a1_4$ & \textellipsis & $a1_N$\\ \hline
\textbf{Attrib2} & $a2_0$ & $a2_1$ & $a2_2$ & $a2_3$ & $a2_4$ & \textellipsis & $a2_N$\\ \hline
\end{tabular}
\caption{Mesh vertex data structure in OpenCTM, for a mesh with normals,
two UV coordinates per vertex, and two custom attributes per vertex.}
\label{tab:MeshVert}
\end{table}
\begin{table}[p]
\centering
\begin{tabular}{|l|l|l|l|l|l|l|l|}\hline
\textbf{Triangle} & $tri_0$ & $tri_1$ & $tri_2$ & $tri_3$ & $tri_4$ & \textellipsis & $tri_M$\\ \hline
\end{tabular}
\caption{Mesh triangle data structure in OpenCTM, where $tri_k$ is a tuple of
three vertex indices. For instance,
$tri_0=(0, 1, 2)$,
$tri_1=(0, 2, 3)$,
$tri_2=(3, 5, 4)$, \textellipsis}
\label{tab:MeshTri}
\end{table}
\subsection{Triangle indices}
\label{sec:MeshIndices}
Each triangle is described by three integers: one vertex index for each corner
of the triangle). The triangle index array looks like this:
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|}\hline
$tri^0_0$ & $tri^1_0$ & $tri^2_0$ & $tri^0_1$ & $tri^1_1$ & $tri^2_1$ & \textellipsis & $tri^0_M$ & $tri^1_M$ & $tri^2_M$\\ \hline
\end{tabular}
\textellipsis where $tri^j_k$ is the vertex index for the $j$:th corner of the
$k$:th triangle.
\subsection{Vertex coordinates}
Each vertex coordinate is described by three floating point values: $x$, $y$
and $z$. The vertex coordinate array looks like this:
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|}\hline
$x_0$ & $y_0$ & $z_0$ & $x_1$ & $y_1$ & $z_1$ & \textellipsis & $x_N$ & $y_N$ & $z_N$\\ \hline
\end{tabular}
\textellipsis where $x_k$, $y_k$ and $z_k$ are the $x$, $y$ and $z$ coordinates
of the $k$:th vertex.
\subsection{Normals}
Each normal is described by three floating point values: $x$, $y$
and $z$. The normal array looks like this:
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|}\hline
$x_0$ & $y_0$ & $z_0$ & $x_1$ & $y_1$ & $z_1$ & \textellipsis & $x_N$ & $y_N$ & $z_N$\\ \hline
\end{tabular}
\textellipsis where $x_k$, $y_k$ and $z_k$ are the $x$, $y$ and $z$ components
of the $k$:th normal.
\subsection{UV coordinates}
A mesh may have several UV maps, where each UV map is described by:
\begin{itemize}
\item A UV coordinate array.
\item A unique UV map name.
\item A file name reference (optional).
\end{itemize}
Each UV coordinate is described by two floating point values: $u$ and $v$.
A UV coordinate array looks like this:
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|}\hline
$u_0$ & $v_0$ & $u_1$ & $v_1$ & $u_2$ & $v_2$ & \textellipsis & $u_N$ & $v_N$\\ \hline
\end{tabular}
\textellipsis where $u_k$ and $v_k$ are the $u$ and $v$ components
of the $k$:th UV coordinate.
\subsection{Custom vertex attributes}
A mesh may have several custom vertex attribute maps, where each attribute map
is described by:
\begin{itemize}
\item A vertex attribute array.
\item A unique attribute map name.
\end{itemize}
Each vertex attribute is described by four floating point values: $a$, $b$, $c$
and $d$. An attribute array looks like this:
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|}\hline
$a_0$ & $b_0$ & $c_0$ & $d_0$ & $a_1$ & $b_1$ & $c_1$ & $d_1$ & \textellipsis & $a_N$ & $b_N$ & $c_N$ & $d_N$\\ \hline
\end{tabular}
\textellipsis where $a_k$, $b_k$, $c_k$ and $d_k$ are the four attribute values
of the $k$:th attribute.
\section{The OpenCTM context}
The OpenCTM API uses a \emph{context} for almost all operations (function calls).
The context is created and destroyed with the functions ctmNewContext() and
ctmFreeContext(), respectively.
A program may instantiate any number of contexts, and all OpenCTM function
calls are completely thread safe (multiple threads can use the OpenCTM API
at the same time), as long as each context instance is handled by a single
thread.
Each context is fully self contained and independent of other contexts.
There are two types of OpenCTM context: \emph{import contexts} and
\emph{export contexts}. Import contexts are used for importing OpenCTM files,
and export contexts are used for exporting OpenCTM files.
The context type is selected when creating the context.
%-------------------------------------------------------------------------------
\chapter{Compression Methods}
The OpenCTM file format supports a few different compression methods, each
with its own advantages and disadvantages. The API makes it possible to
select which method to use when creating OpenCTM files (the default method
is MG1).
\section{RAW}
The RAW compression method is not really a compression method, since it only
stores the data in a raw, uncompressed form. The result is a file with the same
size and data format as the in-memory mesh data structure.
The RAW method is mostly useful for testing purposes, but can be preferred in
certain situations, for instance when file writing speeds and a small memory
footprint is more important than minimizing file sizes.
Another situation where the RAW method can be useful is when you need an
easily parsable binary file format. Usually the OpenCTM API can be used in
almost any application, but in some environments, such as certain script
languages or data inspecion tools, it can be handy to have access to the
raw data.
\section{MG1}
The MG1 compression method effectively reduces the size of the mesh data
by re-coding the connectivity information of the mesh into an easily
compressible format. The data is then compressed using LZMA.
The floating point data, such as vertex coordinates and normals, is fully
preserved in the MG1 method, by simply applying lossless LZMA compression
to it.
Under typical condititions, the connectivity information is compressed to
about two bytes per triangle (17\% of the original size), and vertex data
is compressed to about 75\% of the original size.
While creating MG1 files can be a relatively slow process (compared to the
RAW method, for instance) the reading speed is usually very high, thanks to
the fast LZMA decoder and the uncomplicated data format.
\section{MG2}
The MG2 compression method offers the highest level of compression among the
different OpenCTM methods. It uses the same method for compressing connectivity
information as the MG1 method, but does a better job at compressing vertex
data.
Vertex data is converted to a fixed point representation, which allows for
efficient, lossless, prediction based data compression algorithms.
In short, the MG2 method divides the mesh into small sub-spaces, sorts the data
geometrically, and applies delta-prediction to the data, which effectively
lowers the data entropy. The re-coded vertex data is then compressed with
LZMA.
When using the OpenCTM API for creating MG2 files you can trade mesh resolution
for compression ratio, and the API provides several functions for controlling
the resolution of different vertex attributes independently. Therefor it is
usually important to know the resolution requirements for your specific
application when using the MG2 method.
In some applications, such as games, movies and art, it is important that the
3D model is not visually degraded by compression. In such applications
you will typically tune your resolution settings using trial and error,
until you find a setting that does not alter the model visually.
In other applications, such as CAD/CAM, 3D scanning, calibration, etc,
reasonable resolution settings can usually be derived from the limitations
of the process in which the model is used. For instance, there is usually no
need for nanometer precision in the design of an airplane wing, and there
is little use of micrometer resolution in a manufacturing process that can
not reproduce features smaller than 0.15 mm.
As a side effect of the fact that MG2 produces smaller files than the MG1
method does, loading files is usually faster with the MG2 method than with
the MG1 method. Saving files with the MG2 method is about as fast as with
the MG1 method.
%-------------------------------------------------------------------------------
\chapter{Basic Usage}
\section{Prerequisites}
To use the OpenCTM API, you need to include the OpenCTM include file, like this:
\begin{lstlisting}
#include <openctm.h>
\end{lstlisting}
You also need to link with the OpenCTM import library. For instance, in MS
Visual Studio you can add "openctm.lib" to your Additional Dependencies field
in the Linker section. For gcc/g++ or similar compilers, you will typically
add -lopenctm to the list of compiler options, for instance:
\begin{lstlisting}
> g++ -o foo foo.cpp -lopenctm
\end{lstlisting}
\section{Loading OpenCTM files}
Below is a minimal example of how to load an OpenCTM file with the OpenCTM API,
in just a few lines of code:
\begin{lstlisting}
CTMcontext context;
CTMuint vertCount, triCount, * indices;
CTMfloat * vertices;
// Create a new importer context
context = ctmNewContext(CTM_IMPORT);
// Load the OpenCTM file
ctmLoad(context, "mymesh.ctm");
if(ctmGetError(context) == CTM_NONE)
{
// Access the mesh data
vertCount = ctmGetInteger(context, CTM_VERTEX_COUNT);
vertices = ctmGetFloatArray(context, CTM_VERTICES);
triCount = ctmGetInteger(context, CTM_TRIANGLE_COUNT);
indices = ctmGetIntegerArray(context, CTM_INDICES);
// Deal with the mesh (e.g. transcode it to our
// internal representation)
// ...
}
// Free the context
ctmFreeContext(context);
\end{lstlisting}
\section{Creating OpenCTM files}
Below is a minimal example of how to save an OpenCTM file with the OpenCTM API,
in just a few lines of code:
\begin{lstlisting}
void MySaveFile(CTMuint aVertCount, CTMuint aTriCount,
CTMfloat * aVertices, CTMuint * aIndices,
const char * aFileName)
{
CTMcontext context;
// Create a new exporter context
context = ctmNewContext(CTM_EXPORT);
// Define our mesh representation to OpenCTM
ctmDefineMesh(context, aVertices, aVertCount, aIndices, aTriCount, NULL);
// Save the OpenCTM file
ctmSave(context, aFileName);
// Free the context
ctmFreeContext(context);
}
\end{lstlisting}
%-------------------------------------------------------------------------------
\chapter{Controlling Compression}
When creating OpenCTM files, one of the most important things to control with
the API is the compression method.
\section{Selecting the compression method}
You can select which compression method to use with the ctmCompressionMethod()
function. The different options are:
\begin{tabular}{|l|l|}\hline
\textbf{Name} & \textbf{Description}\\ \hline
CTM\_METHOD\_RAW & Use the RAW compression method.\\ \hline
CTM\_METHOD\_MG1 & Use the MG1 compression method (default).\\ \hline
CTM\_METHOD\_MG2 & Use the MG2 compression method.\\ \hline
\end{tabular}
For instance, to select the MG2 compression method for a given OpenCTM context,
use:
\begin{lstlisting}
ctmCompressionMethod(context, CTM_METHOD_MG2);
\end{lstlisting}
\section{Selecting the compression level}
You can select which LZMA compression level to use with the ctmCompressionLevel()
function. The compression level can be in the range 0-9, where 0 is the fastest
compression, and 9 is the best compression. The compression level also affects the
amount of memory that is used during compression (anywhere from a few megabytes to
several hundred megabytes).
\begin{lstlisting}
ctmCompressionMethod(context, 4);
\end{lstlisting}
The default compression level is 1.
\section{Selecting fixed point precision}
When the MG2 compression method is used, further compression control is provided
through the API that deals with the fixed point precision for different vertex
attributes. The different attribute precisions that can be controlled are:
\begin{tabular}{|l|l|}\hline
\textbf{Attribute} & \textbf{API function}\\ \hline
Vertex coordinate & ctmVertexPrecision() / ctmVertexPrecisionRel()\\ \hline
Normal & ctmNormalPrecision()\\ \hline
UV coordinates & ctmUVCoordPrecision()\\ \hline
Custom attributes & ctmAttribPrecision()\\ \hline
\end{tabular}
Reasonable default values for the fixed point precisions are selected by the API
unless the corresponding API functions are called. However, the API does not know
the requirements for the mesh, which is why it is always a good idea to specify
the fixed point precision that is most relevant for your specific mesh.
\subsection{Vertex coordinate precision}
The vertex coordinate precision can be controlled in two ways:
\begin{itemize}
\item Absolute precision - ctmVertexPrecision().
\item Relative precision - ctmVertexPrecisionRel().
\end{itemize}
You typically specify the absolute precision when you know the properties of the
mesh and what is going to be used for (for instance, if it is a product of a
measurment procecss, or if it will be used in a manufacturing process). For
example, if the vertex coordinate unit is meters, and the precision is specified
as $0.001$, the fixed point precision will be 1 mm:
\begin{lstlisting}
ctmVertexPrecision(context, 0.001);
\end{lstlisting}
When you do not know much about the mesh, it can be useful to specify the
relative precision. The ctmVertexPrecisionRel() function will analyze the mesh
to find a useful base measure, which is multiplied by a scaling factor that
is given as an argument to the function.
The relative precision function uses the average triangle edge length as the
base measure. So for example, if you specify $0.01$ as the relative precision,
the precision will be 1\% of the average triangle edge length, which is usually
a good figure for meshes that will be used in visualization applications:
\begin{lstlisting}
ctmVertexPrecisionRel(context, 0.01);
\end{lstlisting}
It should be noted that unlike the ctmVertexPrecision() function, the
ctmVertexPrecisionRel() function requires that the mesh has been specified
before calling the function.
The default vertex coordinate precision is $2^{-10} \approx 0.00098$.
\subsection{Normal precision}
In the MG2 compression method, each vertex normal is represented in spherical
coordinates (the coordinate system is aligned to the average normal of all
triangles that connect to the vertex).
The precision controls both the angular resolution and the radial resolution
(magnitude). For instance, $0.01$ means that the circle is divided into 100
steps, and the normal magnitude is rounded to 2 decimals:
\begin{lstlisting}
ctmNormalPrecision(context, 0.01);
\end{lstlisting}
The default normal precision is $2^{-8} \approx 0.0039$.
\subsection{UV coordinate precision}
UV coordinate precision is specified on a per UV map basis, and
gives the absolute precision in UV coordinate space.
The effects of different precisions depend on many different things. For
instance if the UV map is used for mapping a 2D texture onto the triangle
mesh, the resolution of the texture can influence the required UV
coordinate precision (e.g. a 4096x4096 texture may require better
precision than a 256x256 texture). The resolution of the mesh may also
affect the required UV coordinate precision.
To specify a resolution of $0.001$ for the UV map $uvMap$, use:
\begin{lstlisting}
ctmUVCoordPrecision(context, uvMap, 0.001);
\end{lstlisting}
The default UV coordinate precision is $2^{-12} \approx 0.00024$.
\subsection{Custom attribute precision}
As with UV coordinates, the precision for custom vertex attributes are
specified on a per attribute basis.
The precision of a custom attribute depends entirely on the type of
attribute. For instance, standard color attributes typically do not require
more then eigh bits per component, which means that $1/256$ is a good
precision setting (if the value range is $[0,1]$):
\begin{lstlisting}
ctmAttribPrecision(context, attribMap, 1.0/256.0);
\end{lstlisting}
For integer values, the precision $1.0$ is a good choice.
The default vertex attribute precision is $2^{-8} \approx 0.0039$.
%-------------------------------------------------------------------------------
\chapter{Error Handling}
An error can occur when calling any of the OpenCTM API functions. To check
for errors, call the ctmGetError() function, which returns a positive error
code if something went wrong, or zero (CTM\_NONE) if no error has occured.
See \ref{tab:ErrorCodes} for a list of possible error codes.
\begin{table}[p]
\centering
\begin{tabular}{|l|p{7cm}|}\hline
\textbf{Code} & \textbf{Description}\\ \hline
CTM\_NONE (zero) & No error has occured (everything is OK).\\ \hline
CTM\_INVALID\_CONTEXT & The OpenCTM context was invalid (e.g. NULL).\\ \hline
CTM\_INVALID\_ARGUMENT & A function argument was invalid.\\ \hline
CTM\_INVALID\_OPERATION & The operation is not allowed.\\ \hline
CTM\_INVALID\_MESH & The mesh was invalid (e.g. no vertices).\\ \hline
CTM\_OUT\_OF\_MEMORY & Not enough memory to proceed.\\ \hline
CTM\_FILE\_ERROR & File I/O error.\\ \hline
CTM\_BAD\_FORMAT & File format error (e.g. unrecognized format or corrupted file).\\ \hline
CTM\_LZMA\_ERROR & An error occured within the LZMA library.\\ \hline
CTM\_INTERNAL\_ERROR & An internal error occured (indicates a bug).\\ \hline
CTM\_UNSUPPORTED\_FORMAT\_VERSION & Unsupported file format version.\\ \hline
\end{tabular}
\caption{OpenCTM error codes.}
\label{tab:ErrorCodes}
\end{table}
The last error code that indicates a failure is stored per OpenCTM context
until the ctmGetError() function is called. Calling the function will reset
the error state.
It is also possible to convert an error code to an error string, using the
ctmErrorString() function, which takes an error code as its argument, and
returns a constant C string (pointer to a null terminated UTF-8 format
character string).
%-------------------------------------------------------------------------------
\chapter{C++ Extensions}
To take better advantage of some of the C++ language features, such as
exception handling, a few C++ wrapper classes are availbale through the standard
API when compiling a C++ program. As usual, just include "openctm.h", and you
will have access to two C++ classes: CTMimporer and CTMexporter.
The main differences between the C++ classes and the standard API are:
\begin{itemize}
\item The C++ classes call ctmNewContext() and ctmFreeContext() in their
constructors and destructors respectively, which makes it easier to
use the C++ dynamic scope mechanisms (such as exception handling).
\item Whenever an OpenCTM error occurs, an exception is thrown. Hence, there
is no method corresponding to the ctmGetError() function.
\end{itemize}
\section{The CTMimporter class}
Here is an example of how to use the CTMimporter class in C++:
\begin{lstlisting}
try
{
// Create a new OpenCTM importer object
CTMimporter ctm;
// Load the OpenCTM file
ctm.Load("mymesh.ctm");
// Access the mesh data
CTMuint vertCount = ctm.GetInteger(CTM_VERTEX_COUNT);
CTMfloat * vertices = ctm.GetFloatArray(CTM_VERTICES);
CTMuint triCount = ctm.GetInteger(CTM_TRIANGLE_COUNT);
CTMuint * indices = ctm.GetIntegerArray(CTM_INDICES);
// Deal with the mesh (e.g. transcode it to our
// internal representation)
// ...
}
catch(exception &e)
{
cout << "Error: " << e.what() << endl;
}
\end{lstlisting}
\section{The CTMexporter class}
Here is an example of how to use the CTMexporter class in C++:
\begin{lstlisting}
void MySaveFile(CTMuint aVertCount, CTMuint aTriCount,
CTMfloat * aVertices, CTMuint * aIndices,
const char * aFileName)
{
try
{
// Create a new OpenCTM exporter object
CTMexporter ctm;
// Define our mesh representation to OpenCTM
ctm.DefineMesh(aVertices, aVertCount, aIndices, aTriCount, NULL);
// Save the OpenCTM file
ctm.Save(aFileName);
}
catch(exception &e)
{
cout << "Error: " << e.what() << endl;
}
}
\end{lstlisting}
\end{document}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
<div style="padding: 1em 1em 0.5em 1em; margin: 2em 0 0 0; border-top: 1px solid #84b0c7; color: #808080; text-align: center;">
<p>Copyright &copy; 2009-2010 Marcus Geelnard &mdash;
<a href="http://openctm.sourceforge.net" title="OpenCTM home page">openctm.sourceforge.net</a></p>
</div>
</body>
</html>

View File

@@ -1,678 +0,0 @@
%-------------------------------------------------------------------------------
% Document: OpenCTM Format Specification
% Author: Marcus Geelnard
% Compile: pdflatex FormatSpecification.tex
%-------------------------------------------------------------------------------
% Note: You need a LaTeX environment to build this document as PDF. The
% recommended way is to install TeX Live (http://www.tug.org/texlive/) and
% a decent LaTeX editor (e.g. texmaker, LEd, etc).
%
% Ubuntu: sudo apt-get install texlive-full
% Mac OS X: http://www.tug.org/mactex/ (MacTeX.mpkg.zip)
%
% To build the PDF document, run pdflatex twice on this .tex file (in order to
% correctly build the TOC).
%-------------------------------------------------------------------------------
% Use the OpenCTM TeX style
\input{openctm-tex.sty}
% Document properties
\author{Marcus Geelnard}
\title{OpenCTM Format Specification}
% PDF specific document properties
\hypersetup{pdftitle={OpenCTM Format Specification}}
\hypersetup{pdfauthor={Marcus Geelnard}}
\hypersetup{pdfkeywords={OpenCTM,format,specification}}
% Document contents
\begin{document}
%--[ Title page ]---------------------------------------------------------------
\begin{titlepage}
\begin{center}
~
\vspace{5cm}
\includegraphics[width=10.0cm]{logo.pdf}
\vspace{0.4cm}
{\large File format version 5}
\vspace{1.0cm}
{\Large Format Specification}
\vspace{1.5cm}
Copyright \copyright \ 2009-2010 Marcus Geelnard
\end{center}
\end{titlepage}
%--[ Table of contents ]--------------------------------------------------------
\tableofcontents
%-------------------------------------------------------------------------------
\chapter{Overview}
This document describes version 5 of the OpenCTM file format.
\section{File structure}
The structure of an OpenCTM file is as follows:
[Header]\newline
[Body data]
Each part of the file is described in the following chapters.
\section{Data formats}
All integer fields are stored in 32-bit little endian format (least significant
byte first).
All floating point fields are stored in 32-bit binary IEEE 754 format (little
endian).
All strings are stored as a 32-bit integer string length (number of bytes)
followed by a UTF-8 format string (there is no zero termination and no BOM).
\section{Packed data}
\label{sec:PackedData}
Some portions of the file are be packed by the lossless LZMA entropy coder,
and are encoded as follows:
\begin{tabular}{|l|l|p{11cm}|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Packed size (number of bytes, $p$).\\ \hline
4 & - & LZMA specific props (five bytes, required by the LZMA decoder).\\ \hline
9 & - & LZMA packed stream ($p$ bytes long) that has been generated by the LzmaCompress() function of the LZMA API.\\ \hline
\end{tabular}
The length of the unpacked data is always known from the context (e.g. the
triangle count uniquely defines the number of bytes required for the
uncompressed triangle indices array).
\subsection{Element interleaving}
Some packed data arrays use element level interleaving, meaning that the
data values are rearranged at the element level. For instance, in a data array
with three elements per value (stride = 3), $x$, $y$ and $z$, the elements are
rearranged as follows:
\begin{center}
$x_1,y_1,z_1,x_2,y_2,z_2,\ldots,x_N,y_N,z_N \Rightarrow
x_1,x_2,\ldots,x_N,y_1,y_2,\ldots,y_N,z_1,z_2,\ldots,z_N$
\end{center}
When decompressing an array that uses element interleaving, the process is
reversed.
\subsection{Byte interleaving}
All packed data arrays use byte level interleaving, meaning that data values
are rearranged at the byte level. For instance, in an integer array, where each
element consists of four bytes: $a$, $b$, $c$ and $d$, the bytes are rearranged
as follows:
\begin{center}
$a_1,b_1,c_1,d_1,a_2,b_2,c_2,d_2,\ldots,a_N,b_N,c_N,d_N \Rightarrow
a_1,a_2,\ldots,a_N,b_1,b_2,\ldots,b_N,c_1,c_2,\ldots,c_N,d_1,d_2,\ldots,d_N$
\end{center}
When decompressing an array that uses byte interleaving, the process is
reversed.
\subsection{Signed magnitude representation}
Some packed integer arrays use signed magnitude representation.
A signed magnitude value, $x'$, is converted to a two's complement value,
$x$, with the following method:
$x = \begin{cases}
x'\; shr\; 1 & x'_0 = 0 \\
-((x'+1)\; shr\; 1) & x'_0 = 1
\end{cases}$
...where $x'_0$ is the least significant bit of $x'$.
%-------------------------------------------------------------------------------
\chapter{Header}
The file must start with a header, which looks as follows:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Magic identifier (0x4d54434f, or "OCTM" when read as ASCII).\\ \hline
4 & Integer & File format version (0x00000005 = version 5).\\ \hline
8 & Integer & Compression method, which must be one of the following:\\
& & 0x00574152 - Use the RAW compression method.\\
& & 0x0031474d - Use the MG1 compression method.\\
& & 0x0032474d - Use the MG2 compression method.\\ \hline
12 & Integer & Vertex count.\\ \hline
16 & Integer & Triangle count.\\ \hline
20 & Integer & UV map count.\\ \hline
24 & Integer & Attribute map count.\\ \hline
28 & Integer & Boolean flags, or:ed together:\\
& & 0x00000001 - The file contains per-vertex normals.\\ \hline
32 & String & File comment ($p$ bytes long string).\\ \hline
\end{tabular}
The length of the file header is $36+p$ bytes, where $p$ is the length of the
comment string.
%-------------------------------------------------------------------------------
\chapter{Body data}
The body data follows immediately after the file header. Its file offset is
dictated by the length of the file header.
The format of the body data is specific for each compression method, which is
defined by the "Compression method" field in the header.
The body data contains the vertex, index, normal, UV map and attribute map
data, usually in a compressed form.
\section{RAW}
The layout of the body data for the RAW compression method is:
[Indices]\newline
[Vertices]\newline
[Normals]\newline
[UV map 0]\newline
[UV map 1]\newline
...\newline
[UV map N]\newline
[Attribute map 0]\newline
[Attribute map 1]\newline
...\newline
[Attribute map M]
\subsection{Indices}
The indices are stored as an integer identifier, 0x58444e49 ("INDX"), followed
by all the triangle indices. Each index is an unsigned integer value. There are
three indices per triangle, and the number of triangles is given by the
"Triangle count" field in the header:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x58444e49, or "INDX" when read as ASCII).\\ \hline
4 & Integer & Vertex index for the 1st corner of the 1st triangle.\\ \hline
8 & Integer & Vertex index for the 2nd corner of the 1st triangle.\\ \hline
12 & Integer & Vertex index for the 3rd corner of the 1st triangle.\\ \hline
16 & Integer & Vertex index for the 1st corner of the 2nd triangle.\\ \hline
... & & \\ \hline
\end{tabular}
The length of the indices section is $4(1+3N)$ bytes, where $N$ is the triangle
count.
\subsection{Vertices}
The vertices are stored as an integer identifier, 0x54524556 ("VERT"), followed
by all the vertex coordinates. Each vertex coordinate is stored as three
floating point values ($x,y,z$), and the number of vertices is given by the
"Vertex count" field in the header:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x54524556, or "VERT" when read as ASCII).\\ \hline
4 & Float & $x$ coordinate of the 1st vertex.\\ \hline
8 & Float & $y$ coordinate of the 1st vertex.\\ \hline
12 & Float & $z$ coordinate of the 1st vertex.\\ \hline
16 & Float & $x$ coordinate of the 2nd vertex.\\ \hline
... & & \\ \hline
\end{tabular}
The length of the vertices section is $4(1+3N)$ bytes, where $N$ is the vertex
count.
\subsection{Normals}
The normals section is optional, and only present if the per-vertex normals
flag is set in the header.
The normals are stored as an integer identifier, 0x4d524f4e ("NORM"), followed
by all the normal coordinates. Each normal is stored as three floating point
values ($x,y,z$), and the number of normals is given by the "Vertex count" field
in the header:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x4d524f4e, or "NORM" when read as ASCII).\\ \hline
4 & Float & $x$ coordinate of the 1st normal.\\ \hline
8 & Float & $y$ coordinate of the 1st normal.\\ \hline
12 & Float & $z$ coordinate of the 1st normal.\\ \hline
16 & Float & $x$ coordinate of the 2nd normal.\\ \hline
... & & \\ \hline
\end{tabular}
The length of the normals section is $4(1+3N)$ bytes, where $N$ is the vertex
count.
\subsection{UV maps}
There can be zero or more UV maps. The number of UV maps is given by the
UV map count in the header.
Each UV map starts with an integer identifier, 0x43584554 ("TEXC"), followed
by two strings (the UV map name and the UV map file name reference), and
finally all the UV coordinates. Each UV coordinate is stored as two floating point
values ($u,v$), and the number of UV coordinates is given by the "Vertex count"
field in the header:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x43584554, or "TEXC" when read as ASCII).\\ \hline
4 & String & Unique UV map name ($p$ bytes long string).\\ \hline
$8+p$ & String & UV map file name reference ($q$ bytes long string).\\ \hline
$12+p+q$ & Float & $u$ coordinate of the 1st UV coordinate.\\ \hline
$16+p+q$ & Float & $v$ coordinate of the 1st UV coordinate.\\ \hline
$20+p+q$ & Float & $u$ coordinate of the 2nd UV coordinate.\\ \hline
... & & \\ \hline
\end{tabular}
The length of a UV map section is $4(3+2N)+p+q$ bytes, where $N$ is the vertex
count, $p$ is the name string length, and $q$ is the file name reference string
length.
\subsection{Attribute maps}
There can be zero or more attribute maps. The number of attribute maps is given by the
attribute map count in the header.
Each attribute map starts with an integer identifier, 0x52545441 ("ATTR"), followed
by the attribute map name string, and finally all the attribute values. Each attribute
value is stored as four floating point values ($a,b,c,d$), and the number of
attribute values is given by the "Vertex count" field in the header:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x52545441, or "ATTR" when read as ASCII).\\ \hline
4 & String & Unique attribute map name ($p$ bytes long string).\\ \hline
$8+p$ & Float & $a$ component of the 1st attribute value.\\ \hline
$12+p$ & Float & $b$ component of the 1st attribute value.\\ \hline
$16+p$ & Float & $c$ component of the 1st attribute value.\\ \hline
$20+p$ & Float & $d$ component of the 1st attribute value.\\ \hline
$24+p$ & Float & $a$ component of the 2nd attribute value.\\ \hline
... & & \\ \hline
\end{tabular}
The length of an attribute map section is $4(2+4N)+p$ bytes, where $N$ is the vertex
count, and $p$ is the name string length.
\section{MG1}
The layout of the body data for the MG1 compression method is:
[Indices]\newline
[Vertices]\newline
[Normals]\newline
[UV map 0]\newline
[UV map 1]\newline
...\newline
[UV map N]\newline
[Attribute map 0]\newline
[Attribute map 1]\newline
...\newline
[Attribute map M]
\subsection{Indices}
\label{sec:MG1Indices}
The triangle indices are stored as an integer identifier, 0x58444e49 ("INDX"),
followed by a packed integer array with element interleaving (see
\ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x58444e49, or "INDX" when read as ASCII).\\ \hline
4 & - & Packed indices data.\\ \hline
\end{tabular}
The unpacked indices array contains delta-encoded indices:
$i'_{1,1}, i'_{1,2}, i'_{1,3}, i'_{2,1}, i'_{2,2}, i'_{2,3} ..., i'_{M,1}, i'_{M,2}, i'_{M,3}$
...that translate into the original triangle indices with the following method:
$i_{k,1} = \begin{cases}
i'_{k,1} + i_{k-1,1} & (k \geq 2) \\
i'_{k,1} & (k = 1)
\end{cases}$
$i_{k,2} = \begin{cases}
i'_{k,2} + i_{k-1,2} & (k \geq 2, i_{k,1} = i_{k-1,1}) \\
i'_{k,2} + i_{k,1} & (\text{otherwise})
\end{cases}$
$i_{k,3} = i'_{k,3} + i_{k,1}$
...where $i_{k,1}, i_{k,2}$ and $i_{k,3}$ are the 1:st, 2:nd and 3:rd vertex index of the
$k$:th triangle, respectively.
Please note that the indices should be sorted in such a manner that
$i'_{k,1} \geq 0, i'_{k,2} \geq 0$ and $i'_{k,3} \geq 0 \; \forall \: k$.
\subsection{Vertices}
The vertices are stored as an integer identifier, 0x54524556 ("VERT"), followed
by a packed float array without element interleaving (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x54524556, or "VERT" when read as ASCII).\\ \hline
4 & - & Packed vertices data.\\ \hline
\end{tabular}
The unpacked vertex array is stored as in the RAW format ($x, y, z$).
\subsection{Normals}
The normals section is optional, and only present if the per-vertex normals
flag is set in the header.
The normals are stored as an integer identifier, 0x4d524f4e ("NORM"), followed
by a packed float array with element interleaving (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x4d524f4e, or "NORM" when read as ASCII).\\ \hline
4 & - & Packed normals data.\\ \hline
\end{tabular}
The unpacked normal array is stored as in the RAW format ($x, y, z$).
\subsection{UV maps}
There can be zero or more UV maps. The number of UV maps is given by the
UV map count in the header.
Each UV map starts with an integer identifier, 0x43584554 ("TEXC"), followed
by two strings (the UV map name and the UV map file name reference), and
finally the packed UV coordinate data.
The UV coordinate data is a packed float array with element interleaving
(see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x43584554, or "TEXC" when read as ASCII).\\ \hline
4 & String & Unique UV map name ($p$ bytes long string).\\ \hline
$8+p$ & String & UV map file name reference ($q$ bytes long string).\\ \hline
$12+p+q$ & - & Packed UV coordinate data.\\ \hline
\end{tabular}
...where $p$ is the name string length, and $q$ is the file name reference string
length.
The unpacked UV coordinate array is stored as in the RAW format ($u, v$).
\subsection{Attribute maps}
There can be zero or more attribute maps. The number of attribute maps is given by the
attribute map count in the header.
Each attribute map starts with an integer identifier, 0x52545441 ("ATTR"), followed
by the attribute map name string, and finally the packed attribute values.
The attribute value data is a packed float array with element interleaving
(see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x52545441, or "ATTR" when read as ASCII).\\ \hline
4 & String & Unique attribute map name ($p$ bytes long string).\\ \hline
$8+p$ & - & Packed attribute value data.\\ \hline
\end{tabular}
...where $p$ is the name string length.
The unpacked attribute value array is stored as in the RAW format ($a, b, c, d$).
\section{MG2}
The layout of the body data for the MG2 compression method is:
[MG2 header]\newline
[Vertices]\newline
[Grid indices]\newline
[Indices]\newline
[Normals]\newline
[UV map 0]\newline
[UV map 1]\newline
...\newline
[UV map N]\newline
[Attribute map 0]\newline
[Attribute map 1]\newline
...\newline
[Attribute map M]
\subsection{MG2 vertex coordinate coding}
\label{sec:MG2VertexCoding}
In the MG2 compression method, all the vertices are divided into a 3D grid,
which can be described by an axis aligned bounding box (minimum fit to the
vertices), and the division factors along the $x$, $y$ and $z$ axes, as shown
in figure \ref{fig:Grid}.
\begin{figure}[pht]
\centering
\includegraphics[width=10.0cm]{grid.pdf}
\caption{3D space subdivision grid. $LB$ and $HB$ are the lower and higher bounds
of the axis aligned bounding box. $div_x$, $div_y$ and $div_z$ are the number
of divisions along each of the axes.}
\label{fig:Grid}
\end{figure}
The vertices are all coded relative to the grid origin of the grid box to which
they belong, and all vertices are associated with a grid box with a unique
grid index.
The grid index, $gi$, is encoded as:
$gi = g_x + div_x(g_y + div_y \times g_z)$
...where $g_x$, $g_y$ and $g_z$ are the integer $x$, $y$ and $z$ positions of the grid
box, within the grid, and:
$g_x \in [0, div_x), g_y \in [0, div_y), g_z \in [0, div_z)$
The grid box origin (lower bound) of each grid box is defined by:
$gridorigin_x(g_x) = LB_x + \frac{HB_x - LB_x}{div_x} g_x$
$gridorigin_y(g_y) = LB_y + \frac{HB_y - LB_y}{div_y} g_y$
$gridorigin_z(g_z) = LB_z + \frac{HB_z - LB_z}{div_z} g_z$
\subsection{MG2 header}
The MG2 header contains information about how to interpret the mesh data. The
header looks as follows:
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x4832474d, or "MG2H" when read as ASCII).\\ \hline
4 & Float & Vertex precision.\\ \hline
8 & Float & Normal precision.\\ \hline
12 & Float & $LB_x$ ($z$ coordinate of the lower bound of the bounding box).\\ \hline
16 & Float & $LB_y$ ($y$ coordinate of the lower bound of the bounding box).\\ \hline
20 & Float & $LB_z$ ($z$ coordinate of the lower bound of the bounding box).\\ \hline
24 & Float & $HB_x$ ($x$ coordinate of the higher bound of the bounding box).\\ \hline
28 & Float & $HB_y$ ($y$ coordinate of the higher bound of the bounding box).\\ \hline
32 & Float & $HB_z$ ($z$ coordinate of the higher bound of the bounding box).\\ \hline
36 & Integer & $div_x$ (number of grid divisions along the $x$ axis, $\geq 1$).\\ \hline
40 & Integer & $div_y$ (number of grid divisions along the $y$ axis, $\geq 1$).\\ \hline
44 & Integer & $div_z$ (number of grid divisions along the $z$ axis, $\geq 1$).\\ \hline
\end{tabular}
\subsection{Vertices}
The vertices are stored as an integer identifier, 0x54524556 ("VERT"), followed
by the packed vertex coordinate data.
The vertex coordinate data is a packed integer array with element interleaving
(see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x54524556, or "VERT" when read as ASCII).\\ \hline
4 & - & Packed vertex coordinate data.\\ \hline
\end{tabular}
The unpacked vertex array has three elements per vertex:
$x'_1, y'_1, z'_1, x'_2, y'_2, z'_2, ..., x'_N, y'_N, z'_N$
The original vertex coordinate, ($x_k$, $y_k$, $z_k$), for vertex number $k$ is defined as:
$dx_k = \begin{cases}
x'_k + dx_{k-1} & (k \geq 2, gi_k = gi_{k-1})\\
x'_k & (otherwise)
\end{cases}$
$x_k = s \times dx_k + gridorigin_x(gi_k)$
$y_k = s \times y'_k + gridorigin_y(gi_k)$
$z_k = s \times z'_k + gridorigin_z(gi_k)$
...where $s$ is the vertex precision, $gi_k$ is the $k$:th grid index (see \ref{sec:GridIndices}),
and $gridorigin(gi_k)$ is the origin (lower bound) of the grid box that is indicated by
grid index $gi_k$, according to \ref{sec:MG2VertexCoding}.
Please note that the vertices should be sorted in such a manner that $x'_k \geq 0, y'_k \geq 0$
and $z'_k \geq 0 \; \forall \: k$.
\subsection{Grid indices}
\label{sec:GridIndices}
The grid indices are stored as an integer identifier, 0x58444947 ("GIDX"), followed
by a packed integer array (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x58444947, or "GIDX" when read as ASCII).\\ \hline
4 & - & Packed grid indices data.\\ \hline
\end{tabular}
The unpacked grid indices array has one element per vertex:
$gi'_1, gi'_2, ..., gi'_N$
The grid index for vertex number $k$ is defined as:
$gi_k = \begin{cases}
gi'_k + gi_{k-1} & (k \geq 2)\\
gi'_k & (k = 1)
\end{cases}$
Please note that the vertices should be sorted in such a manner that $gi'_k \geq 0 \: \forall \: k$.
\subsection{Indices}
The triangle indices are stored exactly as in the MG1 method (see \ref{sec:MG1Indices}).
\subsection{Normals}
The normals section is optional, and only present if the per-vertex normals
flag is set in the header.
The normals are stored as an integer identifier, 0x4d524f4e ("NORM"), followed
by a packed integer array with element interleaving (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x4d524f4e, or "NORM" when read as ASCII).\\ \hline
4 & - & Packed normals data.\\ \hline
\end{tabular}
Note: This section of the document is not yet complete... Please see the source
code file compressMG2.c for more information about how to interpret the
normal data array.
\subsection{UV maps}
There can be zero or more UV maps. The number of UV maps is given by the
UV map count in the header.
Each UV map starts with an integer identifier, 0x43584554 ("TEXC"), followed
by two strings (the UV map name and the UV map file name reference), the
UV coordinate precision (a float value), and finally the packed UV coordinate data.
The UV coordinate data is a packed integer array with element interleaving
and signed magnitude format (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x43584554, or "TEXC" when read as ASCII).\\ \hline
4 & String & Unique UV map name ($p$ bytes long string).\\ \hline
$8+p$ & String & UV map file name reference ($q$ bytes long string).\\ \hline
$12+p+q$ & Float & UV coordinate precision, $s$.\\ \hline
$16+p+q$ & - & Packed UV coordinate data.\\ \hline
\end{tabular}
...where $p$ is the name string length, and $q$ is the file name reference string
length.
The unpacked UV coordinate array contains delta-encoded coordinates:
$u'_1, v'_1, u'_2, v'_2, ..., u'_N, v'_N$
The original UV coordinates are restored with the following method:
$u_k = \begin{cases}
s \times (u'_k + u_{k-1}) & (k \geq 2)\\
s \times u'_k & (k = 1)
\end{cases}$
$v_k = \begin{cases}
s \times (v'_k + v_{k-1}) & (k \geq 2)\\
s \times v'_k & (k = 1)
\end{cases}$
...where $s$ is the UV coordinate precision.
\subsection{Attribute maps}
There can be zero or more attribute maps. The number of attribute maps is given by the
attribute map count in the header.
Each attribute map starts with an integer identifier, 0x52545441 ("ATTR"), followed
by the attribute map name string, the attribute value precision (a float value), and
finally the packed attribute values.
The attribute value data is a packed integer array with element interleaving
and signed magnitude format (see \ref{sec:PackedData}).
\begin{tabular}{|l|l|l|}\hline
\textbf{Offset} & \textbf{Type} & \textbf{Description}\\ \hline
0 & Integer & Identifier (0x52545441, or "ATTR" when read as ASCII).\\ \hline
4 & String & Unique attribute map name ($p$ bytes long string).\\ \hline
$8+p$ & Float & Attribute value precision, $s$.\\ \hline
$12+p$ & - & Packed attribute value data.\\ \hline
\end{tabular}
...where $p$ is the name string length.
The unpacked attribute value array contains delta-encoded attribute values:
$a'_1, b'_1, c'_1, d'_1, a'_2, b'_2, c'_2, d'_2, ..., a'_N, b'_N, c'_N, d'_N$
The original attributes are restored with the following method:
$a_k = \begin{cases}
s \times (a'_k + a_{k-1}) & (k \geq 2)\\
s \times a'_k & (k = 1)
\end{cases}$
$b_k = \begin{cases}
s \times (b'_k + b_{k-1}) & (k \geq 2)\\
s \times b'_k & (k = 1)
\end{cases}$
$c_k = \begin{cases}
s \times (c'_k + c_{k-1}) & (k \geq 2)\\
s \times c'_k & (k = 1)
\end{cases}$
$d_k = \begin{cases}
s \times (d'_k + d_{k-1}) & (k \geq 2)\\
s \times d'_k & (k = 1)
\end{cases}$
...where $s$ is the attribute value precision.
\end{document}

View File

@@ -1,58 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.linux
# Description: Makefile for the documentation for Linux systems (should work on
# most Un*x-like systems, e.g. OpenSolaris).
# This build system requires Doxygen, a full LaTeX installation
# (try TeX Live, http://www.tug.org/texlive/) and Groff
# (Ubuntu: sudo apt-get install groff).
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.PHONY: all clean
all: DevelopersManual.pdf \
FormatSpecification.pdf \
APIReference/index.html \
ctmconv.html \
ctmviewer.html
clean:
rm -f APIReference/*.* DevelopersManual.pdf FormatSpecification.pdf *.aux *.toc *.log *.out ctmconv.html ctmviewer.html
DevelopersManual.pdf: DevelopersManual.tex
pdflatex DevelopersManual.tex
pdflatex DevelopersManual.tex
FormatSpecification.pdf: FormatSpecification.tex
pdflatex FormatSpecification.tex
pdflatex FormatSpecification.tex
APIReference/index.html: ../lib/openctm.h ../lib/openctmpp.h
doxygen
ctmconv.html: ctmconv.1
groff -t -mandoc -Thtml $< > $@
ctmviewer.html: ctmviewer.1
groff -t -mandoc -Thtml $< > $@

View File

@@ -1,56 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.macosx
# Description: Makefile for the documentation for Mac OS X.
# This build system requires Doxygen and a full LaTeX installation
# (try MacTeX, http://www.tug.org/mactex/).
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
.PHONY: all clean
all: DevelopersManual.pdf \
FormatSpecification.pdf \
APIReference/index.html \
ctmconv.html \
ctmviewer.html
clean:
rm -f APIReference/*.* DevelopersManual.pdf FormatSpecification.pdf *.aux *.toc *.log *.out ctmconv.html ctmviewer.html
DevelopersManual.pdf: DevelopersManual.tex
pdflatex DevelopersManual.tex
pdflatex DevelopersManual.tex
FormatSpecification.pdf: FormatSpecification.tex
pdflatex FormatSpecification.tex
pdflatex FormatSpecification.tex
APIReference/index.html: ../lib/openctm.h ../lib/openctmpp.h
doxygen
ctmconv.html: ctmconv.1
groff -t -mandoc -Thtml $< > $@
ctmviewer.html: ctmviewer.1
groff -t -mandoc -Thtml $< > $@

View File

@@ -1,58 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.win
# Description: Makefile for the documentation for Windows.
# This build system requires Doxygen, a full LaTeX installation
# (try TeX Live, http://www.tug.org/texlive/) and Groff
# (try http://gnuwin32.sourceforge.net/packages/groff.htm).
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
all: DevelopersManual.pdf \
FormatSpecification.pdf \
APIReference\index.html \
ctmconv.html \
ctmviewer.html
.PHONY: all clean
clean:
del /Q APIReference\*.* DevelopersManual.pdf FormatSpecification.pdf *.aux *.toc *.log *.out ctmconv.html ctmviewer.html
DevelopersManual.pdf: DevelopersManual.tex
pdflatex DevelopersManual.tex
pdflatex DevelopersManual.tex
FormatSpecification.pdf: FormatSpecification.tex
pdflatex FormatSpecification.tex
pdflatex FormatSpecification.tex
APIReference\index.html: ..\lib\openctm.h ..\lib\openctmpp.h
doxygen
ctmconv.html: ctmconv.1
groff -t -mandoc -Thtml ctmconv.1 > ctmconv.html
ctmviewer.html: ctmviewer.1
groff -t -mandoc -Thtml ctmviewer.1 > ctmviewer.html

View File

@@ -1,92 +0,0 @@
.TH ctmconv 1
.SH NAME
.B ctmconv
- file format converter for 3D models
.SH SYNOPSIS
.B ctmconv
.I infile outfile [options]
.SH DESCRIPTION
.B ctmconv
is a 3D file converter that can convert 3D model files to and from several
different formats.
.PP
The file
.I infile
is loaded, and then saved as
.I outfile
in the target file format.
.PP
The input and output file formats are determined from the file endings.
.SH OPTIONS
The following options are available:
.TP 16
.B --scale arg
Scale the mesh by a scalar factor.
.TP
.B --upaxis arg
Set up axis (X, Y, Z, -X, -Y, -Z). If != Z, the mesh will be flipped.
.TP
.B --flip
Flip triangle orientation.
.TP
.B --calc-normals
If the source file does not contain any normals, calculate them.
.TP
.B --no-normals
Do not export normals.
.TP
.B --no-texcoords
Do not export texture coordinates.
.TP
.B --no-colors
Do not export vertex colors.
.TP
.B --comment arg
Set the file comment (default is to use the comment from the input file, if
any).
.TP
.B --texfile arg
Set the texture file name reference for the texture (default is to use the
texture file name reference from the input file, if any).
.PP
When exporting an OpenCTM file, the following options are also
available:
.TP 16
.B --method arg
Select compression method (RAW, MG1, MG2).
.TP
.B --level arg
Set the compression level (0 - 9).
.TP
.B --vprec arg
Set vertex precision (only for MG2).
.TP
.B --vprecrel arg
Set vertex precision, relative method (only for MG2).
.TP
.B --nprec arg
Set normal precision (only for MG2).
.TP
.B --tprec arg
Set texture map precision (only for MG2).
.TP
.B --cprec arg
Set color precision (only for MG2).
.SH FILE FORMATS
The following 3D model file formats are supported:
OpenCTM (.ctm),
Stanford triangle format (.ply),
Stereolitography (.stl),
3D Studio (.3ds),
COLLADA 1.4/1.5 (.dae),
Wavefront geometry file (.obj),
LightWave object (.lwo),
Geomview object file format (.off),
VRML 2.0 - export only (.wrl).
.SH AVAILABILITY
.B ctmconv
is designed to be portable, and is available for several different systems,
including (but not limited to): Windows, Mac OS X (10.3+), Linux and
OpenSolaris.
.SH SEE ALSO
ctmviewer(1)

View File

@@ -1,86 +0,0 @@
.TH ctmviewer 1
.SH NAME
.B ctmviewer
- 3D viewer for models of various file formats
.SH SYNOPSIS
.B ctmviewer
.I [modelfile [texturefile]]
.SH DESCRIPTION
.B ctmviewer
is a 3D file viewer that can load, show and save 3D model files in several
different formats.
.PP
The program displays an interactive 3D view of the model, which can be operated
with the mouse (e.g. for rotating and zooming).
.PP
If the selected model file contains texture coordinate information, it is
possible to specify which 2D image file to use as a texture with the additional
.I texturefile
argument. If no texture file is given (either by the 3D model file, or by the
.I texturefile
argument), a standard 2D grid is used as a texture.
.SH GUI OPERATIONS
In addition to the command line arguments,
.B ctmviewer
offers several operations that can be performed from the 3D GUI display. For
help, press the F1 key.
.SS Loading and Saving
It is possible to load and save 3D model files from the program by either
using the buttons in the upper left corner of the 3D display, or by using the
keyboard shortcuts CTRL+O (open) and CTRL+S (save).
.PP
It is also possible to load a texture file from the program by using the
Open Texture button.
.SS Rendering
To toggle between a normal filled surface view (default) and a wire frame view,
press the 'w' key.
.SS Camera Control
By holding down the left mouse button and moving the mouse, the camera is
rotated around the 3D model.
.PP
By holding down the right mouse button and moving the mouse, the camera will
pan left/right and up/down.
.PP
By holding down the middle mouse button and moving the mouse, the camera will
zoom in and out. It is also possible to use the mouse wheel (not supported on
all systems) or the +/- keys to zoom in and out.
.PP
Double click the left mouse button on a point on the model to focus the camera
on that point.
.PP
Press the 'f' key to fit the model into the screen view (re-center and re-zoom).
.PP
Press the 'y' key to change the camera up direction to the Y axis (may be
necessary if the model was designed in or for an environment where the Y axis
is considered the up direction).
.PP
Press the 'z' key to change the camera up direction to the Z axis (default).
.SH FILE FORMATS
The following 3D model file formats are supported:
OpenCTM (.ctm),
Stanford triangle format (.ply),
Stereolitography (.stl),
3D Studio (.3ds),
COLLADA 1.4/1.5 (.dae),
Wavefront geometry file (.obj),
LightWave object (.lwo),
Geomview object file format (.off),
VRML 2.0 - export only (.wrl).
.PP
The following 2D image file formats are supported (texture):
JPEG (.jpg), PNG (.png).
.SH AVAILABILITY
.B ctmviewer
is designed to be portable, and is available for several different systems,
including (but not limited to): Windows, Mac OS X (10.3+), Linux and
OpenSolaris.
.PP
.B ctmviewer
uses OpenGL for its accelerated 3D display. When the OpenGL implementation
supports it,
.B ctmviewer
will use per pixel Phong shading for improved visual appearance. Otherwise
.B ctmviewer
will fall back to classic per vertex shading.
.SH SEE ALSO
ctmconv(1)

Binary file not shown.

View File

@@ -1,407 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="750"
height="450"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docname="grid.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0">
<defs
id="defs4">
<marker
inkscape:stockid="Arrow1Mstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mstart"
style="overflow:visible">
<path
id="path3169"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(0.4,0,0,0.4,4,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend"
style="overflow:visible">
<path
id="path3172"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0"
refX="0"
id="Arrow1Send"
style="overflow:visible">
<path
id="path3178"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(-0.2,0,0,-0.2,-1.2,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Sstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Sstart"
style="overflow:visible">
<path
id="path3175"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(0.2,0,0,0.2,1.2,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lstart"
style="overflow:visible">
<path
id="path3163"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(0.8,0,0,0.8,10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend"
style="overflow:visible">
<path
id="path3422"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="381.04961"
inkscape:cy="117.6715"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1247"
inkscape:window-height="1053"
inkscape:window-x="10"
inkscape:window-y="83"
showguides="true"
inkscape:guide-bbox="true">
<sodipodi:guide
orientation="0,1"
position="367.14286,701.42857"
id="guide8756" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:6, 6;stroke-dashoffset:0;stroke-opacity:1"
d="M 367.43289,51.53018 L 367.43289,312.95878"
id="path3168" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 222.85714,402.64792 L 524.28571,402.64792 L 668.57142,312.6479"
id="path2383" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 6;stroke-dashoffset:0;stroke-opacity:1"
d="M 668.57142,312.6479 L 367.14284,312.6479 L 222.85714,402.64792"
id="path2385" />
<path
id="path3157"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 668.57141,50.21932 L 367.14283,50.21932 L 222.85714,140.21933 L 524.2857,140.21933 L 668.57141,50.21932 z"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 222.85986,141.10779 L 222.85986,402.53632"
id="path3162" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 523.92359,141.10779 L 523.92359,402.53632"
id="path3164" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 668.57141,51.53018 L 668.57141,312.95878"
id="path3166" />
<g
id="g8740"
transform="translate(-512.85714,7.1428567)">
<path
sodipodi:nodetypes="cc"
id="path2386"
d="M 586.77594,353.04096 L 535.65012,384.45212"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker-start:url(#Arrow1Mstart);marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccc"
id="path3158"
d="M 607.10168,384.84771 L 535.38085,384.84771 L 535.38085,315.14718"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<flowRoot
transform="translate(-16.692898,-18.42785)"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
id="flowRoot8716"
xml:space="preserve"><flowRegion
id="flowRegion8718"><rect
y="386.86801"
x="631.34534"
height="146.47212"
width="191.92899"
id="rect8720" /></flowRegion><flowPara
style="font-size:20px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowPara8722">x</flowPara></flowRoot> <flowRoot
transform="translate(-37.223353,-55.905268)"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
id="flowRoot8724"
xml:space="preserve"><flowRegion
id="flowRegion8726"><rect
y="386.86801"
x="631.34534"
height="146.47212"
width="191.92899"
id="rect8728" /></flowRegion><flowPara
style="font-size:20px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowPara8730">y</flowPara></flowRoot> <flowRoot
transform="translate(-100.79478,-101.61955)"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
id="flowRoot8732"
xml:space="preserve"><flowRegion
id="flowRegion8734"><rect
y="386.86801"
x="631.34534"
height="146.47212"
width="191.92899"
id="rect8736" /></flowRegion><flowPara
style="font-size:20px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowPara8738">z</flowPara></flowRoot> </g>
<flowRoot
xml:space="preserve"
id="flowRoot8758"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
transform="translate(55.947072,6.9695424)"><flowRegion
id="flowRegion8760"><rect
id="rect8762"
width="125.76399"
height="80.812202"
x="122.73354"
y="402.01776" /></flowRegion><flowPara
id="flowPara8764"
style="font-size:24px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic">LB</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot8766"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
transform="translate(554.66861,-382.30182)"><flowRegion
id="flowRegion8768"><rect
id="rect8770"
width="125.76399"
height="80.812202"
x="122.73354"
y="402.01776" /></flowRegion><flowPara
style="font-size:24px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowPara8774">HB</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 223.24371,402.58596 L 223.24371,420.7687"
id="path8778" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 253.29574,402.58596 L 253.29574,420.7687"
id="path8780" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 283.34777,402.58596 L 283.34777,420.7687"
id="path8782" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 313.39985,402.58596 L 313.39985,420.7687"
id="path8784" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 343.45189,402.58596 L 343.45189,420.7687"
id="path8786" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 373.5039,402.58596 L 373.5039,420.7687"
id="path8794" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 403.55595,402.58596 L 403.55595,420.7687"
id="path8796" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 433.60797,402.58596 L 433.60797,420.7687"
id="path8798" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 463.66002,402.58596 L 463.66002,420.7687"
id="path8800" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 493.71208,402.58596 L 493.71208,420.7687"
id="path8802" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 523.76409,402.58596 L 523.76409,420.7687"
id="path8804" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,402.2703 L 222.23356,402.2703"
id="path8806" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,369.56661 L 222.23356,369.56661"
id="path8808" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,336.86293 L 222.23356,336.86293"
id="path8810" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,304.15923 L 222.23356,304.15923"
id="path8812" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,271.45554 L 222.23356,271.45554"
id="path8814" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,238.75185 L 222.23356,238.75185"
id="path8816" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,206.04816 L 222.23356,206.04816"
id="path8818" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,173.34447 L 222.23356,173.34447"
id="path8820" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 204.05082,140.64078 L 222.23356,140.64078"
id="path8822" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 524.91167,402.91279 L 537.76881,415.76993"
id="path8828" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 545.47547,390.06942 L 558.33261,402.92656"
id="path8830" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 566.03927,377.22605 L 578.89641,390.08319"
id="path8832" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 586.60309,364.38268 L 599.46023,377.23982"
id="path8834" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 607.16698,351.53931 L 620.02412,364.39645"
id="path8836" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 627.73081,338.69594 L 640.58795,351.55308"
id="path8838" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 648.29455,325.85257 L 661.15169,338.70971"
id="path8840" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 668.85841,313.00921 L 681.71555,325.86635"
id="path8842" />
<flowRoot
xml:space="preserve"
id="flowRoot8844"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
transform="translate(233.3577,17.794817)"><flowRegion
id="flowRegion8846"><rect
id="rect8848"
width="125.76399"
height="80.812202"
x="122.73354"
y="402.01776" /></flowRegion><flowPara
id="flowPara8850"
style="font-size:24px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic">div<flowSpan
style="-inkscape-font-specification:Serif Italic;font-family:Serif;font-weight:normal;font-style:italic;font-stretch:normal;font-variant:normal;font-size:14px;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"
id="flowSpan8852">x</flowSpan></flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot8854"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
transform="translate(492.75412,-32.72025)"><flowRegion
id="flowRegion8856"><rect
id="rect8858"
width="125.76399"
height="80.812202"
x="122.73354"
y="402.01776" /></flowRegion><flowPara
id="flowPara8860"
style="font-size:24px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic">div<flowSpan
style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowSpan8862">y</flowSpan></flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot8864"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
transform="translate(30.61126,-185.57739)"><flowRegion
id="flowRegion8866"><rect
id="rect8868"
width="125.76399"
height="80.812202"
x="122.73354"
y="402.01776" /></flowRegion><flowPara
id="flowPara8870"
style="font-size:24px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic">div<flowSpan
style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Serif;-inkscape-font-specification:Serif Italic"
id="flowSpan8872">z</flowSpan></flowPara></flowRoot> </g>
</svg>

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

View File

@@ -1,33 +0,0 @@
% Document class
\documentclass[11pt,a4paper]{report}
% Packages
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{color}
\usepackage{times}
\usepackage{graphicx}
% Paragraph styles
\raggedright
\usepackage{parskip}
% Code listings
\lstset{frame=single,frameround=tttt,backgroundcolor=\color{code},%
language=C,basicstyle={\ttfamily\small},%
breaklines,breakindent=0pt,postbreak=\space\space\space\space}
% Colors
\definecolor{link}{rgb}{0.6,0.0,0.0}
\definecolor{code}{rgb}{0.9,0.9,1.0}
\definecolor{codeA}{rgb}{0.9,1.0,0.9}
\definecolor{codeB}{rgb}{1.0,0.9,0.9}
% PDF specific document properties
% hyperref (bookmarks, links etc) - use this package last
\usepackage[colorlinks=true,linkcolor=link,bookmarks=true,bookmarksopen=true,%
pdfhighlight=/N,bookmarksnumbered=true,bookmarksopenlevel=1,%
pdfview=FitH,pdfstartview=FitH]{hyperref}

View File

@@ -1,81 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.linux
# Description: Makefile for Linux systems (should work on most Un*x-like
# systems with gcc, e.g. OpenSolaris).
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
LZMADIR = liblzma
CC = gcc
CFLAGS = -O3 -W -Wall -c -fPIC -DOPENCTM_BUILD -I$(LZMADIR) -DLZMA_PREFIX_CTM -std=c99 -pedantic
CFLAGS_LZMA = -O3 -W -Wall -c -fPIC -DLZMA_PREFIX_CTM -std=c99 -pedantic
RM = rm -f
DEPEND = $(CPP) -MM
DYNAMICLIB = libopenctm.so
OBJS = openctm.o \
stream.o \
compressRAW.o \
compressMG1.o \
compressMG2.o
LZMA_OBJS = Alloc.o \
LzFind.o \
LzmaDec.o \
LzmaEnc.o \
LzmaLib.o
SRCS = openctm.c \
stream.c \
compressRAW.c \
compressMG1.c \
compressMG2.c
LZMA_SRCS = $(LZMADIR)/Alloc.c \
$(LZMADIR)/LzFind.c \
$(LZMADIR)/LzmaDec.c \
$(LZMADIR)/LzmaEnc.c \
$(LZMADIR)/LzmaLib.c
.phony: all clean depend
all: $(DYNAMICLIB)
clean:
$(RM) $(DYNAMICLIB) $(OBJS) $(LZMA_OBJS)
$(DYNAMICLIB): $(OBJS) $(LZMA_OBJS)
gcc -shared -s -Wl,-soname,$@ -o $@ $(OBJS) $(LZMA_OBJS) -lm
%.o: %.c
$(CC) $(CFLAGS) $<
%.o: $(LZMADIR)/%.c
$(CC) $(CFLAGS_LZMA) $<
depend:
$(DEPEND) $(SRCS) $(LZMA_SRCS) > make.depend
-include make.depend

View File

@@ -1,80 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.macosx
# Description: Makefile for Mac OS X.
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
LZMADIR = liblzma
CC = gcc
CFLAGS = -O3 -W -Wall -c -fvisibility=hidden -DOPENCTM_BUILD -I$(LZMADIR) -DLZMA_PREFIX_CTM -std=c99 -pedantic
CFLAGS_LZMA = -O3 -W -Wall -c -fvisibility=hidden -DLZMA_PREFIX_CTM -std=c99 -pedantic
RM = rm -f
DEPEND = $(CPP) -MM
DYNAMICLIB = libopenctm.dylib
OBJS = openctm.o \
stream.o \
compressRAW.o \
compressMG1.o \
compressMG2.o
LZMA_OBJS = Alloc.o \
LzFind.o \
LzmaDec.o \
LzmaEnc.o \
LzmaLib.o
SRCS = openctm.c \
stream.c \
compressRAW.c \
compressMG1.c \
compressMG2.c
LZMA_SRCS = $(LZMADIR)/Alloc.c \
$(LZMADIR)/LzFind.c \
$(LZMADIR)/LzmaDec.c \
$(LZMADIR)/LzmaEnc.c \
$(LZMADIR)/LzmaLib.c
.phony: all clean depend
all: $(DYNAMICLIB)
clean:
$(RM) $(DYNAMICLIB) $(OBJS) $(LZMA_OBJS)
$(DYNAMICLIB): $(OBJS) $(LZMA_OBJS)
gcc -dynamiclib -o $@ $(OBJS) $(LZMA_OBJS)
%.o: %.c
$(CC) $(CFLAGS) $<
%.o: $(LZMADIR)/%.c
$(CC) $(CFLAGS_LZMA) $<
depend:
$(DEPEND) $(SRCS) $(LZMA_SRCS) > make.depend
-include make.depend

View File

@@ -1,87 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.mingw
# Description: Makefile for MinGW32 for Windows.
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
LZMADIR = liblzma
CC = gcc
CFLAGS = -O3 -W -Wall -c -DOPENCTM_BUILD -I$(LZMADIR) -DLZMA_PREFIX_CTM -std=c99 -pedantic
CFLAGS_LZMA = -O3 -W -Wall -c -DLZMA_PREFIX_CTM -std=c99 -pedantic
RM = del /Q
DEPEND = $(CC) -MM
RC = windres
DYNAMICLIB = openctm.dll
LINKLIB = libopenctm.a
OBJS = openctm.o \
stream.o \
compressRAW.o \
compressMG1.o \
compressMG2.o
LZMA_OBJS = Alloc.o \
LzFind.o \
LzmaDec.o \
LzmaEnc.o \
LzmaLib.o
SRCS = openctm.c \
stream.c \
compressRAW.c \
compressMG1.c \
compressMG2.c
LZMA_SRCS = $(LZMADIR)/Alloc.c \
$(LZMADIR)/LzFind.c \
$(LZMADIR)/LzmaDec.c \
$(LZMADIR)/LzmaEnc.c \
$(LZMADIR)/LzmaLib.c
.phony: all clean depend
all: $(DYNAMICLIB)
clean:
$(RM) $(DYNAMICLIB) $(LINKLIB) $(OBJS) $(LZMA_OBJS) openctm-res.o
$(DYNAMICLIB): $(OBJS) $(LZMA_OBJS) openctm-mingw1.def openctm-mingw2.def openctm-res.o
dllwrap --def openctm-mingw1.def -o $@ $(OBJS) $(LZMA_OBJS) openctm-res.o
strip $@
dlltool --kill-at --output-lib $(LINKLIB) --def openctm-mingw2.def
openctm-res.o: openctm.rc
$(RC) $< $@
%.o: %.c
$(CC) $(CFLAGS) $<
%.o: $(LZMADIR)/%.c
$(CC) $(CFLAGS_LZMA) $<
depend:
$(DEPEND) $(SRCS) $(LZMA_SRCS) > make.depend
-include make.depend

View File

@@ -1,103 +0,0 @@
###############################################################################
# Product: OpenCTM
# File: Makefile.msvc
# Description: Makefile for MS Visual Studio 2008 for Windows.
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
LZMADIR = liblzma
CC = cl
CFLAGS = /nologo /Ox /W3 /c /DOPENCTM_BUILD /I$(LZMADIR) /DLZMA_PREFIX_CTM /D_CRT_SECURE_NO_WARNINGS
CFLAGS_LZMA = /nologo /Ox /W3 /c /DLZMA_PREFIX_CTM
RM = del /Q
RC = rc
DYNAMICLIB = openctm.dll
LINKLIB = openctm.lib
OBJS = openctm.obj \
stream.obj \
compressRAW.obj \
compressMG1.obj \
compressMG2.obj
LZMA_OBJS = Alloc.obj \
LzFind.obj \
LzmaDec.obj \
LzmaEnc.obj \
LzmaLib.obj
SRCS = openctm.c \
stream.c \
compressRAW.c \
compressMG1.c \
compressMG2.c
LZMA_SRCS = $(LZMADIR)\Alloc.c \
$(LZMADIR)\LzFind.c \
$(LZMADIR)\LzmaDec.c \
$(LZMADIR)\LzmaEnc.c \
$(LZMADIR)\LzmaLib.c
all: $(DYNAMICLIB)
.PHONY: clean
clean:
$(RM) $(DYNAMICLIB) $(LINKLIB) $(OBJS) $(LZMA_OBJS) openctm.res
$(DYNAMICLIB): $(OBJS) $(LZMA_OBJS) openctm-msvc.def openctm.res
link /nologo /out:$@ /dll /implib:$(LINKLIB) /def:openctm-msvc.def $(OBJS) $(LZMA_OBJS) openctm.res
openctm.res: openctm.rc
$(RC) openctm.rc
openctm.obj: openctm.c openctm.h internal.h
$(CC) $(CFLAGS) openctm.c
stream.obj: stream.c openctm.h internal.h
$(CC) $(CFLAGS) stream.c
compressRAW.obj: compressRAW.c openctm.h internal.h
$(CC) $(CFLAGS) compressRAW.c
compressMG1.obj: compressMG1.c openctm.h internal.h
$(CC) $(CFLAGS) compressMG1.c
compressMG2.obj: compressMG2.c openctm.h internal.h
$(CC) $(CFLAGS) compressMG2.c
Alloc.obj: $(LZMADIR)\Alloc.c $(LZMADIR)\Alloc.h
$(CC) $(CFLAGS_LZMA) $(LZMADIR)\Alloc.c
LzFind.obj: $(LZMADIR)\LzFind.c $(LZMADIR)\LzFind.h $(LZMADIR)\Types.h $(LZMADIR)\LzHash.h $(LZMADIR)\NameMangle.h
$(CC) $(CFLAGS_LZMA) $(LZMADIR)\LzFind.c
LzmaDec.obj: $(LZMADIR)\LzmaDec.c $(LZMADIR)\LzmaDec.h $(LZMADIR)\Types.h $(LZMADIR)\NameMangle.h
$(CC) $(CFLAGS_LZMA) $(LZMADIR)\LzmaDec.c
LzmaEnc.obj: $(LZMADIR)\LzmaEnc.c $(LZMADIR)\LzmaEnc.h $(LZMADIR)\Types.h $(LZMADIR)\LzFind.h $(LZMADIR)\NameMangle.h
$(CC) $(CFLAGS_LZMA) $(LZMADIR)\LzmaEnc.c
LzmaLib.obj: $(LZMADIR)\LzmaLib.c $(LZMADIR)\LzmaEnc.h $(LZMADIR)\Types.h $(LZMADIR)\LzmaDec.h $(LZMADIR)\Alloc.h $(LZMADIR)\LzmaLib.h $(LZMADIR)\NameMangle.h
$(CC) $(CFLAGS_LZMA) $(LZMADIR)\LzmaLib.c

View File

@@ -1,324 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: compressMG1.c
// Description: Implementation of the MG1 compression method.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include <stdlib.h>
#include <math.h>
#include "openctm.h"
#include "internal.h"
#ifdef __DEBUG_
#include <stdio.h>
#endif
//-----------------------------------------------------------------------------
// _compareTriangle() - Comparator for the triangle sorting.
//-----------------------------------------------------------------------------
static int _compareTriangle(const void * elem1, const void * elem2)
{
CTMuint * tri1 = (CTMuint *) elem1;
CTMuint * tri2 = (CTMuint *) elem2;
if(tri1[0] != tri2[0])
return tri1[0] - tri2[0];
else
return tri1[1] - tri2[1];
}
//-----------------------------------------------------------------------------
// _ctmReArrangeTriangles() - Re-arrange all triangles for optimal
// compression.
//-----------------------------------------------------------------------------
static void _ctmReArrangeTriangles(_CTMcontext * self, CTMuint * aIndices)
{
CTMuint * tri, tmp, i;
// Step 1: Make sure that the first index of each triangle is the smallest
// one (rotate triangle nodes if necessary)
for(i = 0; i < self->mTriangleCount; ++ i)
{
tri = &aIndices[i * 3];
if((tri[1] < tri[0]) && (tri[1] < tri[2]))
{
tmp = tri[0];
tri[0] = tri[1];
tri[1] = tri[2];
tri[2] = tmp;
}
else if((tri[2] < tri[0]) && (tri[2] < tri[1]))
{
tmp = tri[0];
tri[0] = tri[2];
tri[2] = tri[1];
tri[1] = tmp;
}
}
// Step 2: Sort the triangles based on the first triangle index
qsort((void *) aIndices, self->mTriangleCount, sizeof(CTMuint) * 3, _compareTriangle);
}
//-----------------------------------------------------------------------------
// _ctmMakeIndexDeltas() - Calculate various forms of derivatives in order to
// reduce data entropy.
//-----------------------------------------------------------------------------
static void _ctmMakeIndexDeltas(_CTMcontext * self, CTMuint * aIndices)
{
CTMint i;
for(i = self->mTriangleCount - 1; i >= 0; -- i)
{
// Step 1: Calculate delta from second triangle index to the previous
// second triangle index, if the previous triangle shares the same first
// index, otherwise calculate the delta to the first triangle index
if((i >= 1) && (aIndices[i * 3] == aIndices[(i - 1) * 3]))
aIndices[i * 3 + 1] -= aIndices[(i - 1) * 3 + 1];
else
aIndices[i * 3 + 1] -= aIndices[i * 3];
// Step 2: Calculate delta from third triangle index to the first triangle
// index
aIndices[i * 3 + 2] -= aIndices[i * 3];
// Step 3: Calculate derivative of the first triangle index
if(i >= 1)
aIndices[i * 3] -= aIndices[(i - 1) * 3];
}
}
//-----------------------------------------------------------------------------
// _ctmRestoreIndices() - Restore original indices (inverse derivative
// operation).
//-----------------------------------------------------------------------------
static void _ctmRestoreIndices(_CTMcontext * self, CTMuint * aIndices)
{
CTMuint i;
for(i = 0; i < self->mTriangleCount; ++ i)
{
// Step 1: Reverse derivative of the first triangle index
if(i >= 1)
aIndices[i * 3] += aIndices[(i - 1) * 3];
// Step 2: Reverse delta from third triangle index to the first triangle
// index
aIndices[i * 3 + 2] += aIndices[i * 3];
// Step 3: Reverse delta from second triangle index to the previous
// second triangle index, if the previous triangle shares the same first
// index, otherwise reverse the delta to the first triangle index
if((i >= 1) && (aIndices[i * 3] == aIndices[(i - 1) * 3]))
aIndices[i * 3 + 1] += aIndices[(i - 1) * 3 + 1];
else
aIndices[i * 3 + 1] += aIndices[i * 3];
}
}
//-----------------------------------------------------------------------------
// _ctmCompressMesh_MG1() - Compress the mesh that is stored in the CTM
// context, and write it the the output stream in the CTM context.
//-----------------------------------------------------------------------------
int _ctmCompressMesh_MG1(_CTMcontext * self)
{
CTMuint * indices;
_CTMfloatmap * map;
CTMuint i;
#ifdef __DEBUG_
printf("COMPRESSION METHOD: MG1\n");
#endif
// Perpare (sort) indices
indices = (CTMuint *) malloc(sizeof(CTMuint) * self->mTriangleCount * 3);
if(!indices)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
for(i = 0; i < self->mTriangleCount * 3; ++ i)
indices[i] = self->mIndices[i];
_ctmReArrangeTriangles(self, indices);
// Calculate index deltas (entropy-reduction)
_ctmMakeIndexDeltas(self, indices);
// Write triangle indices
#ifdef __DEBUG_
printf("Inidices: ");
#endif
_ctmStreamWrite(self, (void *) "INDX", 4);
if(!_ctmStreamWritePackedInts(self, (CTMint *) indices, self->mTriangleCount, 3, CTM_FALSE))
{
free((void *) indices);
return CTM_FALSE;
}
// Free temporary resources
free((void *) indices);
// Write vertices
#ifdef __DEBUG_
printf("Vertices: ");
#endif
_ctmStreamWrite(self, (void *) "VERT", 4);
if(!_ctmStreamWritePackedFloats(self, self->mVertices, self->mVertexCount * 3, 1))
{
free((void *) indices);
return CTM_FALSE;
}
// Write normals
if(self->mNormals)
{
#ifdef __DEBUG_
printf("Normals: ");
#endif
_ctmStreamWrite(self, (void *) "NORM", 4);
if(!_ctmStreamWritePackedFloats(self, self->mNormals, self->mVertexCount, 3))
return CTM_FALSE;
}
// Write UV maps
map = self->mUVMaps;
while(map)
{
#ifdef __DEBUG_
printf("UV coordinates (%s): ", map->mName ? map->mName : "no name");
#endif
_ctmStreamWrite(self, (void *) "TEXC", 4);
_ctmStreamWriteSTRING(self, map->mName);
_ctmStreamWriteSTRING(self, map->mFileName);
if(!_ctmStreamWritePackedFloats(self, map->mValues, self->mVertexCount, 2))
return CTM_FALSE;
map = map->mNext;
}
// Write attribute maps
map = self->mAttribMaps;
while(map)
{
#ifdef __DEBUG_
printf("Vertex attributes (%s): ", map->mName ? map->mName : "no name");
#endif
_ctmStreamWrite(self, (void *) "ATTR", 4);
_ctmStreamWriteSTRING(self, map->mName);
if(!_ctmStreamWritePackedFloats(self, map->mValues, self->mVertexCount, 4))
return CTM_FALSE;
map = map->mNext;
}
return CTM_TRUE;
}
//-----------------------------------------------------------------------------
// _ctmUncompressMesh_MG1() - Uncmpress the mesh from the input stream in the
// CTM context, and store the resulting mesh in the CTM context.
//-----------------------------------------------------------------------------
int _ctmUncompressMesh_MG1(_CTMcontext * self)
{
CTMuint * indices;
_CTMfloatmap * map;
CTMuint i;
// Allocate memory for the indices
indices = (CTMuint *) malloc(sizeof(CTMuint) * self->mTriangleCount * 3);
if(!indices)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Read triangle indices
if(_ctmStreamReadUINT(self) != FOURCC("INDX"))
{
self->mError = CTM_BAD_FORMAT;
free(indices);
return CTM_FALSE;
}
if(!_ctmStreamReadPackedInts(self, (CTMint *) indices, self->mTriangleCount, 3, CTM_FALSE))
return CTM_FALSE;
// Restore indices
_ctmRestoreIndices(self, indices);
for(i = 0; i < self->mTriangleCount * 3; ++ i)
self->mIndices[i] = indices[i];
// Free temporary resources
free(indices);
// Read vertices
if(_ctmStreamReadUINT(self) != FOURCC("VERT"))
{
self->mError = CTM_BAD_FORMAT;
return CTM_FALSE;
}
if(!_ctmStreamReadPackedFloats(self, self->mVertices, self->mVertexCount * 3, 1))
return CTM_FALSE;
// Read normals
if(self->mNormals)
{
if(_ctmStreamReadUINT(self) != FOURCC("NORM"))
{
self->mError = CTM_BAD_FORMAT;
return CTM_FALSE;
}
if(!_ctmStreamReadPackedFloats(self, self->mNormals, self->mVertexCount, 3))
return CTM_FALSE;
}
// Read UV maps
map = self->mUVMaps;
while(map)
{
if(_ctmStreamReadUINT(self) != FOURCC("TEXC"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
_ctmStreamReadSTRING(self, &map->mName);
_ctmStreamReadSTRING(self, &map->mFileName);
if(!_ctmStreamReadPackedFloats(self, map->mValues, self->mVertexCount, 2))
return CTM_FALSE;
map = map->mNext;
}
// Read vertex attribute maps
map = self->mAttribMaps;
while(map)
{
if(_ctmStreamReadUINT(self) != FOURCC("ATTR"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
_ctmStreamReadSTRING(self, &map->mName);
if(!_ctmStreamReadPackedFloats(self, map->mValues, self->mVertexCount, 4))
return CTM_FALSE;
map = map->mNext;
}
return CTM_TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,181 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: compressRAW.c
// Description: Implementation of the RAW compression method.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "openctm.h"
#include "internal.h"
#ifdef __DEBUG_
#include <stdio.h>
#endif
//-----------------------------------------------------------------------------
// _ctmCompressMesh_RAW() - Compress the mesh that is stored in the CTM
// context using the RAW method, and write it the the output stream in the CTM
// context.
//-----------------------------------------------------------------------------
int _ctmCompressMesh_RAW(_CTMcontext * self)
{
CTMuint i;
_CTMfloatmap * map;
#ifdef __DEBUG_
printf("COMPRESSION METHOD: RAW\n");
#endif
// Write triangle indices
#ifdef __DEBUG_
printf("Inidices: %d bytes\n", (CTMuint)(self->mTriangleCount * 3 * sizeof(CTMuint)));
#endif
_ctmStreamWrite(self, (void *) "INDX", 4);
for(i = 0; i < self->mTriangleCount * 3; ++ i)
_ctmStreamWriteUINT(self, self->mIndices[i]);
// Write vertices
#ifdef __DEBUG_
printf("Vertices: %d bytes\n", (CTMuint)(self->mVertexCount * 3 * sizeof(CTMfloat)));
#endif
_ctmStreamWrite(self, (void *) "VERT", 4);
for(i = 0; i < self->mVertexCount * 3; ++ i)
_ctmStreamWriteFLOAT(self, self->mVertices[i]);
// Write normals
if(self->mNormals)
{
#ifdef __DEBUG_
printf("Normals: %d bytes\n", (CTMuint)(self->mVertexCount * 3 * sizeof(CTMfloat)));
#endif
_ctmStreamWrite(self, (void *) "NORM", 4);
for(i = 0; i < self->mVertexCount * 3; ++ i)
_ctmStreamWriteFLOAT(self, self->mNormals[i]);
}
// Write UV maps
map = self->mUVMaps;
while(map)
{
#ifdef __DEBUG_
printf("UV coordinates (%s): %d bytes\n", map->mName ? map->mName : "no name", (CTMuint)(self->mVertexCount * 2 * sizeof(CTMfloat)));
#endif
_ctmStreamWrite(self, (void *) "TEXC", 4);
_ctmStreamWriteSTRING(self, map->mName);
_ctmStreamWriteSTRING(self, map->mFileName);
for(i = 0; i < self->mVertexCount * 2; ++ i)
_ctmStreamWriteFLOAT(self, map->mValues[i]);
map = map->mNext;
}
// Write attribute maps
map = self->mAttribMaps;
while(map)
{
#ifdef __DEBUG_
printf("Vertex attributes (%s): %d bytes\n", map->mName ? map->mName : "no name", (CTMuint)(self->mVertexCount * 4 * sizeof(CTMfloat)));
#endif
_ctmStreamWrite(self, (void *) "ATTR", 4);
_ctmStreamWriteSTRING(self, map->mName);
for(i = 0; i < self->mVertexCount * 4; ++ i)
_ctmStreamWriteFLOAT(self, map->mValues[i]);
map = map->mNext;
}
return 1;
}
//-----------------------------------------------------------------------------
// _ctmUncompressMesh_RAW() - Uncmpress the mesh from the input stream in the
// CTM context using the RAW method, and store the resulting mesh in the CTM
// context.
//-----------------------------------------------------------------------------
int _ctmUncompressMesh_RAW(_CTMcontext * self)
{
CTMuint i;
_CTMfloatmap * map;
// Read triangle indices
if(_ctmStreamReadUINT(self) != FOURCC("INDX"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
for(i = 0; i < self->mTriangleCount * 3; ++ i)
self->mIndices[i] = _ctmStreamReadUINT(self);
// Read vertices
if(_ctmStreamReadUINT(self) != FOURCC("VERT"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
for(i = 0; i < self->mVertexCount * 3; ++ i)
self->mVertices[i] = _ctmStreamReadFLOAT(self);
// Read normals
if(self->mNormals)
{
if(_ctmStreamReadUINT(self) != FOURCC("NORM"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
for(i = 0; i < self->mVertexCount * 3; ++ i)
self->mNormals[i] = _ctmStreamReadFLOAT(self);
}
// Read UV maps
map = self->mUVMaps;
while(map)
{
if(_ctmStreamReadUINT(self) != FOURCC("TEXC"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
_ctmStreamReadSTRING(self, &map->mName);
_ctmStreamReadSTRING(self, &map->mFileName);
for(i = 0; i < self->mVertexCount * 2; ++ i)
map->mValues[i] = _ctmStreamReadFLOAT(self);
map = map->mNext;
}
// Read attribute maps
map = self->mAttribMaps;
while(map)
{
if(_ctmStreamReadUINT(self) != FOURCC("ATTR"))
{
self->mError = CTM_BAD_FORMAT;
return 0;
}
_ctmStreamReadSTRING(self, &map->mName);
for(i = 0; i < self->mVertexCount * 4; ++ i)
map->mValues[i] = _ctmStreamReadFLOAT(self);
map = map->mNext;
}
return 1;
}

View File

@@ -1,147 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: internal.h
// Description: Internal (private) declarations, types and function prototypes.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __OPENCTM_INTERNAL_H_
#define __OPENCTM_INTERNAL_H_
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
// OpenCTM file format version (v5).
#define _CTM_FORMAT_VERSION 0x00000005
// Flags for the Mesh flags field of the file header
#define _CTM_HAS_NORMALS_BIT 0x00000001
//-----------------------------------------------------------------------------
// _CTMfloatmap - Internal representation of a floating point based vertex map
// (used for UV maps and attribute maps).
//-----------------------------------------------------------------------------
typedef struct _CTMfloatmap_struct _CTMfloatmap;
struct _CTMfloatmap_struct {
char * mName; // Unique name
char * mFileName; // File name reference (used only for UV maps)
CTMfloat mPrecision; // Precision for this map
CTMfloat * mValues; // Attribute/UV coordinate values (per vertex)
_CTMfloatmap * mNext; // Pointer to the next map in the list (linked list)
};
//-----------------------------------------------------------------------------
// _CTMcontext - Internal CTM context structure.
//-----------------------------------------------------------------------------
typedef struct {
// Context mode (import or export)
CTMenum mMode;
// Vertices
CTMfloat * mVertices;
CTMuint mVertexCount;
// Indices
CTMuint * mIndices;
CTMuint mTriangleCount;
// Normals (optional)
CTMfloat * mNormals;
// Multiple sets of UV coordinate maps (optional)
CTMuint mUVMapCount;
_CTMfloatmap * mUVMaps;
// Multiple sets of custom vertex attribute maps (optional)
CTMuint mAttribMapCount;
_CTMfloatmap * mAttribMaps;
// Last error code
CTMenum mError;
// The selected compression method
CTMenum mMethod;
// The selected compression level
CTMuint mCompressionLevel;
// Vertex coordinate precision
CTMfloat mVertexPrecision;
// Normal precision (angular + magnitude)
CTMfloat mNormalPrecision;
// File comment
char * mFileComment;
// Read() function pointer
CTMreadfn mReadFn;
// Write() function pointer
CTMwritefn mWriteFn;
// User data (for stream read/write - usually the stream handle)
void * mUserData;
} _CTMcontext;
//-----------------------------------------------------------------------------
// Macros
//-----------------------------------------------------------------------------
#define FOURCC(str) (((CTMuint) str[0]) | (((CTMuint) str[1]) << 8) | \
(((CTMuint) str[2]) << 16) | (((CTMuint) str[3]) << 24))
//-----------------------------------------------------------------------------
// Funcion prototypes for stream.c
//-----------------------------------------------------------------------------
CTMuint _ctmStreamRead(_CTMcontext * self, void * aBuf, CTMuint aCount);
CTMuint _ctmStreamWrite(_CTMcontext * self, void * aBuf, CTMuint aCount);
CTMuint _ctmStreamReadUINT(_CTMcontext * self);
void _ctmStreamWriteUINT(_CTMcontext * self, CTMuint aValue);
CTMfloat _ctmStreamReadFLOAT(_CTMcontext * self);
void _ctmStreamWriteFLOAT(_CTMcontext * self, CTMfloat aValue);
void _ctmStreamReadSTRING(_CTMcontext * self, char ** aValue);
void _ctmStreamWriteSTRING(_CTMcontext * self, const char * aValue);
int _ctmStreamReadPackedInts(_CTMcontext * self, CTMint * aData, CTMuint aCount, CTMuint aSize, CTMint aSignedInts);
int _ctmStreamWritePackedInts(_CTMcontext * self, CTMint * aData, CTMuint aCount, CTMuint aSize, CTMint aSignedInts);
int _ctmStreamReadPackedFloats(_CTMcontext * self, CTMfloat * aData, CTMuint aCount, CTMuint aSize);
int _ctmStreamWritePackedFloats(_CTMcontext * self, CTMfloat * aData, CTMuint aCount, CTMuint aSize);
//-----------------------------------------------------------------------------
// Funcion prototypes for compressRAW.c
//-----------------------------------------------------------------------------
int _ctmCompressMesh_RAW(_CTMcontext * self);
int _ctmUncompressMesh_RAW(_CTMcontext * self);
//-----------------------------------------------------------------------------
// Funcion prototypes for compressMG1.c
//-----------------------------------------------------------------------------
int _ctmCompressMesh_MG1(_CTMcontext * self);
int _ctmUncompressMesh_MG1(_CTMcontext * self);
//-----------------------------------------------------------------------------
// Funcion prototypes for compressMG2.c
//-----------------------------------------------------------------------------
int _ctmCompressMesh_MG2(_CTMcontext * self);
int _ctmUncompressMesh_MG2(_CTMcontext * self);
#endif // __OPENCTM_INTERNAL_H_

View File

@@ -1,127 +0,0 @@
/* Alloc.c -- Memory allocation functions
2008-09-24
Igor Pavlov
Public domain */
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include "Alloc.h"
/* #define _SZ_ALLOC_DEBUG */
/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
#ifdef _SZ_ALLOC_DEBUG
#include <stdio.h>
int g_allocCount = 0;
int g_allocCountMid = 0;
int g_allocCountBig = 0;
#endif
void *MyAlloc(size_t size)
{
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
{
void *p = malloc(size);
fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p);
return p;
}
#else
return malloc(size);
#endif
}
void MyFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address);
#endif
free(address);
}
#ifdef _WIN32
void *MidAlloc(size_t size)
{
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
#endif
return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
}
void MidFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
#endif
if (address == 0)
return;
VirtualFree(address, 0, MEM_RELEASE);
}
#ifndef MEM_LARGE_PAGES
#undef _7ZIP_LARGE_PAGES
#endif
#ifdef _7ZIP_LARGE_PAGES
SIZE_T g_LargePageSize = 0;
typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
#endif
void SetLargePageSize()
{
#ifdef _7ZIP_LARGE_PAGES
SIZE_T size = 0;
GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
if (largePageMinimum == 0)
return;
size = largePageMinimum();
if (size == 0 || (size & (size - 1)) != 0)
return;
g_LargePageSize = size;
#endif
}
void *BigAlloc(size_t size)
{
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
#endif
#ifdef _7ZIP_LARGE_PAGES
if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
{
void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
if (res != 0)
return res;
}
#endif
return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
}
void BigFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
#endif
if (address == 0)
return;
VirtualFree(address, 0, MEM_RELEASE);
}
#endif

View File

@@ -1,34 +0,0 @@
/* Alloc.h -- Memory allocation functions
2008-03-13
Igor Pavlov
Public domain */
#ifndef __COMMON_ALLOC_H
#define __COMMON_ALLOC_H
#include <stddef.h>
#include "NameMangle.h"
void *MyAlloc(size_t size);
void MyFree(void *address);
#ifdef _WIN32
void SetLargePageSize();
void *MidAlloc(size_t size);
void MidFree(void *address);
void *BigAlloc(size_t size);
void BigFree(void *address);
#else
#define MidAlloc(size) MyAlloc(size)
#define MidFree(address) MyFree(address)
#define BigAlloc(size) MyAlloc(size)
#define BigFree(address) MyFree(address)
#endif
#endif

View File

@@ -1,751 +0,0 @@
/* LzFind.c -- Match finder for LZ algorithms
2008-10-04 : Igor Pavlov : Public domain */
#include <string.h>
#include "LzFind.h"
#include "LzHash.h"
#define kEmptyHashValue 0
#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
#define kNormalizeMask (~(kNormalizeStepMin - 1))
#define kMaxHistorySize ((UInt32)3 << 30)
#define kStartMaxLen 3
static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
{
if (!p->directInput)
{
alloc->Free(alloc, p->bufferBase);
p->bufferBase = 0;
}
}
/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
{
UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
if (p->directInput)
{
p->blockSize = blockSize;
return 1;
}
if (p->bufferBase == 0 || p->blockSize != blockSize)
{
LzInWindow_Free(p, alloc);
p->blockSize = blockSize;
p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
}
return (p->bufferBase != 0);
}
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
{
p->posLimit -= subValue;
p->pos -= subValue;
p->streamPos -= subValue;
}
static void MatchFinder_ReadBlock(CMatchFinder *p)
{
if (p->streamEndWasReached || p->result != SZ_OK)
return;
for (;;)
{
Byte *dest = p->buffer + (p->streamPos - p->pos);
size_t size = (p->bufferBase + p->blockSize - dest);
if (size == 0)
return;
p->result = p->stream->Read(p->stream, dest, &size);
if (p->result != SZ_OK)
return;
if (size == 0)
{
p->streamEndWasReached = 1;
return;
}
p->streamPos += (UInt32)size;
if (p->streamPos - p->pos > p->keepSizeAfter)
return;
}
}
void MatchFinder_MoveBlock(CMatchFinder *p)
{
memmove(p->bufferBase,
p->buffer - p->keepSizeBefore,
(size_t)(p->streamPos - p->pos + p->keepSizeBefore));
p->buffer = p->bufferBase + p->keepSizeBefore;
}
int MatchFinder_NeedMove(CMatchFinder *p)
{
/* if (p->streamEndWasReached) return 0; */
return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
}
void MatchFinder_ReadIfRequired(CMatchFinder *p)
{
if (p->streamEndWasReached)
return;
if (p->keepSizeAfter >= p->streamPos - p->pos)
MatchFinder_ReadBlock(p);
}
static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
{
if (MatchFinder_NeedMove(p))
MatchFinder_MoveBlock(p);
MatchFinder_ReadBlock(p);
}
static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
{
p->cutValue = 32;
p->btMode = 1;
p->numHashBytes = 4;
/* p->skipModeBits = 0; */
p->directInput = 0;
p->bigHash = 0;
}
#define kCrcPoly 0xEDB88320
void MatchFinder_Construct(CMatchFinder *p)
{
UInt32 i;
p->bufferBase = 0;
p->directInput = 0;
p->hash = 0;
MatchFinder_SetDefaultSettings(p);
for (i = 0; i < 256; i++)
{
UInt32 r = i;
int j;
for (j = 0; j < 8; j++)
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
p->crc[i] = r;
}
}
static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
{
alloc->Free(alloc, p->hash);
p->hash = 0;
}
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
{
MatchFinder_FreeThisClassMemory(p, alloc);
LzInWindow_Free(p, alloc);
}
static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
{
size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
if (sizeInBytes / sizeof(CLzRef) != num)
return 0;
return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
}
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
ISzAlloc *alloc)
{
UInt32 sizeReserv;
if (historySize > kMaxHistorySize)
{
MatchFinder_Free(p, alloc);
return 0;
}
sizeReserv = historySize >> 1;
if (historySize > ((UInt32)2 << 30))
sizeReserv = historySize >> 2;
sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
/* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
if (LzInWindow_Create(p, sizeReserv, alloc))
{
UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
UInt32 hs;
p->matchMaxLen = matchMaxLen;
{
p->fixedHashSize = 0;
if (p->numHashBytes == 2)
hs = (1 << 16) - 1;
else
{
hs = historySize - 1;
hs |= (hs >> 1);
hs |= (hs >> 2);
hs |= (hs >> 4);
hs |= (hs >> 8);
hs >>= 1;
/* hs >>= p->skipModeBits; */
hs |= 0xFFFF; /* don't change it! It's required for Deflate */
if (hs > (1 << 24))
{
if (p->numHashBytes == 3)
hs = (1 << 24) - 1;
else
hs >>= 1;
}
}
p->hashMask = hs;
hs++;
if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
hs += p->fixedHashSize;
}
{
UInt32 prevSize = p->hashSizeSum + p->numSons;
UInt32 newSize;
p->historySize = historySize;
p->hashSizeSum = hs;
p->cyclicBufferSize = newCyclicBufferSize;
p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
newSize = p->hashSizeSum + p->numSons;
if (p->hash != 0 && prevSize == newSize)
return 1;
MatchFinder_FreeThisClassMemory(p, alloc);
p->hash = AllocRefs(newSize, alloc);
if (p->hash != 0)
{
p->son = p->hash + p->hashSizeSum;
return 1;
}
}
}
MatchFinder_Free(p, alloc);
return 0;
}
static void MatchFinder_SetLimits(CMatchFinder *p)
{
UInt32 limit = kMaxValForNormalize - p->pos;
UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
if (limit2 < limit)
limit = limit2;
limit2 = p->streamPos - p->pos;
if (limit2 <= p->keepSizeAfter)
{
if (limit2 > 0)
limit2 = 1;
}
else
limit2 -= p->keepSizeAfter;
if (limit2 < limit)
limit = limit2;
{
UInt32 lenLimit = p->streamPos - p->pos;
if (lenLimit > p->matchMaxLen)
lenLimit = p->matchMaxLen;
p->lenLimit = lenLimit;
}
p->posLimit = p->pos + limit;
}
void MatchFinder_Init(CMatchFinder *p)
{
UInt32 i;
for (i = 0; i < p->hashSizeSum; i++)
p->hash[i] = kEmptyHashValue;
p->cyclicBufferPos = 0;
p->buffer = p->bufferBase;
p->pos = p->streamPos = p->cyclicBufferSize;
p->result = SZ_OK;
p->streamEndWasReached = 0;
MatchFinder_ReadBlock(p);
MatchFinder_SetLimits(p);
}
static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
{
return (p->pos - p->historySize - 1) & kNormalizeMask;
}
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
{
UInt32 i;
for (i = 0; i < numItems; i++)
{
UInt32 value = items[i];
if (value <= subValue)
value = kEmptyHashValue;
else
value -= subValue;
items[i] = value;
}
}
static void MatchFinder_Normalize(CMatchFinder *p)
{
UInt32 subValue = MatchFinder_GetSubValue(p);
MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
MatchFinder_ReduceOffsets(p, subValue);
}
static void MatchFinder_CheckLimits(CMatchFinder *p)
{
if (p->pos == kMaxValForNormalize)
MatchFinder_Normalize(p);
if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
MatchFinder_CheckAndMoveAndRead(p);
if (p->cyclicBufferPos == p->cyclicBufferSize)
p->cyclicBufferPos = 0;
MatchFinder_SetLimits(p);
}
static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
UInt32 *distances, UInt32 maxLen)
{
son[_cyclicBufferPos] = curMatch;
for (;;)
{
UInt32 delta = pos - curMatch;
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
return distances;
{
const Byte *pb = cur - delta;
curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
if (pb[maxLen] == cur[maxLen] && *pb == *cur)
{
UInt32 len = 0;
while (++len != lenLimit)
if (pb[len] != cur[len])
break;
if (maxLen < len)
{
*distances++ = maxLen = len;
*distances++ = delta - 1;
if (len == lenLimit)
return distances;
}
}
}
}
}
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
UInt32 *distances, UInt32 maxLen)
{
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
UInt32 len0 = 0, len1 = 0;
for (;;)
{
UInt32 delta = pos - curMatch;
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
{
*ptr0 = *ptr1 = kEmptyHashValue;
return distances;
}
{
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
const Byte *pb = cur - delta;
UInt32 len = (len0 < len1 ? len0 : len1);
if (pb[len] == cur[len])
{
if (++len != lenLimit && pb[len] == cur[len])
while (++len != lenLimit)
if (pb[len] != cur[len])
break;
if (maxLen < len)
{
*distances++ = maxLen = len;
*distances++ = delta - 1;
if (len == lenLimit)
{
*ptr1 = pair[0];
*ptr0 = pair[1];
return distances;
}
}
}
if (pb[len] < cur[len])
{
*ptr1 = curMatch;
ptr1 = pair + 1;
curMatch = *ptr1;
len1 = len;
}
else
{
*ptr0 = curMatch;
ptr0 = pair;
curMatch = *ptr0;
len0 = len;
}
}
}
}
static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
{
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
UInt32 len0 = 0, len1 = 0;
for (;;)
{
UInt32 delta = pos - curMatch;
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
{
*ptr0 = *ptr1 = kEmptyHashValue;
return;
}
{
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
const Byte *pb = cur - delta;
UInt32 len = (len0 < len1 ? len0 : len1);
if (pb[len] == cur[len])
{
while (++len != lenLimit)
if (pb[len] != cur[len])
break;
{
if (len == lenLimit)
{
*ptr1 = pair[0];
*ptr0 = pair[1];
return;
}
}
}
if (pb[len] < cur[len])
{
*ptr1 = curMatch;
ptr1 = pair + 1;
curMatch = *ptr1;
len1 = len;
}
else
{
*ptr0 = curMatch;
ptr0 = pair;
curMatch = *ptr0;
len0 = len;
}
}
}
}
#define MOVE_POS \
++p->cyclicBufferPos; \
p->buffer++; \
if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
#define MOVE_POS_RET MOVE_POS return offset;
static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
#define GET_MATCHES_HEADER2(minLen, ret_op) \
UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
cur = p->buffer;
#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
#define GET_MATCHES_FOOTER(offset, maxLen) \
offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
distances + offset, maxLen) - distances); MOVE_POS_RET;
#define SKIP_FOOTER \
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 offset;
GET_MATCHES_HEADER(2)
HASH2_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
offset = 0;
GET_MATCHES_FOOTER(offset, 1)
}
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 offset;
GET_MATCHES_HEADER(3)
HASH_ZIP_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
offset = 0;
GET_MATCHES_FOOTER(offset, 2)
}
static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 hash2Value, delta2, maxLen, offset;
GET_MATCHES_HEADER(3)
HASH3_CALC;
delta2 = p->pos - p->hash[hash2Value];
curMatch = p->hash[kFix3HashSize + hashValue];
p->hash[hash2Value] =
p->hash[kFix3HashSize + hashValue] = p->pos;
maxLen = 2;
offset = 0;
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
{
for (; maxLen != lenLimit; maxLen++)
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
break;
distances[0] = maxLen;
distances[1] = delta2 - 1;
offset = 2;
if (maxLen == lenLimit)
{
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
MOVE_POS_RET;
}
}
GET_MATCHES_FOOTER(offset, maxLen)
}
static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
GET_MATCHES_HEADER(4)
HASH4_CALC;
delta2 = p->pos - p->hash[ hash2Value];
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
curMatch = p->hash[kFix4HashSize + hashValue];
p->hash[ hash2Value] =
p->hash[kFix3HashSize + hash3Value] =
p->hash[kFix4HashSize + hashValue] = p->pos;
maxLen = 1;
offset = 0;
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
{
distances[0] = maxLen = 2;
distances[1] = delta2 - 1;
offset = 2;
}
if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
{
maxLen = 3;
distances[offset + 1] = delta3 - 1;
offset += 2;
delta2 = delta3;
}
if (offset != 0)
{
for (; maxLen != lenLimit; maxLen++)
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
break;
distances[offset - 2] = maxLen;
if (maxLen == lenLimit)
{
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
MOVE_POS_RET;
}
}
if (maxLen < 3)
maxLen = 3;
GET_MATCHES_FOOTER(offset, maxLen)
}
static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
GET_MATCHES_HEADER(4)
HASH4_CALC;
delta2 = p->pos - p->hash[ hash2Value];
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
curMatch = p->hash[kFix4HashSize + hashValue];
p->hash[ hash2Value] =
p->hash[kFix3HashSize + hash3Value] =
p->hash[kFix4HashSize + hashValue] = p->pos;
maxLen = 1;
offset = 0;
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
{
distances[0] = maxLen = 2;
distances[1] = delta2 - 1;
offset = 2;
}
if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
{
maxLen = 3;
distances[offset + 1] = delta3 - 1;
offset += 2;
delta2 = delta3;
}
if (offset != 0)
{
for (; maxLen != lenLimit; maxLen++)
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
break;
distances[offset - 2] = maxLen;
if (maxLen == lenLimit)
{
p->son[p->cyclicBufferPos] = curMatch;
MOVE_POS_RET;
}
}
if (maxLen < 3)
maxLen = 3;
offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
distances + offset, maxLen) - (distances));
MOVE_POS_RET
}
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
UInt32 offset;
GET_MATCHES_HEADER(3)
HASH_ZIP_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
distances, 2) - (distances));
MOVE_POS_RET
}
static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
SKIP_HEADER(2)
HASH2_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
SKIP_FOOTER
}
while (--num != 0);
}
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
SKIP_HEADER(3)
HASH_ZIP_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
SKIP_FOOTER
}
while (--num != 0);
}
static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
UInt32 hash2Value;
SKIP_HEADER(3)
HASH3_CALC;
curMatch = p->hash[kFix3HashSize + hashValue];
p->hash[hash2Value] =
p->hash[kFix3HashSize + hashValue] = p->pos;
SKIP_FOOTER
}
while (--num != 0);
}
static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
UInt32 hash2Value, hash3Value;
SKIP_HEADER(4)
HASH4_CALC;
curMatch = p->hash[kFix4HashSize + hashValue];
p->hash[ hash2Value] =
p->hash[kFix3HashSize + hash3Value] = p->pos;
p->hash[kFix4HashSize + hashValue] = p->pos;
SKIP_FOOTER
}
while (--num != 0);
}
static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
UInt32 hash2Value, hash3Value;
SKIP_HEADER(4)
HASH4_CALC;
curMatch = p->hash[kFix4HashSize + hashValue];
p->hash[ hash2Value] =
p->hash[kFix3HashSize + hash3Value] =
p->hash[kFix4HashSize + hashValue] = p->pos;
p->son[p->cyclicBufferPos] = curMatch;
MOVE_POS
}
while (--num != 0);
}
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
do
{
SKIP_HEADER(3)
HASH_ZIP_CALC;
curMatch = p->hash[hashValue];
p->hash[hashValue] = p->pos;
p->son[p->cyclicBufferPos] = curMatch;
MOVE_POS
}
while (--num != 0);
}
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
{
vTable->Init = (Mf_Init_Func)MatchFinder_Init;
vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
if (!p->btMode)
{
vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
}
else if (p->numHashBytes == 2)
{
vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
}
else if (p->numHashBytes == 3)
{
vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
}
else
{
vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
}
}

View File

@@ -1,107 +0,0 @@
/* LzFind.h -- Match finder for LZ algorithms
2008-10-04 : Igor Pavlov : Public domain */
#ifndef __LZFIND_H
#define __LZFIND_H
#include "Types.h"
typedef UInt32 CLzRef;
typedef struct _CMatchFinder
{
Byte *buffer;
UInt32 pos;
UInt32 posLimit;
UInt32 streamPos;
UInt32 lenLimit;
UInt32 cyclicBufferPos;
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
UInt32 matchMaxLen;
CLzRef *hash;
CLzRef *son;
UInt32 hashMask;
UInt32 cutValue;
Byte *bufferBase;
ISeqInStream *stream;
int streamEndWasReached;
UInt32 blockSize;
UInt32 keepSizeBefore;
UInt32 keepSizeAfter;
UInt32 numHashBytes;
int directInput;
int btMode;
/* int skipModeBits; */
int bigHash;
UInt32 historySize;
UInt32 fixedHashSize;
UInt32 hashSizeSum;
UInt32 numSons;
SRes result;
UInt32 crc[256];
} CMatchFinder;
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
int MatchFinder_NeedMove(CMatchFinder *p);
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
void MatchFinder_MoveBlock(CMatchFinder *p);
void MatchFinder_ReadIfRequired(CMatchFinder *p);
void MatchFinder_Construct(CMatchFinder *p);
/* Conditions:
historySize <= 3 GB
keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
*/
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
ISzAlloc *alloc);
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
UInt32 *distances, UInt32 maxLen);
/*
Conditions:
Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
*/
typedef void (*Mf_Init_Func)(void *object);
typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
typedef void (*Mf_Skip_Func)(void *object, UInt32);
typedef struct _IMatchFinder
{
Mf_Init_Func Init;
Mf_GetIndexByte_Func GetIndexByte;
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
Mf_GetMatches_Func GetMatches;
Mf_Skip_Func Skip;
} IMatchFinder;
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
void MatchFinder_Init(CMatchFinder *p);
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
#endif

View File

@@ -1,54 +0,0 @@
/* LzHash.h -- HASH functions for LZ algorithms
2008-10-04 : Igor Pavlov : Public domain */
#ifndef __LZHASH_H
#define __LZHASH_H
#define kHash2Size (1 << 10)
#define kHash3Size (1 << 16)
#define kHash4Size (1 << 20)
#define kFix3HashSize (kHash2Size)
#define kFix4HashSize (kHash2Size + kHash3Size)
#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
#define HASH3_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
hash2Value = temp & (kHash2Size - 1); \
hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
#define HASH4_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
hash2Value = temp & (kHash2Size - 1); \
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
#define HASH5_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
hash2Value = temp & (kHash2Size - 1); \
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
hash4Value &= (kHash4Size - 1); }
/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
#define MT_HASH2_CALC \
hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
#define MT_HASH3_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
hash2Value = temp & (kHash2Size - 1); \
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
#define MT_HASH4_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
hash2Value = temp & (kHash2Size - 1); \
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,223 +0,0 @@
/* LzmaDec.h -- LZMA Decoder
2008-10-04 : Igor Pavlov : Public domain */
#ifndef __LZMADEC_H
#define __LZMADEC_H
#include "Types.h"
/* #define _LZMA_PROB32 */
/* _LZMA_PROB32 can increase the speed on some CPUs,
but memory usage for CLzmaDec::probs will be doubled in that case */
#ifdef _LZMA_PROB32
#define CLzmaProb UInt32
#else
#define CLzmaProb UInt16
#endif
/* ---------- LZMA Properties ---------- */
#define LZMA_PROPS_SIZE 5
typedef struct _CLzmaProps
{
unsigned lc, lp, pb;
UInt32 dicSize;
} CLzmaProps;
/* LzmaProps_Decode - decodes properties
Returns:
SZ_OK
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
/* ---------- LZMA Decoder state ---------- */
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
#define LZMA_REQUIRED_INPUT_MAX 20
typedef struct
{
CLzmaProps prop;
CLzmaProb *probs;
Byte *dic;
const Byte *buf;
UInt32 range, code;
SizeT dicPos;
SizeT dicBufSize;
UInt32 processedPos;
UInt32 checkDicSize;
unsigned state;
UInt32 reps[4];
unsigned remainLen;
int needFlush;
int needInitState;
UInt32 numProbs;
unsigned tempBufSize;
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
} CLzmaDec;
#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
void LzmaDec_Init(CLzmaDec *p);
/* There are two types of LZMA streams:
0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
typedef enum
{
LZMA_FINISH_ANY, /* finish at any point */
LZMA_FINISH_END /* block must be finished at the end */
} ELzmaFinishMode;
/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
You must use LZMA_FINISH_END, when you know that current output buffer
covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
and output value of destLen will be less than output buffer size limit.
You can check status result also.
You can use multiple checks to test data integrity after full decompression:
1) Check Result and "status" variable.
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
You must use correct finish mode in that case. */
typedef enum
{
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
} ELzmaStatus;
/* ELzmaStatus is used only as output value for function call */
/* ---------- Interfaces ---------- */
/* There are 3 levels of interfaces:
1) Dictionary Interface
2) Buffer Interface
3) One Call Interface
You can select any of these interfaces, but don't mix functions from different
groups for same object. */
/* There are two variants to allocate state for Dictionary Interface:
1) LzmaDec_Allocate / LzmaDec_Free
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
You can use variant 2, if you set dictionary buffer manually.
For Buffer Interface you must always use variant 1.
LzmaDec_Allocate* can return:
SZ_OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
/* ---------- Dictionary Interface ---------- */
/* You can use it, if you want to eliminate the overhead for data copying from
dictionary to some other external buffer.
You must work with CLzmaDec variables directly in this interface.
STEPS:
LzmaDec_Constr()
LzmaDec_Allocate()
for (each new stream)
{
LzmaDec_Init()
while (it needs more decompression)
{
LzmaDec_DecodeToDic()
use data from CLzmaDec::dic and update CLzmaDec::dicPos
}
}
LzmaDec_Free()
*/
/* LzmaDec_DecodeToDic
The decoding to internal dictionary buffer (CLzmaDec::dic).
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
finishMode:
It has meaning only if the decoding reaches output limit (dicLimit).
LZMA_FINISH_ANY - Decode just dicLimit bytes.
LZMA_FINISH_END - Stream must be finished after dicLimit.
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
LZMA_STATUS_NEEDS_MORE_INPUT
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
SZ_ERROR_DATA - Data error
*/
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
/* ---------- Buffer Interface ---------- */
/* It's zlib-like interface.
See LzmaDec_DecodeToDic description for information about STEPS and return results,
but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
to work with CLzmaDec variables manually.
finishMode:
It has meaning only if the decoding reaches output limit (*destLen).
LZMA_FINISH_ANY - Decode just destLen bytes.
LZMA_FINISH_END - Stream must be finished after (*destLen).
*/
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
/* ---------- One Call Interface ---------- */
/* LzmaDecode
finishMode:
It has meaning only if the decoding reaches output limit (*destLen).
LZMA_FINISH_ANY - Decode just destLen bytes.
LZMA_FINISH_END - Stream must be finished after (*destLen).
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
*/
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
ELzmaStatus *status, ISzAlloc *alloc);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,72 +0,0 @@
/* LzmaEnc.h -- LZMA Encoder
2008-10-04 : Igor Pavlov : Public domain */
#ifndef __LZMAENC_H
#define __LZMAENC_H
#include "Types.h"
#define LZMA_PROPS_SIZE 5
typedef struct _CLzmaEncProps
{
int level; /* 0 <= level <= 9 */
UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version
default = (1 << 24) */
int lc; /* 0 <= lc <= 8, default = 3 */
int lp; /* 0 <= lp <= 4, default = 0 */
int pb; /* 0 <= pb <= 4, default = 2 */
int algo; /* 0 - fast, 1 - normal, default = 1 */
int fb; /* 5 <= fb <= 273, default = 32 */
int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
int numHashBytes; /* 2, 3 or 4, default = 4 */
UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
int numThreads; /* 1 or 2, default = 2 */
} CLzmaEncProps;
void LzmaEncProps_Init(CLzmaEncProps *p);
void LzmaEncProps_Normalize(CLzmaEncProps *p);
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
/* ---------- CLzmaEncHandle Interface ---------- */
/* LzmaEnc_* functions can return the following exit codes:
Returns:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater in props
SZ_ERROR_WRITE - Write callback error.
SZ_ERROR_PROGRESS - some break from progress callback
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
typedef void * CLzmaEncHandle;
CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
/* ---------- One Call Interface ---------- */
/* LzmaEncode
Return code:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater
SZ_ERROR_OUTPUT_EOF - output buffer overflow
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
#endif

View File

@@ -1,48 +0,0 @@
/* LzmaLib.c -- LZMA library wrapper
2008-08-05
Igor Pavlov
Public domain */
#include "LzmaEnc.h"
#include "LzmaDec.h"
#include "Alloc.h"
#include "LzmaLib.h"
static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
static void SzFree(void *p, void *address) { p = p; MyFree(address); }
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize,
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
int lc, /* 0 <= lc <= 8, default = 3 */
int lp, /* 0 <= lp <= 4, default = 0 */
int pb, /* 0 <= pb <= 4, default = 2 */
int fb, /* 5 <= fb <= 273, default = 32 */
int numThreads, /* 1 or 2, default = 2 */
int algo /* 0 = fast, 1 = normal */
)
{
CLzmaEncProps props;
LzmaEncProps_Init(&props);
props.level = level;
props.dictSize = dictSize;
props.lc = lc;
props.lp = lp;
props.pb = pb;
props.fb = fb;
props.numThreads = numThreads;
props.algo = algo;
return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0,
NULL, &g_Alloc, &g_Alloc);
}
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
const unsigned char *props, size_t propsSize)
{
ELzmaStatus status;
return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc);
}

View File

@@ -1,136 +0,0 @@
/* LzmaLib.h -- LZMA library interface
2008-08-05
Igor Pavlov
Public domain */
#ifndef __LZMALIB_H
#define __LZMALIB_H
#include "Types.h"
#ifdef __cplusplus
#define MY_EXTERN_C extern "C"
#else
#define MY_EXTERN_C extern
#endif
#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
#define LZMA_PROPS_SIZE 5
/*
RAM requirements for LZMA:
for compression: (dictSize * 11.5 + 6 MB) + state_size
for decompression: dictSize + state_size
state_size = (4 + (1.5 << (lc + lp))) KB
by default (lc=3, lp=0), state_size = 16 KB.
LZMA properties (5 bytes) format
Offset Size Description
0 1 lc, lp and pb in encoded form.
1 4 dictSize (little endian).
*/
/*
LzmaCompress
------------
outPropsSize -
In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
LZMA Encoder will use defult values for any parameter, if it is
-1 for any from: level, loc, lp, pb, fb, numThreads
0 for dictSize
level - compression level: 0 <= level <= 9;
level dictSize algo fb
0: 16 KB 0 32
1: 64 KB 0 32
2: 256 KB 0 32
3: 1 MB 0 32
4: 4 MB 0 32
5: 16 MB 1 32
6: 32 MB 1 32
7+: 64 MB 1 64
The default value for "level" is 5.
algo = 0 means fast method
algo = 1 means normal method
dictSize - The dictionary size in bytes. The maximum value is
128 MB = (1 << 27) bytes for 32-bit version
1 GB = (1 << 30) bytes for 64-bit version
The default value is 16 MB = (1 << 24) bytes.
It's recommended to use the dictionary that is larger than 4 KB and
that can be calculated as (1 << N) or (3 << N) sizes.
lc - The number of literal context bits (high bits of previous literal).
It can be in the range from 0 to 8. The default value is 3.
Sometimes lc=4 gives the gain for big files.
lp - The number of literal pos bits (low bits of current position for literals).
It can be in the range from 0 to 4. The default value is 0.
The lp switch is intended for periodical data when the period is equal to 2^lp.
For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
better to set lc=0, if you change lp switch.
pb - The number of pos bits (low bits of current position).
It can be in the range from 0 to 4. The default value is 2.
The pb switch is intended for periodical data when the period is equal 2^pb.
fb - Word size (the number of fast bytes).
It can be in the range from 5 to 273. The default value is 32.
Usually, a big number gives a little bit better compression ratio and
slower compression process.
numThreads - The number of thereads. 1 or 2. The default value is 2.
Fast mode (algo = 0) can use only 1 thread.
Out:
destLen - processed output size
Returns:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater
SZ_ERROR_OUTPUT_EOF - output buffer overflow
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* default = (1 << 24) */
int lc, /* 0 <= lc <= 8, default = 3 */
int lp, /* 0 <= lp <= 4, default = 0 */
int pb, /* 0 <= pb <= 4, default = 2 */
int fb, /* 5 <= fb <= 273, default = 32 */
int numThreads, /* 1 or 2, default = 2 */
int algo /* 0 = fast, 1 = normal, default = 0 for level < 5, 1 for level >= 5 */
);
/*
LzmaUncompress
--------------
In:
dest - output data
destLen - output data size
src - input data
srcLen - input data size
Out:
destLen - processed output size
srcLen - processed input size
Returns:
SZ_OK - OK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation arror
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
*/
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
const unsigned char *props, size_t propsSize);
#endif

View File

@@ -1,84 +0,0 @@
/* NameMangle.h -- Name mangling to avoid linking conflicts
2009-04-15 : Marcus Geelnard : Public domain */
#ifndef __7Z_NAMEMANGLE_H
#define __7Z_NAMEMANGLE_H
#ifdef LZMA_PREFIX_CTM
/* Alloc.c */
#define MyAlloc _ctm_MyAlloc
#define MyFree _ctm_MyFree
#ifdef _WIN32
#define MidAlloc _ctm_MidAlloc
#define MidFree _ctm_MidFree
#define SetLargePageSize _ctm_SetLargePageSize
#define BigAlloc _ctm_BigAlloc
#define BigFree _ctm_BigFree
#endif /* _WIN32 */
/* LzFind.c */
#define MatchFinder_GetPointerToCurrentPos _ctm_MatchFinder_GetPointerToCurrentPos
#define MatchFinder_GetIndexByte _ctm_MatchFinder_GetIndexByte
#define MatchFinder_GetNumAvailableBytes _ctm_MatchFinder_GetNumAvailableBytes
#define MatchFinder_ReduceOffsets _ctm_MatchFinder_ReduceOffsets
#define MatchFinder_MoveBlock _ctm_MatchFinder_MoveBlock
#define MatchFinder_NeedMove _ctm_MatchFinder_NeedMove
#define MatchFinder_ReadIfRequired _ctm_MatchFinder_ReadIfRequired
#define MatchFinder_Construct _ctm_MatchFinder_Construct
#define MatchFinder_Free _ctm_MatchFinder_Free
#define MatchFinder_Create _ctm_MatchFinder_Create
#define MatchFinder_Init _ctm_MatchFinder_Init
#define MatchFinder_Normalize3 _ctm_MatchFinder_Normalize3
#define GetMatchesSpec1 _ctm_GetMatchesSpec1
#define Bt3Zip_MatchFinder_GetMatches _ctm_Bt3Zip_MatchFinder_GetMatches
#define Hc3Zip_MatchFinder_GetMatches _ctm_Hc3Zip_MatchFinder_GetMatches
#define Bt3Zip_MatchFinder_Skip _ctm_Bt3Zip_MatchFinder_Skip
#define Hc3Zip_MatchFinder_Skip _ctm_Hc3Zip_MatchFinder_Skip
#define MatchFinder_CreateVTable _ctm_MatchFinder_CreateVTable
/* LzmaDec.c */
#define LzmaDec_InitDicAndState _ctm_LzmaDec_InitDicAndState
#define LzmaDec_Init _ctm_LzmaDec_Init
#define LzmaDec_DecodeToDic _ctm_LzmaDec_DecodeToDic
#define LzmaDec_DecodeToBuf _ctm_LzmaDec_DecodeToBuf
#define LzmaDec_FreeProbs _ctm_LzmaDec_FreeProbs
#define LzmaDec_Free _ctm_LzmaDec_Free
#define LzmaProps_Decode _ctm_LzmaProps_Decode
#define LzmaDec_AllocateProbs _ctm_LzmaDec_AllocateProbs
#define LzmaDec_Allocate _ctm_LzmaDec_Allocate
#define LzmaDecode _ctm_LzmaDecode
/* LzmaEnc.c */
#define LzmaEncProps_Init _ctm_LzmaEncProps_Init
#define LzmaEncProps_Normalize _ctm_LzmaEncProps_Normalize
#define LzmaEncProps_GetDictSize _ctm_LzmaEncProps_GetDictSize
#define LzmaEnc_FastPosInit _ctm_LzmaEnc_FastPosInit
#define LzmaEnc_SaveState _ctm_LzmaEnc_SaveState
#define LzmaEnc_RestoreState _ctm_LzmaEnc_RestoreState
#define LzmaEnc_SetProps _ctm_LzmaEnc_SetProps
#define LzmaEnc_InitPriceTables _ctm_LzmaEnc_InitPriceTables
#define LzmaEnc_Construct _ctm_LzmaEnc_Construct
#define LzmaEnc_Create _ctm_LzmaEnc_Create
#define LzmaEnc_FreeLits _ctm_LzmaEnc_FreeLits
#define LzmaEnc_Destruct _ctm_LzmaEnc_Destruct
#define LzmaEnc_Destroy _ctm_LzmaEnc_Destroy
#define LzmaEnc_Init _ctm_LzmaEnc_Init
#define LzmaEnc_InitPrices _ctm_LzmaEnc_InitPrices
#define LzmaEnc_PrepareForLzma2 _ctm_LzmaEnc_PrepareForLzma2
#define LzmaEnc_MemPrepare _ctm_LzmaEnc_MemPrepare
#define LzmaEnc_Finish _ctm_LzmaEnc_Finish
#define LzmaEnc_GetNumAvailableBytes _ctm_LzmaEnc_GetNumAvailableBytes
#define LzmaEnc_GetCurBuf _ctm_LzmaEnc_GetCurBuf
#define LzmaEnc_CodeOneMemBlock _ctm_LzmaEnc_CodeOneMemBlock
#define LzmaEnc_Encode _ctm_LzmaEnc_Encode
#define LzmaEnc_WriteProperties _ctm_LzmaEnc_WriteProperties
#define LzmaEnc_MemEncode _ctm_LzmaEnc_MemEncode
/* LzmaLib.c */
#define LzmaCompress _ctm_LzmaCompress
#define LzmaUncompress _ctm_LzmaUncompress
#endif /* LZMA_PREFIX_CTM */
#endif /* __7Z_NAMEMANGLE_H */

View File

@@ -1,210 +0,0 @@
/* Types.h -- Basic types
2008-11-23 : Igor Pavlov : Public domain */
#ifndef __7Z_TYPES_H
#define __7Z_TYPES_H
#include <stddef.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include "NameMangle.h"
#define SZ_OK 0
#define SZ_ERROR_DATA 1
#define SZ_ERROR_MEM 2
#define SZ_ERROR_CRC 3
#define SZ_ERROR_UNSUPPORTED 4
#define SZ_ERROR_PARAM 5
#define SZ_ERROR_INPUT_EOF 6
#define SZ_ERROR_OUTPUT_EOF 7
#define SZ_ERROR_READ 8
#define SZ_ERROR_WRITE 9
#define SZ_ERROR_PROGRESS 10
#define SZ_ERROR_FAIL 11
#define SZ_ERROR_THREAD 12
#define SZ_ERROR_ARCHIVE 16
#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes;
#ifdef _WIN32
typedef DWORD WRes;
#else
typedef int WRes;
#endif
#ifndef RINOK
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
#endif
typedef unsigned char Byte;
typedef short Int16;
typedef unsigned short UInt16;
#ifdef _LZMA_UINT32_IS_ULONG
typedef long Int32;
typedef unsigned long UInt32;
#else
typedef int Int32;
typedef unsigned int UInt32;
#endif
#ifdef _SZ_NO_INT_64
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
NOTES: Some code will work incorrectly in that case! */
typedef long Int64;
typedef unsigned long UInt64;
#else
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
#endif
#endif
#ifdef _LZMA_NO_SYSTEM_SIZE_T
typedef UInt32 SizeT;
#else
typedef size_t SizeT;
#endif
typedef int Bool;
#define True 1
#define False 0
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#define MY_NO_INLINE __declspec(noinline)
#else
#define MY_NO_INLINE
#endif
#define MY_CDECL __cdecl
#define MY_STD_CALL __stdcall
#define MY_FAST_CALL MY_NO_INLINE __fastcall
#else
#define MY_CDECL
#define MY_STD_CALL
#define MY_FAST_CALL
#endif
/* The following interfaces use first parameter as pointer to structure */
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
} ISeqInStream;
/* it can return SZ_ERROR_INPUT_EOF */
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
typedef struct
{
size_t (*Write)(void *p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
} ISeqOutStream;
typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
SZ_SEEK_END = 2
} ESzSeek;
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
} ISeekInStream;
typedef struct
{
SRes (*Look)(void *p, void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
SRes (*Skip)(void *p, size_t offset);
/* offset must be <= output(*size) of Look */
SRes (*Read)(void *p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
} ILookInStream;
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
/* reads via ILookInStream::Read */
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
#define LookToRead_BUF_SIZE (1 << 14)
typedef struct
{
ILookInStream s;
ISeekInStream *realStream;
size_t pos;
size_t size;
Byte buf[LookToRead_BUF_SIZE];
} CLookToRead;
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
void LookToRead_Init(CLookToRead *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
typedef struct
{
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
/* Returns: result. (result != SZ_OK) means break.
Value (UInt64)(Int64)-1 for size means unknown value. */
} ICompressProgress;
typedef struct
{
void *(*Alloc)(void *p, size_t size);
void (*Free)(void *p, void *address); /* address can be 0 */
} ISzAlloc;
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
#define IAlloc_Free(p, a) (p)->Free((p), a)
#endif

View File

@@ -1,7 +0,0 @@
This is the C library implementation of LZMA compression/decompression by Igor Pavlov.
Author: Igor Pavlov
License: Public domain
Version: 4.65 (2009-02-03)
Some administrative adaptations for integration in OpenCTM were made by Marcus Geelnard.

View File

@@ -1,15 +0,0 @@
openctm.o: openctm.c openctm.h internal.h
stream.o: stream.c openctm.h internal.h
compressRAW.o: compressRAW.c openctm.h internal.h
compressMG1.o: compressMG1.c openctm.h internal.h
compressMG2.o: compressMG2.c openctm.h internal.h
Alloc.o: liblzma/Alloc.c liblzma/Alloc.h liblzma/NameMangle.h
LzFind.o: liblzma/LzFind.c liblzma/LzFind.h liblzma/Types.h \
liblzma/NameMangle.h liblzma/LzHash.h
LzmaDec.o: liblzma/LzmaDec.c liblzma/LzmaDec.h liblzma/Types.h \
liblzma/NameMangle.h
LzmaEnc.o: liblzma/LzmaEnc.c liblzma/LzmaEnc.h liblzma/Types.h \
liblzma/NameMangle.h liblzma/LzFind.h
LzmaLib.o: liblzma/LzmaLib.c liblzma/LzmaEnc.h liblzma/Types.h \
liblzma/NameMangle.h liblzma/LzmaDec.h liblzma/Alloc.h \
liblzma/LzmaLib.h

View File

@@ -1,32 +0,0 @@
LIBRARY openctm.dll
EXPORTS
ctmAddAttribMap = ctmAddAttribMap@12 @1
ctmAddUVMap = ctmAddUVMap@16 @2
ctmAttribPrecision = ctmAttribPrecision@12 @3
ctmCompressionLevel = ctmCompressionLevel@8 @4
ctmCompressionMethod = ctmCompressionMethod@8 @5
ctmDefineMesh = ctmDefineMesh@24 @6
ctmFileComment = ctmFileComment@8 @7
ctmFreeContext = ctmFreeContext@4 @8
ctmGetAttribMapFloat = ctmGetAttribMapFloat@12 @9
ctmGetAttribMapString = ctmGetAttribMapString@12 @10
ctmGetError = ctmGetError@4 @11
ctmGetFloat = ctmGetFloat@8 @12
ctmGetFloatArray = ctmGetFloatArray@8 @13
ctmGetInteger = ctmGetInteger@8 @14
ctmGetIntegerArray = ctmGetIntegerArray@8 @15
ctmGetNamedAttribMap = ctmGetNamedAttribMap@8 @16
ctmGetNamedUVMap = ctmGetNamedUVMap@8 @17
ctmGetString = ctmGetString@8 @18
ctmGetUVMapFloat = ctmGetUVMapFloat@12 @19
ctmGetUVMapString = ctmGetUVMapString@12 @20
ctmErrorString = ctmErrorString@4 @21
ctmLoad = ctmLoad@8 @22
ctmLoadCustom = ctmLoadCustom@12 @23
ctmNewContext = ctmNewContext@4 @24
ctmNormalPrecision = ctmNormalPrecision@8 @25
ctmSave = ctmSave@8 @26
ctmSaveCustom = ctmSaveCustom@12 @27
ctmUVCoordPrecision = ctmUVCoordPrecision@12 @28
ctmVertexPrecision = ctmVertexPrecision@8 @29
ctmVertexPrecisionRel = ctmVertexPrecisionRel@8 @30

View File

@@ -1,32 +0,0 @@
LIBRARY openctm.dll
EXPORTS
ctmAddAttribMap@12 @1
ctmAddUVMap@16 @2
ctmAttribPrecision@12 @3
ctmCompressionLevel@8 @4
ctmCompressionMethod@8 @5
ctmDefineMesh@24 @6
ctmFileComment@8 @7
ctmFreeContext@4 @8
ctmGetAttribMapFloat@12 @9
ctmGetAttribMapString@12 @10
ctmGetError@4 @11
ctmGetFloat@8 @12
ctmGetFloatArray@8 @13
ctmGetInteger@8 @14
ctmGetIntegerArray@8 @15
ctmGetNamedAttribMap@8 @16
ctmGetNamedUVMap@8 @17
ctmGetString@8 @18
ctmGetUVMapFloat@12 @19
ctmGetUVMapString@12 @20
ctmErrorString@4 @21
ctmLoad@8 @22
ctmLoadCustom@12 @23
ctmNewContext@4 @24
ctmNormalPrecision@8 @25
ctmSave@8 @26
ctmSaveCustom@12 @27
ctmUVCoordPrecision@12 @28
ctmVertexPrecision@8 @29
ctmVertexPrecisionRel@8 @30

View File

@@ -1,32 +0,0 @@
LIBRARY openctm.dll
EXPORTS
ctmAddAttribMap
ctmAddUVMap
ctmAttribPrecision
ctmCompressionLevel
ctmCompressionMethod
ctmDefineMesh
ctmFileComment
ctmFreeContext
ctmGetAttribMapFloat
ctmGetAttribMapString
ctmGetError
ctmGetFloat
ctmGetFloatArray
ctmGetInteger
ctmGetIntegerArray
ctmGetNamedAttribMap
ctmGetNamedUVMap
ctmGetString
ctmGetUVMapFloat
ctmGetUVMapString
ctmErrorString
ctmLoad
ctmLoadCustom
ctmNewContext
ctmNormalPrecision
ctmSave
ctmSaveCustom
ctmUVCoordPrecision
ctmVertexPrecision
ctmVertexPrecisionRel

File diff suppressed because it is too large Load Diff

View File

@@ -1,655 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: openctm.h
// Description: OpenCTM API definition.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __OPENCTM_H_
#define __OPENCTM_H_
/*! @mainpage OpenCTM API Reference
*
* @section intro_sec Introduction
*
* OpenCTM is an open file format for storing compressed triangle meshes.
* In order to easily read and write OpenCTM files (usually suffixed .ctm) an
* API (Application Program Interface) is provided that can easily be used from
* most modern programming languages.
*
* The OpenCTM functionality itself is written in highly portable standard C
* (C99).
*
* @section usage_sec Usage
*
* For information about how to use the OpenCTM API, see openctm.h.
*
* For information about the C++ wrapper classes, see CTMimporter and
* CTMexporter.
*
* @section example_sec Example usage
*
* @subsection example_load_sec Loading a CTM file
*
* Here is a simple example of loading a CTM file:
*
* @code
* CTMcontext context;
* CTMuint vertCount, triCount, * indices;
* CTMfloat * vertices;
*
* // Create a new context
* context = ctmNewContext(CTM_IMPORT);
*
* // Load the OpenCTM file
* ctmLoad(context, "mymesh.ctm");
* if(ctmGetError(context) == CTM_NONE)
* {
* // Access the mesh data
* vertCount = ctmGetInteger(context, CTM_VERTEX_COUNT);
* vertices = ctmGetFloatArray(context, CTM_VERTICES);
* triCount = ctmGetInteger(context, CTM_TRIANGLE_COUNT);
* indices = ctmGetIntegerArray(context, CTM_INDICES);
*
* // Deal with the mesh (e.g. transcode it to our internal representation)
* // ...
* }
*
* // Free the context
* ctmFreeContext(context);
* @endcode
*
* @subsection example_create_sec Creating a CTM file
*
* Here is a simple example of creating a CTM file:
*
* @code
* CTMcontext context;
* CTMuint vertCount, triCount, * indices;
* CTMfloat * vertices;
*
* // Create our mesh in memory
* vertCount = 100;
* triCount = 120;
* vertices = (CTMfloat *) malloc(3 * sizeof(CTMfloat) * vertCount);
* indices = (CTMuint *) malloc(3 * sizeof(CTMuint) * triCount);
* // ...
*
* // Create a new context
* context = ctmNewContext(CTM_EXPORT);
*
* // Define our mesh representation to OpenCTM (store references to it in
* // the context)
* ctmDefineMesh(context, vertices, vertCount, indices, triCount, NULL);
*
* // Save the OpenCTM file
* ctmSave(context, "mymesh.ctm");
*
* // Free the context
* ctmFreeContext(context);
*
* // Free our mesh
* free(indices);
* free(vertices);
* @endcode
*/
#ifdef __cplusplus
extern "C" {
#endif
// Declare calling conventions etc.
#if defined(WIN32) || defined(_WIN32)
// Windows
#if defined(OPENCTM_STATIC)
#define CTMEXPORT
#else
#if defined(OPENCTM_BUILD)
#define CTMEXPORT __declspec(dllexport)
#else
#define CTMEXPORT __declspec(dllimport)
#endif
#endif
#if defined(__MINGW32__)
#define CTMCALL __attribute__ ((__stdcall__))
#elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
#define CTMCALL __stdcall
#else
#define CTMCALL
#endif
#else
// Unix
#if !defined(OPENCTM_STATIC) && !defined(OPENCTM_BUILD)
#define CTMEXPORT extern
#else
#if defined(OPENCTM_BUILD) && defined(__GNUC__) && (__GNUC__ >= 4)
#define CTMEXPORT __attribute__ ((visibility("default")))
#else
#define CTMEXPORT
#endif
#endif
#define CTMCALL
#endif
// Get system specific type definitions for sized integers. We use the C99
// standard stdint.h for this.
#ifdef _MSC_VER
// MS Visual Studio does not support C99
typedef int int32_t;
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
/// OpenCTM API version (1.0).
#define CTM_API_VERSION 0x00000100
/// Boolean TRUE.
#define CTM_TRUE 1
/// Boolean FALSE.
#define CTM_FALSE 0
/// Single precision floating point type (IEEE 754 32 bits wide).
typedef float CTMfloat;
/// Signed integer (32 bits wide).
typedef int32_t CTMint;
/// Unsigned integer (32 bits wide).
typedef uint32_t CTMuint;
/// OpenCTM context handle.
typedef void * CTMcontext;
/// OpenCTM specific enumerators.
/// @note For the information query functions, it is an error to query a value
/// of the wrong type (e.g. to query a string value with the
/// ctmGetInteger() function).
typedef enum {
// Error codes (see ctmGetError())
CTM_NONE = 0x0000, ///< No error has occured (everything is OK).
/// Also used as an error return value for
/// functions that should return a CTMenum
/// value.
CTM_INVALID_CONTEXT = 0x0001, ///< The OpenCTM context was invalid (e.g. NULL).
CTM_INVALID_ARGUMENT = 0x0002, ///< A function argument was invalid.
CTM_INVALID_OPERATION = 0x0003, ///< The operation is not allowed.
CTM_INVALID_MESH = 0x0004, ///< The mesh was invalid (e.g. no vertices).
CTM_OUT_OF_MEMORY = 0x0005, ///< Not enough memory to proceed.
CTM_FILE_ERROR = 0x0006, ///< File I/O error.
CTM_BAD_FORMAT = 0x0007, ///< File format error (e.g. unrecognized format or corrupted file).
CTM_LZMA_ERROR = 0x0008, ///< An error occured within the LZMA library.
CTM_INTERNAL_ERROR = 0x0009, ///< An internal error occured (indicates a bug).
CTM_UNSUPPORTED_FORMAT_VERSION = 0x000A, ///< Unsupported file format version.
// OpenCTM context modes
CTM_IMPORT = 0x0101, ///< The OpenCTM context will be used for importing data.
CTM_EXPORT = 0x0102, ///< The OpenCTM context will be used for exporting data.
// Compression methods
CTM_METHOD_RAW = 0x0201, ///< Just store the raw data.
CTM_METHOD_MG1 = 0x0202, ///< Lossless compression (floating point).
CTM_METHOD_MG2 = 0x0203, ///< Lossless compression (fixed point).
// Context queries
CTM_VERTEX_COUNT = 0x0301, ///< Number of vertices in the mesh (integer).
CTM_TRIANGLE_COUNT = 0x0302, ///< Number of triangles in the mesh (integer).
CTM_HAS_NORMALS = 0x0303, ///< CTM_TRUE if the mesh has normals (integer).
CTM_UV_MAP_COUNT = 0x0304, ///< Number of UV coordinate sets (integer).
CTM_ATTRIB_MAP_COUNT = 0x0305, ///< Number of custom attribute sets (integer).
CTM_VERTEX_PRECISION = 0x0306, ///< Vertex precision - for MG2 (float).
CTM_NORMAL_PRECISION = 0x0307, ///< Normal precision - for MG2 (float).
CTM_COMPRESSION_METHOD = 0x0308, ///< Compression method (integer).
CTM_FILE_COMMENT = 0x0309, ///< File comment (string).
// UV/attribute map queries
CTM_NAME = 0x0501, ///< Unique name (UV/attrib map string).
CTM_FILE_NAME = 0x0502, ///< File name reference (UV map string).
CTM_PRECISION = 0x0503, ///< Value precision (UV/attrib map float).
// Array queries
CTM_INDICES = 0x0601, ///< Triangle indices (integer array).
CTM_VERTICES = 0x0602, ///< Vertex point coordinates (float array).
CTM_NORMALS = 0x0603, ///< Per vertex normals (float array).
CTM_UV_MAP_1 = 0x0700, ///< Per vertex UV map 1 (float array).
CTM_UV_MAP_2 = 0x0701, ///< Per vertex UV map 2 (float array).
CTM_UV_MAP_3 = 0x0702, ///< Per vertex UV map 3 (float array).
CTM_UV_MAP_4 = 0x0703, ///< Per vertex UV map 4 (float array).
CTM_UV_MAP_5 = 0x0704, ///< Per vertex UV map 5 (float array).
CTM_UV_MAP_6 = 0x0705, ///< Per vertex UV map 6 (float array).
CTM_UV_MAP_7 = 0x0706, ///< Per vertex UV map 7 (float array).
CTM_UV_MAP_8 = 0x0707, ///< Per vertex UV map 8 (float array).
CTM_ATTRIB_MAP_1 = 0x0800, ///< Per vertex attribute map 1 (float array).
CTM_ATTRIB_MAP_2 = 0x0801, ///< Per vertex attribute map 2 (float array).
CTM_ATTRIB_MAP_3 = 0x0802, ///< Per vertex attribute map 3 (float array).
CTM_ATTRIB_MAP_4 = 0x0803, ///< Per vertex attribute map 4 (float array).
CTM_ATTRIB_MAP_5 = 0x0804, ///< Per vertex attribute map 5 (float array).
CTM_ATTRIB_MAP_6 = 0x0805, ///< Per vertex attribute map 6 (float array).
CTM_ATTRIB_MAP_7 = 0x0806, ///< Per vertex attribute map 7 (float array).
CTM_ATTRIB_MAP_8 = 0x0807 ///< Per vertex attribute map 8 (float array).
} CTMenum;
/// Stream read() function pointer.
/// @param[in] aBuf Pointer to the memory buffer to which data should be read.
/// @param[in] aCount The number of bytes to read.
/// @param[in] aUserData The custom user data that was passed to the
/// ctmLoadCustom() function.
/// @return The number of bytes actually read (if this is less than aCount, it
/// indicates that an error occured or the end of file was reached
/// before all bytes were read).
typedef CTMuint (CTMCALL * CTMreadfn)(void * aBuf, CTMuint aCount, void * aUserData);
/// Stream write() function pointer.
/// @param[in] aBuf Pointer to the memory buffer from which data should be written.
/// @param[in] aCount The number of bytes to write.
/// @param[in] aUserData The custom user data that was passed to the
/// ctmSaveCustom() function.
/// @return The number of bytes actually written (if this is less than aCount, it
/// indicates that an error occured).
typedef CTMuint (CTMCALL * CTMwritefn)(const void * aBuf, CTMuint aCount, void * aUserData);
/// Create a new OpenCTM context. The context is used for all subsequent
/// OpenCTM function calls. Several contexts can coexist at the same time.
/// @param[in] aMode An OpenCTM context mode. Set this to CTM_IMPORT if the
/// context will be used for importing data, or set it to CTM_EXPORT
/// if it will be used for exporting data.
/// @return An OpenCTM context handle (or NULL if no context could be created).
CTMEXPORT CTMcontext CTMCALL ctmNewContext(CTMenum aMode);
/// Free an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @see ctmNewContext()
CTMEXPORT void CTMCALL ctmFreeContext(CTMcontext aContext);
/// Returns the latest error. Calling this function will return the last
/// produced error code, or CTM_NO_ERROR (zero) if no error has occured since
/// the last call to ctmGetError(). When this function is called, the internal
/// error varibale will be reset to CTM_NONE.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @return An OpenCTM error code.
/// @see CTMenum
CTMEXPORT CTMenum CTMCALL ctmGetError(CTMcontext aContext);
/// Converts an OpenCTM error code to a zero-terminated string.
/// @param[in] aError An OpenCTM error code, as returned by ctmGetError().
/// @return A zero terminated string that describes the error. For instance,
/// if \c aError is CTM_INVALID_OPERATION, then the return value will
/// be "CTM_INVALID_OPERATION".
/// @see CTMenum
CTMEXPORT const char * CTMCALL ctmErrorString(CTMenum aError);
/// Get information about an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aProperty Which property to return.
/// @return An integer value, representing the OpenCTM context property given
/// by \c aProperty.
/// @see CTMenum
CTMEXPORT CTMuint CTMCALL ctmGetInteger(CTMcontext aContext, CTMenum aProperty);
/// Get information about an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aProperty Which property to return.
/// @return A floating point value, representing the OpenCTM context property
/// given by \c aProperty.
/// @see CTMenum
CTMEXPORT CTMfloat CTMCALL ctmGetFloat(CTMcontext aContext, CTMenum aProperty);
/// Get an integer array from an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aProperty Which array to return.
/// @return An integer array. If the requested array does not exist, or
/// if \c aProperty does not indicate an integer array, the function
/// returns NULL.
/// @note The array is only valid as long as the OpenCTM context is valid, or
/// until the corresponding array changes within the OpenCTM context.
/// Trying to access an invalid array will result in undefined
/// behaviour. Therefor it is recommended that the array is copied to
/// a new variable if it is to be used other than directly after the call
/// to ctmGetIntegerArray().
/// @see CTMenum
CTMEXPORT const CTMuint * CTMCALL ctmGetIntegerArray(CTMcontext aContext,
CTMenum aProperty);
/// Get a floating point array from an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aProperty Which array to return.
/// @return A floating point array. If the requested array does not exist, or
/// if \c aProperty does not indicate a float array, the function
/// returns NULL.
/// @note The array is only valid as long as the OpenCTM context is valid, or
/// until the corresponding array changes within the OpenCTM context.
/// Trying to access an invalid array will result in undefined
/// behaviour. Therefor it is recommended that the array is copied to
/// a new variable if it is to be used other than directly after the call
/// to ctmGetFloatArray().
/// @see CTMenum
CTMEXPORT const CTMfloat * CTMCALL ctmGetFloatArray(CTMcontext aContext,
CTMenum aProperty);
/// Get a reference to the named UV map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aName The name of the UV map that should be returned.
/// @return A reference to a UV map. If the UV map was found, a value of
/// CTM_UV_MAP_1 or higher is returned, otherwise CTM_NONE is
/// returned.
CTMEXPORT CTMenum CTMCALL ctmGetNamedUVMap(CTMcontext aContext,
const char * aName);
/// Get information about a UV map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aUVMap Which UV map to query (CTM_UV_MAP_1 or higher).
/// @param[in] aProperty Which UV map property to return.
/// @return A string value, representing the UV map property given
/// by \c aProperty.
/// @note The string is only valid as long as the UV map within the OpenCTM
/// context is valid. Trying to access an invalid string will result in
/// undefined behaviour. Therefor it is recommended that the string is
/// copied to a new variable if it is to be used other than directly after
/// the call to ctmGetUVMapString().
/// @see CTMenum
CTMEXPORT const char * CTMCALL ctmGetUVMapString(CTMcontext aContext,
CTMenum aUVMap, CTMenum aProperty);
/// Get information about a UV map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aUVMap Which UV map to query (CTM_UV_MAP_1 or higher).
/// @param[in] aProperty Which UV map property to return.
/// @return A floating point value, representing the UV map property given
/// by \c aProperty.
/// @see CTMenum
CTMEXPORT CTMfloat CTMCALL ctmGetUVMapFloat(CTMcontext aContext,
CTMenum aUVMap, CTMenum aProperty);
/// Get a reference to the named vertex attribute map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aName The name of the attribute map that should be returned.
/// @return A reference to an attribute map. If the attribute map was found,
/// a value of CTM_ATTRIB_MAP_1 or higher is returned, otherwise
/// CTM_NONE is returned.
CTMEXPORT CTMenum CTMCALL ctmGetNamedAttribMap(CTMcontext aContext,
const char * aName);
/// Get information about a vertex attribute map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aAttribMap Which vertex attribute map to query (CTM_ATTRIB_MAP_1
/// or higher).
/// @param[in] aProperty Which vertex attribute map property to return.
/// @return A string value, representing the vertex attribute map property given
/// by \c aProperty.
/// @note The string is only valid as long as the vertex attribute map within
/// the OpenCTM context is valid. Trying to access an invalid string will
/// result in undefined behaviour. Therefor it is recommended that the
/// string is copied to a new variable if it is to be used other than
/// directly after the call to ctmGetAttribMapString().
/// @see CTMenum
CTMEXPORT const char * CTMCALL ctmGetAttribMapString(CTMcontext aContext,
CTMenum aAttribMap, CTMenum aProperty);
/// Get information about a vertex attribute map.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aAttribMap Which vertex attribute map to query (CTM_ATTRIB_MAP_1
/// or higher).
/// @param[in] aProperty Which vertex attribute map property to return.
/// @return A floating point value, representing the vertex attribute map
/// property given by \c aProperty.
/// @see CTMenum
CTMEXPORT CTMfloat CTMCALL ctmGetAttribMapFloat(CTMcontext aContext,
CTMenum aAttribMap, CTMenum aProperty);
/// Get information about an OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aProperty Which property to return.
/// @return A string value, representing the OpenCTM context property given
/// by \c aProperty.
/// @note The string is only valid as long as the OpenCTM context is valid, or
/// until the corresponding string changes within the OpenCTM context
/// (e.g. calling ctmFileComment() invalidates the CTM_FILE_COMMENT
/// string). Trying to access an invalid string will result in undefined
/// behaviour. Therefor it is recommended that the string is copied to
/// a new variable if it is to be used other than directly after the call
/// to ctmGetString().
/// @see CTMenum
CTMEXPORT const char * CTMCALL ctmGetString(CTMcontext aContext,
CTMenum aProperty);
/// Set which compression method to use for the given OpenCTM context.
/// The selected compression method will be used when calling the ctmSave()
/// function.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aMethod Which compression method to use: CTM_METHOD_RAW,
/// CTM_METHOD_MG1 or CTM_METHOD_MG2 (the default method is
/// CTM_METHOD_MG1).
/// @see CTM_METHOD_RAW, CTM_METHOD_MG1, CTM_METHOD_MG2
CTMEXPORT void CTMCALL ctmCompressionMethod(CTMcontext aContext,
CTMenum aMethod);
/// Set which LZMA compression level to use for the given OpenCTM context.
/// The compression level can be between 0 (fastest) and 9 (best). The higher
/// the compression level, the more memory is required for compression and
/// decompression. The default compression level is 1.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aLevel Which compression level to use (0 to 9).
CTMEXPORT void CTMCALL ctmCompressionLevel(CTMcontext aContext,
CTMuint aLevel);
/// Set the vertex coordinate precision (only used by the MG2 compression
/// method).
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aPrecision Fixed point precision. For instance, if this value is
/// 0.001, all vertex coordinates will be rounded to three decimals.
/// The default vertex coordinate precision is 2^-10 ~= 0.00098.
CTMEXPORT void CTMCALL ctmVertexPrecision(CTMcontext aContext,
CTMfloat aPrecision);
/// Set the vertex coordinate precision, relative to the mesh dimensions (only
/// used by the MG2 compression method).
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aRelPrecision Relative precision. This factor is multiplied by the
/// average triangle edge length in the mesh in order to obtain the
/// final, fixed point precision. For instance, if aRelPrecision is
/// 0.01, and the average edge length is 3.7, then the fixed point
/// precision is set to 0.037.
/// @note The mesh must have been defined using the ctmDefineMesh() function
/// before calling this function.
/// @see ctmVertexPrecision().
CTMEXPORT void CTMCALL ctmVertexPrecisionRel(CTMcontext aContext,
CTMfloat aRelPrecision);
/// Set the normal precision (only used by the MG2 compression method). The
/// normal is represented in spherical coordinates in the MG2 compression
/// method, and the normal precision controls the angular and radial resolution.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aPrecision Fixed point precision. For the angular information,
/// this value represents the angular precision. For the radial
/// information, this value is the linear resolution. For instance,
/// 0.01 means that the circle is divided into 100 steps, and the
/// normal magnitude is rounded to 2 decimals. The default normal
/// precision is 2^-8 ~= 0.0039.
CTMEXPORT void CTMCALL ctmNormalPrecision(CTMcontext aContext,
CTMfloat aPrecision);
/// Set the coordinate precision for the specified UV map (only used by the
/// MG2 compression method).
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aUVMap A UV map specifier for a defined UV map
/// (CTM_UV_MAP_1, ...).
/// @param[in] aPrecision Fixed point precision. For instance, if this value is
/// 0.001, all UV coordinates will be rounded to three decimals.
/// The default UV coordinate precision is 2^-12 ~= 0.00024.
/// @see ctmAddUVMap().
CTMEXPORT void CTMCALL ctmUVCoordPrecision(CTMcontext aContext,
CTMenum aUVMap, CTMfloat aPrecision);
/// Set the attribute value precision for the specified attribute map (only
/// used by the MG2 compression method).
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aAttribMap An attribute map specifier for a defined attribute map
/// (CTM_ATTRIB_MAP_1, ...).
/// @param[in] aPrecision Fixed point precision. For instance, if this value is
/// 0.001, all attribute values will be rounded to three decimals.
/// If the attributes represent integer values, set the precision
/// to 1.0. The default attribute precision is 2^-8 ~= 0.0039.
/// @see ctmAddAttribMap().
CTMEXPORT void CTMCALL ctmAttribPrecision(CTMcontext aContext,
CTMenum aAttribMap, CTMfloat aPrecision);
/// Set the file comment for the given OpenCTM context.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aFileComment The file comment (zero terminated UTF-8 string).
CTMEXPORT void CTMCALL ctmFileComment(CTMcontext aContext,
const char * aFileComment);
/// Define a triangle mesh.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aVertices An array of vertices (three consecutive floats make
/// one vertex).
/// @param[in] aVertexCount The number of vertices in \c aVertices (and
/// optionally \c aTexCoords).
/// @param[in] aIndices An array of vertex indices (three consecutive integers
/// make one triangle).
/// @param[in] aTriangleCount The number of triangles in \c aIndices (there
/// must be exactly 3 x \c aTriangleCount indices in \c aIndices).
/// @param[in] aNormals An array of per-vertex normals (or NULL if there are
/// no normals). Each normal is made up by three consecutive floats,
/// and there must be \c aVertexCount normals.
/// @see ctmAddUVMap(), ctmAddAttribMap(), ctmSave(), ctmSaveCustom().
CTMEXPORT void CTMCALL ctmDefineMesh(CTMcontext aContext,
const CTMfloat * aVertices, CTMuint aVertexCount, const CTMuint * aIndices,
CTMuint aTriangleCount, const CTMfloat * aNormals);
/// Define a UV map. There can be several UV maps in a mesh. A UV map is
/// typically used for 2D texture mapping.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aUVCoords An array of UV coordinates. Each UV coordinate is made
/// up by two consecutive floats, and there must be as many
/// coordinates as there are vertices in the mesh.
/// @param[in] aName A unique name for this UV map (zero terminated UTF-8
/// string).
/// @param[in] aFileName A reference to a image file (zero terminated
/// UTF-8 string). If no file name reference exists, pass NULL.
/// @return A UV map index (CTM_UV_MAP_1 and higher). If the function
/// failed, it will return the zero valued CTM_NONE (use ctmGetError()
/// to determine the cause of the error).
/// @note A triangle mesh must have been defined before calling this function,
/// since the number of vertices is defined by the triangle mesh.
/// @see ctmDefineMesh().
CTMEXPORT CTMenum CTMCALL ctmAddUVMap(CTMcontext aContext,
const CTMfloat * aUVCoords, const char * aName, const char * aFileName);
/// Define a custom vertex attribute map. Custom vertex attributes can be used
/// for defining special per-vertex attributes, such as color, weight, ambient
/// occlusion factor, etc.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aAttribValues An array of attribute values. Each attribute value
/// is made up by four consecutive floats, and there must be as many
/// values as there are vertices in the mesh.
/// @param[in] aName A unique name for this attribute map (zero terminated UTF-8
/// string).
/// @return A attribute map index (CTM_ATTRIB_MAP_1 and higher). If the function
/// failed, it will return the zero valued CTM_NONE (use ctmGetError()
/// to determine the cause of the error).
/// @note A triangle mesh must have been defined before calling this function,
/// since the number of vertices is defined by the triangle mesh.
/// @see ctmDefineMesh().
CTMEXPORT CTMenum CTMCALL ctmAddAttribMap(CTMcontext aContext,
const CTMfloat * aAttribValues, const char * aName);
/// Load an OpenCTM format file into the context. The mesh data can be retrieved
/// with the various ctmGet functions.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aFileName The name of the file to be loaded.
CTMEXPORT void CTMCALL ctmLoad(CTMcontext aContext, const char * aFileName);
/// Load an OpenCTM format file using a custom stream read function. The mesh
/// data can be retrieved with the various ctmGet functions.
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aReadFn Pointer to a custom stream read function.
/// @param[in] aUserData Custom user data, which can be a C language FILE
/// handle, C++ istream object, or a custom object pointer
/// of any type. The user data pointer will be passed to the
/// custom stream read function.
/// @see CTMreadfn.
CTMEXPORT void CTMCALL ctmLoadCustom(CTMcontext aContext, CTMreadfn aReadFn,
void * aUserData);
/// Save an OpenCTM format file. The mesh must have been defined by
/// ctmDefineMesh().
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aFileName The name of the file to be saved.
CTMEXPORT void CTMCALL ctmSave(CTMcontext aContext, const char * aFileName);
/// Save an OpenCTM format file using a custom stream write function. The mesh
/// must have been defined by ctmDefineMesh().
/// @param[in] aContext An OpenCTM context that has been created by
/// ctmNewContext().
/// @param[in] aWriteFn Pointer to a custom stream write function.
/// @param[in] aUserData Custom user data, which can be a C language FILE
/// handle, C++ ostream object, or a custom object pointer
/// of any type. The user data pointer will be passed to the
/// custom stream write function.
/// @see CTMwritefn.
CTMEXPORT void CTMCALL ctmSaveCustom(CTMcontext aContext, CTMwritefn aWriteFn,
void * aUserData);
#ifdef __cplusplus
}
#endif
// C++ extensions to the API (to disable C++ extensions, define OPENCTM_NO_CPP)
#if defined(__cplusplus) && !defined(OPENCTM_NO_CPP)
#include "openctmpp.h"
#endif
#endif // __OPENCTM_H_

View File

@@ -1,26 +0,0 @@
1 VERSIONINFO
FILEVERSION 1,0,3,0
PRODUCTVERSION 1,0,3,0
FILEOS 0x4
FILETYPE 0x2
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "ProductVersion", "1.0.3.0"
VALUE "FileVersion", "1.0.3.0"
VALUE "FileDescription", "OpenCTM API shared library"
VALUE "ProductName", "OpenCTM"
VALUE "OriginalFilename", "openctm.dll"
VALUE "LegalCopyright", "© 2009-2010 Marcus Geelnard"
VALUE "License", "This software is released under the zlib/libpng license."
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END

View File

@@ -1,377 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: openctmpp.h
// Description: C++ wrapper for the OpenCTM API.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
// To disable C++ extensions, define OPENCTM_NO_CPP
#ifndef OPENCTM_NO_CPP
#ifndef __OPENCTMPP_H_
#define __OPENCTMPP_H_
// Just in case (if this file was included from outside openctm.h)...
#ifndef __OPENCTM_H_
#include "openctm.h"
#endif
#include <exception>
/// OpenCTM exception. When an error occurs, a \c ctm_error exception is
/// thrown. Its what() function returns the name of the OpenCTM error code
/// (for instance "CTM_INVALID_OPERATION").
class ctm_error: public std::exception
{
private:
CTMenum mErrorCode;
public:
explicit ctm_error(CTMenum aError)
{
mErrorCode = aError;
}
virtual const char* what() const throw()
{
return ctmErrorString(mErrorCode);
}
CTMenum error_code() const throw()
{
return mErrorCode;
}
};
/// OpenCTM importer class. This is a C++ wrapper class for an OpenCTM import
/// context. Usage example:
///
/// @code
/// // Create a new OpenCTM importer object
/// CTMimporter ctm;
///
/// // Load the OpenCTM file
/// ctm.Load("mymesh.ctm");
///
/// // Access the mesh data
/// vertCount = ctm.GetInteger(CTM_VERTEX_COUNT);
/// vertices = ctm.GetFloatArray(CTM_VERTICES);
/// triCount = ctm.GetInteger(CTM_TRIANGLE_COUNT);
/// indices = ctm.GetIntegerArray(CTM_INDICES);
///
/// // Deal with the mesh (e.g. transcode it to our internal representation)
/// // ...
/// @endcode
class CTMimporter {
private:
/// The OpenCTM context handle.
CTMcontext mContext;
/// Check for OpenCTM errors, and throw an exception if an error has
/// occured.
void CheckError()
{
CTMenum err = ctmGetError(mContext);
if(err != CTM_NONE)
abort(); //throw ctm_error(err);
}
public:
/// Constructor
CTMimporter()
{
mContext = ctmNewContext(CTM_IMPORT);
}
/// Destructor
~CTMimporter()
{
ctmFreeContext(mContext);
}
/// Wrapper for ctmGetInteger()
CTMuint GetInteger(CTMenum aProperty)
{
CTMuint res = ctmGetInteger(mContext, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetFloat()
CTMfloat GetFloat(CTMenum aProperty)
{
CTMfloat res = ctmGetFloat(mContext, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetIntegerArray()
const CTMuint * GetIntegerArray(CTMenum aProperty)
{
const CTMuint * res = ctmGetIntegerArray(mContext, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetFloatArray()
const CTMfloat * GetFloatArray(CTMenum aProperty)
{
const CTMfloat * res = ctmGetFloatArray(mContext, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetNamedUVMap()
CTMenum GetNamedUVMap(const char * aName)
{
CTMenum res = ctmGetNamedUVMap(mContext, aName);
CheckError();
return res;
}
/// Wrapper for ctmGetUVMapString()
const char * GetUVMapString(CTMenum aUVMap, CTMenum aProperty)
{
const char * res = ctmGetUVMapString(mContext, aUVMap, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetUVMapFloat()
CTMfloat GetUVMapFloat(CTMenum aUVMap, CTMenum aProperty)
{
CTMfloat res = ctmGetUVMapFloat(mContext, aUVMap, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetNamedAttribMap()
CTMenum GetNamedAttribMap(const char * aName)
{
CTMenum res = ctmGetNamedAttribMap(mContext, aName);
CheckError();
return res;
}
/// Wrapper for ctmGetAttribMapString()
const char * GetAttribMapString(CTMenum aAttribMap, CTMenum aProperty)
{
const char * res = ctmGetAttribMapString(mContext, aAttribMap, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetAttribMapFloat()
CTMfloat GetAttribMapFloat(CTMenum aAttribMap, CTMenum aProperty)
{
CTMfloat res = ctmGetAttribMapFloat(mContext, aAttribMap, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmGetString()
const char * GetString(CTMenum aProperty)
{
const char * res = ctmGetString(mContext, aProperty);
CheckError();
return res;
}
/// Wrapper for ctmLoad()
void Load(const char * aFileName)
{
ctmLoad(mContext, aFileName);
CheckError();
}
/// Wrapper for ctmLoadCustom()
void LoadCustom(CTMreadfn aReadFn, void * aUserData)
{
ctmLoadCustom(mContext, aReadFn, aUserData);
CheckError();
}
// You can not copy nor assign from one CTMimporter object to another, since
// the object contains hidden state. By declaring these dummy prototypes
// without an implementation, you will at least get linker errors if you try
// to copy or assign a CTMimporter object.
CTMimporter(const CTMimporter& v);
CTMimporter& operator=(const CTMimporter& v);
};
/// OpenCTM exporter class. This is a C++ wrapper class for an OpenCTM export
/// context. Usage example:
/// @code
/// void MySaveFile(CTMuint aVertCount, CTMuint aTriCount, CTMfloat * aVertices,
/// CTMuint * aIndices, const char * aFileName)
/// {
/// // Create a new OpenCTM exporter object
/// CTMexporter ctm;
///
/// // Define our mesh representation to OpenCTM (store references to it in
/// // the context)
/// ctm.DefineMesh(aVertices, aVertCount, aIndices, aTriCount, NULL);
///
/// // Save the OpenCTM file
/// ctm.Save(aFileName);
/// }
/// @endcode
class CTMexporter {
private:
/// The OpenCTM context handle.
CTMcontext mContext;
/// Check for OpenCTM errors, and throw an exception if an error has
/// occured.
void CheckError()
{
CTMenum err = ctmGetError(mContext);
if(err != CTM_NONE)
abort(); //throw ctm_error(err);
}
public:
/// Constructor
CTMexporter()
{
mContext = ctmNewContext(CTM_EXPORT);
}
/// Destructor
~CTMexporter()
{
ctmFreeContext(mContext);
}
/// Wrapper for ctmCompressionMethod()
void CompressionMethod(CTMenum aMethod)
{
ctmCompressionMethod(mContext, aMethod);
CheckError();
}
/// Wrapper for ctmCompressionLevel()
void CompressionLevel(CTMuint aLevel)
{
ctmCompressionLevel(mContext, aLevel);
CheckError();
}
/// Wrapper for ctmVertexPrecision()
void VertexPrecision(CTMfloat aPrecision)
{
ctmVertexPrecision(mContext, aPrecision);
CheckError();
}
/// Wrapper for ctmVertexPrecisionRel()
void VertexPrecisionRel(CTMfloat aRelPrecision)
{
ctmVertexPrecisionRel(mContext, aRelPrecision);
CheckError();
}
/// Wrapper for ctmNormalPrecision()
void NormalPrecision(CTMfloat aPrecision)
{
ctmNormalPrecision(mContext, aPrecision);
CheckError();
}
/// Wrapper for ctmUVCoordPrecision()
void UVCoordPrecision(CTMenum aUVMap, CTMfloat aPrecision)
{
ctmUVCoordPrecision(mContext, aUVMap, aPrecision);
CheckError();
}
/// Wrapper for ctmAttribPrecision()
void AttribPrecision(CTMenum aAttribMap, CTMfloat aPrecision)
{
ctmAttribPrecision(mContext, aAttribMap, aPrecision);
CheckError();
}
/// Wrapper for ctmFileComment()
void FileComment(const char * aFileComment)
{
ctmFileComment(mContext, aFileComment);
CheckError();
}
/// Wrapper for ctmDefineMesh()
void DefineMesh(const CTMfloat * aVertices, CTMuint aVertexCount,
const CTMuint * aIndices, CTMuint aTriangleCount,
const CTMfloat * aNormals)
{
ctmDefineMesh(mContext, aVertices, aVertexCount, aIndices, aTriangleCount,
aNormals);
CheckError();
}
/// Wrapper for ctmAddUVMap()
CTMenum AddUVMap(const CTMfloat * aUVCoords, const char * aName,
const char * aFileName)
{
CTMenum res = ctmAddUVMap(mContext, aUVCoords, aName, aFileName);
CheckError();
return res;
}
/// Wrapper for ctmAddAttribMap()
CTMenum AddAttribMap(const CTMfloat * aAttribValues, const char * aName)
{
CTMenum res = ctmAddAttribMap(mContext, aAttribValues, aName);
CheckError();
return res;
}
/// Wrapper for ctmSave()
void Save(const char * aFileName)
{
ctmSave(mContext, aFileName);
CheckError();
}
/// Wrapper for ctmSaveCustom()
void SaveCustom(CTMwritefn aWriteFn, void * aUserData)
{
ctmSaveCustom(mContext, aWriteFn, aUserData);
CheckError();
}
// You can not copy nor assign from one CTMexporter object to another, since
// the object contains hidden state. By declaring these dummy prototypes
// without an implementation, you will at least get linker errors if you try
// to copy or assign a CTMexporter object.
CTMexporter(const CTMexporter& v);
CTMexporter& operator=(const CTMexporter& v);
};
#endif // __OPENCTMPP_H_
#endif // OPENCTM_NO_CPP

View File

@@ -1,512 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM
// File: stream.c
// Description: Stream I/O functions.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include <LzmaLib.h>
#include "openctm.h"
#include "internal.h"
#ifdef __DEBUG_
#include <stdio.h>
#endif
//-----------------------------------------------------------------------------
// _ctmStreamRead() - Read data from a stream.
//-----------------------------------------------------------------------------
CTMuint _ctmStreamRead(_CTMcontext * self, void * aBuf, CTMuint aCount)
{
if(!self->mUserData || !self->mReadFn)
return 0;
return self->mReadFn(aBuf, aCount, self->mUserData);
}
//-----------------------------------------------------------------------------
// _ctmStreamWrite() - Write data to a stream.
//-----------------------------------------------------------------------------
CTMuint _ctmStreamWrite(_CTMcontext * self, void * aBuf, CTMuint aCount)
{
if(!self->mUserData || !self->mWriteFn)
return 0;
return self->mWriteFn(aBuf, aCount, self->mUserData);
}
//-----------------------------------------------------------------------------
// _ctmStreamReadUINT() - Read an unsigned integer from a stream in a machine
// endian independent manner (for portability).
//-----------------------------------------------------------------------------
CTMuint _ctmStreamReadUINT(_CTMcontext * self)
{
unsigned char buf[4];
_ctmStreamRead(self, (void *) buf, 4);
return ((CTMuint) buf[0]) |
(((CTMuint) buf[1]) << 8) |
(((CTMuint) buf[2]) << 16) |
(((CTMuint) buf[3]) << 24);
}
//-----------------------------------------------------------------------------
// _ctmStreamWriteUINT() - Write an unsigned integer to a stream in a machine
// endian independent manner (for portability).
//-----------------------------------------------------------------------------
void _ctmStreamWriteUINT(_CTMcontext * self, CTMuint aValue)
{
unsigned char buf[4];
buf[0] = aValue & 0x000000ff;
buf[1] = (aValue >> 8) & 0x000000ff;
buf[2] = (aValue >> 16) & 0x000000ff;
buf[3] = (aValue >> 24) & 0x000000ff;
_ctmStreamWrite(self, (void *) buf, 4);
}
//-----------------------------------------------------------------------------
// _ctmStreamReadFLOAT() - Read a floating point value from a stream in a
// machine endian independent manner (for portability).
//-----------------------------------------------------------------------------
CTMfloat _ctmStreamReadFLOAT(_CTMcontext * self)
{
union {
CTMfloat f;
CTMuint i;
} u;
u.i = _ctmStreamReadUINT(self);
return u.f;
}
//-----------------------------------------------------------------------------
// _ctmStreamWriteFLOAT() - Write a floating point value to a stream in a
// machine endian independent manner (for portability).
//-----------------------------------------------------------------------------
void _ctmStreamWriteFLOAT(_CTMcontext * self, CTMfloat aValue)
{
union {
CTMfloat f;
CTMuint i;
} u;
u.f = aValue;
_ctmStreamWriteUINT(self, u.i);
}
//-----------------------------------------------------------------------------
// _ctmStreamReadSTRING() - Read a string value from a stream. The format of
// the string in the stream is: an unsigned integer (string length) followed by
// the string (without null termination).
//-----------------------------------------------------------------------------
void _ctmStreamReadSTRING(_CTMcontext * self, char ** aValue)
{
CTMuint len;
// Clear the old string
if(*aValue)
{
free(*aValue);
*aValue = (char *) 0;
}
// Get string length
len = _ctmStreamReadUINT(self);
// Read string
if(len > 0)
{
*aValue = (char *) malloc(len + 1);
if(*aValue)
{
_ctmStreamRead(self, (void *) *aValue, len);
(*aValue)[len] = 0;
}
}
}
//-----------------------------------------------------------------------------
// _ctmStreamWriteSTRING() - Write a string value to a stream. The format of
// the string in the stream is: an unsigned integer (string length) followed by
// the string (without null termination).
//-----------------------------------------------------------------------------
void _ctmStreamWriteSTRING(_CTMcontext * self, const char * aValue)
{
CTMuint len;
// Get string length
if(aValue)
len = (CTMuint)strlen(aValue);
else
len = 0;
// Write string length
_ctmStreamWriteUINT(self, len);
// Write string
if(len > 0)
_ctmStreamWrite(self, (void *) aValue, len);
}
//-----------------------------------------------------------------------------
// _ctmStreamReadPackedInts() - Read an compressed binary integer data array
// from a stream, and uncompress it.
//-----------------------------------------------------------------------------
int _ctmStreamReadPackedInts(_CTMcontext * self, CTMint * aData,
CTMuint aCount, CTMuint aSize, CTMint aSignedInts)
{
size_t packedSize, unpackedSize;
CTMuint i, k, x;
CTMint value;
unsigned char * packed, * tmp;
unsigned char props[5];
int lzmaRes;
// Read packed data size from the stream
packedSize = (size_t) _ctmStreamReadUINT(self);
// Read LZMA compression props from the stream
_ctmStreamRead(self, (void *) props, 5);
// Allocate memory and read the packed data from the stream
packed = (unsigned char *) malloc(packedSize);
if(!packed)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
_ctmStreamRead(self, (void *) packed, (CTMuint)packedSize);
// Allocate memory for interleaved array
tmp = (unsigned char *) malloc(aCount * aSize * 4);
if(!tmp)
{
free(packed);
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Uncompress
unpackedSize = aCount * aSize * 4;
lzmaRes = LzmaUncompress(tmp, &unpackedSize, packed,
&packedSize, props, 5);
// Free the packed array
free(packed);
// Error?
if((lzmaRes != SZ_OK) || (unpackedSize != aCount * aSize * 4))
{
self->mError = CTM_LZMA_ERROR;
free(tmp);
return CTM_FALSE;
}
// Convert interleaved array to integers
for(i = 0; i < aCount; ++ i)
{
for(k = 0; k < aSize; ++ k)
{
value = (CTMint) tmp[i + k * aCount + 3 * aCount * aSize] |
(((CTMint) tmp[i + k * aCount + 2 * aCount * aSize]) << 8) |
(((CTMint) tmp[i + k * aCount + aCount * aSize]) << 16) |
(((CTMint) tmp[i + k * aCount]) << 24);
// Convert signed magnitude to two's complement?
if(aSignedInts)
{
x = (CTMuint) value;
value = (x & 1) ? -(CTMint)((x + 1) >> 1) : (CTMint)(x >> 1);
}
aData[i * aSize + k] = value;
}
}
// Free the interleaved array
free(tmp);
return CTM_TRUE;
}
//-----------------------------------------------------------------------------
// _ctmStreamWritePackedInts() - Compress a binary integer data array, and
// write it to a stream.
//-----------------------------------------------------------------------------
int _ctmStreamWritePackedInts(_CTMcontext * self, CTMint * aData,
CTMuint aCount, CTMuint aSize, CTMint aSignedInts)
{
int lzmaRes, lzmaAlgo;
CTMuint i, k;
CTMint value;
size_t bufSize, outPropsSize;
unsigned char * packed, outProps[5], *tmp;
#ifdef __DEBUG_
CTMuint negCount = 0;
#endif
// Allocate memory for interleaved array
tmp = (unsigned char *) malloc(aCount * aSize * 4);
if(!tmp)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Convert integers to an interleaved array
for(i = 0; i < aCount; ++ i)
{
for(k = 0; k < aSize; ++ k)
{
value = aData[i * aSize + k];
// Convert two's complement to signed magnitude?
if(aSignedInts)
value = value < 0 ? -1 - (value << 1) : value << 1;
#ifdef __DEBUG_
else if(value < 0)
++ negCount;
#endif
tmp[i + k * aCount + 3 * aCount * aSize] = value & 0x000000ff;
tmp[i + k * aCount + 2 * aCount * aSize] = (value >> 8) & 0x000000ff;
tmp[i + k * aCount + aCount * aSize] = (value >> 16) & 0x000000ff;
tmp[i + k * aCount] = (value >> 24) & 0x000000ff;
}
}
// Allocate memory for the packed data
bufSize = 1000 + aCount * aSize * 4;
packed = (unsigned char *) malloc(bufSize);
if(!packed)
{
free(tmp);
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Call LZMA to compress
outPropsSize = 5;
lzmaAlgo = (self->mCompressionLevel < 1 ? 0 : 1);
lzmaRes = LzmaCompress(packed,
&bufSize,
(const unsigned char *) tmp,
aCount * aSize * 4,
outProps,
&outPropsSize,
self->mCompressionLevel, // Level (0-9)
0, -1, -1, -1, -1, -1, // Default values (set by level)
lzmaAlgo // Algorithm (0 = fast, 1 = normal)
);
// Free temporary array
free(tmp);
// Error?
if(lzmaRes != SZ_OK)
{
self->mError = CTM_LZMA_ERROR;
free(packed);
return CTM_FALSE;
}
#ifdef __DEBUG_
printf("%d->%d bytes (%d negative words)\n", aCount * aSize * 4, (int) bufSize, negCount);
#endif
// Write packed data size to the stream
_ctmStreamWriteUINT(self, (CTMuint) bufSize);
// Write LZMA compression props to the stream
_ctmStreamWrite(self, (void *) outProps, 5);
// Write the packed data to the stream
_ctmStreamWrite(self, (void *) packed, (CTMuint) bufSize);
// Free the packed data
free(packed);
return CTM_TRUE;
}
//-----------------------------------------------------------------------------
// _ctmStreamReadPackedFloats() - Read an compressed binary float data array
// from a stream, and uncompress it.
//-----------------------------------------------------------------------------
int _ctmStreamReadPackedFloats(_CTMcontext * self, CTMfloat * aData,
CTMuint aCount, CTMuint aSize)
{
CTMuint i, k;
size_t packedSize, unpackedSize;
union {
CTMfloat f;
CTMint i;
} value;
unsigned char * packed, * tmp;
unsigned char props[5];
int lzmaRes;
// Read packed data size from the stream
packedSize = (size_t) _ctmStreamReadUINT(self);
// Read LZMA compression props from the stream
_ctmStreamRead(self, (void *) props, 5);
// Allocate memory and read the packed data from the stream
packed = (unsigned char *) malloc(packedSize);
if(!packed)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
_ctmStreamRead(self, (void *) packed, (CTMuint)packedSize);
// Allocate memory for interleaved array
tmp = (unsigned char *) malloc(aCount * aSize * 4);
if(!tmp)
{
free(packed);
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Uncompress
unpackedSize = aCount * aSize * 4;
lzmaRes = LzmaUncompress(tmp, &unpackedSize, packed,
&packedSize, props, 5);
// Free the packed array
free(packed);
// Error?
if((lzmaRes != SZ_OK) || (unpackedSize != aCount * aSize * 4))
{
self->mError = CTM_LZMA_ERROR;
free(tmp);
return CTM_FALSE;
}
// Convert interleaved array to floats
for(i = 0; i < aCount; ++ i)
{
for(k = 0; k < aSize; ++ k)
{
value.i = (CTMint) tmp[i + k * aCount + 3 * aCount * aSize] |
(((CTMint) tmp[i + k * aCount + 2 * aCount * aSize]) << 8) |
(((CTMint) tmp[i + k * aCount + aCount * aSize]) << 16) |
(((CTMint) tmp[i + k * aCount]) << 24);
aData[i * aSize + k] = value.f;
}
}
// Free the interleaved array
free(tmp);
return CTM_TRUE;
}
//-----------------------------------------------------------------------------
// _ctmStreamWritePackedFloats() - Compress a binary float data array, and
// write it to a stream.
//-----------------------------------------------------------------------------
int _ctmStreamWritePackedFloats(_CTMcontext * self, CTMfloat * aData,
CTMuint aCount, CTMuint aSize)
{
int lzmaRes, lzmaAlgo;
CTMuint i, k;
union {
CTMfloat f;
CTMint i;
} value;
size_t bufSize, outPropsSize;
unsigned char * packed, outProps[5], *tmp;
// Allocate memory for interleaved array
tmp = (unsigned char *) malloc(aCount * aSize * 4);
if(!tmp)
{
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Convert floats to an interleaved array
for(i = 0; i < aCount; ++ i)
{
for(k = 0; k < aSize; ++ k)
{
value.f = aData[i * aSize + k];
tmp[i + k * aCount + 3 * aCount * aSize] = value.i & 0x000000ff;
tmp[i + k * aCount + 2 * aCount * aSize] = (value.i >> 8) & 0x000000ff;
tmp[i + k * aCount + aCount * aSize] = (value.i >> 16) & 0x000000ff;
tmp[i + k * aCount] = (value.i >> 24) & 0x000000ff;
}
}
// Allocate memory for the packed data
bufSize = 1000 + aCount * aSize * 4;
packed = (unsigned char *) malloc(bufSize);
if(!packed)
{
free(tmp);
self->mError = CTM_OUT_OF_MEMORY;
return CTM_FALSE;
}
// Call LZMA to compress
outPropsSize = 5;
lzmaAlgo = (self->mCompressionLevel < 1 ? 0 : 1);
lzmaRes = LzmaCompress(packed,
&bufSize,
(const unsigned char *) tmp,
aCount * aSize * 4,
outProps,
&outPropsSize,
self->mCompressionLevel, // Level (0-9)
0, -1, -1, -1, -1, -1, // Default values (set by level)
lzmaAlgo // Algorithm (0 = fast, 1 = normal)
);
// Free temporary array
free(tmp);
// Error?
if(lzmaRes != SZ_OK)
{
self->mError = CTM_LZMA_ERROR;
free(packed);
return CTM_FALSE;
}
#ifdef __DEBUG_
printf("%d->%d bytes\n", aCount * aSize * 4, (int) bufSize);
#endif
// Write packed data size to the stream
_ctmStreamWriteUINT(self, (CTMuint) bufSize);
// Write LZMA compression props to the stream
_ctmStreamWrite(self, (void *) outProps, 5);
// Write the packed data to the stream
_ctmStreamWrite(self, (void *) packed, (CTMuint) bufSize);
// Free the packed data
free(packed);
return CTM_TRUE;
}

View File

@@ -1,332 +0,0 @@
#!BPY
"""
Name: 'OpenCTM (*.ctm)...'
Blender: 248
Group: 'Export'
Tooltip: 'Export active object to OpenCTM (compressed) format'
"""
import bpy
import Blender
from Blender import Mesh, Scene, Window, sys, Image, Draw
import BPyMesh
import ctypes
from ctypes import *
from ctypes.util import find_library
import os
__author__ = "Marcus Geelnard"
__version__ = "0.4"
__bpydoc__ = """\
This script exports OpenCTM files from Blender. It supports normals,
colours, and UV coordinates per vertex. Only one mesh can be exported
at a time.
"""
# Copyright (C) 2009-2010: Marcus Geelnard
#
# This program is released to the public domain.
#
# Portions of this code are taken from ply_export.py in Blender
# 2.48.
#
# The script uses the OpenCTM shared library (.so, .dll, etc). If no
# such library can be found, the script will exit with an error
# message.
#
# v0.4, 2009-09-14
# - Updated to OpenCTM API version 0.8 (texture maps are now called UV maps)
#
# v0.3, 2009-08-09
# - Changed vertex color attribute name to "Color"
#
# v0.2, 2009-06-30
# - Added precision settings for MG2 export
# - Added some error checking
#
# v0.1, 2009-05-31
# - First test version with an alpha version of the OpenCTM API
#
def file_callback(filename):
if not filename.lower().endswith('.ctm'):
filename += '.ctm'
# Get object mesh from the selected object
scn = bpy.data.scenes.active
ob = scn.objects.active
if not ob:
Blender.Draw.PupMenu('Error%t|Select 1 active object')
return
mesh = BPyMesh.getMeshFromObject(ob, None, False, False, scn)
if not mesh:
Blender.Draw.PupMenu('Error%t|Could not get mesh data from active object')
return
# Check which mesh properties are present...
hasVertexUV = mesh.vertexUV or mesh.faceUV
hasVertexColors = mesh.vertexColors
# Show a GUI for the export settings
pupBlock = []
EXPORT_APPLY_MODIFIERS = Draw.Create(1)
pupBlock.append(('Apply Modifiers', EXPORT_APPLY_MODIFIERS, 'Use transformed mesh data.'))
EXPORT_NORMALS = Draw.Create(1)
pupBlock.append(('Normals', EXPORT_NORMALS, 'Export vertex normal data.'))
if hasVertexUV:
EXPORT_UV = Draw.Create(1)
pupBlock.append(('UVs', EXPORT_UV, 'Export texface UV coords.'))
if hasVertexColors:
EXPORT_COLORS = Draw.Create(1)
pupBlock.append(('Colors', EXPORT_COLORS, 'Export vertex Colors.'))
EXPORT_MG2 = Draw.Create(0)
pupBlock.append(('Fixed Point', EXPORT_MG2, 'Use limited precision algorithm (MG2 method = better compression).'))
if not Draw.PupBlock('Export...', pupBlock):
return
# Adjust export settings according to GUI selections
EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS.val
EXPORT_NORMALS = EXPORT_NORMALS.val
if hasVertexUV:
EXPORT_UV = EXPORT_UV.val
else:
EXPORT_UV = False
if hasVertexColors:
EXPORT_COLORS = EXPORT_COLORS.val
else:
EXPORT_COLORS = False
EXPORT_MG2 = EXPORT_MG2.val
# If the user wants to export MG2, then show another GUI...
if EXPORT_MG2:
pupBlock = []
EXPORT_VPREC = Draw.Create(0.01)
pupBlock.append(('Vertex', EXPORT_VPREC, 0.0001, 1.0, 'Relative vertex precision (fixed point).'))
if EXPORT_NORMALS:
EXPORT_NPREC = Draw.Create(1.0/256.0)
pupBlock.append(('Normal', EXPORT_NPREC, 0.0001, 1.0, 'Normal precision (fixed point).'))
if EXPORT_UV:
EXPORT_UVPREC = Draw.Create(1.0/1024.0)
pupBlock.append(('UV', EXPORT_UVPREC, 0.0001, 1.0, 'UV precision (fixed point).'))
if EXPORT_COLORS:
EXPORT_CPREC = Draw.Create(1.0/256.0)
pupBlock.append(('Color', EXPORT_CPREC, 0.0001, 1.0, 'Color precision (fixed point).'))
if not Draw.PupBlock('Fixed point precision...', pupBlock):
return
# Adjust export settings according to GUI selections
if EXPORT_MG2:
EXPORT_VPREC = EXPORT_VPREC.val
else:
EXPORT_VPREC = 0.1
if EXPORT_MG2 and EXPORT_NORMALS:
EXPORT_NPREC = EXPORT_NPREC.val
else:
EXPORT_NPREC = 0.1
if EXPORT_MG2 and EXPORT_UV:
EXPORT_UVPREC = EXPORT_UVPREC.val
else:
EXPORT_UVPREC = 0.1
if EXPORT_MG2 and EXPORT_COLORS:
EXPORT_CPREC = EXPORT_CPREC.val
else:
EXPORT_CPREC = 0.1
is_editmode = Blender.Window.EditMode()
if is_editmode:
Blender.Window.EditMode(0, '', 0)
Window.WaitCursor(1)
try:
# Get the mesh, again, if we wanted modifiers (from GUI selection)
if EXPORT_APPLY_MODIFIERS:
mesh = BPyMesh.getMeshFromObject(ob, None, EXPORT_APPLY_MODIFIERS, False, scn)
if not mesh:
Blender.Draw.PupMenu('Error%t|Could not get mesh data from active object')
return
mesh.transform(ob.matrixWorld, True)
# Count triangles (quads count as two triangles)
triangleCount = 0
for f in mesh.faces:
if len(f.v) == 4:
triangleCount += 2
else:
triangleCount += 1
# Extract indices from the Blender mesh (quads are split into two triangles)
pindices = cast((c_int * 3 * triangleCount)(), POINTER(c_int))
i = 0
for f in mesh.faces:
pindices[i] = c_int(f.v[0].index)
pindices[i + 1] = c_int(f.v[1].index)
pindices[i + 2] = c_int(f.v[2].index)
i += 3
if len(f.v) == 4:
pindices[i] = c_int(f.v[0].index)
pindices[i + 1] = c_int(f.v[2].index)
pindices[i + 2] = c_int(f.v[3].index)
i += 3
# Extract vertex array from the Blender mesh
vertexCount = len(mesh.verts)
pvertices = cast((c_float * 3 * vertexCount)(), POINTER(c_float))
i = 0
for v in mesh.verts:
pvertices[i] = c_float(v.co.x)
pvertices[i + 1] = c_float(v.co.y)
pvertices[i + 2] = c_float(v.co.z)
i += 3
# Extract normals
if EXPORT_NORMALS:
pnormals = cast((c_float * 3 * vertexCount)(), POINTER(c_float))
i = 0
for v in mesh.verts:
pnormals[i] = c_float(v.no.x)
pnormals[i + 1] = c_float(v.no.y)
pnormals[i + 2] = c_float(v.no.z)
i += 3
else:
pnormals = POINTER(c_float)()
# Extract UVs
if EXPORT_UV:
ptexCoords = cast((c_float * 2 * vertexCount)(), POINTER(c_float))
if mesh.faceUV:
for f in mesh.faces:
for j, v in enumerate(f.v):
k = v.index
if k < vertexCount:
uv = f.uv[j]
ptexCoords[k * 2] = uv[0]
ptexCoords[k * 2 + 1] = uv[1]
else:
i = 0
for v in mesh.verts:
ptexCoords[i] = c_float(v.uvco[0])
ptexCoords[i + 1] = c_float(v.uvco[1])
i += 2
else:
ptexCoords = POINTER(c_float)()
# Extract colors
if EXPORT_COLORS:
pcolors = cast((c_float * 4 * vertexCount)(), POINTER(c_float))
for f in mesh.faces:
for j, v in enumerate(f.v):
k = v.index
if k < vertexCount:
col = f.col[j]
pcolors[k * 4] = col.r / 255.0
pcolors[k * 4 + 1] = col.g / 255.0
pcolors[k * 4 + 2] = col.b / 255.0
pcolors[k * 4 + 3] = 1.0
else:
pcolors = POINTER(c_float)()
# Load the OpenCTM shared library
if os.name == 'nt':
libHDL = WinDLL('openctm.dll')
else:
libName = find_library('openctm')
if not libName:
Blender.Draw.PupMenu('Could not find the OpenCTM shared library')
return
libHDL = CDLL(libName)
if not libHDL:
Blender.Draw.PupMenu('Could not open the OpenCTM shared library')
return
# Get all the functions from the shared library that we need
ctmNewContext = libHDL.ctmNewContext
ctmNewContext.argtypes = [c_int]
ctmNewContext.restype = c_void_p
ctmFreeContext = libHDL.ctmFreeContext
ctmFreeContext.argtypes = [c_void_p]
ctmGetError = libHDL.ctmGetError
ctmGetError.argtypes = [c_void_p]
ctmGetError.restype = c_int
ctmErrorString = libHDL.ctmErrorString
ctmErrorString.argtypes = [c_int]
ctmErrorString.restype = c_char_p
ctmFileComment = libHDL.ctmFileComment
ctmFileComment.argtypes = [c_void_p, c_char_p]
ctmDefineMesh = libHDL.ctmDefineMesh
ctmDefineMesh.argtypes = [c_void_p, POINTER(c_float), c_int, POINTER(c_int), c_int, POINTER(c_float)]
ctmSave = libHDL.ctmSave
ctmSave.argtypes = [c_void_p, c_char_p]
ctmAddUVMap = libHDL.ctmAddUVMap
ctmAddUVMap.argtypes = [c_void_p, POINTER(c_float), c_char_p, c_char_p]
ctmAddUVMap.restype = c_int
ctmAddAttribMap = libHDL.ctmAddAttribMap
ctmAddAttribMap.argtypes = [c_void_p, POINTER(c_float), c_char_p]
ctmAddAttribMap.restype = c_int
ctmCompressionMethod = libHDL.ctmCompressionMethod
ctmCompressionMethod.argtypes = [c_void_p, c_int]
ctmVertexPrecisionRel = libHDL.ctmVertexPrecisionRel
ctmVertexPrecisionRel.argtypes = [c_void_p, c_float]
ctmNormalPrecision = libHDL.ctmNormalPrecision
ctmNormalPrecision.argtypes = [c_void_p, c_float]
ctmUVCoordPrecision = libHDL.ctmUVCoordPrecision
ctmUVCoordPrecision.argtypes = [c_void_p, c_int, c_float]
ctmAttribPrecision = libHDL.ctmAttribPrecision
ctmAttribPrecision.argtypes = [c_void_p, c_int, c_float]
# Create an OpenCTM context
ctm = ctmNewContext(0x0102) # CTM_EXPORT
try:
# Set the file comment
ctmFileComment(ctm, c_char_p('%s - created by Blender %s (www.blender.org)' % (ob.getName(), Blender.Get('version'))))
# Define the mesh
ctmDefineMesh(ctm, pvertices, c_int(vertexCount), pindices, c_int(triangleCount), pnormals)
# Add UV coordinates?
if EXPORT_UV:
tm = ctmAddUVMap(ctm, ptexCoords, c_char_p(), c_char_p())
if EXPORT_MG2:
ctmUVCoordPrecision(ctm, tm, EXPORT_UVPREC)
# Add colors?
if EXPORT_COLORS:
cm = ctmAddAttribMap(ctm, pcolors, c_char_p('Color'))
if EXPORT_MG2:
ctmAttribPrecision(ctm, cm, EXPORT_CPREC)
# Set compression method
if EXPORT_MG2:
ctmCompressionMethod(ctm, 0x0203) # CTM_METHOD_MG2
ctmVertexPrecisionRel(ctm, EXPORT_VPREC)
if EXPORT_NORMALS:
ctmNormalPrecision(ctm, EXPORT_NPREC)
else:
ctmCompressionMethod(ctm, 0x0202) # CTM_METHOD_MG1
# Save the file
ctmSave(ctm, c_char_p(filename))
# Check for errors
e = ctmGetError(ctm)
if e != 0:
s = ctmErrorString(e)
Blender.Draw.PupMenu('Error%t|Could not save the file: ' + s)
finally:
# Free the OpenCTM context
ctmFreeContext(ctm)
finally:
Window.WaitCursor(0)
if is_editmode:
Blender.Window.EditMode(1, '', 0)
def main():
Blender.Window.FileSelector(file_callback, 'Export OpenCTM', Blender.sys.makename(ext='.ctm'))
if __name__=='__main__':
main()

View File

@@ -1,226 +0,0 @@
#!BPY
"""
Name: 'OpenCTM (*.ctm)...'
Blender: 248
Group: 'Import'
Tooltip: 'Import an OpenCTM file'
"""
import bpy
import Blender
from Blender import Mesh, Scene, Window, sys, Image, Draw
import BPyMesh
import math
import ctypes
from ctypes import *
from ctypes.util import find_library
import os
__author__ = "Marcus Geelnard"
__version__ = "0.4"
__bpydoc__ = """\
This script imports OpenCTM files into Blender. It supports normals,
colours, and UV coordinates per vertex.
"""
# Copyright (C) 2009-2010: Marcus Geelnard
#
# This program is released to the public domain.
#
# Portions of this code are taken from ply_import.py in Blender
# 2.48.
#
# The script uses the OpenCTM shared library (.so, .dll, etc). If no
# such library can be found, the script will exit with an error
# message.
#
# v0.4, 2009-09-14
# - Updated to OpenCTM API version 0.8 (texture maps are now called UV maps)
#
# v0.3, 2009-08-09
# - Changed vertex color attribute name to "Color"
#
# v0.2, 2009-06-30
# - Better error reporting
#
# v0.1, 2009-05-31
# - First test version with an alpha version of the OpenCTM API
#
def file_callback(filename):
Window.WaitCursor(1)
try:
# Load the OpenCTM shared library
if os.name == 'nt':
libHDL = WinDLL('openctm.dll')
else:
libName = find_library('openctm')
if not libName:
Blender.Draw.PupMenu('Could not find the OpenCTM shared library')
return
libHDL = CDLL(libName)
if not libHDL:
Blender.Draw.PupMenu('Could not open the OpenCTM shared library')
return
# Get all the functions from the shared library that we need
ctmNewContext = libHDL.ctmNewContext
ctmNewContext.argtypes = [c_int]
ctmNewContext.restype = c_void_p
ctmFreeContext = libHDL.ctmFreeContext
ctmFreeContext.argtypes = [c_void_p]
ctmGetError = libHDL.ctmGetError
ctmGetError.argtypes = [c_void_p]
ctmGetError.restype = c_int
ctmErrorString = libHDL.ctmErrorString
ctmErrorString.argtypes = [c_int]
ctmErrorString.restype = c_char_p
ctmLoad = libHDL.ctmLoad
ctmLoad.argtypes = [c_void_p, c_char_p]
ctmGetInteger = libHDL.ctmGetInteger
ctmGetInteger.argtypes = [c_void_p, c_int]
ctmGetInteger.restype = c_int
ctmGetString = libHDL.ctmGetString
ctmGetString.argtypes = [c_void_p, c_int]
ctmGetString.restype = c_char_p
ctmGetIntegerArray = libHDL.ctmGetIntegerArray
ctmGetIntegerArray.argtypes = [c_void_p, c_int]
ctmGetIntegerArray.restype = POINTER(c_int)
ctmGetFloatArray = libHDL.ctmGetFloatArray
ctmGetFloatArray.argtypes = [c_void_p, c_int]
ctmGetFloatArray.restype = POINTER(c_float)
ctmGetNamedAttribMap = libHDL.ctmGetNamedAttribMap
ctmGetNamedAttribMap.argtypes = [c_void_p, c_char_p]
ctmGetNamedAttribMap.restype = c_int
# Create an OpenCTM context
ctm = ctmNewContext(0x0101) # CTM_IMPORT
try:
# Load the file
ctmLoad(ctm, c_char_p(filename))
err = ctmGetError(ctm)
if err != 0:
s = ctmErrorString(err)
Blender.Draw.PupMenu('Could not load the file: ' + s)
return
# Get the mesh properties
vertexCount = ctmGetInteger(ctm, 0x0301) # CTM_VERTEX_COUNT
triangleCount = ctmGetInteger(ctm, 0x0302) # CTM_TRIANGLE_COUNT
hasNormals = ctmGetInteger(ctm, 0x0303) # CTM_HAS_NORMALS
texMapCount = ctmGetInteger(ctm, 0x0304) # CTM_UV_MAP_COUNT
# Get indices
pindices = ctmGetIntegerArray(ctm, 0x0601) # CTM_INDICES
# Get vertices
pvertices = ctmGetFloatArray(ctm, 0x0602) # CTM_VERTICES
# Get normals
if hasNormals == 1:
pnormals = ctmGetFloatArray(ctm, 0x0603) # CTM_NORMALS
else:
pnormals = None
# Get texture coordinates
if texMapCount > 0:
ptexCoords = ctmGetFloatArray(ctm, 0x0700) # CTM_UV_MAP_1
else:
ptexCoords = None
# Get colors
colorMap = ctmGetNamedAttribMap(ctm, c_char_p('Color'))
if colorMap != 0:
pcolors = ctmGetFloatArray(ctm, colorMap)
else:
pcolors = None
# We will be creating vectors...
Vector = Blender.Mathutils.Vector
# Create Blender verts and faces
verts = []
for i in range(vertexCount):
verts.append(Vector(pvertices[i * 3], pvertices[i * 3 + 1], pvertices[i * 3 + 2]))
faces = []
for i in range(triangleCount):
faces.append((pindices[i * 3], pindices[i * 3 + 1], pindices[i * 3 + 2]))
# Create a new Blender mesh from the loaded mesh data
objName = Blender.sys.splitext(Blender.sys.basename(filename))[0]
mesh = bpy.data.meshes.new(objName)
mesh.verts.extend(verts)
mesh.faces.extend(faces)
# Add normals?
if pnormals:
i = 0
for v in mesh.verts:
n = Vector(pnormals[i], pnormals[i + 1], pnormals[i + 2])
v.no = n
i += 3
else:
mesh.calcNormals()
# Always use smooth normals - regardless if they are defined or calculated
for f in mesh.faces:
f.smooth = 1
# Add texture coordinates?
if ptexCoords:
mesh.faceUV = 1
for f in mesh.faces:
for j, v in enumerate(f.v):
k = v.index
if k < vertexCount:
uv = f.uv[j]
uv[0] = ptexCoords[k * 2]
uv[1] = ptexCoords[k * 2 + 1]
# Add colors?
if pcolors:
mesh.vertexColors = 1
for f in mesh.faces:
for j, v in enumerate(f.v):
k = v.index
if k < vertexCount:
col = f.col[j]
r = int(round(pcolors[k * 4] * 255.0))
if r < 0: r = 0
if r > 255: r = 255
g = int(round(pcolors[k * 4 + 1] * 255.0))
if g < 0: g = 0
if g > 255: g = 255
b = int(round(pcolors[k * 4 + 2] * 255.0))
if b < 0: b = 0
if b > 255: b = 255
col.r = r
col.g = g
col.b = b
# Select all vertices in the mesh
mesh.sel = True
# Create a new object with the new mesh
scn = bpy.data.scenes.active
scn.objects.selected = []
obj = scn.objects.new(mesh, objName)
scn.objects.active = obj
finally:
# Free the OpenCTM context
ctmFreeContext(ctm)
finally:
Window.WaitCursor(0)
Blender.Redraw()
def main():
Blender.Window.FileSelector(file_callback, 'Import OpenCTM', '*.ctm')
if __name__=='__main__':
main()

View File

@@ -1,48 +0,0 @@
OpenCTM Blender import/export scripts
INSTRUCTIONS
============
The OpenCTM Blender import/export scripts makes it possible to import and
export OpenCTM format files in Blender (a free 3D modeling software -
http://www.blender.org).
To use these scripts, they need to be properly installed along with the
OpenCTM shared library.
Below follow instructions for the three major platforms under which these
scripts have been tested.
Windows:
--------
1) Copy the file "openctm.dll" to the Blender program folder (e.g.
C:\Program Files\Blender Foundation\Blender).
2) Copy the files openctm_export.py and openctm_import.py to the Blender
scripts folder (e.g. %APPDATA%\Blender Foundation\Blender\.blender\scripts).
3) Restart Blender (you may need to run Scripts > Update Menus in a Scripts
window in order for the File > Import / Export menus to be updated).
Mac OS X:
---------
1) Copy the file "libopenctm.dylib" to /usr/local/lib (e.g. using
"sudo cp libopenctm.dylib /usr/local/lib/").
2) Copy the files openctm_export.py and openctm_import.py to the Blender
scripts folder (e.g. /Applications/blender.app/Contents/MacOS/.blender/scripts/).
3) Restart Blender (you may need to run Scripts > Update Menus in a Scripts
window in order for the File > Import / Export menus to be updated).
Linux:
------
1) Copy the file "libopenctm.so" to /usr/lib (e.g. using
"sudo cp libopenctm.so /usr/lib/").
2) Copy the files openctm_export.py and openctm_import.py to the Blender
scripts folder (e.g. /usr/share/blender/scripts/blender/).
3) Restart Blender (you may need to run Scripts > Update Menus in a Scripts
window in order for the File > Import / Export menus to be updated).

View File

@@ -1,196 +0,0 @@
"""
OpenCTM Exporter for Maya.
"""
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import maya.cmds as mc
import sys, math
import os
import ctypes
from ctypes import *
import openctm
__author__ = "Jonas Innala"
__version__ = "0.1"
kPluginTranslatorTypeName = "OpenCTM Exporter"
class OpemCTMExporter(OpenMayaMPx.MPxFileTranslator):
def __init__(self):
OpenMayaMPx.MPxFileTranslator.__init__(self)
def haveWriteMethod(self):
return True
def haveReadMethod(self):
return False
def filter(self):
return "*.ctm"
def defaultExtension(self):
return "ctm"
def writer( self, fileObject, optionString, accessMode ):
fileName = fileObject.fullName()
selection = OpenMaya.MSelectionList()
all = (accessMode == self.kExportAccessMode or accessMode == self.kSaveAccessMode)
dagIterator = None
if(all):
dagIterator = OpenMaya.MItDag(OpenMaya.MItDag.kBreadthFirst, OpenMaya.MFn.kGeometric)
else:
OpenMaya.MGlobal.getActiveSelectionList( selection )
dagIterator = OpenMaya.MItSelectionList ( selection, OpenMaya.MFn.kGeometric )
ctmindices = []
ctmvertices = []
ctmnormals = []
ctmtexcoords = []
indicesOffset = 0
while not dagIterator.isDone():
dagPath = OpenMaya.MDagPath()
if (all):
dagIterator.getPath(dagPath)
else:
dagIterator.getDagPath(dagPath)
fnMesh = None
try:
fnMesh = OpenMaya.MFnMesh( dagPath )
except:
dagIterator.next()
continue
meshPoints = OpenMaya.MPointArray()
fnMesh.getPoints( meshPoints,OpenMaya.MSpace.kWorld )
meshNormals = OpenMaya.MFloatVectorArray()
fnMesh.getNormals(meshNormals)
UVSets = []
fnMesh.getUVSetNames( UVSets )
u = OpenMaya.MFloatArray()
v = OpenMaya.MFloatArray()
fnMesh.getUVs( u, v, UVSets[0] )
iterPolys = OpenMaya.MItMeshPolygon( dagPath )
offset = 0
maxPoints = 0
normals = {}
uvs = {}
while not iterPolys.isDone():
if not iterPolys.hasValidTriangulation():
return OpenMaya.MStatus.kFailiure
uvSet = []
iterPolys.getUVSetNames(uvSet)
polygonVertices = OpenMaya.MIntArray()
iterPolys.getVertices( polygonVertices )
numTrianglesPx = OpenMaya.MScriptUtil()
numTrianglesPx.createFromInt(0)
numTrianglesPtr = numTrianglesPx.asIntPtr()
iterPolys.numTriangles(numTrianglesPtr)
numTriangles = OpenMaya.MScriptUtil(numTrianglesPtr).asInt()
offset = len(ctmvertices)
localindices = []
for i in range( numTriangles ):
points = OpenMaya.MPointArray()
indices = OpenMaya.MIntArray()
iterPolys.getTriangle( i, points,indices)
ctmindices.append (indicesOffset)
indicesOffset += 1
ctmindices.append (indicesOffset)
indicesOffset += 1
ctmindices.append (indicesOffset)
indicesOffset += 1
localindices.append(int(indices[0]))
localindices.append(int(indices[1]))
localindices.append(int(indices[2]))
localIndex = []
for gt in range(indices.length()) :
for gv in range( polygonVertices.length() ):
if indices[gt] == polygonVertices[gv]:
localIndex.append( gv )
break
normals[int(indices[0])] = (float(meshNormals[iterPolys.normalIndex(localIndex[0])].x),float(meshNormals[iterPolys.normalIndex(localIndex[0])].y),float(meshNormals[iterPolys.normalIndex(localIndex[0])].z))
normals[int(indices[1])] = (float(meshNormals[iterPolys.normalIndex(localIndex[1])].x),float(meshNormals[iterPolys.normalIndex(localIndex[1])].y),float(meshNormals[iterPolys.normalIndex(localIndex[1])].z))
normals[int(indices[2])] = (float(meshNormals[iterPolys.normalIndex(localIndex[2])].x),float(meshNormals[iterPolys.normalIndex(localIndex[2])].y),float(meshNormals[iterPolys.normalIndex(localIndex[2])].z))
uvID = [0,0,0]
for vtxInPolygon in range(3):
uvIDPx = OpenMaya.MScriptUtil()
uvIDPx.createFromInt(0)
uvIDPtr = numTrianglesPx.asIntPtr()
iterPolys.getUVIndex( localIndex[vtxInPolygon], uvIDPtr, UVSets[0] )
uvID[vtxInPolygon] = OpenMaya.MScriptUtil(uvIDPtr).asInt()
if (iterPolys.hasUVs()):
uvs[int(indices[0])] = (u[uvID[0]], v[uvID[0]])
uvs[int(indices[1])] = (u[uvID[1]], v[uvID[1]])
uvs[int(indices[2])] = (u[uvID[2]], v[uvID[2]])
for i in localindices:
ctmvertices.append (float(meshPoints[i].x))
ctmvertices.append (float(meshPoints[i].y))
ctmvertices.append (float(meshPoints[i].z))
ctmnormals.append(normals[i][0])
ctmnormals.append(normals[i][1])
ctmnormals.append(normals[i][2])
if (iterPolys.hasUVs()):
ctmtexcoords.append(uvs[i][0])
ctmtexcoords.append(uvs[i][1])
iterPolys.next()
dagIterator.next()
pindices = cast((openctm.CTMuint * len(ctmindices))(), POINTER(openctm.CTMuint))
pvertices = cast((openctm.CTMfloat * len(ctmvertices))(), POINTER(openctm.CTMfloat))
pnormals = cast((openctm.CTMfloat * len(ctmnormals))(), POINTER(openctm.CTMfloat))
ptexcoords = cast((openctm.CTMfloat * len(ctmtexcoords))(), POINTER(openctm.CTMfloat))
for i in range(len(ctmindices)):
pindices[i] = openctm.CTMuint(ctmindices[i])
for i in range(len(ctmvertices)):
pvertices[i] = openctm.CTMfloat(ctmvertices[i])
pnormals[i] = openctm.CTMfloat(ctmnormals[i])
for i in range(len(ctmtexcoords)):
ptexcoords[i] = openctm.CTMfloat(ctmtexcoords[i])
context = openctm.ctmNewContext(openctm.CTM_EXPORT)
comment = "Exported with OpenCTM exporter using Maya " + OpenMaya.MGlobal.mayaVersion()
openctm.ctmFileComment(context, c_char_p(comment))
openctm.ctmDefineMesh(context, pvertices, openctm.CTMuint(len(ctmvertices)/3), pindices, openctm.CTMuint(len(ctmindices)/3), pnormals)
openctm.ctmAddUVMap (context, ptexcoords,c_char_p() , c_char_p())
openctm.ctmSave(context, c_char_p(fileName))
openctm.ctmFreeContext(context)
e = openctm.ctmGetError(context)
if e != 0:
s = openctm.ctmErrorString(e)
print s
return OpenMaya.MStatus.kFailiure
else:
return OpenMaya.MStatus.kSuccess
def reader( self, fileObject, optionString, accessMode ):
return OpenMaya.MStatus.kFailiure
def translatorCreator():
return OpenMayaMPx.asMPxPtr( OpemCTMExporter() )
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject, "Autodesk", "10.0", "Any")
try:
mplugin.registerFileTranslator( kPluginTranslatorTypeName, None, translatorCreator )
except:
sys.stderr.write( "Failed to register command: %s\n" % kPluginTranslatorTypeName )
raise
def uninitializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
print "Plug-in OpenCTM Exporter uninitialized"
try:
mplugin.deregisterFileTranslator( kPluginTranslatorTypeName )
except:
sys.stderr.write( "Failed to unregister command: %s\n" % kPluginCmdName )
raise

View File

@@ -1,31 +0,0 @@
OpenCTM Maya export scripts
INSTRUCTIONS
============
The OpenCTM Maya export scripts makes it possible to export OpenCTM format files in Maya (http://autodesk.com/).
To use these scripts, they need to be properly installed along with the
OpenCTM shared library.
Windows:
--------
1) Copy "openctm.dll" to your maya plugin folder (e.g. C:\Program Files\Autodesk\Maya2008\bin\plug-ins for Maya 2008).
2) Copy openctm_translator.py to your maya plugin folder (e.g. C:\Program Files\Autodesk\Maya2008\bin\plug-ins for Maya 2008).
3) Copy openctm.py in /bindings/python/ to the same folder as openctm_translator.py (e.g. C:\Program Files\Autodesk\Maya2008\bin\plug-ins for Maya 2008).
Mac OS X:
---------
1) Copy the file "libopenctm.dylib" to /usr/local/lib (e.g. using
"sudo cp libopenctm.dylib /usr/local/lib/").
2) Copy openctm_translator.py to your maya plugin folder (e.g. /Users/Shared/Autodesk/maya/2010/plug-ins for Maya 2010).
3) Copy openctm.py in /bindings/python/ to the same folder as openctm_translator.py (e.g. /Users/Shared/Autodesk/maya/2010/plug-ins for Maya 2010).
Linux:
------
1) Copy the file "libopenctm.so" to /usr/lib (e.g. using
"sudo cp libopenctm.so /usr/lib/").

View File

@@ -1,432 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: 3ds.cpp
// Description: Implementation of the 3DS file format importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
#include <fstream>
#include <vector>
#include <list>
#include "3ds.h"
#ifdef _MSC_VER
typedef unsigned short uint16;
typedef unsigned int uint32;
#else
#include <stdint.h>
typedef uint16_t uint16;
typedef uint32_t uint32;
#endif
using namespace std;
// Known 3DS chunks
#define CHUNK_MAIN 0x4d4d
#define CHUNK_M3D_VERSION 0x0002
#define CHUNK_3DEDIT 0x3d3d
#define CHUNK_MESH_VERSION 0x3d3e
#define CHUNK_OBJECT 0x4000
#define CHUNK_TRIMESH 0x4100
#define CHUNK_VERTEXLIST 0x4110
#define CHUNK_MAPPINGCOORDS 0x4140
#define CHUNK_FACES 0x4120
#define CHUNK_MSH_MAT_GROUP 0x4130
#define CHUNK_MAT_ENTRY 0xafff
#define CHUNK_MAT_NAME 0xa000
#define CHUNK_MAT_TEXMAP 0xa200
#define CHUNK_MAT_MAPNAME 0xa300
// 3DS object class
class Obj3DS {
public:
vector<uint16> mIndices;
vector<Vector3> mVertices;
vector<Vector2> mUVCoords;
};
/// Read a 16-bit integer, endian independent.
static uint16 ReadInt16(istream &aStream)
{
unsigned char buf[2];
aStream.read((char *) buf, 2);
return ((uint16) buf[0]) | (((uint16) buf[1]) << 8);
}
/// Write a 16-bit integer, endian independent.
static void WriteInt16(ostream &aStream, uint16 aValue)
{
unsigned char buf[2];
buf[0] = aValue & 255;
buf[1] = (aValue >> 8) & 255;
aStream.write((char *) buf, 2);
}
/// Read a 32-bit integer, endian independent.
static uint32 ReadInt32(istream &aStream)
{
unsigned char buf[4];
aStream.read((char *) buf, 4);
return ((uint32) buf[0]) | (((uint32) buf[1]) << 8) |
(((uint32) buf[2]) << 16) | (((uint32) buf[3]) << 24);
}
/// Write a 32-bit integer, endian independent.
static void WriteInt32(ostream &aStream, uint32 aValue)
{
unsigned char buf[4];
buf[0] = aValue & 255;
buf[1] = (aValue >> 8) & 255;
buf[2] = (aValue >> 16) & 255;
buf[3] = (aValue >> 24) & 255;
aStream.write((char *) buf, 4);
}
/// Read a Vector2, endian independent.
static Vector2 ReadVector2(istream &aStream)
{
union {
uint32 i;
float f;
} val;
Vector2 result;
val.i = ReadInt32(aStream);
result.u = val.f;
val.i = ReadInt32(aStream);
result.v = val.f;
return result;
}
/// Write a Vector2, endian independent.
static void WriteVector2(ostream &aStream, Vector2 aValue)
{
union {
uint32 i;
float f;
} val;
val.f = aValue.u;
WriteInt32(aStream, val.i);
val.f = aValue.v;
WriteInt32(aStream, val.i);
}
/// Read a Vector3, endian independent.
static Vector3 ReadVector3(istream &aStream)
{
union {
uint32 i;
float f;
} val;
Vector3 result;
val.i = ReadInt32(aStream);
result.x = val.f;
val.i = ReadInt32(aStream);
result.y = val.f;
val.i = ReadInt32(aStream);
result.z = val.f;
return result;
}
/// Write a Vector3, endian independent.
static void WriteVector3(ostream &aStream, Vector3 aValue)
{
union {
uint32 i;
float f;
} val;
val.f = aValue.x;
WriteInt32(aStream, val.i);
val.f = aValue.y;
WriteInt32(aStream, val.i);
val.f = aValue.z;
WriteInt32(aStream, val.i);
}
/// Import a 3DS file from a file.
void Import_3DS(const char * aFileName, Mesh * aMesh)
{
// Clear the mesh
aMesh->Clear();
// Open the input file
ifstream f(aFileName, ios::in | ios::binary);
if(f.fail())
throw_runtime_error("Could not open input file.");
// Get file size
f.seekg(0, ios::end);
uint32 fileSize = (uint32)f.tellg();
f.seekg(0, ios::beg);
// Check file size (rough initial check)
if(fileSize < 6)
throw_runtime_error("Invalid 3DS file format.");
uint16 chunk, count;
uint32 chunkLen;
// Read & check file header identifier
chunk = ReadInt16(f);
chunkLen = ReadInt32(f);
if((chunk != CHUNK_MAIN) || (chunkLen != fileSize))
throw_runtime_error("Invalid 3DS file format.");
// Parse chunks, and store the data in a temporary list, objList...
Obj3DS * obj = 0;
list<Obj3DS> objList;
bool hasUVCoords = false;
while(uint32(f.tellg()) < fileSize)
{
// Read next chunk
chunk = ReadInt16(f);
chunkLen = ReadInt32(f);
// What chunk did we get?
switch(chunk)
{
// 3D Edit -> Step into
case CHUNK_3DEDIT:
break;
// Object -> Step into
case CHUNK_OBJECT:
// Skip object name (null terminated string)
while((uint32(f.tellg()) < fileSize) && f.get()) {};
// Create a new object
objList.push_back(Obj3DS());
obj = &objList.back();
break;
// Triangle mesh -> Step into
case CHUNK_TRIMESH:
break;
// Vertex list (point coordinates)
case CHUNK_VERTEXLIST:
count = ReadInt16(f);
if((!obj) || ((obj->mVertices.size() > 0) && (obj->mVertices.size() != count)))
{
f.seekg(count * 12, ios::cur);
break;
}
if(obj->mVertices.size() == 0)
obj->mVertices.resize(count);
for(uint16 i = 0; i < count; ++ i)
obj->mVertices[i] = ReadVector3(f);
break;
// Texture map coordinates (UV coordinates)
case CHUNK_MAPPINGCOORDS:
count = ReadInt16(f);
if((!obj) || ((obj->mUVCoords.size() > 0) && (obj->mUVCoords.size() != count)))
{
f.seekg(count * 8, ios::cur);
break;
}
if(obj->mUVCoords.size() == 0)
obj->mUVCoords.resize(count);
for(uint16 i = 0; i < count; ++ i)
obj->mUVCoords[i] = ReadVector2(f);
if(count > 0)
hasUVCoords = true;
break;
// Face description (triangle indices)
case CHUNK_FACES:
count = ReadInt16(f);
if(!obj)
{
f.seekg(count * 8, ios::cur);
break;
}
if(obj->mIndices.size() == 0)
obj->mIndices.resize(3 * count);
for(uint32 i = 0; i < count; ++ i)
{
obj->mIndices[i * 3] = ReadInt16(f);
obj->mIndices[i * 3 + 1] = ReadInt16(f);
obj->mIndices[i * 3 + 2] = ReadInt16(f);
ReadInt16(f); // Skip face flag
}
break;
default: // Unknown/ignored - skip past this one
f.seekg(chunkLen - 6, ios::cur);
}
}
// Close the input file
f.close();
// Convert the loaded object list to the mesh structore (merge all geometries)
aMesh->Clear();
for(list<Obj3DS>::iterator o = objList.begin(); o != objList.end(); ++ o)
{
// Append...
uint32 idxOffset = (uint32)aMesh->mIndices.size();
uint32 vertOffset = (uint32)aMesh->mVertices.size();
aMesh->mIndices.resize(idxOffset + (*o).mIndices.size());
aMesh->mVertices.resize(vertOffset + (*o).mVertices.size());
if(hasUVCoords)
aMesh->mTexCoords.resize(vertOffset + (*o).mVertices.size());
// Transcode the data
for(uint32 i = 0; i < (*o).mIndices.size(); ++ i)
aMesh->mIndices[idxOffset + i] = vertOffset + uint32((*o).mIndices[i]);
for(uint32 i = 0; i < (*o).mVertices.size(); ++ i)
aMesh->mVertices[vertOffset + i] = (*o).mVertices[i];
if(hasUVCoords)
{
if((*o).mUVCoords.size() == (*o).mVertices.size())
for(uint32 i = 0; i < (*o).mVertices.size(); ++ i)
aMesh->mTexCoords[vertOffset + i] = (*o).mUVCoords[i];
else
for(uint32 i = 0; i < (*o).mVertices.size(); ++ i)
aMesh->mTexCoords[vertOffset + i] = Vector2(0.0f, 0.0f);
}
}
}
/// Export a 3DS file to a file.
void Export_3DS(const char * aFileName, Mesh * aMesh, Options &aOptions)
{
// First, check that the mesh fits in a 3DS file (at most 65535 triangles
// and 65535 vertices are supported).
if((aMesh->mIndices.size() > (3*65535)) || (aMesh->mVertices.size() > 65535))
throw_runtime_error("The mesh is too large to fit in a 3DS file.");
// What should we export?
bool exportTexCoords = aMesh->HasTexCoords() && !aOptions.mNoTexCoords;
// Predefined names / strings
string objName("Object1");
string matName("Material0");
// Get mesh properties
uint32 triCount = (uint32)(aMesh->mIndices.size() / 3);
uint32 vertCount = (uint32)aMesh->mVertices.size();
// Calculate the material chunk size
uint32 materialSize = 0;
uint32 matGroupSize = 0;
if(exportTexCoords && aMesh->mTexFileName.size() > 0)
{
materialSize += 24 + (uint32)matName.size() + 1 + (uint32)aMesh->mTexFileName.size() + 1;
matGroupSize += 8 + (uint32)matName.size() + 1 + 2 * triCount;
}
// Calculate the mesh chunk size
uint32 triMeshSize = 22 + 8 * triCount + 12 * vertCount + matGroupSize;
if(exportTexCoords)
triMeshSize += 8 + 8 * vertCount;
// Calculate the total file size
uint32 fileSize = 38 + (uint32)objName.size() + 1 + materialSize + triMeshSize;
// Open the output file
ofstream f(aFileName, ios::out | ios::binary);
if(f.fail())
throw_runtime_error("Could not open output file.");
// Write file header
WriteInt16(f, CHUNK_MAIN);
WriteInt32(f, fileSize);
WriteInt16(f, CHUNK_M3D_VERSION);
WriteInt32(f, 6 + 4);
WriteInt32(f, 0x00000003);
// 3D Edit chunk
WriteInt16(f, CHUNK_3DEDIT);
WriteInt32(f, 16 + materialSize + (uint32)objName.size() + 1 + triMeshSize);
WriteInt16(f, CHUNK_MESH_VERSION);
WriteInt32(f, 6 + 4);
WriteInt32(f, 0x00000003);
// Material chunk
if(materialSize > 0)
{
WriteInt16(f, CHUNK_MAT_ENTRY);
WriteInt32(f, materialSize);
WriteInt16(f, CHUNK_MAT_NAME);
WriteInt32(f, 6 + (uint32)matName.size() + 1);
f.write(matName.c_str(), (uint32)matName.size() + 1);
WriteInt16(f, CHUNK_MAT_TEXMAP);
WriteInt32(f, 12 + (uint32)aMesh->mTexFileName.size() + 1);
WriteInt16(f, CHUNK_MAT_MAPNAME);
WriteInt32(f, 6 + (uint32)aMesh->mTexFileName.size() + 1);
f.write(aMesh->mTexFileName.c_str(), (uint32)aMesh->mTexFileName.size() + 1);
}
// Object chunk
WriteInt16(f, CHUNK_OBJECT);
WriteInt32(f, 6 + (uint32)objName.size() + 1 + triMeshSize);
f.write(objName.c_str(), (uint32)objName.size() + 1);
// Triangle Mesh chunk
WriteInt16(f, CHUNK_TRIMESH);
WriteInt32(f, triMeshSize);
// Vertex List chunk
WriteInt16(f, CHUNK_VERTEXLIST);
WriteInt32(f, 8 + 12 * vertCount);
WriteInt16(f, vertCount);
for(uint32 i = 0; i < vertCount; ++ i)
WriteVector3(f, aMesh->mVertices[i]);
// Mapping Coordinates chunk
if(exportTexCoords)
{
WriteInt16(f, CHUNK_MAPPINGCOORDS);
WriteInt32(f, 8 + 8 * vertCount);
WriteInt16(f, vertCount);
for(uint32 i = 0; i < vertCount; ++ i)
WriteVector2(f, aMesh->mTexCoords[i]);
}
// Faces chunk
WriteInt16(f, CHUNK_FACES);
WriteInt32(f, 8 + 8 * triCount);
WriteInt16(f, triCount);
for(uint32 i = 0; i < triCount; ++ i)
{
WriteInt16(f, uint16(aMesh->mIndices[i * 3]));
WriteInt16(f, uint16(aMesh->mIndices[i * 3 + 1]));
WriteInt16(f, uint16(aMesh->mIndices[i * 3 + 2]));
WriteInt16(f, 0);
}
// Material Group chunk
if(matGroupSize > 0)
{
WriteInt16(f, CHUNK_MSH_MAT_GROUP);
WriteInt32(f, matGroupSize);
f.write(matName.c_str(), matName.size() + 1);
WriteInt16(f, triCount);
for(uint16 i = 0; i < triCount; ++ i)
WriteInt16(f, i);
}
}

View File

@@ -1,40 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: 3ds.h
// Description: Interface for the 3DS file format importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __3DS_H_
#define __3DS_H_
#include "mesh.h"
#include "convoptions.h"
/// Import a 3DS file from a file.
void Import_3DS(const char * aFileName, Mesh * aMesh);
/// Export a 3DS file to a file.
void Export_3DS(const char * aFileName, Mesh * aMesh, Options &aOptions);
#endif // __3DS_H_

View File

@@ -1,112 +0,0 @@
###############################################################################
# Product: OpenCTM tools
# File: Makefile.linux
# Description: Makefile for the OpenCTM tools, Linux version
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
OPENCTMDIR = ../lib
GLEWDIR = glew
JPEGDIR = jpeg
RPLYDIR = rply
TINYXMLDIR = tinyxml
ZLIBDIR = zlib
PNGLITEDIR = pnglite
CPP = g++
CPPFLAGS = -c -O3 -W -Wall `pkg-config --cflags gtk+-2.0` -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(JPEGDIR) -I$(TINYXMLDIR) -I$(GLEWDIR) -I$(ZLIBDIR) -I$(PNGLITEDIR)
MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o off.o wrl.o
CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS)
CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_gtk.o convoptions.o glew.o pnglite.o $(MESHOBJS)
CTMBENCHOBJS = ctmbench.o systimer.o
all: ctmconv ctmviewer ctmbench
clean:
rm -f ctmconv ctmviewer ctmbench $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c phong_frag.h phong_vert.h
cd $(JPEGDIR) && $(MAKE) -f makefile.linux clean
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux clean
cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux clean
libopenctm.so: $(OPENCTMDIR)/libopenctm.so
cp $< $@
ctmconv: $(CTMCONVOBJS) $(TINYXMLDIR)/libtinyxml.a libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) $(CTMCONVOBJS) -Wl,-rpath,. -lopenctm -ltinyxml
ctmviewer: $(CTMVIEWEROBJS) $(JPEGDIR)/libjpeg.a $(TINYXMLDIR)/libtinyxml.a $(ZLIBDIR)/libz.a libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) -L$(JPEGDIR) -L$(ZLIBDIR) $(CTMVIEWEROBJS) -Wl,-rpath,. -lopenctm -ltinyxml -ljpeg -lz -lglut -lGL -lGLU `pkg-config --libs gtk+-2.0`
ctmbench: $(CTMBENCHOBJS) libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -Wl,-rpath,. -lopenctm
%.o: %.cpp
$(CPP) $(CPPFLAGS) -o $@ $<
ctmconv.o: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
ctmviewer.o: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons/icon_open.h icons/icon_save.h icons/icon_help.h
ctmbench.o: ctmbench.cpp systimer.h
common.o: common.cpp common.h
image.o: image.cpp image.h common.h $(JPEGDIR)/libjpeg.a
systimer.o: systimer.cpp systimer.h
sysdialog_gtk.o: sysdialog_gtk.cpp sysdialog.h
convoptions.o: convoptions.cpp convoptions.h
mesh.o: mesh.cpp mesh.h convoptions.h
meshio.o: meshio.cpp common.h convoptions.h mesh.h ctm.h ply.h stl.h 3ds.h dae.h obj.h lwo.h off.h wrl.h
ctm.o: ctm.cpp ctm.h mesh.h convoptions.h
ply.o: ply.cpp ply.h mesh.h convoptions.h common.h
stl.o: stl.cpp stl.h mesh.h convoptions.h
3ds.o: 3ds.cpp 3ds.h mesh.h convoptions.h
dae.o: dae.cpp dae.h mesh.h convoptions.h
obj.o: obj.cpp obj.h mesh.h convoptions.h common.h
lwo.o: lwo.cpp lwo.h mesh.h convoptions.h
off.o: off.cpp off.h mesh.h convoptions.h common.h
wrl.o: wrl.cpp wrl.h mesh.h convoptions.h common.h
phong_vert.h: phong.vert bin2c
./bin2c phong.vert phongVertSrc > $@
phong_frag.h: phong.frag bin2c
./bin2c phong.frag phongFragSrc > $@
bin2c: bin2c.cpp
$(CPP) -Os -W -Wall -o $@ $<
$(JPEGDIR)/libjpeg.a:
cd $(JPEGDIR) && $(MAKE) -f makefile.linux libjpeg.a
$(ZLIBDIR)/libz.a:
cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux
glew.o: $(GLEWDIR)/glew.c
gcc -c -Os -W -I$(GLEWDIR) -o $@ $<
rply.o: $(RPLYDIR)/rply.c
gcc -c -O2 -W -I$(RPLYDIR) -o $@ $<
pnglite.o: $(PNGLITEDIR)/pnglite.c
gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
$(TINYXMLDIR)/libtinyxml.a:
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux

View File

@@ -1,117 +0,0 @@
###############################################################################
# Product: OpenCTM tools
# File: Makefile.macosx
# Description: Makefile for the OpenCTM tools, Mac OS X version
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
OPENCTMDIR = ../lib
GLEWDIR = glew
JPEGDIR = jpeg
RPLYDIR = rply
TINYXMLDIR = tinyxml
ZLIBDIR = zlib
PNGLITEDIR = pnglite
CPP = g++
CPPFLAGS = -c -O3 -W -Wall -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(JPEGDIR) -I$(TINYXMLDIR) -I$(GLEWDIR) -I$(ZLIBDIR) -I$(PNGLITEDIR)
OCPP = g++ -x objective-c++
OCPPFLAGS = -c -O3 -W -Wall
MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o off.o wrl.o
CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS)
CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_mac.o convoptions.o glew.o pnglite.o $(MESHOBJS)
CTMBENCHOBJS = ctmbench.o systimer.o
all: ctmconv ctmviewer ctmbench
clean:
rm -f ctmconv ctmviewer ctmbench $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c phong_frag.h phong_vert.h
cd $(JPEGDIR) && $(MAKE) -f makefile.macosx clean
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.macosx clean
cd $(ZLIBDIR) && $(MAKE) -f Makefile.macosx clean
libopenctm.so: $(OPENCTMDIR)/libopenctm.so
cp $< $@
ctmconv: $(CTMCONVOBJS) $(TINYXMLDIR)/libtinyxml.a $(OPENCTMDIR)/libopenctm.dylib
$(CPP) -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) $(CTMCONVOBJS) -lopenctm -ltinyxml
ctmviewer: $(CTMVIEWEROBJS) $(JPEGDIR)/libjpeg.a $(TINYXMLDIR)/libtinyxml.a $(ZLIBDIR)/libz.a $(OPENCTMDIR)/libopenctm.dylib
$(CPP) -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) -L$(JPEGDIR) -L$(ZLIBDIR) $(CTMVIEWEROBJS) -lopenctm -ltinyxml -ljpeg -lz -framework GLUT -framework OpenGL -framework Cocoa
ctmbench: $(CTMBENCHOBJS) $(OPENCTMDIR)/libopenctm.dylib
$(CPP) -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -lopenctm
%.o: %.cpp
$(CPP) $(CPPFLAGS) -o $@ $<
%.o: %.mm
$(OCPP) $(OCPPFLAGS) -o $@ $<
ctmconv.o: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
ctmviewer.o: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons/icon_open.h icons/icon_save.h icons/icon_help.h
ctmbench.o: ctmbench.cpp systimer.h
common.o: common.cpp common.h
image.o: image.cpp image.h common.h $(JPEGDIR)/libjpeg.a
systimer.o: systimer.cpp systimer.h
sysdialog_mac.o: sysdialog_mac.mm sysdialog.h
convoptions.o: convoptions.cpp convoptions.h
mesh.o: mesh.cpp mesh.h convoptions.h
meshio.o: meshio.cpp common.h convoptions.h mesh.h ctm.h ply.h stl.h 3ds.h dae.h obj.h lwo.h off.h wrl.h
ctm.o: ctm.cpp ctm.h mesh.h convoptions.h
ply.o: ply.cpp ply.h mesh.h convoptions.h common.h
stl.o: stl.cpp stl.h mesh.h convoptions.h
3ds.o: 3ds.cpp 3ds.h mesh.h convoptions.h
dae.o: dae.cpp dae.h mesh.h convoptions.h
obj.o: obj.cpp obj.h mesh.h convoptions.h common.h
lwo.o: lwo.cpp lwo.h mesh.h convoptions.h
off.o: off.cpp off.h mesh.h convoptions.h common.h
wrl.o: wrl.cpp wrl.h mesh.h convoptions.h common.h
phong_vert.h: phong.vert bin2c
./bin2c phong.vert phongVertSrc > $@
phong_frag.h: phong.frag bin2c
./bin2c phong.frag phongFragSrc > $@
bin2c: bin2c.cpp
$(CPP) -Os -W -Wall -o $@ $<
$(JPEGDIR)/libjpeg.a:
cd $(JPEGDIR) && $(MAKE) -f makefile.macosx libjpeg.a
$(ZLIBDIR)/libz.a:
cd $(ZLIBDIR) && $(MAKE) -f Makefile.macosx
glew.o: $(GLEWDIR)/glew.c
gcc -c -Os -W -I$(GLEWDIR) -o $@ $<
rply.o: $(RPLYDIR)/rply.c
gcc -c -O2 -W -I$(RPLYDIR) -o $@ $<
pnglite.o: $(PNGLITEDIR)/pnglite.c
gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
$(TINYXMLDIR)/libtinyxml.a:
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.macosx

View File

@@ -1,119 +0,0 @@
###############################################################################
# Product: OpenCTM tools
# File: Makefile.mingw
# Description: Makefile for the OpenCTM tools, MinGW32 version
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
OPENCTMDIR = ..\lib
GLEWDIR = glew
JPEGDIR = jpeg
RPLYDIR = rply
TINYXMLDIR = tinyxml
ZLIBDIR = zlib
PNGLITEDIR = pnglite
CPP = g++
CPPFLAGS = -c -O3 -W -Wall -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(JPEGDIR) -I$(TINYXMLDIR) -I$(GLEWDIR) -I$(ZLIBDIR) -I$(PNGLITEDIR) -DGLEW_STATIC
RC = windres
MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o off.o wrl.o
CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS) ctmconv-res.o
CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_win.o convoptions.o glew.o pnglite.o $(MESHOBJS) ctmviewer-res.o
CTMBENCHOBJS = ctmbench.o systimer.o
all: ctmconv.exe ctmviewer.exe ctmbench.exe
clean:
del /Q ctmconv.exe ctmviewer.exe ctmbench.exe $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c.exe phong_frag.h phong_vert.h
cd $(JPEGDIR) && $(MAKE) -f Makefile.mingw clean
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.mingw clean
cd $(ZLIBDIR) && $(MAKE) -f Makefile.mingw clean
openctm.dll: $(OPENCTMDIR)\openctm.dll
copy $< $@
ctmconv.exe: $(CTMCONVOBJS) $(TINYXMLDIR)/libtinyxml.a openctm.dll
$(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) $(CTMCONVOBJS) -lopenctm -ltinyxml
ctmviewer.exe: $(CTMVIEWEROBJS) $(JPEGDIR)/libjpeg.a $(TINYXMLDIR)/libtinyxml.a $(ZLIBDIR)/libz.a openctm.dll
$(CPP) -mwindows -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) -L$(JPEGDIR) -L$(ZLIBDIR) $(CTMVIEWEROBJS) -lopenctm -ltinyxml -ljpeg -lz -lfreeglut -lopengl32 -lglu32 -lcomdlg32
ctmbench.exe: $(CTMBENCHOBJS) openctm.dll
$(CPP) -s -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -lopenctm
%.o: %.cpp
$(CPP) $(CPPFLAGS) -o $@ $<
ctmconv.o: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
ctmviewer.o: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons/icon_open.h icons/icon_save.h icons/icon_help.h
ctmbench.o: ctmbench.cpp systimer.h
common.o: common.cpp common.h
image.o: image.cpp image.h common.h $(JPEGDIR)/libjpeg.a
systimer.o: systimer.cpp systimer.h
sysdialog_win.o: sysdialog_win.cpp sysdialog.h
convoptions.o: convoptions.cpp convoptions.h
mesh.o: mesh.cpp mesh.h convoptions.h
meshio.o: meshio.cpp common.h convoptions.h mesh.h ctm.h ply.h stl.h 3ds.h dae.h obj.h lwo.h off.h wrl.h
ctm.o: ctm.cpp ctm.h mesh.h convoptions.h
ply.o: ply.cpp ply.h mesh.h convoptions.h common.h
stl.o: stl.cpp stl.h mesh.h convoptions.h
3ds.o: 3ds.cpp 3ds.h mesh.h convoptions.h
dae.o: dae.cpp dae.h mesh.h convoptions.h
obj.o: obj.cpp obj.h mesh.h convoptions.h common.h
lwo.o: lwo.cpp lwo.h mesh.h convoptions.h
off.o: off.cpp off.h mesh.h convoptions.h common.h
wrl.o: wrl.cpp wrl.h mesh.h convoptions.h common.h
phong_vert.h: phong.vert bin2c.exe
bin2c.exe phong.vert phongVertSrc > $@
phong_frag.h: phong.frag bin2c.exe
bin2c.exe phong.frag phongFragSrc > $@
bin2c.exe: bin2c.cpp
$(CPP) -Os -W -Wall -o $@ $<
ctmconv-res.o: ctmconv.rc icons\openctm.ico
$(RC) $< $@
ctmviewer-res.o: ctmviewer.rc icons\openctm.ico
$(RC) $< $@
$(JPEGDIR)/libjpeg.a:
cd $(JPEGDIR) && $(MAKE) -f Makefile.mingw libjpeg.a
$(ZLIBDIR)/libz.a:
cd $(ZLIBDIR) && $(MAKE) -f Makefile.mingw
glew.o: $(GLEWDIR)/glew.c
gcc -c -Os -W -I$(GLEWDIR) -DGLEW_STATIC -o $@ $<
rply.o: $(RPLYDIR)/rply.c
gcc -c -O2 -W -I$(RPLYDIR) -o $@ $<
pnglite.o: $(PNGLITEDIR)/pnglite.c
gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
$(TINYXMLDIR)/libtinyxml.a:
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.mingw

View File

@@ -1,119 +0,0 @@
###############################################################################
# Product: OpenCTM tools
# File: Makefile.msvc
# Description: Makefile for the OpenCTM tools, MS Visual Studio version
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
OPENCTMDIR = ..\lib
GLEWDIR = glew
JPEGDIR = jpeg
RPLYDIR = rply
TINYXMLDIR = tinyxml
ZLIBDIR = zlib
PNGLITEDIR = pnglite
CPP = cl
CPPFLAGS = /nologo /c /Ox /W3 /EHsc /I$(OPENCTMDIR) /I$(RPLYDIR) /I$(JPEGDIR) /I$(TINYXMLDIR) /I$(GLEWDIR) /I$(ZLIBDIR) /I$(PNGLITEDIR) /DGLEW_STATIC /D_CRT_SECURE_NO_WARNINGS
RC = rc
MESHOBJS = mesh.obj meshio.obj ctm.obj ply.obj rply.obj stl.obj 3ds.obj dae.obj obj.obj lwo.obj off.obj wrl.obj
CTMCONVOBJS = ctmconv.obj common.obj systimer.obj convoptions.obj $(MESHOBJS) ctmconv.res
CTMVIEWEROBJS = ctmviewer.obj common.obj image.obj systimer.obj sysdialog_win.obj convoptions.obj glew.obj pnglite.obj $(MESHOBJS) ctmviewer.res
CTMBENCHOBJS = ctmbench.obj systimer.obj
all: ctmconv.exe ctmviewer.exe ctmbench.exe
clean:
del /Q ctmconv.exe ctmviewer.exe ctmbench.exe $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c.exe phong_frag.h phong_vert.h
cd $(JPEGDIR) && $(MAKE) /fmakefile.vc cleanlib
cd $(TINYXMLDIR) && $(MAKE) /fMakefile.msvc clean
cd $(ZLIBDIR) && $(MAKE) /fMakefile.msvc clean
openctm.dll: $(OPENCTMDIR)\openctm.dll
copy $(OPENCTMDIR)\openctm.dll openctm.dll
ctmconv.exe: $(CTMCONVOBJS) $(TINYXMLDIR)\tinyxml.lib openctm.dll
$(CPP) /nologo /Fe$@ $(CTMCONVOBJS) /link /LIBPATH:$(OPENCTMDIR) /LIBPATH:$(TINYXMLDIR) openctm.lib tinyxml.lib
ctmviewer.exe: $(CTMVIEWEROBJS) $(JPEGDIR)\libjpeg.lib $(TINYXMLDIR)\tinyxml.lib $(ZLIBDIR)\libz.lib openctm.dll
$(CPP) /nologo /Fe$@ $(CTMVIEWEROBJS) /link /subsystem:windows /entry:mainCRTStartup /LIBPATH:$(OPENCTMDIR) /LIBPATH:$(TINYXMLDIR) /LIBPATH:$(JPEGDIR) /LIBPATH:$(ZLIBDIR) openctm.lib tinyxml.lib glut.lib libjpeg.lib libz.lib opengl32.lib glu32.lib
ctmbench.exe: $(CTMBENCHOBJS) openctm.dll
$(CPP) /nologo /Fe$@ $(CTMBENCHOBJS) /link /LIBPATH:$(OPENCTMDIR) openctm.lib
.cpp.obj:
$(CPP) $(CPPFLAGS) /Fo$@ $<
ctmconv.obj: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
ctmviewer.obj: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons\icon_open.h icons\icon_save.h icons\icon_help.h
ctmbench.obj: ctmbench.cpp systimer.h
common.obj: common.cpp common.h
image.obj: image.cpp image.h common.h $(JPEGDIR)\libjpeg.lib
systimer.obj: systimer.cpp systimer.h
sysdialog_win.obj: sysdialog_win.cpp sysdialog.h
convoptions.obj: convoptions.cpp convoptions.h
mesh.obj: mesh.cpp mesh.h convoptions.h
meshio.obj: meshio.cpp common.h convoptions.h mesh.h ctm.h ply.h stl.h 3ds.h dae.h obj.h lwo.h off.h wrl.h
ctm.obj: ctm.cpp ctm.h mesh.h convoptions.h
ply.obj: ply.cpp ply.h mesh.h convoptions.h common.h
stl.obj: stl.cpp stl.h mesh.h convoptions.h
3ds.obj: 3ds.cpp 3ds.h mesh.h convoptions.h
dae.obj: dae.cpp dae.h mesh.h convoptions.h
obj.obj: obj.cpp obj.h mesh.h convoptions.h common.h
lwo.obj: lwo.cpp lwo.h mesh.h convoptions.h
off.obj: off.cpp off.h mesh.h convoptions.h common.h
wrl.obj: wrl.cpp wrl.h mesh.h convoptions.h common.h
phong_vert.h: phong.vert bin2c.exe
bin2c.exe phong.vert phongVertSrc > $@
phong_frag.h: phong.frag bin2c.exe
bin2c.exe phong.frag phongFragSrc > $@
bin2c.exe: bin2c.cpp
$(CPP) /nologo /Ox /W3 /EHsc /Fe$@ bin2c.cpp
ctmconv.res: ctmconv.rc icons\openctm.ico
$(RC) ctmconv.rc
ctmviewer.res: ctmviewer.rc icons\openctm.ico
$(RC) ctmviewer.rc
$(JPEGDIR)\libjpeg.lib:
cd $(JPEGDIR) && $(MAKE) /fmakefile.vc libjpeg.lib
$(ZLIBDIR)\libz.lib:
cd $(ZLIBDIR) && $(MAKE) /fMakefile.msvc
glew.obj: $(GLEWDIR)\glew.c
cl /nologo /c /Ox /W3 /I$(GLEWDIR) /DGLEW_STATIC /Fo$@ $(GLEWDIR)\glew.c
rply.obj: $(RPLYDIR)\rply.c
cl /nologo /c /Ox /W3 /I$(RPLYDIR) /D_CRT_SECURE_NO_WARNINGS /Fo$@ $(RPLYDIR)\rply.c
pnglite.obj: $(PNGLITEDIR)\pnglite.c
cl /nologo /c /Ox /W3 /I$(PNGLITEDIR) /D_CRT_SECURE_NO_WARNINGS /Fo$@ $(PNGLITEDIR)\pnglite.c
$(TINYXMLDIR)\tinyxml.lib:
cd $(TINYXMLDIR) && $(MAKE) /fMakefile.msvc

View File

@@ -1,74 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: bin2c.cpp
// Description: Binary to C source code file converter (used for building the
/// tools).
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char ** argv)
{
// Check arguments
if(argc != 3)
{
cerr << "Usage: " << argv[0] << " file varname" << endl;
return 0;
}
// Open input file
ifstream f(argv[1], ios::binary | ios::in);
if(f.fail())
{
cerr << "Unable to open file: " << argv[1] << endl;
return 0;
}
// Read & translate input file and print to standard out...
cout << "static const unsigned char " << argv[2] << "[] = {" << endl;
while(!f.eof())
{
unsigned char buf[19];
f.read((char *) buf, 19);
unsigned int count = f.gcount();
if(count > 0)
{
cout << " ";
for(unsigned int i = 0; i < count; ++ i)
cout << int(buf[i]) << ",";
cout << endl;
}
}
cout << " 0" << endl;
cout << "};" << endl;
// Close input file
f.close();
return 0;
}

View File

@@ -1,97 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: common.cpp
// Description: Miscellaneous helper functions.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
using namespace std;
// Convert a string to upper case.
string UpperCase(const string &aString)
{
string result(aString);
for(unsigned int i = 0; i < result.size(); ++ i)
result[i] = toupper(result[i]);
return result;
}
// Trim heading and trailing white spaces of a string
string TrimString(const string &aString)
{
size_t l = aString.size();
size_t p1 = 0, p2 = l - 1;
while((p1 < p2) && IsWhiteSpace(aString[p1]))
++ p1;
while((p2 > p1) && IsWhiteSpace(aString[p2]))
-- p2;
return aString.substr(p1, p2 - p1 + 1);
}
// Extract the file name of a file path (excluding the path).
string ExtractFileName(const string &aString)
{
string result = "";
size_t pathPos = aString.rfind("/");
if(pathPos == string::npos)
pathPos = aString.rfind("\\");
if(pathPos != string::npos)
result = aString.substr(pathPos + 1);
return result;
}
// Extract the file path of a file path (excluding the file name).
string ExtractFilePath(const string &aString)
{
string result = "";
size_t pathPos = aString.rfind("/");
if(pathPos == string::npos)
pathPos = aString.rfind("\\");
if(pathPos != string::npos)
result = aString.substr(0, pathPos);
return result;
}
// Extract the file extension of a file name.
string ExtractFileExt(const string &aString)
{
string result = "";
size_t extPos = aString.rfind(".");
if(extPos != string::npos)
result = aString.substr(extPos);
return result;
}
// Check if a character is an end-of-line marker or not
bool IsEOL(const char c)
{
return (c == '\n') || (c == '\r');
}
// Check if a character is a white space or not
bool IsWhiteSpace(const char c)
{
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r');
}

View File

@@ -1,56 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: common.h
// Description: Miscellaneous helper functions.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __COMMON_H_
#define __COMMON_H_
#include <string>
void throw_runtime_error(std::string str);
// Convert a string to upper case.
std::string UpperCase(const std::string &aString);
// Trim heading and trailing white spaces of a string
std::string TrimString(const std::string &aString);
// Extract the file name of a file path (excluding the path).
std::string ExtractFileName(const std::string &aString);
// Extract the file path of a file path (excluding the file name).
std::string ExtractFilePath(const std::string &aString);
// Extract the file extension of a file name.
std::string ExtractFileExt(const std::string &aString);
// Check if a character is an end-of-line marker or not
bool IsEOL(const char c);
// Check if a character is a white space or not
bool IsWhiteSpace(const char c);
#endif // __COMMON_H_

View File

@@ -1,190 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: convoptions.cpp
// Description: Implementation of the conversion options class.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
#include <string>
#include <sstream>
#include "convoptions.h"
using namespace std;
/// Constructor
Options::Options()
{
// Set default values
mScale = 1.0f;
mUpAxis = uaZ;
mFlipTriangles = false;
mCalcNormals = false;
mNoNormals = false;
mNoTexCoords = false;
mNoColors = false;
mMethod = CTM_METHOD_MG2;
mLevel = 1;
mVertexPrecision = 0.0f;
mVertexPrecisionRel = 0.01f;
mNormalPrecision = 1.0f / 256.0f;
mTexMapPrecision = 1.0f / 4096.0f;
mColorPrecision = 1.0f / 256.0f;
mComment = string("");
mTexFileName = string("");
}
/// Convert a string to a floating point value
static CTMfloat GetFloatArg(char * aFloatString)
{
stringstream s;
s << aFloatString;
s.seekg(0);
CTMfloat f;
s >> f;
return f;
}
/// Convert a string to an integer value
static CTMint GetIntArg(char * aIntString)
{
stringstream s;
s << aIntString;
s.seekg(0);
CTMint i;
s >> i;
return i;
}
/// Get options from the command line arguments
void Options::GetFromArgs(int argc, char **argv, int aStartIdx)
{
for(int i = aStartIdx; i < argc; ++ i)
{
string cmd(argv[i]);
if((cmd == string("--scale")) && (i < (argc - 1)))
{
mScale = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--upaxis")) && (i < (argc - 1)))
{
string upaxis(argv[i + 1]);
++ i;
if(upaxis == string("X"))
mUpAxis = uaX;
else if(upaxis == string("Y"))
mUpAxis = uaY;
else if(upaxis == string("Z"))
mUpAxis = uaZ;
else if(upaxis == string("-X"))
mUpAxis = uaNX;
else if(upaxis == string("-Y"))
mUpAxis = uaNY;
else if(upaxis == string("-Z"))
mUpAxis = uaNZ;
else
throw_runtime_error("Invalid up axis (use X, Y, Z, -X, -Y or -Z).");
}
else if(cmd == string("--flip"))
{
mFlipTriangles = true;
}
else if(cmd == string("--calc-normals"))
{
mCalcNormals = true;
}
else if(cmd == string("--no-normals"))
{
mNoNormals = true;
}
else if(cmd == string("--no-texcoords"))
{
mNoTexCoords = true;
}
else if(cmd == string("--no-colors"))
{
mNoColors = true;
}
else if((cmd == string("--method")) && (i < (argc - 1)))
{
string method(argv[i + 1]);
++ i;
if(method == string("RAW"))
mMethod = CTM_METHOD_RAW;
else if(method == string("MG1"))
mMethod = CTM_METHOD_MG1;
else if(method == string("MG2"))
mMethod = CTM_METHOD_MG2;
else
throw_runtime_error("Invalid method (use RAW, MG1 or MG2).");
}
else if((cmd == string("--level")) && (i < (argc - 1)))
{
CTMint val = GetIntArg(argv[i + 1]);
if( (val < 0) || (val > 9) )
throw_runtime_error("Invalid compression level (it must be in the range 0 - 9).");
mLevel = CTMuint(val);
++ i;
}
else if((cmd == string("--vprec")) && (i < (argc - 1)))
{
mVertexPrecision = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--vprecrel")) && (i < (argc - 1)))
{
mVertexPrecisionRel = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--nprec")) && (i < (argc - 1)))
{
mNormalPrecision = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--tprec")) && (i < (argc - 1)))
{
mTexMapPrecision = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--cprec")) && (i < (argc - 1)))
{
mColorPrecision = GetFloatArg(argv[i + 1]);
++ i;
}
else if((cmd == string("--comment")) && (i < (argc - 1)))
{
mComment = string(argv[i + 1]);
++ i;
}
else if((cmd == string("--texfile")) && (i < (argc - 1)))
{
mTexFileName = string(argv[i + 1]);
++ i;
}
else
throw_runtime_error(string("Invalid argument: ") + cmd);
}
}

View File

@@ -1,68 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: convoptions.h
// Description: Interface for the conversion options class.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __CONVOPTIONS_H_
#define __CONVOPTIONS_H_
#include <string>
#include <openctm.h>
typedef enum {
uaX, uaY, uaZ, uaNX, uaNY, uaNZ
} UpAxis;
class Options {
public:
/// Constructor
Options();
/// Get options from the command line arguments
void GetFromArgs(int argc, char **argv, int aStartIdx);
CTMfloat mScale;
UpAxis mUpAxis;
bool mFlipTriangles;
bool mCalcNormals;
bool mNoNormals;
bool mNoTexCoords;
bool mNoColors;
CTMenum mMethod;
CTMuint mLevel;
CTMfloat mVertexPrecision;
CTMfloat mVertexPrecisionRel;
CTMfloat mNormalPrecision;
CTMfloat mTexMapPrecision;
CTMfloat mColorPrecision;
std::string mComment;
std::string mTexFileName;
};
#endif // __CONVOPTIONS_H_

View File

@@ -1,166 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: ctm.h
// Description: Implementation of the OpenCTM file format importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
#include <openctm.h>
#include "ctm.h"
using namespace std;
/// Import an OpenCTM file from a file.
void Import_CTM(const char * aFileName, Mesh * aMesh)
{
// Clear the mesh
aMesh->Clear();
// Load the file using the OpenCTM API
CTMimporter ctm;
// Load the file
ctm.Load(aFileName);
// Extract file comment
const char * comment = ctm.GetString(CTM_FILE_COMMENT);
if(comment)
aMesh->mComment = string(comment);
// Extract indices
CTMuint numTriangles = ctm.GetInteger(CTM_TRIANGLE_COUNT);
aMesh->mIndices.resize(numTriangles * 3);
const CTMuint * indices = ctm.GetIntegerArray(CTM_INDICES);
for(CTMuint i = 0; i < numTriangles * 3; ++ i)
aMesh->mIndices[i] = indices[i];
// Extract vertices
CTMuint numVertices = ctm.GetInteger(CTM_VERTEX_COUNT);
aMesh->mVertices.resize(numVertices);
const CTMfloat * vertices = ctm.GetFloatArray(CTM_VERTICES);
for(CTMuint i = 0; i < numVertices; ++ i)
{
aMesh->mVertices[i].x = vertices[i * 3];
aMesh->mVertices[i].y = vertices[i * 3 + 1];
aMesh->mVertices[i].z = vertices[i * 3 + 2];
}
// Extract normals
if(ctm.GetInteger(CTM_HAS_NORMALS) == CTM_TRUE)
{
aMesh->mNormals.resize(numVertices);
const CTMfloat * normals = ctm.GetFloatArray(CTM_NORMALS);
for(CTMuint i = 0; i < numVertices; ++ i)
{
aMesh->mNormals[i].x = normals[i * 3];
aMesh->mNormals[i].y = normals[i * 3 + 1];
aMesh->mNormals[i].z = normals[i * 3 + 2];
}
}
// Extract texture coordinates
if(ctm.GetInteger(CTM_UV_MAP_COUNT) > 0)
{
aMesh->mTexCoords.resize(numVertices);
const CTMfloat * texCoords = ctm.GetFloatArray(CTM_UV_MAP_1);
for(CTMuint i = 0; i < numVertices; ++ i)
{
aMesh->mTexCoords[i].u = texCoords[i * 2];
aMesh->mTexCoords[i].v = texCoords[i * 2 + 1];
}
const char * str = ctm.GetUVMapString(CTM_UV_MAP_1, CTM_FILE_NAME);
if(str)
aMesh->mTexFileName = string(str);
else
aMesh->mTexFileName = string("");
}
// Extract colors
CTMenum colorAttrib = ctm.GetNamedAttribMap("Color");
if(colorAttrib != CTM_NONE)
{
aMesh->mColors.resize(numVertices);
const CTMfloat * colors = ctm.GetFloatArray(colorAttrib);
for(CTMuint i = 0; i < numVertices; ++ i)
{
aMesh->mColors[i].x = colors[i * 4];
aMesh->mColors[i].y = colors[i * 4 + 1];
aMesh->mColors[i].z = colors[i * 4 + 2];
aMesh->mColors[i].w = colors[i * 4 + 3];
}
}
}
/// Export an OpenCTM file to a file.
void Export_CTM(const char * aFileName, Mesh * aMesh, Options &aOptions)
{
// Save the file using the OpenCTM API
CTMexporter ctm;
// Define mesh
CTMfloat * normals = 0;
if(aMesh->HasNormals() && !aOptions.mNoNormals)
normals = &aMesh->mNormals[0].x;
ctm.DefineMesh((CTMfloat *) &aMesh->mVertices[0].x, (CTMuint)aMesh->mVertices.size(),
(const CTMuint*) &aMesh->mIndices[0], (CTMuint)aMesh->mIndices.size() / 3,
normals);
// Define texture coordinates
if(aMesh->HasTexCoords())
{
const char * fileName = NULL;
if(aMesh->mTexFileName.size() > 0)
fileName = aMesh->mTexFileName.c_str();
CTMenum map = ctm.AddUVMap(&aMesh->mTexCoords[0].u, "Diffuse color", fileName);
ctm.UVCoordPrecision(map, aOptions.mTexMapPrecision);
}
// Define vertex colors
if(aMesh->HasColors())
{
CTMenum map = ctm.AddAttribMap(&aMesh->mColors[0].x, "Color");
ctm.AttribPrecision(map, aOptions.mColorPrecision);
}
// Set file comment
if(aMesh->mComment.size() > 0)
ctm.FileComment(aMesh->mComment.c_str());
// Set compression method and level
ctm.CompressionMethod(aOptions.mMethod);
ctm.CompressionLevel(aOptions.mLevel);
// Set vertex precision
if(aOptions.mVertexPrecision > 0.0f)
ctm.VertexPrecision(aOptions.mVertexPrecision);
else
ctm.VertexPrecisionRel(aOptions.mVertexPrecisionRel);
// Set normal precision
ctm.NormalPrecision(aOptions.mNormalPrecision);
// Export file
ctm.Save(aFileName);
}

View File

@@ -1,40 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: ctm.h
// Description: Interface for the OpenCTM file format importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __CTM_H_
#define __CTM_H_
#include "mesh.h"
#include "convoptions.h"
/// Import an OpenCTM file from a file.
void Import_CTM(const char * aFileName, Mesh * aMesh);
/// Export an OpenCTM file to a file.
void Export_CTM(const char * aFileName, Mesh * aMesh, Options &aOptions);
#endif // __CTM_H_

View File

@@ -1,189 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: ctmbench.cpp
// Description: Load/save benchmark tool. This tools is actually just a quick
// hack used for development and testing. To change the compression
// parameters for the save benchmarks, a recompile is required.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include <stdexcept>
#include <iostream>
#include <cstdlib>
#include <openctm.h>
#include "systimer.h"
using namespace std;
//-----------------------------------------------------------------------------
// BenchmarkLoads() - Benchmark function for loading OpenCTM files.
//-----------------------------------------------------------------------------
void BenchmarkLoads(int aIterations, const char * aFileName, double &tMin,
double &tMax, double &tTotal)
{
SysTimer timer;
// Iterate...
cout << "Doing " << aIterations << " load iterations..." << endl << flush;
for(int i = 0; i < aIterations; ++ i)
{
CTMimporter ctm;
// Start the timer
timer.Push();
// Load the file
ctm.Load(aFileName);
// Stop the timer
double t = timer.PopDelta();
if(i == 0)
{
tMin = t;
tMax = t;
}
else
{
if(t < tMin) tMin = t;
if(t > tMax) tMax = t;
}
tTotal += t;
}
}
//-----------------------------------------------------------------------------
// BenchmarkSaves() - Benchmark function for saving OpenCTM files.
//-----------------------------------------------------------------------------
void BenchmarkSaves(int aIterations, const char * aInFile, const char * aOutFile,
double &tMin, double &tMax, double &tTotal)
{
SysTimer timer;
// Load the file
CTMimporter in;
in.Load(aInFile);
// Extract mesh definition
CTMint triCount = in.GetInteger(CTM_TRIANGLE_COUNT);
CTMint vertCount = in.GetInteger(CTM_VERTEX_COUNT);
const CTMuint * indx = in.GetIntegerArray(CTM_INDICES);
const CTMfloat * vert = in.GetFloatArray(CTM_VERTICES);
const CTMfloat * norm = 0;
if(in.GetInteger(CTM_HAS_NORMALS))
norm = in.GetFloatArray(CTM_NORMALS);
// Iterate...
cout << "Doing " << aIterations << " save iterations..." << endl << flush;
for(int i = 0; i < aIterations; ++ i)
{
// Define the mesh
CTMexporter out;
out.DefineMesh(vert, vertCount, indx, triCount, norm);
int uvCount = in.GetInteger(CTM_UV_MAP_COUNT);
for(int k = 0; k < uvCount; ++ k)
{
const CTMfloat * uvMap = in.GetFloatArray(CTMenum(CTM_UV_MAP_1 + k));
const char * name = in.GetUVMapString(CTMenum(CTM_UV_MAP_1 + k), CTM_NAME);
const char * fileName = in.GetUVMapString(CTMenum(CTM_UV_MAP_1 + k), CTM_FILE_NAME);
out.AddUVMap(uvMap, name, fileName);
}
int attrCount = in.GetInteger(CTM_ATTRIB_MAP_COUNT);
for(int k = 0; k < attrCount; ++ k)
{
const CTMfloat * attrMap = in.GetFloatArray(CTMenum(CTM_ATTRIB_MAP_1 + k));
const char * name = in.GetAttribMapString(CTMenum(CTM_ATTRIB_MAP_1 + k), CTM_NAME);
out.AddAttribMap(attrMap, name);
}
// Select compression parameters
out.CompressionMethod(CTM_METHOD_MG1);
// Start the timer
timer.Push();
// Save the file
out.Save(aOutFile);
// Stop the timer
double t = timer.PopDelta();
if(i == 0)
{
tMin = t;
tMax = t;
}
else
{
if(t < tMin) tMin = t;
if(t > tMax) tMax = t;
}
tTotal += t;
}
}
//-----------------------------------------------------------------------------
// main() - Program entry.
//-----------------------------------------------------------------------------
int main(int argc, char **argv)
{
// Usage?
if((argc < 3) || (argc > 4))
{
cout << "Usage: ctmbench iterations infile [outfile]" << endl;
return 0;
}
// Get the number of iterations
int iterations;
iterations = atoi(argv[1]);
if(iterations < 1)
iterations = 1;
// Should we do load benchmarking or save benchmarking?
bool benchSave = (argc == 4);
try
{
double tMin = 0.0, tMax = 0.0, tTotal = 0.0;
if(benchSave)
BenchmarkSaves(iterations, argv[2], argv[3], tMin, tMax, tTotal);
else
BenchmarkLoads(iterations, argv[2], tMin, tMax, tTotal);
// Print report
cout << " Min: " << tMin * 1000.0 << " ms" << endl;
cout << " Max: " << tMax * 1000.0 << " ms" << endl;
cout << "Avg.: " << (tTotal / iterations) * 1000.0 << " ms" << endl;
}
catch(exception &e)
{
cout << "Error: " << e.what() << endl;
}
}

View File

@@ -1,229 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: ctmconv.cpp
// Description: 3D file format conversion tool. The program can be used to
// convert various 3D file formats to and from the OpenCTM file
// format, and also for conversion between other formats.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
#include <vector>
#include <iostream>
#include <list>
#include <string>
#include <cctype>
#include "systimer.h"
#include "convoptions.h"
#include "mesh.h"
#include "meshio.h"
using namespace std;
//-----------------------------------------------------------------------------
// PreProcessMesh()
//-----------------------------------------------------------------------------
static void PreProcessMesh(Mesh &aMesh, Options &aOptions)
{
// Nothing to do?
if((aOptions.mScale == 1.0f) && (aOptions.mUpAxis == uaZ) &&
(!aOptions.mFlipTriangles) && (!aOptions.mCalcNormals))
return;
// Create 3x3 transformation matrices for the vertices and the normals
Vector3 vX, vY, vZ;
Vector3 nX, nY, nZ;
switch(aOptions.mUpAxis)
{
case uaX:
nX = Vector3(0.0f, 0.0f, 1.0f);
nY = Vector3(0.0f, 1.0f, 0.0f);
nZ = Vector3(-1.0f, 0.0f, 0.0f);
break;
case uaY:
nX = Vector3(1.0f, 0.0f, 0.0f);
nY = Vector3(0.0f, 0.0f, 1.0f);
nZ = Vector3(0.0f, -1.0f, 0.0f);
break;
case uaZ:
nX = Vector3(1.0f, 0.0f, 0.0f);
nY = Vector3(0.0f, 1.0f, 0.0f);
nZ = Vector3(0.0f, 0.0f, 1.0f);
break;
case uaNX:
nX = Vector3(0.0f, 0.0f, -1.0f);
nY = Vector3(0.0f, 1.0f, 0.0f);
nZ = Vector3(1.0f, 0.0f, 0.0f);
break;
case uaNY:
nX = Vector3(1.0f, 0.0f, 0.0f);
nY = Vector3(0.0f, 0.0f, -1.0f);
nZ = Vector3(0.0f, 1.0f, 0.0f);
break;
case uaNZ:
nX = Vector3(-1.0f, 0.0f, 0.0f);
nY = Vector3(0.0f, 1.0f, 0.0f);
nZ = Vector3(0.0f, 0.0f, -1.0f);
break;
}
vX = nX * aOptions.mScale;
vY = nY * aOptions.mScale;
vZ = nZ * aOptions.mScale;
cout << "Processing... " << flush;
SysTimer timer;
timer.Push();
// Update all vertex coordinates
for(CTMuint i = 0; i < aMesh.mVertices.size(); ++ i)
aMesh.mVertices[i] = vX * aMesh.mVertices[i].x +
vY * aMesh.mVertices[i].y +
vZ * aMesh.mVertices[i].z;
// Update all normals
if(aMesh.HasNormals() && !aOptions.mNoNormals)
{
for(CTMuint i = 0; i < aMesh.mNormals.size(); ++ i)
aMesh.mNormals[i] = nX * aMesh.mNormals[i].x +
nY * aMesh.mNormals[i].y +
nZ * aMesh.mNormals[i].z;
}
// Flip trianlges?
if(aOptions.mFlipTriangles)
{
CTMuint triCount = (CTMuint)(aMesh.mIndices.size() / 3);
for(CTMuint i = 0; i < triCount; ++ i)
{
CTMuint tmp = aMesh.mIndices[i * 3];
aMesh.mIndices[i * 3] = aMesh.mIndices[i * 3 + 1];
aMesh.mIndices[i * 3 + 1] = tmp;
}
}
// Calculate normals?
if((!aOptions.mNoNormals) && aOptions.mCalcNormals &&
(!aMesh.HasNormals()))
aMesh.CalculateNormals();
double dt = timer.PopDelta();
cout << 1000.0 * dt << " ms" << endl;
}
void throw_runtime_error(std::string str)
{
cout << "Error: " << str << endl;
abort();
}
//-----------------------------------------------------------------------------
// main()
//-----------------------------------------------------------------------------
int main(int argc, char ** argv)
{
// Get file names and options
Options opt;
string inFile;
string outFile;
if(argc < 3)
{
cout << "Error: Too few arguments." << endl << endl;
cout << "Usage: " << argv[0] << " infile outfile [options]" << endl << endl;
cout << "Options:" << endl;
cout << endl << " Data manipulation (all formats)" << endl;
cout << " --scale arg Scale the mesh by a scalar factor." << endl;
cout << " --upaxis arg Set up axis (X, Y, Z, -X, -Y, -Z). If != Z, the mesh will" << endl;
cout << " be flipped." << endl;
cout << " --flip Flip triangle orientation." << endl;
cout << " --calc-normals If the source file does not contain any normals, calculate" << endl;
cout << " them." << endl;
cout << " --no-normals Do not export normals." << endl;
cout << " --no-texcoords Do not export texture coordinates." << endl;
cout << " --no-colors Do not export vertex colors." << endl;
cout << endl << " OpenCTM output" << endl;
cout << " --method arg Select compression method (RAW, MG1, MG2)" << endl;
cout << " --level arg Set the compression level (0 - 9)" << endl;
cout << endl << " OpenCTM MG2 method" << endl;
cout << " --vprec arg Set vertex precision" << endl;
cout << " --vprecrel arg Set vertex precision, relative method" << endl;
cout << " --nprec arg Set normal precision" << endl;
cout << " --tprec arg Set texture map precision" << endl;
cout << " --cprec arg Set color precision" << endl;
cout << endl << " Miscellaneous" << endl;
cout << " --comment arg Set the file comment (default is to use the comment" << endl;
cout << " from the input file, if any)." << endl;
cout << " --texfile arg Set the texture file name reference for the texture" << endl;
cout << " (default is to use the texture file name reference" << endl;
cout << " from the input file, if any)." << endl;
// Show supported formats
cout << endl << "Supported file formats:" << endl << endl;
list<string> formatList;
SupportedFormats(formatList);
for(list<string>::iterator i = formatList.begin(); i != formatList.end(); ++ i)
cout << " " << (*i) << endl;
cout << endl;
return 0;
}
inFile = string(argv[1]);
outFile = string(argv[2]);
opt.GetFromArgs(argc, argv, 3);
// Define mesh
Mesh mesh;
// Create a timer instance
SysTimer timer;
double dt;
// Load input file
cout << "Loading " << inFile << "... " << flush;
timer.Push();
ImportMesh(inFile.c_str(), &mesh);
dt = timer.PopDelta();
cout << 1000.0 * dt << " ms" << endl;
// Manipulate the mesh
PreProcessMesh(mesh, opt);
// Override comment?
if(opt.mComment.size() > 0)
mesh.mComment = opt.mComment;
// Override texture file name?
if(opt.mTexFileName.size() > 0)
mesh.mTexFileName = opt.mTexFileName;
// Save output file
cout << "Saving " << outFile << "... " << flush;
timer.Push();
ExportMesh(outFile.c_str(), &mesh, opt);
dt = timer.PopDelta();
cout << 1000.0 * dt << " ms" << endl;
return 0;
}

View File

@@ -1,27 +0,0 @@
0 ICON "icons\openctm.ico"
1 VERSIONINFO
FILEVERSION 1,0,3,0
PRODUCTVERSION 1,0,3,0
FILEOS 0x04
FILETYPE 0x01
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "ProductVersion", "1.0.3.0"
VALUE "FileVersion", "1.0.3.0"
VALUE "FileDescription", "OpenCTM 3D file converter"
VALUE "ProductName", "ctmconv"
VALUE "OriginalFilename", "ctmconv.exe"
VALUE "LegalCopyright", "© 2009-2010 Marcus Geelnard"
VALUE "License", "This software is released under the zlib/libpng license."
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*" />
</dependentAssembly>
</dependency>
</assembly>

View File

@@ -1,29 +0,0 @@
GLUT_ICON ICON "icons\\openctm.ico"
1 VERSIONINFO
FILEVERSION 1,0,3,0
PRODUCTVERSION 1,0,3,0
FILEOS 0x04
FILETYPE 0x01
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "ProductVersion", "1.0.3.0"
VALUE "FileVersion", "1.0.3.0"
VALUE "FileDescription", "OpenCTM 3D file viewer"
VALUE "ProductName", "ctmviewer"
VALUE "OriginalFilename", "ctmviewer.exe"
VALUE "LegalCopyright", "© 2009-2010 Marcus Geelnard"
VALUE "License", "This software is released under the zlib/libpng license."
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END
1 24 "ctmviewer.exe.manifest"

View File

@@ -1,725 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: dae.cpp
// Description: Implementation of the DAE (Collada) file format
// importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include "common.h"
#include <fstream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <clocale>
#include <tinyxml.h>
#include "dae.h"
#if !defined(WIN32) && defined(_WIN32)
#define WIN32
#endif
#ifdef WIN32
#include <windows.h>
#endif
using namespace std;
enum Axis
{
X,Y,Z,S,T
};
class Source
{
public:
Source() : stride(0), count(0), offset(0)
{
}
Source(const Source& copy) : array(copy.array), stride(copy.stride), count(copy.count), offset(copy.offset), params(copy.params)
{
}
vector<float> array;
size_t stride, count, offset;
vector<string> params;
};
class Indexes {
public:
Indexes(size_t _vertIndex = 0, size_t _normalIndex = 0, size_t _texcoordIndex = 0) : vertIndex(_vertIndex), normalIndex(_normalIndex), texcoordIndex(_texcoordIndex) {
}
Indexes(const Indexes& copy) : vertIndex(copy.vertIndex), normalIndex(copy.normalIndex), texcoordIndex(copy.texcoordIndex) {
}
size_t vertIndex, normalIndex, texcoordIndex;
};
enum Semantic
{
VERTEX,
NORMAL,
TEXCOORD,
POSITIONS,
UNKNOWN
};
struct Input
{
string source;
Semantic semantic;
size_t offset;
};
Semantic ToSemantic(const string& semantic)
{
if (semantic == "VERTEX")
return VERTEX;
else if (semantic == "NORMAL")
return NORMAL;
else if (semantic == "TEXCOORD")
return TEXCOORD;
else if (semantic == "POSITIONS")
return POSITIONS;
else
return UNKNOWN;
}
void ReadIndexArray(TiXmlElement* p , vector<size_t>& array)
{
istringstream strStream (p->GetText());
char val[100];
size_t value = 0;
while (!strStream.eof()) {
strStream >> val;
value = atoi(val);
array.push_back(value);
}
}
void ReadInputs(TiXmlElement* rootElem,bool& hasVerts,bool& hasNormals,bool& hasTexcoords, string& vertSource,string& normalSource,string& texcoordSource, vector<Input>& inputs) {
TiXmlHandle root(rootElem);
for(TiXmlElement* inputElem = root.FirstChild( "input" ).ToElement();inputElem; inputElem = inputElem->NextSiblingElement())
{
if(string(inputElem->Value()) != "input")
continue;
//TiXmlHandle input(inputElem);
inputs.push_back(Input());
inputs.back().source = string(inputElem->Attribute("source")).substr(1);
inputs.back().offset = atoi(inputElem->Attribute("offset"));
inputs.back().semantic = ToSemantic(inputElem->Attribute("semantic"));
switch(inputs.back().semantic)
{
case VERTEX:
hasVerts = true;
vertSource = inputs.back().source;
break;
case NORMAL:
hasNormals = true;
normalSource = inputs.back().source;
break;
case TEXCOORD:
hasTexcoords = true;
texcoordSource = inputs.back().source;
break;
default:
break;
}
}
}
Source& GetSource(map<string, Source >& sources, map<string, vector<Input> >& vertices,const string& source)
{
map<string, Source >::iterator srcIterator = sources.find(source);
if (srcIterator != sources.end())
return srcIterator->second;
map<string, vector<Input> >::iterator vertIterator = vertices.find(source);
if (vertIterator != vertices.end() ) {
for (vector<Input>::iterator i = vertIterator->second.begin(); i != vertIterator->second.end() ; ++i) {
srcIterator = sources.find(i->source);
if (srcIterator != sources.end())
return srcIterator->second;
}
} else {
abort(); //throw string("Error");
}
return srcIterator->second;
}
void InsertVertNormalTexcoord(vector<Vector3>& vertVector,vector<Vector3>& normalVector,vector<Vector2>& texcoordVector, bool hasVerts, bool hasNormals, bool hasTexcoords,const string& vertSource ,const string& normalSource ,const string& texcoordSource ,size_t vertIndex , size_t normalIndex , size_t texcoordIndex, map<string, Source >& sources,map<string, vector<Input> >& vertices)
{
if (hasVerts) {
Source& src = GetSource(sources, vertices , vertSource);
float x = 0, y = 0, z = 0;
if (src.stride >= 1)
x = src.array[src.offset + vertIndex*src.stride];
if (src.stride >= 2)
y = src.array[src.offset + vertIndex*src.stride + 1];
if (src.stride >= 3)
z = src.array[src.offset + vertIndex*src.stride + 2];
vertVector.push_back(Vector3(x,y,z));
}
if (hasNormals) {
Source& src = GetSource(sources, vertices , normalSource);
float x = 0, y = 0, z = 0;
if (src.stride >= 1)
x = src.array[src.offset + normalIndex*src.stride];
if (src.stride >= 2)
y = src.array[src.offset + normalIndex*src.stride + 1];
if (src.stride >= 3)
z = src.array[src.offset + normalIndex*src.stride + 2];
normalVector.push_back(Vector3(x,y,z) );
}
if (hasTexcoords) {
Source& src = GetSource(sources, vertices , texcoordSource);
float s = 0, t = 0;
if (src.stride >= 1)
s = src.array[src.offset + texcoordIndex*src.stride];
if (src.stride >= 2)
t = src.array[src.offset + texcoordIndex*src.stride + 1];
texcoordVector.push_back(Vector2(s,t));
}
}
/// Import a DAE file from a file.
void Import_DAE(const char * aFileName, Mesh * aMesh)
{
// Start by ensuring that we use proper locale settings for the file format
setlocale(LC_NUMERIC, "C");
// Clear the mesh
aMesh->Clear();
// Load the XML document
TiXmlDocument doc(aFileName);
if (doc.LoadFile())
{
TiXmlHandle hDoc(&doc);
TiXmlElement* elem = hDoc.FirstChildElement().Element();
TiXmlHandle hRoot(elem);
map<string, Source > sources;
size_t indicesOffset = 0, vertexOffset = 0, texcoordOffset = 0, normalOffset = 0;
TiXmlHandle geometry = hRoot.FirstChild( "library_geometries" ).FirstChild("geometry");
for(elem = geometry.ToElement(); elem; elem=elem->NextSiblingElement())
{
TiXmlHandle geometry(elem);
TiXmlElement* meshElem = geometry.FirstChild("mesh").ToElement();
if(meshElem)
{
TiXmlHandle mesh(meshElem);
TiXmlElement* sourceElem;
for(sourceElem = mesh.FirstChild("source").ToElement(); sourceElem;
sourceElem = sourceElem->NextSiblingElement())
{
if(string(sourceElem->Value()) != "source")
continue;
TiXmlHandle source(sourceElem);
string id = source.ToElement()->Attribute("id");
TiXmlElement* arr = sourceElem->FirstChild("float_array")->ToElement();
string str = arr->GetText();
istringstream strStream (str);
sources.insert(make_pair(id, Source()));
TiXmlElement* techniqueElem = sourceElem->FirstChild("technique_common")->ToElement();
TiXmlElement* accessorElem = techniqueElem->FirstChild("accessor")->ToElement();
sources[id].stride = atoi(accessorElem->Attribute("stride"));
sources[id].count = atoi(accessorElem->Attribute("count"));
if (accessorElem->Attribute("offset"))
sources[id].offset = atoi(accessorElem->Attribute("offset"));
char val[100];
float value = 0;
while(!strStream.eof())
{
strStream >> val;
value = float(atof(val));
sources[id].array.push_back(value);
}
}
TiXmlElement* verticesElem = mesh.FirstChild("vertices").ToElement();
map<string, vector<Input> > vertices;
if (verticesElem) {
string id = verticesElem->Attribute("id");
vertices.insert(make_pair(id, vector<Input>()));
TiXmlElement* inputElem;
for(inputElem = verticesElem->FirstChild("input")->ToElement();
inputElem; inputElem = inputElem->NextSiblingElement())
{
if(string(inputElem->Value()) != "input")
continue;
vertices[id].push_back(Input());
vertices[id].back().source = string(inputElem->Attribute("source")).substr(1);
vertices[id].back().semantic = ToSemantic(inputElem->Attribute("semantic"));
}
}
TiXmlElement* trianglesElem = mesh.FirstChild("triangles").ToElement();
if(trianglesElem)
{
TiXmlHandle triangles(trianglesElem);
vector<Input> inputs;
bool hasVerts = false, hasNormals = false, hasTexcoords = false;
string vertSource = "", normalSource = "", texcoordSource = "";
/*
TiXmlElement* inputElem;
for(inputElem = triangles.FirstChild( "input" ).ToElement();
inputElem; inputElem = inputElem->NextSiblingElement())
{
if(string(inputElem->Value()) != "input")
continue;
//TiXmlHandle input(inputElem);
inputs.push_back(Input());
inputs.back().source = string(inputElem->Attribute("source")).substr(1);
inputs.back().offset = atoi(inputElem->Attribute("offset"));
inputs.back().semantic = ToSemantic(inputElem->Attribute("semantic"));
switch(inputs.back().semantic)
{
case VERTEX:
hasVerts = true;
vertSource = inputs.back().source;
break;
case NORMAL:
hasNormals = true;
normalSource = inputs.back().source;
break;
case TEXCOORD:
hasTexcoords = true;
texcoordSource = inputs.back().source;
break;
default:
break;
}
}
*/
ReadInputs(trianglesElem, hasVerts, hasNormals, hasTexcoords, vertSource, normalSource, texcoordSource, inputs);
vector<size_t> pArray;
TiXmlElement* p = triangles.FirstChild( "p" ).ToElement();
ReadIndexArray(p,pArray);
vector<size_t> indexVector;
vector<Vector3> vertVector, normalVector;
vector<Vector2> texcoordVector;
map<size_t, map<size_t, map< size_t, size_t > > > prevIndices;
size_t index = 0;
for (size_t i = 0; i < pArray.size() ; i += inputs.size()) {
size_t vertIndex = 0, normalIndex = 0, texcoordIndex = 0;
for (vector<Input>::const_iterator j = inputs.begin(); j != inputs.end(); ++j) {
switch (j->semantic) {
case VERTEX:
vertIndex = pArray[i + j->offset];
break;
case NORMAL:
normalIndex = pArray[i + j->offset];
break;
case TEXCOORD:
texcoordIndex = pArray[i + j->offset];
break;
default:
break;
}
}
map<size_t, map<size_t, map< size_t, size_t > > >::iterator prevIt1 = prevIndices.find(vertIndex);
if(prevIt1 != prevIndices.end())
{
map<size_t, map< size_t, size_t > >::iterator prevIt2 = prevIt1->second.find(normalIndex);
if(prevIt2 != prevIt1->second.end())
{
map< size_t, size_t >::iterator prevIt3 = prevIt2->second.find(texcoordIndex);
if(prevIt3 != prevIt2->second.end())
{
indexVector.push_back(prevIt3->second);
}
else
{
indexVector.push_back(index);
prevIt2->second.insert(make_pair(texcoordIndex, index));
InsertVertNormalTexcoord(vertVector, normalVector, texcoordVector, hasVerts, hasNormals, hasTexcoords, vertSource, normalSource, texcoordSource, vertIndex, normalIndex, texcoordIndex, sources, vertices);
++index;
}
}
else
{
indexVector.push_back(index);
prevIt1->second.insert(make_pair(normalIndex, map< size_t, size_t >()));
prevIt1->second[normalIndex].insert(make_pair(texcoordIndex, index));
InsertVertNormalTexcoord(vertVector, normalVector, texcoordVector, hasVerts, hasNormals, hasTexcoords, vertSource, normalSource, texcoordSource, vertIndex, normalIndex, texcoordIndex, sources, vertices);
++index;
}
}
else
{
indexVector.push_back(index);
prevIndices.insert(make_pair(vertIndex,map<size_t, map< size_t, size_t > >()));
prevIndices[vertIndex].insert(make_pair(normalIndex, map< size_t, size_t >()));
prevIndices[vertIndex][normalIndex].insert(make_pair(texcoordIndex, index));
InsertVertNormalTexcoord(vertVector, normalVector, texcoordVector, hasVerts, hasNormals, hasTexcoords, vertSource, normalSource, texcoordSource, vertIndex, normalIndex, texcoordIndex, sources, vertices);
++index;
}
}
TiXmlElement* polylistElem = mesh.FirstChild("polylist").ToElement();
if (polylistElem) {
TiXmlHandle polylist(polylistElem);
vector<size_t> vcountArray, pArray;
TiXmlElement* vcountElem = polylist.FirstChild("vcount").ToElement();
ReadIndexArray(vcountElem, vcountArray);
TiXmlElement* pElem = polylist.FirstChild("p").ToElement();
ReadIndexArray(pElem, pArray);
vector<Input> inputs;
bool hasVerts = false, hasNormals = false, hasTexcoords = false;
string vertSource = "", normalSource = "", texcoordSource = "";
ReadInputs(polylistElem, hasVerts, hasNormals, hasTexcoords, vertSource, normalSource, texcoordSource, inputs);
size_t offset = 0;
for (size_t i = 0; i < vcountArray.size(); ++i) {
vector<Indexes> convexPolygon;
for (size_t j = 0; j < vcountArray[i]; ++j) {
convexPolygon.push_back(Indexes());
for (vector<Input>::const_iterator j = inputs.begin(); j != inputs.end(); ++j) {
switch (j->semantic) {
case VERTEX:
convexPolygon.back().vertIndex = pArray[offset + j->offset];
break;
case NORMAL:
convexPolygon.back().normalIndex = pArray[offset + j->offset];
break;
case TEXCOORD:
convexPolygon.back().texcoordIndex = pArray[offset + j->offset];
break;
default:
break;
}
}
}
offset += vcountArray[i];
}
}
size_t indicesOff = indicesOffset, vertexOff = vertexOffset, normalOff = normalOffset, texcoordOff = texcoordOffset;
indicesOffset += indexVector.size();
vertexOffset += vertVector.size();
normalOffset += normalVector.size();
texcoordOffset += texcoordVector.size();
aMesh->mIndices.resize(indicesOffset );
aMesh->mVertices.resize(vertexOffset );
aMesh->mNormals.resize(normalOffset );
aMesh->mTexCoords.resize(texcoordOffset );
for(size_t i = 0; i < indexVector.size(); ++i)
aMesh->mIndices[indicesOff + i] = (unsigned int)indexVector[i];
for(size_t i = 0; i < vertVector.size(); ++i)
aMesh->mVertices[vertexOff + i] = vertVector[i];
for(size_t i = 0; i < normalVector.size(); ++i)
aMesh->mNormals[normalOff + i] = normalVector[i];
for(size_t i = 0; i < texcoordVector.size(); ++i)
aMesh->mTexCoords[texcoordOff + i] = texcoordVector[i];
}
}
}
}
else
throw_runtime_error("Could not open input file.");
}
/// Dump a float array to an XML text node.
static void FloatArrayToXML(TiXmlElement * aNode, float * aArray,
unsigned int aCount)
{
stringstream ss;
for(unsigned int i = 0; i < aCount; ++ i)
ss << aArray[i] << " ";
aNode->LinkEndChild(new TiXmlText(ss.str().c_str()));
}
/// Generate an ISO 8601 format date string.
static string MakeISO8601DateTime(void)
{
char buf[500];
#ifdef WIN32
SYSTEMTIME tm;
GetSystemTime(&tm);
sprintf(buf, "%i-%02i-%02iT%02i:%02i:%02i.%03iZ", tm.wYear,
tm.wMonth, tm.wDay, tm.wHour, tm.wMinute, tm.wSecond,
tm.wMilliseconds);
#else
time_t t;
time(&t);
struct tm tm;
localtime_r(&t, &tm);
sprintf(buf, "%i-%02i-%02iT%02i:%02i:%02i", tm.tm_year + 1900,
tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
#endif
return string(buf);
}
/// Export a DAE file to a file.
void Export_DAE(const char * aFileName, Mesh * aMesh, Options &aOptions)
{
// Start by ensuring that we use proper locale settings for the file format
setlocale(LC_NUMERIC, "C");
// What should we export?
bool exportTexCoords = aMesh->HasTexCoords() && !aOptions.mNoTexCoords;
bool exportNormals = aMesh->HasNormals() && !aOptions.mNoNormals;
TiXmlDocument xmlDoc;
TiXmlElement * elem;
string dateTime = MakeISO8601DateTime();
// Set XML declaration
xmlDoc.LinkEndChild(new TiXmlDeclaration("1.0", "utf-8", ""));
// Create root node
TiXmlElement * root = new TiXmlElement("COLLADA");
xmlDoc.LinkEndChild(root);
root->SetAttribute("xmlns", "http://www.collada.org/2005/11/COLLADASchema");
root->SetAttribute("version", "1.4.1");
// Create traceability nodes
TiXmlElement * asset = new TiXmlElement("asset");
root->LinkEndChild(asset);
TiXmlElement * contributor = new TiXmlElement("contributor");
asset->LinkEndChild(contributor);
TiXmlElement * authoring_tool = new TiXmlElement("authoring_tool");
contributor->LinkEndChild(authoring_tool);
authoring_tool->LinkEndChild(new TiXmlText("ctmconv"));
TiXmlElement * comments = new TiXmlElement("comments");
contributor->LinkEndChild(comments);
comments->LinkEndChild(new TiXmlText(aMesh->mComment.c_str()));
elem = new TiXmlElement("created");
asset->LinkEndChild(elem);
elem->LinkEndChild(new TiXmlText(dateTime.c_str()));
elem = new TiXmlElement("modified");
asset->LinkEndChild(elem);
elem->LinkEndChild(new TiXmlText(dateTime.c_str()));
// Create the geometry nodes
TiXmlElement * library_geometries = new TiXmlElement("library_geometries");
root->LinkEndChild(library_geometries);
TiXmlElement * geometry = new TiXmlElement("geometry");
library_geometries->LinkEndChild(geometry);
geometry->SetAttribute("id", "Mesh-1");
geometry->SetAttribute("name", "Mesh-1");
TiXmlElement * mesh = new TiXmlElement("mesh");
geometry->LinkEndChild(mesh);
// Vertices (positions)
TiXmlElement * source_position = new TiXmlElement("source");
mesh->LinkEndChild(source_position);
source_position->SetAttribute("id", "Mesh-1-positions");
source_position->SetAttribute("name", "position");
TiXmlElement * positions_array = new TiXmlElement("float_array");
source_position->LinkEndChild(positions_array);
positions_array->SetAttribute("id", "Mesh-1-positions-array");
positions_array->SetAttribute("count", int(aMesh->mVertices.size() * 3));
FloatArrayToXML(positions_array, &aMesh->mVertices[0].x, (unsigned int)aMesh->mVertices.size() * 3);
TiXmlElement * positions_technique = new TiXmlElement("technique_common");
source_position->LinkEndChild(positions_technique);
TiXmlElement * positions_technique_accessor = new TiXmlElement("accessor");
positions_technique->LinkEndChild(positions_technique_accessor);
positions_technique_accessor->SetAttribute("count", int(aMesh->mVertices.size()));
positions_technique_accessor->SetAttribute("offset", 0);
positions_technique_accessor->SetAttribute("source", "#Mesh-1-positions-array");
positions_technique_accessor->SetAttribute("stride", 3);
elem = new TiXmlElement("param");
positions_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "X");
elem->SetAttribute("type", "float");
elem = new TiXmlElement("param");
positions_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "Y");
elem->SetAttribute("type", "float");
elem = new TiXmlElement("param");
positions_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "Z");
elem->SetAttribute("type", "float");
// Normals
if(exportNormals)
{
TiXmlElement * source_normal = new TiXmlElement("source");
mesh->LinkEndChild(source_normal);
source_normal->SetAttribute("id", "Mesh-1-normals");
source_normal->SetAttribute("name", "normal");
TiXmlElement * normals_array = new TiXmlElement("float_array");
source_normal->LinkEndChild(normals_array);
normals_array->SetAttribute("id", "Mesh-1-normals-array");
normals_array->SetAttribute("count", int(aMesh->mVertices.size() * 3));
FloatArrayToXML(normals_array, &aMesh->mNormals[0].x, (unsigned int)aMesh->mNormals.size() * 3);
TiXmlElement * normals_technique = new TiXmlElement("technique_common");
source_normal->LinkEndChild(normals_technique);
TiXmlElement * normals_technique_accessor = new TiXmlElement("accessor");
normals_technique->LinkEndChild(normals_technique_accessor);
normals_technique_accessor->SetAttribute("count", int(aMesh->mVertices.size()));
normals_technique_accessor->SetAttribute("offset", 0);
normals_technique_accessor->SetAttribute("source", "#Mesh-1-normals-array");
normals_technique_accessor->SetAttribute("stride", 3);
elem = new TiXmlElement("param");
normals_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "X");
elem->SetAttribute("type", "float");
elem = new TiXmlElement("param");
normals_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "Y");
elem->SetAttribute("type", "float");
elem = new TiXmlElement("param");
normals_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "Z");
elem->SetAttribute("type", "float");
}
// UV map
if(exportTexCoords)
{
TiXmlElement * source_map1 = new TiXmlElement("source");
mesh->LinkEndChild(source_map1);
source_map1->SetAttribute("id", "Mesh-1-map1");
source_map1->SetAttribute("name", "map1");
TiXmlElement * map1_array = new TiXmlElement("float_array");
source_map1->LinkEndChild(map1_array);
map1_array->SetAttribute("id", "Mesh-1-map1-array");
map1_array->SetAttribute("count", int(aMesh->mVertices.size() * 3));
FloatArrayToXML(map1_array, &aMesh->mTexCoords[0].u, (unsigned int)aMesh->mTexCoords.size() * 2);
TiXmlElement * map1_technique = new TiXmlElement("technique_common");
source_map1->LinkEndChild(map1_technique);
TiXmlElement * map1_technique_accessor = new TiXmlElement("accessor");
map1_technique->LinkEndChild(map1_technique_accessor);
map1_technique_accessor->SetAttribute("count", int(aMesh->mVertices.size()));
map1_technique_accessor->SetAttribute("offset", 0);
map1_technique_accessor->SetAttribute("source", "#Mesh-1-map1-array");
map1_technique_accessor->SetAttribute("stride", 2);
elem = new TiXmlElement("param");
map1_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "S");
elem->SetAttribute("type", "float");
elem = new TiXmlElement("param");
map1_technique_accessor->LinkEndChild(elem);
elem->SetAttribute("name", "T");
elem->SetAttribute("type", "float");
}
// Vertices
TiXmlElement * vertices = new TiXmlElement("vertices");
mesh->LinkEndChild(vertices);
vertices->SetAttribute("id", "Mesh-1-vertices");
TiXmlElement * vertices_input = new TiXmlElement("input");
vertices->LinkEndChild(vertices_input);
vertices_input->SetAttribute("semantic", "POSITION");
vertices_input->SetAttribute("source", "#Mesh-1-positions");
// Triangles
TiXmlElement * triangles = new TiXmlElement("triangles");
mesh->LinkEndChild(triangles);
triangles->SetAttribute("count", int(aMesh->mIndices.size() / 3));
int triangleInputCount = 0;
elem = new TiXmlElement("input");
triangles->LinkEndChild(elem);
elem->SetAttribute("offset", triangleInputCount);
elem->SetAttribute("semantic", "VERTEX");
elem->SetAttribute("source", "#Mesh-1-vertices");
++ triangleInputCount;
if(exportNormals)
{
elem = new TiXmlElement("input");
triangles->LinkEndChild(elem);
elem->SetAttribute("offset", triangleInputCount);
elem->SetAttribute("semantic", "NORMAL");
elem->SetAttribute("source", "#Mesh-1-normals");
++ triangleInputCount;
}
if(exportTexCoords)
{
elem = new TiXmlElement("input");
triangles->LinkEndChild(elem);
elem->SetAttribute("offset", triangleInputCount);
elem->SetAttribute("semantic", "TEXCOORD");
elem->SetAttribute("source", "#Mesh-1-map1");
elem->SetAttribute("set", 0);
++ triangleInputCount;
}
{
elem = new TiXmlElement("p");
triangles->LinkEndChild(elem);
stringstream ss;
for(unsigned int i = 0; i < aMesh->mIndices.size(); ++ i)
for(int j = 0; j < triangleInputCount; ++ j)
ss << aMesh->mIndices[i] << " ";
elem->LinkEndChild(new TiXmlText(ss.str().c_str()));
}
// Scene
TiXmlElement * library_visual_scenes = new TiXmlElement("library_visual_scenes");
root->LinkEndChild(library_visual_scenes);
TiXmlElement * visual_scene = new TiXmlElement("visual_scene");
library_visual_scenes->LinkEndChild(visual_scene);
visual_scene->SetAttribute("id", "Scene-1");
visual_scene->SetAttribute("name", "Scene-1");
TiXmlElement * visual_scene_node = new TiXmlElement("node");
visual_scene->LinkEndChild(visual_scene_node);
visual_scene_node->SetAttribute("id", "Object-1");
visual_scene_node->SetAttribute("name", "Object-1");
TiXmlElement * instance_geometry = new TiXmlElement("instance_geometry");
visual_scene_node->LinkEndChild(instance_geometry);
instance_geometry->SetAttribute("url", "#Mesh-1");
TiXmlElement * scene = new TiXmlElement("scene");
root->LinkEndChild(scene);
TiXmlElement * instance_visual_scene = new TiXmlElement("instance_visual_scene");
scene->LinkEndChild(instance_visual_scene);
instance_visual_scene->SetAttribute("url", "#Scene-1");
// Save the XML document to a file
xmlDoc.SaveFile(aFileName);
if(xmlDoc.Error())
throw_runtime_error(string(xmlDoc.ErrorDesc()));
}

View File

@@ -1,40 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: dae.h
// Description: Interface for the DAE (Collada) file format importer/exporter.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#ifndef __DAE_H_
#define __DAE_H_
#include "mesh.h"
#include "convoptions.h"
/// Import a DAE file from a file.
void Import_DAE(const char * aFileName, Mesh * aMesh);
/// Export a DAE file to a file.
void Export_DAE(const char * aFileName, Mesh * aMesh, Options &aOptions);
#endif // __DAE_H_

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,73 +0,0 @@
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

File diff suppressed because it is too large Load Diff

View File

@@ -1,448 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
width="48"
height="48"
id="svg97"
inkscape:version="0.47pre4 r22446"
sodipodi:docname="Document-open.svg">
<metadata
id="metadata3052">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="672"
inkscape:window-height="539"
id="namedview3050"
showgrid="false"
inkscape:zoom="4.9166667"
inkscape:cx="24"
inkscape:cy="24"
inkscape:window-x="0"
inkscape:window-y="35"
inkscape:window-maximized="0"
inkscape:current-layer="svg97" />
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective3054" />
<radialGradient
cx="605.71429"
cy="486.64789"
r="117.14286"
fx="605.71429"
fy="486.64789"
id="radialGradient5031"
xlink:href="#linearGradient5060"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" />
<linearGradient
id="linearGradient5060">
<stop
id="stop5062"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop5064"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="605.71429"
cy="486.64789"
r="117.14286"
fx="605.71429"
fy="486.64789"
id="radialGradient5029"
xlink:href="#linearGradient5060"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" />
<linearGradient
id="linearGradient5048">
<stop
id="stop5050"
style="stop-color:#000000;stop-opacity:0"
offset="0" />
<stop
id="stop5056"
style="stop-color:#000000;stop-opacity:1"
offset="0.5" />
<stop
id="stop5052"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507"
id="linearGradient5027"
xlink:href="#linearGradient5048"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" />
<linearGradient
id="linearGradient269">
<stop
id="stop270"
style="stop-color:#a3a3a3;stop-opacity:1"
offset="0" />
<stop
id="stop271"
style="stop-color:#4c4c4c;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="8.824419"
cy="3.7561285"
r="37.751713"
fx="8.824419"
fy="3.7561285"
id="radialGradient8234"
xlink:href="#linearGradient269"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.968273,0,0,1.046686,44.36453,-17.00717)" />
<linearGradient
id="linearGradient259">
<stop
id="stop260"
style="stop-color:#fafafa;stop-opacity:1"
offset="0" />
<stop
id="stop8238"
style="stop-color:#a8a8a8;stop-opacity:1"
offset="0.5" />
<stop
id="stop261"
style="stop-color:#cdcdcd;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="25.875"
y1="10.625"
x2="25.25"
y2="30.875"
id="linearGradient8236"
xlink:href="#linearGradient259"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,1.238806,0,-7.880597)" />
<linearGradient
id="linearGradient13842">
<stop
id="stop13844"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop13846"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient9766">
<stop
id="stop9768"
style="stop-color:#6194cb;stop-opacity:1"
offset="0" />
<stop
id="stop9770"
style="stop-color:#729fcf;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient148">
<stop
id="stop149"
style="stop-color:#ffffff;stop-opacity:0.13402061"
offset="0" />
<stop
id="stop150"
style="stop-color:#ffffff;stop-opacity:0.05154639"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient335">
<stop
id="stop336"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop337"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient1789">
<stop
id="stop1790"
style="stop-color:#a0a0a0;stop-opacity:1"
offset="0" />
<stop
id="stop1791"
style="stop-color:#a8a8a8;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient137">
<stop
id="stop138"
style="stop-color:#ffffff;stop-opacity:0.70059878"
offset="0" />
<stop
id="stop139"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="19.116116"
y1="28.946041"
x2="19.426924"
y2="51.912693"
id="linearGradient155"
xlink:href="#linearGradient335"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.421537,0.703464)" />
<linearGradient
x1="14.899379"
y1="27.059643"
x2="22.715446"
y2="41.836895"
id="linearGradient156"
xlink:href="#linearGradient148"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.535299,0,0,0.651339,3.451418,2.448)" />
<linearGradient
x1="5.2657914"
y1="18.725863"
x2="8.212224"
y2="52.625851"
id="linearGradient158"
xlink:href="#linearGradient137"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.462696,0,0.06907908,0.683669,0,0)" />
<radialGradient
cx="26.106777"
cy="38.195114"
r="32.259769"
fx="26.106777"
fy="38.195114"
id="radialGradient159"
xlink:href="#linearGradient1789"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.015635,0,0.103105,1.000512,0,-0.08369458)" />
<linearGradient
x1="22.175976"
y1="36.987999"
x2="22.065331"
y2="32.050499"
id="linearGradient13162"
xlink:href="#linearGradient9766"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,1.022118,52.05694,-1.323026)" />
<linearGradient
x1="22.25"
y1="37.625"
x2="19.75"
y2="14.875"
id="linearGradient13848"
xlink:href="#linearGradient13842"
gradientUnits="userSpaceOnUse" />
</defs>
<g
id="layer1"
transform="translate(-0.20338983,2.0338983)" />
<g
id="layer3"
transform="translate(-0.20338983,2.0338983)">
<path
d="m 4.6200285,38.651015 c 0.041808,0.420455 0.4973856,0.840909 0.9111553,0.840909 l 31.1361622,0 c 0.41377,0 0.785732,-0.420454 0.743924,-0.840909 L 34.714653,11.531728 C 34.672845,11.111274 34.217267,10.69082 33.803498,10.69082 l -12.723416,0 c -0.590546,0 -1.209083,-0.379552 -1.402861,-0.9603351 L 18.574219,6.4246085 C 18.404967,5.9173308 18.027069,5.6888138 17.259746,5.6888138 l -14.9373272,0 c -0.4137696,0 -0.7857312,0.4204542 -0.7439232,0.8409082 l 3.0415329,32.121293 z"
id="path2375"
style="fill:url(#radialGradient159);fill-opacity:1;fill-rule:nonzero;stroke:#5a5a5a;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 3.3386019,17.533487 31.1498591,0"
id="path13113"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 5.3301525,37.533487 29.9877545,0"
id="path13160"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 5.3301525,35.533487 29.9877545,0"
id="path13139"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<g
transform="matrix(0.02165152,0,0,0.01903841,42.41538,36.93372)"
id="g5022"
style="display:inline">
<rect
width="1339.6335"
height="478.35718"
x="-1559.2523"
y="-150.69685"
id="rect4173"
style="opacity:0.40206185;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m -219.61876,-150.68038 c 0,0 0,478.33079 0,478.33079 142.874166,0.90045 345.40022,-107.16966 345.40014,-239.196175 0,-132.026537 -159.436816,-239.134595 -345.40014,-239.134615 z"
id="path5058"
style="opacity:0.40206185;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m -1559.2523,-150.68038 c 0,0 0,478.33079 0,478.33079 -142.8742,0.90045 -345.4002,-107.16966 -345.4002,-239.196175 0,-132.026537 159.4368,-239.134595 345.4002,-239.134615 z"
id="path5018"
style="opacity:0.40206185;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
</g>
<path
d="m 6.1717518,38.418674 c 0.031356,0.310327 -0.1546248,0.517212 -0.475404,0.413769 l 0,0 C 5.3755686,38.729001 5.1477798,38.522116 5.1164238,38.211789 L 2.0868572,6.8445942 C 2.0555012,6.534267 2.2434512,6.3468711 2.5537784,6.3468711 L 17.303531,6.2554251 c 0.531284,-0.00329 0.739429,0.053306 0.879799,0.517212 0,0 1.085374,3.1127979 1.246234,3.6981049 L 17.873968,7.5537061 C 17.608788,7.0564434 17.275224,7.1399365 16.901178,7.1399365 l -13.1294005,0 c -0.3103272,0 -0.496308,0.2068848 -0.464952,0.517212 L 6.2856462,38.522116 6.1717518,38.418674 z"
id="path2380"
style="fill:url(#linearGradient158);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.17341149;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 2.3052333,7.533487 14.7837337,0"
id="path13145"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 2.7573333,11.533487 30.7388807,0"
id="path13115"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<g
transform="matrix(1.034424,0,0.10452,1.034424,-10.03248,2.631914)"
id="g2381"
style="fill:#ffffff;fill-opacity:0.5803109;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4;display:block">
<path
d="m 41.785743,9.0363862 c 0.0096,-0.4745828 0.01519,-0.7245056 -0.423393,-0.7242032 l -12.55582,0.00866 c -0.3,0 -0.324614,-0.1432061 0,0 0.324614,0.1432061 1.247098,0.6582712 2.182697,0.7009947 0,0 10.796477,0.016463 10.796516,0.014551 z"
id="path2382"
style="stroke:none" />
</g>
<path
d="m 3.1628954,15.533487 30.8305566,0"
id="path13123"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 5.1594716,33.533487 29.9877544,0"
id="path13121"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 4.8658086,31.533487 30.1087244,0"
id="path13119"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 4.6336367,29.533487 30.1692103,0"
id="path13135"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 4.4629557,27.533487 30.1692103,0"
id="path13137"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 4.2556718,25.533487 30.2051212,0"
id="path13143"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 4.0235198,23.533487 30.2655812,0"
id="path13133"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 3.8528389,21.533487 30.2655811,0"
id="path13117"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<g
transform="matrix(1.034424,0,0.10452,1.034424,-10.03248,2.631914)"
id="g1853"
style="fill:#ffffff;fill-opacity:0.5803109;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4;display:block">
<path
d="m 41.785743,9.0363862 c 0.0096,-0.4745828 0.01519,-0.7245056 -0.423393,-0.7242032 l -12.55582,0.00866 c -0.3,0 -0.324614,-0.1432061 0,0 0.324614,0.1432061 1.247098,0.6582712 2.182697,0.7009947 0,0 10.796477,0.016463 10.796516,0.014551 z"
id="path1855"
style="stroke:none" />
</g>
<path
d="m 2.9642313,13.533487 31.0265037,0"
id="path13127"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 3.6514189,19.533487 30.2957961,0"
id="path13125"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 2.5242572,9.5334871 15.2808158,0"
id="path13147"
style="opacity:0.11363633;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="M 34.375,14.125 37,38.75 6,38.875 c 0,0 -1.875,-24.75 -1.875,-24.75 0,0 30.375,0 30.25,0 z"
id="path13840"
style="opacity:0.39204544;fill:url(#linearGradient13848);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 43.375,2.4944033 c 0.5,16.8787317 -9.075063,18.5284757 -6.012563,29.0002577 0,0 -31.487437,0.885937 -31.487437,0.885937 C 4,19.527986 14.25,11.166045 11.25,2.649254 L 43.375,2.4944033 z"
id="path8230"
style="fill:url(#linearGradient8236);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient8234);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 15.4375,6.5624999 23.5625,0"
id="path8277"
style="fill:none;stroke:#a1a1a1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 5.7785654,39.065997 c 0.103442,0.211469 0.310326,0.422928 0.6206519,0.422928 l 33.3084527,0 c 0.206892,0 0.521164,-0.126305 0.708174,-0.264351 0.530402,-0.391535 0.65486,-0.612385 0.892782,-0.973467 2.448126,-3.71546 5.805141,-19.276893 5.805141,-19.276893 0.103442,-0.21146 -0.103441,-0.42292 -0.413767,-0.42292 l -34.923642,0 c -0.310326,0 -1.655965,16.10733 -4.8629988,19.287023 l -1.2382357,1.22768 0.1034419,0 z"
id="path2401"
style="fill:url(#linearGradient13162);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 15.356073,8.5624999 19.725347,0"
id="path8279"
style="fill:none;stroke:#a1a1a1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 13.134476,20.138641 c -0.772747,4.990757 -1.501301,9.009243 -2.71599,13.513864 2.386485,-0.707107 7.116116,-3.204505 17.116116,-3.204505 10,0 16.723573,-9.248699 17.651651,-10.353553 l -32.051777,0.04419 z"
id="path323"
style="fill:url(#linearGradient156);fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 15.143007,10.5625 24.314824,0"
id="path8281"
style="fill:none;stroke:#a1a1a1;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 45.820083,19.6875 -33.158471,0 c 0,0 -2.147748,16.019607 -4.7222722,18.240578 8.1210772,0 31.5711712,-0.04864 31.5909902,-0.04864 1.751659,0 4.907641,-12.636194 6.289753,-18.191942 z"
id="path324"
style="opacity:0.52272728;fill:none;stroke:url(#linearGradient155);stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 14.398767,12.5625 23.853392,0"
id="path8283"
style="fill:none;stroke:#a1a1a1;stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 13.629028,14.5625 23.346303,0"
id="path8285"
style="fill:none;stroke:#a1a1a1;stroke-width:1.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="m 12.520679,16.5625 18.646161,0"
id="path8287"
style="fill:none;stroke:#a1a1a1;stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
d="M 6.375,31.75 C 5.1336344,19.511961 13.5625,12.6875 12,2.9999999 l 30.875,0 -30,0.625 C 14.125,13.1875 6.6786165,18.271447 6.375,31.75 z"
id="path8289"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:block;overflow:visible" />
</g>
<g
id="layer2"
transform="translate(-0.20338983,2.0338983)" />
</svg>

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,557 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="Document-save.svg"
inkscape:version="0.47pre4 r22446"
sodipodi:version="0.32"
id="svg2913"
height="48px"
width="48px"
version="1.1">
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective3278" />
<linearGradient
inkscape:collect="always"
id="linearGradient6925">
<stop
style="stop-color:#204a87;stop-opacity:1;"
offset="0"
id="stop6927" />
<stop
style="stop-color:#204a87;stop-opacity:0;"
offset="1"
id="stop6929" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6901">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop6903" />
<stop
style="stop-color:#3465a4;stop-opacity:0;"
offset="1"
id="stop6905" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4991">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4993" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop4995" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4991"
id="radialGradient4997"
cx="23.447077"
cy="6.4576745"
fx="23.447077"
fy="6.4576745"
r="19.0625"
gradientTransform="matrix(-1.314471,-0.01006312,-0.01022964,1.336221,46.59608,-5.784887)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient2187"
inkscape:collect="always">
<stop
id="stop2189"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop2191"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2187"
id="linearGradient1764"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.914114,0,0,0.914114,-3.493698,-3.581902)"
x1="33.059906"
y1="27.394117"
x2="12.624337"
y2="12.583769" />
<linearGradient
inkscape:collect="always"
id="linearGradient8662">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop8664" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop8666" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient8662"
id="radialGradient8668"
cx="24.837126"
cy="36.421127"
fx="24.837126"
fy="36.421127"
r="15.644737"
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient2555">
<stop
id="stop2557"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
style="stop-color:#e6e6e6;stop-opacity:1.0000000;"
offset="0.50000000"
id="stop2561" />
<stop
id="stop2563"
offset="0.75000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
<stop
style="stop-color:#e1e1e1;stop-opacity:1.0000000;"
offset="0.84166664"
id="stop2565" />
<stop
id="stop2559"
offset="1.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient4274">
<stop
style="stop-color:#ffffff;stop-opacity:0.25490198;"
offset="0.0000000"
id="stop4276" />
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop4278" />
</linearGradient>
<linearGradient
id="linearGradient4264"
inkscape:collect="always">
<stop
id="stop4266"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop4268"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient4254"
inkscape:collect="always">
<stop
id="stop4256"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop4258"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient4244">
<stop
id="stop4246"
offset="0.0000000"
style="stop-color:#e4e4e4;stop-opacity:1.0000000;" />
<stop
id="stop4248"
offset="1.0000000"
style="stop-color:#d3d3d3;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient4236"
inkscape:collect="always">
<stop
id="stop4238"
offset="0"
style="stop-color:#eeeeee;stop-opacity:1;" />
<stop
id="stop4240"
offset="1"
style="stop-color:#eeeeee;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient4228">
<stop
id="stop4230"
offset="0.0000000"
style="stop-color:#bbbbbb;stop-opacity:1.0000000;" />
<stop
id="stop4232"
offset="1.0000000"
style="stop-color:#9f9f9f;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient4184">
<stop
id="stop4186"
offset="0.0000000"
style="stop-color:#838383;stop-opacity:1.0000000;" />
<stop
id="stop4188"
offset="1.0000000"
style="stop-color:#bbbbbb;stop-opacity:0.0000000;" />
</linearGradient>
<linearGradient
gradientTransform="translate(1.170493,2.92418)"
y2="35.281250"
x2="24.687500"
y1="35.281250"
x1="7.0625000"
gradientUnits="userSpaceOnUse"
id="linearGradient4209"
xlink:href="#linearGradient4184"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="40.943935"
x2="36.183067"
y1="28.481176"
x1="7.6046205"
id="linearGradient4234"
xlink:href="#linearGradient4228"
inkscape:collect="always"
gradientTransform="translate(0.375,4.25)" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="33.758667"
x2="12.221823"
y1="37.205811"
x1="12.277412"
id="linearGradient4242"
xlink:href="#linearGradient4236"
inkscape:collect="always"
gradientTransform="translate(0.375,4.25)" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.286242,0.781698,-0.710782,1.169552,-1.979348,-0.62686)"
r="20.935817"
fy="2.9585190"
fx="15.571491"
cy="2.9585190"
cx="15.571491"
id="radialGradient4250"
xlink:href="#linearGradient4244"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="47.620636"
x2="44.096100"
y1="4.4331360"
x1="12.378357"
id="linearGradient4260"
xlink:href="#linearGradient4254"
inkscape:collect="always"
gradientTransform="translate(0.375,4.25)" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.651032,0,9.455693)"
r="23.555494"
fy="27.096155"
fx="23.201941"
cy="27.096155"
cx="23.201941"
id="radialGradient4270"
xlink:href="#linearGradient4264"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="26.357183"
x2="23.688078"
y1="11.318835"
x1="23.688078"
id="linearGradient4272"
xlink:href="#linearGradient4274"
inkscape:collect="always"
gradientTransform="translate(0.375,4.25)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2555"
id="linearGradient2553"
x1="33.431175"
y1="31.964777"
x2="21.747974"
y2="11.780679"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6901"
id="linearGradient6907"
x1="14.751649"
y1="15.868432"
x2="8.8953285"
y2="16.743431"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0.375,-0.875)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6925"
id="linearGradient6931"
x1="12.25"
y1="18.25"
x2="7"
y2="21.118431"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0.375,-0.875)" />
</defs>
<sodipodi:namedview
inkscape:window-y="178"
inkscape:window-x="462"
inkscape:window-height="907"
inkscape:window-width="999"
inkscape:document-units="px"
inkscape:grid-bbox="true"
showgrid="true"
inkscape:current-layer="layer1"
inkscape:cy="13.714547"
inkscape:cx="11.306615"
inkscape:zoom="8"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="0.22745098"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
inkscape:showpageshadow="false"
fill="#3465a4"
stroke="#204a87"
inkscape:window-maximized="0" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Save</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>hdd</rdf:li>
<rdf:li>hard drive</rdf:li>
<rdf:li>save</rdf:li>
<rdf:li>io</rdf:li>
<rdf:li>store</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:identifier />
<dc:source>http://jimmac.musichall.cz</dc:source>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="pix"
id="layer2"
inkscape:groupmode="layer">
<path
transform="matrix(1.052533,0,0,0.363113,-0.136757,31.11986)"
d="m 46.757435,27.096155 a 23.555494,15.335379 0 1 1 -47.11098877,0 23.555494,15.335379 0 1 1 47.11098877,0 z"
sodipodi:ry="15.335379"
sodipodi:rx="23.555494"
sodipodi:cy="27.096155"
sodipodi:cx="23.201941"
id="path4262"
style="opacity:0.56000001;color:#000000;fill:url(#radialGradient4270);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
sodipodi:type="arc" />
<path
sodipodi:nodetypes="cccsccccccccc"
id="path4196"
d="m 11.66069,12.212628 c -0.625,0 -1.031249,0.29018 -1.281248,0.843753 -10e-7,0 -6.4687505,17.103557 -6.4687505,17.103557 0,0 -0.25,0.671559 -0.25,1.78125 0,0 0,9.649968 0,9.649968 0,1.082613 0.6577855,1.625002 1.65625,1.625 l 38.5624985,0 c 0.984853,0 1.59375,-0.71818 1.59375,-1.84375 l 0,-9.649968 c 0,0 0.105963,-0.770423 -0.09375,-1.3125 L 38.66069,13.212631 c -0.184525,-0.511906 -0.636905,-0.988098 -1.125,-1.000003 l -25.875,0 z"
style="fill:none;stroke:#535353;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="ccccccccc"
id="path4170"
d="m 3.6485915,31.246812 0.7646021,-0.692215 37.6096894,0.0625 3.462407,0.317298 0,10.438532 c 0,1.125569 -0.607018,1.843331 -1.591871,1.843331 l -38.5829876,0 c -0.9984647,0 -1.6618399,-0.542051 -1.6618399,-1.624664 l 0,-10.344782 z"
style="fill:url(#linearGradient4234);fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
sodipodi:nodetypes="csccccccs"
id="path3093"
d="m 3.9240842,30.164404 c -0.7142857,1.464286 -6.156e-4,2.392857 1.0357143,2.392857 0,0 38.9999985,0 38.9999985,0 1.119047,-0.02381 1.845238,-1.011905 1.428571,-2.142858 L 38.674082,13.203704 C 38.489558,12.691798 38.01932,12.215606 37.531225,12.203701 l -25.857142,0 c -0.625,0 -1.035714,0.303573 -1.285713,0.857146 0,0 -6.4642858,17.103557 -6.4642858,17.103557 z"
style="fill:url(#radialGradient4250);fill-opacity:1;fill-rule:evenodd;stroke:none" />
<rect
y="35.424183"
x="8.232996"
height="5.5625"
width="17.625"
id="rect4174"
style="color:#000000;fill:url(#linearGradient4209);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.40899992;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
sodipodi:nodetypes="cscc"
id="path4194"
d="m 8.2329947,40.98668 c 0,0 0,-4.011485 0,-4.011485 1.8355273,3.179226 8.2964903,4.011485 12.9374973,4.011485 0,0 -12.9374973,0 -12.9374973,0 z"
style="opacity:0.81142853;fill:url(#linearGradient4242);fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
sodipodi:nodetypes="cccccccc"
id="path4201"
d="m 45.171162,29.878688 c 0.06352,1.249974 -0.414003,2.31584 -1.322116,2.34375 0,0 -38.1187164,-10e-7 -38.1187163,0 -1.2892319,0 -1.867736,-0.324947 -2.0840507,-0.868056 0.091761,0.944332 0.8258174,1.649306 2.0840507,1.649306 -1e-7,-10e-7 38.1187163,0 38.1187163,0 1.076007,-0.03307 1.752805,-1.424024 1.352164,-2.994791 l -0.03005,-0.130209 z"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
id="path4211"
d="m 11.34375,14.40625 c -0.04608,0.200321 -0.1875,0.386797 -0.1875,0.59375 0,0.948605 0.59098,1.789474 1.34375,2.59375 0.240268,-0.154075 0.365117,-0.354408 0.625,-0.5 -0.940309,-0.816004 -1.553396,-1.716582 -1.78125,-2.6875 z m 26.65625,0 c -0.228727,0.969616 -0.842012,1.872426 -1.78125,2.6875 0.274144,0.153582 0.403988,0.36824 0.65625,0.53125 0.757262,-0.806656 1.3125,-1.673044 1.3125,-2.625 0,-0.206953 -0.141594,-0.393429 -0.1875,-0.59375 z m 2.1875,8.4375 c -0.613791,4.040111 -7.298613,7.25 -15.53125,7.25 -8.212254,1e-6 -14.8601499,-3.192786 -15.5,-7.21875 -0.032357,0.197132 -0.125,0.391882 -0.125,0.59375 3e-7,4.317947 6.989104,7.843751 15.625,7.84375 8.635896,0 15.656249,-3.525802 15.65625,-7.84375 0,-0.212924 -0.08905,-0.417356 -0.125,-0.625 z"
style="opacity:0.69142857;color:#000000;fill:url(#linearGradient4272);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
transform="translate(0.46338843,4.42678)"
d="m 8.5736699,25.593554 a 1.3700194,1.016466 0 1 1 -2.7400389,0 1.3700194,1.016466 0 1 1 2.7400389,0 z"
sodipodi:ry="1.016466"
sodipodi:rx="1.3700194"
sodipodi:cy="25.593554"
sodipodi:cx="7.2036505"
id="path4224"
style="color:#000000;fill:#ffffff;fill-opacity:0.45762706;fill-rule:evenodd;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="color:#000000;fill:#ffffff;fill-opacity:0.45762706;fill-rule:evenodd;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible"
id="path4226"
sodipodi:cx="7.2036505"
sodipodi:cy="25.593554"
sodipodi:rx="1.3700194"
sodipodi:ry="1.016466"
d="m 8.5736699,25.593554 a 1.3700194,1.016466 0 1 1 -2.7400389,0 1.3700194,1.016466 0 1 1 2.7400389,0 z"
transform="translate(34.34205,4.33839)" />
<path
style="fill:none;stroke:url(#linearGradient4260);stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 12.017515,12.665723 c -0.601692,0 -0.992791,0.279358 -1.233466,0.812287 -10e-7,0 -6.4150149,16.590722 -6.4150149,16.590722 0,0 -0.2406768,0.646515 -0.2406768,1.714823 0,0 0,9.290096 0,9.290096 0,1.35474 0.4440561,1.626899 1.5944841,1.626899 l 37.6869046,0 c 1.323126,0 1.534316,-0.316397 1.534316,-1.837492 l 0,-9.290096 c 0,0 0.10201,-0.741691 -0.09025,-1.263553 L 38.260616,13.503434 c -0.177643,-0.492817 -0.550652,-0.82625 -1.020545,-0.837711 l -25.222556,0 z"
id="path4252"
sodipodi:nodetypes="cccsccccccccc" />
<path
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885"
d="m 40.875,35.679166 0,5.020935"
id="path4282" />
<path
id="path4284"
d="m 38.875,35.738943 0,5.020935"
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885" />
<path
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885"
d="m 36.875,35.738943 0,5.020935"
id="path4286" />
<path
id="path4288"
d="m 34.875,35.738943 0,5.020935"
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885" />
<path
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885"
d="m 32.875,35.738943 0,5.020935"
id="path4290" />
<path
id="path4292"
d="m 30.875,35.738943 0,5.020935"
style="fill:none;stroke:#ffffff;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:0.42372885" />
<path
id="path4294"
d="m 39.875,35.729065 0,5.020935"
style="opacity:0.09714284;fill:none;stroke:#000000;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="opacity:0.09714284;fill:none;stroke:#000000;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1"
d="m 37.875,35.788842 0,5.020935"
id="path4296" />
<path
id="path4298"
d="m 35.875,35.788842 0,5.020935"
style="opacity:0.09714284;fill:none;stroke:#000000;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="opacity:0.09714284;fill:none;stroke:#000000;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1"
d="m 33.875,35.788842 0,5.020935"
id="path4300" />
<path
id="path4302"
d="m 31.875,35.788842 0,5.020935"
style="opacity:0.09714284;fill:none;stroke:#000000;stroke-width:1.00000048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="path4572"
d="m 8.25,35.4375 0,5.53125 12.5625,0 L 8.59375,40.625 8.25,35.4375 z"
style="opacity:0.43999999;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
sodipodi:type="arc"
style="opacity:0.20571427;color:#000000;fill:url(#linearGradient2553);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.93365198;marker:none;visibility:visible;display:inline;overflow:visible"
id="path2545"
sodipodi:cx="25"
sodipodi:cy="19.5625"
sodipodi:rx="14.875"
sodipodi:ry="6.6875"
d="m 39.875,19.5625 a 14.875,6.6875 0 1 1 -29.75,0 14.875,6.6875 0 1 1 29.75,0 z"
transform="matrix(1.037815,0,0,1.060747,-1.257878,2.15537)" />
</g>
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="down">
<path
transform="matrix(1.13019,0,0,-0.759601,-3.534725,52.79054)"
d="m 40.481863,36.421127 a 15.644737,8.3968935 0 1 1 -31.2894745,0 15.644737,8.3968935 0 1 1 31.2894745,0 z"
sodipodi:ry="8.3968935"
sodipodi:rx="15.644737"
sodipodi:cy="36.421127"
sodipodi:cx="24.837126"
id="path8660"
style="opacity:0.14117647;color:#000000;fill:url(#radialGradient8668);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
sodipodi:type="arc" />
<path
style="color:#000000;fill:url(#linearGradient6907);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient6931);stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
d="M 3.5784501,24.960194 C 2.5479477,-6.260337 29.116616,-1.326115 28.957416,14.913689 l 7.312914,0 L 24.892652,27.899671 12.960426,14.913689 c 0,0 7.541433,0 7.541433,0 C 20.958921,3.944322 3.7842324,0.735035 3.5784501,24.960194 z"
id="path1432"
sodipodi:nodetypes="ccccccc" />
<path
sodipodi:nodetypes="ccccccc"
id="path2177"
d="M 8.0392103,8.229105 C 12.78138,-0.915031 28.497336,1.842544 28.136604,15.704393 l 6.317372,0 c 0,0 -9.565825,10.957376 -9.565825,10.957376 L 14.79168,15.704393 c 0,0 6.45664,0 6.45664,0 C 21.519975,4.129161 11.297265,4.659521 8.0392103,8.229105 z"
style="opacity:0.47159095;color:#000000;fill:none;stroke:url(#linearGradient1764);stroke-width:0.99999934;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
<path
style="opacity:0.49431817;color:#000000;fill:url(#radialGradient4997);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.9999997;marker:none;visibility:visible;display:inline;overflow:visible"
d="m 35.142155,15.336613 -1.984176,2.545709 c -5.410032,-1.516293 -7.88615,2.729342 -15.673695,1.73179 l -3.861286,-4.409035 7.18647,0.08279 C 20.858219,3.441457 8.7193098,4.123966 5.4042663,12.752829 9.2122201,-2.136122 28.268316,-0.068588 28.65832,15.239112 l 6.483835,0.0975 z"
id="path4989"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,218 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48.000000px"
height="48.000000px"
id="svg6361"
sodipodi:version="0.32"
inkscape:version="0.47pre4 r22446"
sodipodi:docname="Help-browser.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective23" />
<linearGradient
id="linearGradient2431">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2433" />
<stop
style="stop-color:#b8b8b8;stop-opacity:1;"
offset="1"
id="stop2435" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient21644">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop21646" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop21648" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient21644"
id="radialGradient21650"
cx="25.125"
cy="36.75"
fx="25.125"
fy="36.75"
r="15.75"
gradientTransform="matrix(1,0,0,0.595238,0,14.875)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient2933">
<stop
id="stop2935"
offset="0"
style="stop-color:#9cbcde;stop-opacity:1" />
<stop
id="stop2937"
offset="1"
style="stop-color:#204a87" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2933"
id="radialGradient2207"
cx="26.544321"
cy="28.458725"
fx="26.544321"
fy="28.458725"
r="22.376116"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.238342,0.00595485,-0.00650776,1.351272,-6.992513,-9.744842)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2431"
id="radialGradient2437"
cx="-19.515638"
cy="16.855663"
fx="-19.515638"
fy="16.855663"
r="8.7536434"
gradientTransform="matrix(4.445991,0,0,6.8665,67.25071,-104.6679)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
inkscape:guide-bbox="true"
showguides="true"
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.15294118"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8"
inkscape:cx="22.974936"
inkscape:cy="15.153388"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1014"
inkscape:window-height="1104"
inkscape:window-x="178"
inkscape:window-y="35"
inkscape:showpageshadow="false"
fill="#deb887"
stroke="#204a87"
inkscape:window-maximized="0" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Help Browser</dc:title>
<dc:date>2005-11-06</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Tuomas Kuosmanen</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>help</rdf:li>
<rdf:li>browser</rdf:li>
<rdf:li>documentation</rdf:li>
<rdf:li>docs</rdf:li>
<rdf:li>man</rdf:li>
<rdf:li>info</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:contributor>
<cc:Agent>
<dc:title>Jakub Steiner, Andreas Nilsson</dc:title>
</cc:Agent>
</dc:contributor>
<dc:source>http://tigert.com</dc:source>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="opacity:0.63068183;color:#000000;fill:url(#radialGradient21650);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="path21642"
sodipodi:cx="25.125"
sodipodi:cy="36.75"
sodipodi:rx="15.75"
sodipodi:ry="9.375"
d="m 40.875,36.75 a 15.75,9.375 0 1 1 -31.5,0 15.75,9.375 0 1 1 31.5,0 z"
transform="matrix(1.173803,0,0,0.6,-5.004403,20.325)" />
<path
sodipodi:type="arc"
style="fill:url(#radialGradient2207);fill-opacity:1;stroke:#204a87;stroke-width:1"
id="path2093"
sodipodi:cx="23.909048"
sodipodi:cy="23.825787"
sodipodi:rx="21.876116"
sodipodi:ry="21.876116"
d="m 45.785164,23.825787 a 21.876116,21.876116 0 1 1 -43.7522317,0 21.876116,21.876116 0 1 1 43.7522317,0 z"
transform="matrix(0.938442,0,0,0.93868,1.564075,1.633906)" />
<path
transform="matrix(0.855103,0,0,0.855213,3.555288,3.625019)"
d="m 45.785164,23.825787 a 21.876116,21.876116 0 1 1 -43.7522317,0 21.876116,21.876116 0 1 1 43.7522317,0 z"
sodipodi:ry="21.876116"
sodipodi:rx="21.876116"
sodipodi:cy="23.825787"
sodipodi:cx="23.909048"
id="path2209"
style="opacity:0.96022728;fill:none;stroke:#ffffff;stroke-width:3.03077435;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:type="arc" />
<path
sodipodi:type="inkscape:offset"
inkscape:radius="0.13495015"
inkscape:original="M -20.25 6 C -21.298341 6.000026 -22.372769 6.1244771 -23.5 6.34375 C -24.627244 6.563073 -25.886043 6.8832479 -27.25 7.34375 L -27.25 12.5 C -26.100219 11.776335 -24.997109 11.236862 -23.9375 10.875 C -22.877902 10.502213 -21.881822 10.312521 -20.96875 10.3125 C -19.999334 10.312521 -19.259834 10.530174 -18.71875 10.96875 C -18.177686 11.396402 -17.906262 12.013726 -17.90625 12.78125 C -17.906261 13.285654 -18.039408 13.776881 -18.34375 14.28125 C -18.636843 14.785651 -19.107484 15.33609 -19.75 15.90625 L -20.84375 16.84375 C -22.038631 17.918325 -22.815518 18.829509 -23.1875 19.53125 C -23.559495 20.22205 -23.750005 21.007137 -23.75 21.90625 L -23.75 22.71875 L -17.65625 22.71875 L -17.65625 21.96875 C -17.656262 21.475338 -17.517981 21.030712 -17.28125 20.625 C -17.044542 20.208345 -16.547785 19.648586 -15.78125 18.96875 L -14.71875 18.03125 C -13.659161 17.055386 -12.908389 16.156813 -12.46875 15.3125 C -12.029144 14.457253 -11.781268 13.480828 -11.78125 12.40625 C -11.781268 10.311973 -12.525902 8.7417969 -13.96875 7.65625 C -15.41163 6.559783 -17.499549 6.0000261 -20.25 6 z M -23.75 25.15625 L -23.75 31 L -17.65625 31 L -17.65625 25.15625 L -23.75 25.15625 z "
xlink:href="#text2215"
style="font-size:34.15322876px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:url(#radialGradient2437);fill-opacity:1;stroke:#ffffff;stroke-width:1.09947276px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.78612713;font-family:Bitstream Vera Sans"
id="path1554"
d="m -20.25,5.875 c -1.059019,2.63e-5 -2.147637,0.1232356 -3.28125,0.34375 -1.132925,0.2204283 -2.380162,0.5375125 -3.75,1 a 0.13496364,0.13496364 0 0 0 -0.03125,0 0.13496364,0.13496364 0 0 0 -0.03125,0.03125 0.13496364,0.13496364 0 0 0 -0.03125,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 l 0,5.15625 a 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 c 1.142438,-0.719043 2.233352,-1.267138 3.28125,-1.625 1.048141,-0.368756 2.043116,-0.562479 2.9375,-0.5625 0.949218,2.1e-5 1.644925,0.210545 2.15625,0.625 0.508723,0.40209 0.781238,0.98304 0.78125,1.71875 -10e-6,0.480657 -0.144188,0.95141 -0.4375,1.4375 -0.282991,0.487016 -0.740265,1.030495 -1.375,1.59375 L -20.9375,16.75 c -1.201459,1.08049 -1.989243,1.991022 -2.375,2.71875 -0.383113,0.711446 -0.562505,1.519324 -0.5625,2.4375 l 0,0.8125 a 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 l 6.09375,0 a 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,-0.03125 0.13496364,0.13496364 0 0 0 0.03125,-0.03125 0.13496364,0.13496364 0 0 0 0,-0.03125 0.13496364,0.13496364 0 0 0 0,-0.03125 l 0,-0.75 c -1.1e-5,-0.468196 0.14837,-0.892849 0.375,-1.28125 0.222295,-0.391284 0.708073,-0.950359 1.46875,-1.625 l 1.0625,-0.9375 c 1.066588,-0.98231 1.830659,-1.884654 2.28125,-2.75 0.449269,-0.874046 0.687482,-1.87342 0.6875,-2.96875 -1.8e-5,-2.126265 -0.743769,-3.7340276 -2.21875,-4.84375 -1.475197,-1.1210252 -3.60624,-1.6874737 -6.375,-1.6875 z m -3.5625,19.15625 a 0.13496364,0.13496364 0 0 0 -0.03125,0.03125 0.13496364,0.13496364 0 0 0 -0.03125,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 l 0,5.84375 a 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0.03125 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 l 6.09375,0 a 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,0 0.13496364,0.13496364 0 0 0 0.03125,-0.03125 0.13496364,0.13496364 0 0 0 0.03125,-0.03125 0.13496364,0.13496364 0 0 0 0,-0.03125 0.13496364,0.13496364 0 0 0 0,-0.03125 l 0,-5.84375 a 0.13496364,0.13496364 0 0 0 0,-0.03125 0.13496364,0.13496364 0 0 0 0,-0.03125 0.13496364,0.13496364 0 0 0 -0.03125,-0.03125 0.13496364,0.13496364 0 0 0 -0.03125,-0.03125 0.13496364,0.13496364 0 0 0 -0.03125,0 0.13496364,0.13496364 0 0 0 -0.03125,0 l -6.09375,0 a 0.13496364,0.13496364 0 0 0 -0.03125,0 0.13496364,0.13496364 0 0 0 -0.03125,0 z"
transform="matrix(0.849895,0,0,0.835205,41.72981,8.548327)"
inkscape:href="#text2215" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="128" height="128" viewBox="0 0 128 128"
overflow="visible" enable-background="new 0 0 128 128" xml:space="preserve">
<path opacity="0.2" fill="#1A1A1A" d="M125,106c0,6.286-2.713,9-9,9H14c-6.286,0-9-2.714-9-9V24c0-6.287,2.714-9,9-9h102
c6.287,0,9,2.713,9,9V106z"/>
<path opacity="0.2" fill="#1A1A1A" d="M124.25,107c0,6.286-2.68,9-8.888,9H14.638c-6.208,0-8.888-2.714-8.888-9V25
c0-6.287,2.68-9,8.888-9h100.725c6.208,0,8.888,2.713,8.888,9V107z"/>
<path opacity="0.4" fill="#1A1A1A" d="M14,12C7.178,12,4,15.178,4,22v82c0,6.822,3.178,10,10,10h102c6.822,0,10-3.178,10-10V22
c0-6.822-3.178-10-10-10H14z"/>
<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="23.3413" y1="24" x2="119.5405" y2="114.0588">
<stop offset="0" style="stop-color:#F8F9F8"/>
<stop offset="1" style="stop-color:#E7E7E6"/>
</linearGradient>
<path fill="url(#XMLID_7_)" d="M125,104c0,6.286-2.713,9-9,9H14c-6.286,0-9-2.714-9-9V22c0-6.287,2.714-9,9-9h102
c6.287,0,9,2.713,9,9V104z"/>
<rect x="16" y="36" fill="#003A8F" width="98" height="52"/>
<rect x="17" y="37" fill="#FFFFFF" width="98" height="52"/>
<radialGradient id="XMLID_8_" cx="44" cy="46" r="94.8685" gradientUnits="userSpaceOnUse">
<stop offset="0" style="stop-color:#538ED4"/>
<stop offset="1" style="stop-color:#001940"/>
</radialGradient>
<rect x="16" y="50" fill="url(#XMLID_8_)" width="98" height="38"/>
<rect x="16" y="36" fill="#296096" width="98" height="14"/>
<path fill="#52463A" d="M67,87.951c-2.975-3.135-5.95-6.269-11.899-6.269c-5.949,0-20.823-6.271-20.823-6.271
s-11.899-6.27-17.849-6.27c0,6.27,0,18.809,0,18.809H67z"/>
<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="70.2695" y1="26.522" x2="57.2696" y2="73.522">
<stop offset="0" style="stop-color:#65A2DC"/>
<stop offset="0.5674" style="stop-color:#4E83C2"/>
<stop offset="1" style="stop-color:#88AEC2"/>
</linearGradient>
<path fill="url(#XMLID_9_)" d="M113,54.143c-30,0-84,11.429-96,22.857V37h96V54.143z"/>
<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="18.6816" y1="75.5381" x2="49.1252" y2="91.7747">
<stop offset="0" style="stop-color:#7C8271"/>
<stop offset="1" style="stop-color:#786755"/>
</linearGradient>
<path fill="url(#XMLID_10_)" d="M65.5,88c-2.912-2.833-5.823-5.666-11.647-5.666c-5.823,0-20.382-5.667-20.382-5.667
S21.823,71,16,71c0,5.667,0,17,0,17H65.5z"/>
<path fill="#CBC7B8" d="M17,77c1.74-1.657,4.369-3.314,7.675-4.938c-2.697-0.968-5.513-1.774-7.675-1.902V77z"/>
<path fill="#52463A" d="M83.939,87.955c0,0,2.728-4.596,6.291-4.596c3.564,0,4.401,4.596,4.401,4.596H83.939z"/>
<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="85.4639" y1="86.5039" x2="94.0352" y2="86.5039" gradientTransform="matrix(1 0 -0.1353 0.9324 11.5082 5.4565)">
<stop offset="0" style="stop-color:#7C8271"/>
<stop offset="1" style="stop-color:#786755"/>
</linearGradient>
<path fill="url(#XMLID_11_)" d="M85,87.955c0,0,2.187-3.685,5.043-3.685c2.857,0,3.528,3.685,3.528,3.685H85z"/>
<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="41" y1="47.7856" x2="101.25" y2="47.7856">
<stop offset="0" style="stop-color:#6085B9"/>
<stop offset="1" style="stop-color:#37497A"/>
</linearGradient>
<path fill="url(#XMLID_12_)" d="M45.288,50.143h67.215c-1.565-2.777-4.952-4.714-8.909-4.714H54.199
C50.241,45.429,46.853,47.366,45.288,50.143z"/>
<path fill="#BCAC8D" d="M27.793,76.766c-1.633-2.153-4.843-3.357-5.856-0.658c-1.012,2.697-2.025,5.396-2.025,5.396l6.983,4.161
L27.793,76.766z"/>
<path fill="#56573F" d="M30.825,76.912C30.327,79.664,27,87,27,87h-8c0,0,8.157-11.922,9.991-11.005
C30.825,76.912,30.825,76.912,30.825,76.912z"/>
<path fill="#3A434C" d="M30,86c0,0,5.228-2.161,6.918-3.625s2.457-3.311,2.457-3.311l-4.461,0.313L30,86z"/>
<path fill="#BCAC8D" d="M37,81c-2-1-5-1-5,1s0,4,0,4l7,1L37,81z"/>
<path fill="#BCAC8D" d="M46,82.493c-2-0.751-5-0.751-5,0.751c0,1.503,0,3.005,0,3.005L48,87L46,82.493z"/>
<path fill="#94876F" d="M53.794,83.459c-1.85-0.699-3.949-0.699-3.047,0.699c0.901,1.399,1.803,2.799,1.803,2.799l5.348,0.699
L53.794,83.459z"/>
<path fill="#53634C" d="M51,86c0,0-4-4-6-5s-4-1-4-1l2,4L51,86z"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -1,229 +0,0 @@
//------------------------------------------------------------------------------
// Original: Help-browser.svg
// Size: 32x32
// Format: RGBA
// Conversion:
// 1) SVG to 32x32 PNG with Inkscape
// 2) PNG to RGBA with ImageMagick (convert icon_help.png icon_help.rgba)
// 3) RGBA to C code with bin2c (bin2c icon_help.rgba icon_help > icon_help.h)
//------------------------------------------------------------------------------
static const unsigned char icon_help[] = {
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,31,73,135,49,
34,75,136,152,51,90,145,205,80,114,161,219,106,134,175,230,106,134,175,
230,80,114,161,219,51,91,145,205,33,77,137,153,31,73,135,49,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,33,75,136,92,68,103,155,219,148,168,198,246,209,218,231,255,247,
249,251,255,247,249,251,255,247,249,251,255,247,249,251,255,247,249,251,255,
247,249,251,255,210,219,231,255,149,170,198,246,69,104,155,219,33,74,137,
93,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,30,75,135,34,34,76,138,207,133,156,190,
248,240,243,247,255,247,249,251,255,238,242,246,255,189,202,221,255,162,181,
207,255,140,164,196,255,141,164,197,255,163,182,208,255,190,203,221,255,239,
242,247,255,247,249,251,255,240,243,247,255,136,158,192,248,35,77,138,207,
30,75,135,34,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,31,
73,136,73,66,102,153,230,197,208,224,255,247,249,251,255,228,233,241,255,
122,149,186,255,67,105,158,255,63,102,157,255,65,104,158,255,66,105,159,
255,66,106,159,255,66,106,159,255,66,105,159,255,71,109,161,255,125,152,
189,255,228,234,241,255,247,249,251,255,199,210,226,255,67,103,154,229,35,
73,136,73,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,30,75,135,68,109,137,177,240,237,241,
246,255,247,249,251,255,181,196,217,255,72,110,161,255,64,103,157,255,67,
106,159,255,69,108,161,255,71,110,162,255,72,111,163,255,73,112,164,255,
73,112,164,255,72,111,163,255,71,110,163,255,70,109,161,255,79,116,166,
255,184,199,219,255,247,249,251,255,238,241,246,255,111,139,178,240,34,75,
135,68,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
31,77,131,33,66,102,154,229,237,241,246,255,236,240,245,255,123,150,187,
255,62,102,156,255,66,105,159,255,70,109,161,255,73,111,164,255,75,114,
165,255,77,116,167,255,79,117,168,255,80,118,168,255,80,118,168,255,79,
117,168,255,78,116,167,255,76,114,166,255,73,112,164,255,71,109,162,255,
129,155,191,255,237,241,246,255,238,242,246,255,67,104,155,229,31,77,131,
33,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,34,76,137,207,197,
208,224,255,247,249,251,255,123,150,187,255,63,102,157,255,67,107,160,255,
72,110,163,255,75,114,165,255,79,117,168,255,81,119,170,255,102,135,180,
255,120,150,189,255,128,157,194,255,114,146,187,255,94,130,177,255,84,122,
172,255,82,120,170,255,80,118,168,255,76,115,166,255,73,111,163,255,130,
156,192,255,248,249,251,255,200,211,227,255,37,79,138,207,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,33,74,134,93,133,157,190,248,247,249,251,255,181,196,
217,255,63,102,156,255,68,107,160,255,72,111,163,255,77,115,167,255,81,
119,169,255,185,200,220,255,217,224,235,255,233,237,242,255,244,246,247,255,
251,251,251,255,240,242,246,255,228,234,241,255,193,206,224,255,101,136,180,
255,85,123,173,255,82,120,170,255,78,116,167,255,74,112,164,255,186,200,
220,255,248,249,251,255,137,161,194,248,33,74,137,93,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
68,103,155,219,240,243,247,255,228,233,241,255,73,111,161,255,67,106,159,
255,72,111,163,255,77,116,167,255,82,120,170,255,86,124,173,255,224,230,
238,255,244,244,244,255,247,247,247,255,250,250,250,255,252,252,252,255,251,
251,251,255,249,249,249,255,247,247,247,255,210,220,232,255,96,131,179,255,
88,125,174,255,83,121,171,255,79,117,168,255,84,121,170,255,229,235,242,
255,241,244,248,255,70,105,156,219,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,30,75,135,51,148,168,198,246,247,
249,251,255,123,150,187,255,65,104,158,255,71,110,162,255,76,115,166,255,
82,120,170,255,87,125,174,255,92,129,177,255,225,231,238,255,245,245,245,
255,233,238,244,255,222,230,239,255,229,235,243,255,250,251,252,255,249,249,
249,255,246,246,246,255,244,244,245,255,137,164,199,255,93,130,178,255,88,
126,174,255,83,121,171,255,78,116,167,255,132,158,193,255,248,249,251,255,
152,172,201,246,30,75,135,51,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,33,75,137,153,209,218,231,255,239,242,247,255,68,107,
159,255,68,107,161,255,75,113,165,255,80,119,169,255,86,124,173,255,92,
129,177,255,97,134,180,255,224,231,240,255,182,199,221,255,121,154,195,255,
111,147,190,255,116,151,193,255,224,231,240,255,249,249,249,255,246,246,246,
255,244,244,244,255,174,193,216,255,98,135,181,255,93,130,178,255,88,125,
174,255,82,120,170,255,82,118,169,255,240,243,247,255,212,221,233,255,35,
77,138,153,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
51,89,146,206,247,249,251,255,189,203,221,255,65,104,158,255,72,110,163,
255,78,116,167,255,84,122,171,255,90,127,176,255,96,133,180,255,101,138,
184,255,107,143,188,255,111,146,190,255,114,150,193,255,117,152,195,255,128,
161,200,255,231,237,244,255,248,248,248,255,246,246,246,255,243,243,244,255,
149,174,207,255,103,139,184,255,97,134,181,255,92,129,177,255,86,123,173,
255,79,118,168,255,194,207,225,255,248,249,251,255,54,92,148,205,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,80,114,162,219,247,
249,251,255,164,182,208,255,68,107,160,255,74,113,165,255,81,119,169,255,
87,125,174,255,94,131,178,255,100,136,182,255,106,142,187,255,111,147,190,
255,116,151,194,255,120,155,197,255,133,166,203,255,221,230,239,255,249,249,
249,255,247,247,247,255,245,245,245,255,224,231,239,255,120,154,195,255,107,
143,188,255,101,138,183,255,95,132,179,255,89,126,175,255,82,120,170,255,
171,189,213,255,248,249,251,255,83,117,164,219,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,106,135,175,230,247,249,251,255,143,166,
198,255,69,108,161,255,76,115,166,255,83,121,171,255,90,127,176,255,96,
133,180,255,103,139,185,255,109,145,189,255,115,150,193,255,121,156,197,255,
132,164,204,255,221,230,241,255,248,248,248,255,247,247,247,255,245,245,245,
255,232,237,243,255,148,176,209,255,117,152,194,255,111,146,190,255,104,141,
186,255,98,135,181,255,91,129,177,255,85,122,172,255,152,174,204,255,248,
249,251,255,109,137,177,230,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,106,135,176,230,247,249,251,255,143,167,198,255,71,110,162,
255,78,116,167,255,85,123,172,255,92,129,177,255,99,135,182,255,106,142,
187,255,112,148,191,255,119,154,196,255,125,159,200,255,204,218,233,255,245,
245,245,255,245,245,245,255,245,245,245,255,235,239,245,255,161,187,217,255,
126,161,201,255,120,155,197,255,114,149,192,255,107,143,188,255,100,137,183,
255,94,131,178,255,87,124,173,255,153,175,205,255,248,249,251,255,110,137,
177,230,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,81,
115,162,219,247,249,251,255,166,184,209,255,72,111,163,255,79,117,168,255,
86,124,173,255,93,130,178,255,100,137,183,255,107,143,188,255,114,150,193,
255,121,156,198,255,128,162,202,255,226,233,240,255,242,242,242,255,243,243,
243,255,243,244,245,255,179,201,226,255,136,169,208,255,129,164,203,255,123,
157,199,255,116,151,194,255,109,145,189,255,102,138,184,255,95,132,179,255,
88,125,174,255,173,191,215,255,248,249,251,255,84,118,164,219,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,52,92,146,206,247,249,
251,255,192,205,223,255,73,112,164,255,80,118,169,255,87,125,174,255,94,
131,179,255,101,138,184,255,108,144,189,255,116,151,194,255,123,157,199,255,
131,165,205,255,212,223,237,255,216,227,238,255,218,228,239,255,220,230,241,
255,154,185,218,255,138,172,210,255,131,165,205,255,124,159,200,255,117,152,
195,255,110,146,190,255,103,139,185,255,96,133,180,255,89,126,175,255,197,
210,227,255,248,249,251,255,56,95,149,205,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,35,77,138,152,211,220,232,255,239,243,247,
255,79,116,167,255,80,118,169,255,87,125,174,255,94,131,179,255,101,138,
184,255,109,144,189,255,116,151,194,255,123,158,199,255,131,165,204,255,209,
221,235,255,217,227,239,255,219,229,241,255,218,229,240,255,155,185,218,255,
139,172,210,255,132,166,205,255,125,159,200,255,117,153,195,255,110,146,190,
255,103,139,185,255,96,133,180,255,94,130,178,255,241,244,248,255,214,222,
234,255,37,79,139,152,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,31,73,135,49,151,172,200,246,248,249,251,255,132,158,193,255,
80,118,168,255,87,124,173,255,94,131,178,255,101,137,183,255,108,144,188,
255,115,150,193,255,122,157,198,255,132,165,204,255,230,235,241,255,236,236,
236,255,237,237,237,255,236,238,241,255,160,188,219,255,137,170,209,255,130,
164,204,255,123,158,199,255,116,152,194,255,109,145,189,255,102,139,184,255,
95,132,179,255,142,168,200,255,248,250,252,255,155,176,203,246,31,73,135,
49,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,70,105,157,218,241,244,248,255,230,235,242,255,90,126,173,255,86,
123,173,255,92,130,177,255,99,136,182,255,106,142,187,255,113,148,192,255,
120,155,196,255,129,162,202,255,229,234,240,255,234,234,234,255,235,235,235,
255,234,237,240,255,155,184,216,255,133,167,206,255,127,162,202,255,121,156,
198,255,115,150,193,255,108,144,188,255,101,137,183,255,104,139,184,255,232,
237,244,255,242,245,249,255,73,108,159,218,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,33,75,136,
92,139,162,195,247,248,249,251,255,189,203,222,255,84,122,171,255,91,128,
176,255,97,134,181,255,104,140,185,255,110,146,190,255,116,152,194,255,125,
159,199,255,231,236,241,255,237,237,237,255,237,237,237,255,237,239,242,255,
150,179,212,255,128,162,203,255,123,158,199,255,118,153,195,255,112,147,191,
255,105,141,186,255,99,135,182,255,194,208,226,255,248,250,252,255,145,167,
199,247,36,78,139,92,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,38,80,140,206,
202,213,228,255,248,249,251,255,139,164,198,255,88,126,174,255,95,132,179,
255,101,137,183,255,107,143,187,255,112,148,191,255,119,153,195,255,157,183,
212,255,162,187,215,255,164,188,217,255,163,188,216,255,130,163,203,255,123,
157,199,255,119,154,196,255,114,149,192,255,108,144,188,255,102,139,184,255,
148,173,205,255,249,250,252,255,206,217,231,255,41,81,141,206,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,31,77,131,33,71,106,158,229,239,
242,247,255,238,242,247,255,141,166,199,255,91,128,177,255,97,134,181,255,
103,139,185,255,108,144,188,255,112,148,191,255,116,151,194,255,119,154,196,
255,121,156,197,255,121,156,197,255,120,155,196,255,117,152,195,255,113,149,
192,255,109,145,189,255,104,140,185,255,150,175,206,255,240,243,248,255,240,
244,248,255,74,109,160,229,31,77,131,33,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,34,79,139,68,115,142,180,240,239,243,
247,255,248,250,252,255,193,207,225,255,103,138,183,255,98,135,181,255,103,
139,185,255,107,143,188,255,110,146,190,255,113,148,192,255,114,150,193,255,
114,150,193,255,113,149,192,255,111,147,190,255,108,144,188,255,113,147,189,
255,197,211,228,255,249,250,252,255,241,244,248,255,118,145,184,240,38,79,
139,68,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,30,70,124,76,71,107,157,231,205,215,230,
255,248,250,252,255,232,237,244,255,146,171,203,255,104,138,184,255,101,138,
184,255,104,141,186,255,107,143,187,255,108,144,188,255,108,144,188,255,107,
143,188,255,110,145,188,255,152,176,207,255,234,239,245,255,249,250,252,255,
208,219,232,255,74,109,158,231,31,65,114,83,0,0,0,6,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,0,0,0,2,0,
0,0,16,0,0,0,28,15,37,63,69,37,77,135,217,143,165,196,250,
242,245,249,255,248,250,252,255,242,245,249,255,201,213,229,255,177,195,218,
255,163,185,212,255,164,186,212,255,178,197,220,255,202,215,230,255,243,246,
249,255,249,250,252,255,243,246,249,255,146,169,199,250,39,79,134,219,13,
34,57,76,0,0,0,37,0,0,0,24,0,0,0,11,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,0,0,0,5,0,0,0,19,0,0,
0,32,0,0,0,45,0,0,0,58,24,52,93,137,70,102,150,231,155,
175,202,249,216,225,236,255,249,250,252,255,249,250,252,255,249,250,252,255,
249,250,252,255,249,250,252,255,249,250,252,255,217,226,237,255,157,176,203,
250,71,104,151,232,25,51,90,144,0,0,0,67,0,0,0,54,0,0,
0,40,0,0,0,28,0,0,0,15,0,0,0,1,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,0,0,0,9,0,0,0,22,0,0,0,
34,0,0,0,45,0,0,0,57,0,0,0,68,14,32,59,112,31,65,
114,188,58,93,141,225,87,117,159,234,110,136,173,241,110,136,173,241,87,
116,158,234,59,93,141,226,32,66,113,190,13,30,56,118,0,0,0,75,
0,0,0,64,0,0,0,53,0,0,0,42,0,0,0,30,0,0,0,
18,0,0,0,4,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,0,0,0,9,0,0,0,20,
0,0,0,30,0,0,0,38,0,0,0,45,0,0,0,52,0,0,0,
57,0,0,0,61,0,0,0,64,0,0,0,64,0,0,0,63,0,0,
0,60,0,0,0,56,0,0,0,50,0,0,0,43,0,0,0,35,0,
0,0,27,0,0,0,17,0,0,0,5,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,0,
0,0,1,0,0,0,5,0,0,0,10,0,0,0,14,0,0,0,18,
0,0,0,20,0,0,0,21,0,0,0,20,0,0,0,16,0,0,0,
13,0,0,0,9,0,0,0,4,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,
0
};

View File

@@ -1,229 +0,0 @@
//------------------------------------------------------------------------------
// Original: Document_open.svg
// Size: 32x32
// Format: RGBA
// Conversion:
// 1) SVG to 32x32 PNG with Inkscape
// 2) PNG to RGBA with ImageMagick (convert icon_open.png icon_open.rgba)
// 3) RGBA to C code with bin2c (bin2c icon_open.rgba icon_open > icon_open.h)
//------------------------------------------------------------------------------
static const unsigned char icon_open[] = {
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,77,
77,77,56,76,76,76,57,75,75,75,58,78,78,78,59,77,77,77,60,
75,75,75,61,78,78,78,62,81,81,81,63,86,86,86,65,89,89,89,
66,91,91,91,67,94,94,94,68,100,100,100,69,102,102,102,70,104,104,
104,71,106,106,106,72,110,110,110,74,112,112,112,75,117,117,117,76,119,
119,119,77,121,121,121,78,123,123,123,79,128,128,128,10,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,107,107,107,231,214,214,
214,247,204,204,204,246,203,203,203,246,201,201,201,246,201,201,201,245,199,
199,199,246,200,200,200,245,199,199,199,246,199,199,199,246,200,200,200,246,
200,200,200,246,201,201,201,246,200,200,200,247,202,202,202,246,201,201,201,
247,202,202,202,248,202,202,202,248,203,203,203,248,203,203,203,249,204,204,
204,249,148,148,148,237,123,123,123,27,255,255,255,0,255,255,255,0,255,
255,255,0,90,90,90,36,90,90,90,48,90,90,90,48,90,90,90,48,
90,90,90,48,90,90,90,48,118,118,118,217,252,252,252,255,250,250,250,
255,250,250,250,255,250,250,250,255,250,250,250,255,250,250,250,255,250,250,
250,255,250,250,250,255,250,250,250,255,250,250,250,255,250,250,250,255,250,
250,250,255,250,250,250,255,250,250,250,255,250,250,250,255,250,250,250,255,
250,250,250,255,250,250,250,255,250,250,250,255,250,250,250,255,158,158,158,
228,112,112,112,16,255,255,255,0,255,255,255,0,96,96,96,71,140,140,
140,237,167,167,167,240,168,168,168,240,168,168,168,240,169,169,169,240,170,
170,170,241,125,125,125,251,242,242,242,255,241,241,241,255,201,201,201,255,
194,194,194,255,194,194,194,255,194,194,194,255,194,194,194,255,194,194,194,
255,195,195,195,255,195,195,195,255,195,195,195,255,195,195,195,255,195,195,
195,255,195,195,195,255,195,195,195,255,195,195,195,255,196,196,196,255,202,
202,202,255,247,247,247,255,248,248,248,255,148,148,148,227,102,102,102,5,
255,255,255,0,255,255,255,0,94,94,94,89,189,189,189,254,169,169,169,
255,162,162,162,255,162,162,162,255,162,162,162,255,162,162,162,255,137,137,
137,255,237,237,237,255,231,231,231,255,211,211,211,255,208,208,208,255,208,
208,208,255,209,209,209,255,209,209,209,255,209,209,209,255,209,209,209,255,
209,209,209,255,210,210,210,255,210,210,210,255,210,210,210,255,211,211,211,
255,211,211,211,255,227,227,227,255,232,232,232,255,233,233,233,255,238,238,
238,255,238,238,238,255,139,139,139,226,255,255,255,0,255,255,255,0,255,
255,255,0,90,90,90,61,180,180,180,249,165,165,165,255,156,156,156,255,
156,156,156,255,156,156,156,255,156,156,156,255,161,161,161,255,228,228,228,
255,221,221,221,255,199,199,199,255,197,197,197,255,198,198,198,255,198,198,
198,255,198,198,198,255,199,199,199,255,199,199,199,255,199,199,199,255,199,
199,199,255,199,199,199,255,200,200,200,255,200,200,200,255,200,200,200,255,
220,220,220,255,227,227,227,255,227,227,227,255,228,228,228,255,228,228,228,
255,131,131,131,212,255,255,255,0,255,255,255,0,255,255,255,0,90,90,
90,37,171,171,171,241,177,177,177,255,162,162,162,255,162,162,162,255,162,
162,162,255,139,139,139,255,209,209,209,255,213,213,213,255,211,211,211,255,
178,178,178,255,178,178,178,255,179,179,179,255,179,179,179,255,179,179,179,
255,179,179,179,255,179,179,179,255,179,179,179,255,179,179,179,255,179,179,
179,255,180,180,180,255,180,180,180,255,180,180,180,255,180,180,180,255,180,
180,180,255,180,180,180,255,212,212,212,255,210,210,210,255,122,122,122,184,
255,255,255,0,255,255,255,0,255,255,255,0,90,90,90,12,156,156,156,
236,182,182,182,255,161,161,161,255,161,161,161,255,161,161,161,255,117,117,
117,255,227,227,227,255,201,201,201,255,190,190,190,255,178,178,178,255,178,
178,178,255,178,178,178,255,178,178,178,255,178,178,178,255,178,178,178,255,
178,178,178,255,179,179,179,255,179,179,179,255,179,179,179,255,179,179,179,
255,179,179,179,255,180,180,180,255,180,180,180,255,180,180,180,255,198,198,
198,255,208,208,208,255,179,179,179,254,112,112,112,116,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,141,141,141,230,180,180,180,255,
155,155,155,255,155,155,155,255,153,153,153,255,154,154,154,255,208,208,208,
255,192,192,192,255,182,182,182,255,181,181,181,255,182,182,182,255,182,182,
182,255,183,183,183,255,183,183,183,255,183,183,183,255,184,184,184,255,184,
184,184,255,184,184,184,255,184,184,184,255,184,184,184,255,185,185,185,255,
185,185,185,255,185,185,185,255,191,191,191,255,197,197,197,255,198,198,198,
255,128,128,128,228,102,102,102,25,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,129,129,129,220,185,185,185,255,156,156,156,255,156,
156,156,255,128,128,128,255,204,204,204,255,183,183,183,255,182,182,182,255,
174,174,174,255,174,174,174,255,174,174,174,255,174,174,174,255,175,175,175,
255,175,175,175,255,175,175,175,255,176,176,176,255,176,176,176,255,176,176,
176,255,176,176,176,255,176,176,176,255,177,177,177,255,177,177,177,255,177,
177,177,255,183,183,183,255,188,188,188,255,181,181,181,255,109,109,109,188,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,117,117,117,210,197,197,197,255,161,161,161,255,160,160,160,255,112,112,
112,255,210,210,210,255,172,172,172,255,167,167,167,255,165,165,165,255,165,
165,165,255,165,165,165,255,165,165,165,255,165,165,165,255,165,165,165,255,
166,166,166,255,166,166,166,255,166,166,166,255,166,166,166,255,166,166,166,
255,170,170,170,255,177,177,177,255,177,177,177,255,178,178,178,255,178,178,
178,255,179,179,179,255,134,134,134,237,90,90,90,62,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,104,104,104,198,
198,198,198,255,155,155,155,255,150,150,150,255,158,158,158,255,185,185,185,
255,126,146,171,255,90,126,170,255,90,126,170,255,90,126,170,255,90,126,
170,255,90,126,170,255,90,126,170,255,90,126,170,255,90,125,170,255,90,
125,170,255,90,125,170,255,90,125,170,255,90,125,170,255,90,125,170,255,
90,125,170,255,90,125,170,255,90,125,170,255,90,125,170,255,90,125,170,
255,70,108,154,243,61,109,170,187,61,109,170,187,61,109,170,187,61,109,
170,187,59,108,169,68,255,255,255,0,102,102,102,175,185,185,185,255,146,
146,146,255,119,119,119,255,195,195,195,255,175,175,175,255,87,125,174,255,
169,196,225,255,163,191,222,255,163,191,222,255,163,191,223,255,163,191,223,
255,163,191,223,255,163,191,223,255,163,191,223,255,163,191,223,255,163,191,
223,255,163,191,223,255,163,191,223,255,163,191,223,255,163,191,223,255,163,
191,223,255,163,191,222,255,163,191,222,255,163,191,222,255,163,191,222,255,
163,191,222,255,163,191,222,255,162,191,222,255,149,180,215,255,61,109,170,
146,255,255,255,0,102,102,102,145,181,181,181,255,142,142,142,255,107,107,
107,255,208,208,208,255,180,180,180,255,99,136,183,255,155,187,221,255,133,
172,213,255,133,172,213,255,133,172,213,255,133,172,213,255,133,172,213,255,
133,172,213,255,132,171,213,255,132,171,213,255,132,171,213,255,132,171,213,
255,131,171,213,255,131,170,213,255,131,170,213,255,130,170,212,255,130,170,
212,255,129,170,212,255,129,170,212,255,129,169,212,255,128,169,212,255,128,
168,212,255,130,170,212,255,126,162,204,245,52,101,164,66,255,255,255,0,
98,98,98,109,175,175,175,255,139,139,139,255,159,159,159,255,190,190,190,
255,175,178,183,255,113,148,191,255,146,180,218,255,133,172,213,255,133,172,
213,255,132,171,213,255,132,171,213,255,132,171,213,255,131,171,213,255,131,
171,213,255,131,170,213,255,131,170,213,255,130,170,212,255,129,170,212,255,
129,170,212,255,129,169,212,255,129,169,212,255,128,169,212,255,128,169,212,
255,128,168,212,255,127,168,212,255,127,168,212,255,118,162,208,255,143,179,
217,255,86,129,183,229,52,101,164,10,255,255,255,0,90,90,90,74,162,
162,162,252,122,122,122,255,196,196,196,255,189,189,189,255,158,169,183,255,
126,161,201,255,137,175,215,255,132,171,213,255,131,171,213,255,131,170,213,
255,131,170,213,255,130,170,212,255,130,170,212,255,129,170,212,255,129,170,
212,255,129,169,212,255,128,169,212,255,128,169,212,255,128,168,212,255,128,
168,212,255,127,168,212,255,127,168,212,255,127,168,211,255,126,167,211,255,
126,167,211,255,118,162,208,255,114,159,207,255,150,184,219,255,63,111,171,
210,255,255,255,0,255,255,255,0,90,90,90,50,147,147,147,242,114,114,
114,255,208,208,208,255,193,193,193,255,137,157,183,255,136,171,210,255,131,
170,213,255,130,170,212,255,130,170,212,255,129,170,212,255,129,169,212,255,
129,169,212,255,128,169,212,255,128,169,212,255,128,168,212,255,127,168,212,
255,127,168,212,255,127,168,211,255,127,168,211,255,126,167,211,255,126,167,
211,255,126,167,211,255,125,167,211,255,125,166,211,255,117,161,208,255,114,
159,207,255,116,160,208,255,138,173,212,255,60,109,170,159,255,255,255,0,
255,255,255,0,90,90,90,25,134,134,134,234,107,107,107,255,220,220,220,
255,198,198,198,255,109,141,180,255,142,177,214,255,129,169,212,255,129,169,
212,255,128,169,212,255,128,168,212,255,128,168,212,255,127,168,212,255,127,
168,212,255,127,168,211,255,126,167,211,255,126,167,211,255,126,167,211,255,
126,167,211,255,125,167,211,255,125,167,211,255,125,166,211,255,124,166,210,
255,120,163,209,255,115,159,207,255,114,159,207,255,114,159,207,255,126,167,
211,255,108,150,197,245,53,102,164,77,255,255,255,0,255,255,255,0,90,
90,90,3,124,124,124,229,106,106,106,255,217,217,217,255,202,202,202,255,
91,130,179,255,141,178,216,255,128,168,212,255,127,168,212,255,127,168,211,
255,127,168,211,255,126,167,211,255,126,167,211,255,126,167,211,255,126,167,
211,255,125,167,211,255,125,166,211,255,125,166,211,255,124,166,210,255,124,
166,210,255,123,165,210,255,121,164,209,255,116,161,208,255,114,159,207,255,
114,159,207,255,114,159,207,255,114,159,207,255,133,172,213,255,75,121,178,
225,52,101,164,11,255,255,255,0,255,255,255,0,255,255,255,0,115,115,
115,222,108,108,108,255,206,206,206,255,202,203,204,255,94,135,183,255,132,
171,213,255,126,167,211,255,126,167,211,255,126,167,211,255,125,167,211,255,
125,167,211,255,125,166,211,255,123,165,210,255,122,165,210,255,121,164,209,
255,121,164,209,255,120,163,209,255,118,162,209,255,117,161,208,255,115,160,
207,255,114,159,207,255,114,159,207,255,114,159,207,255,114,159,207,255,114,
159,207,255,114,159,207,255,132,170,213,255,61,109,170,203,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,109,109,109,214,110,110,110,
255,144,144,144,255,126,136,149,255,102,142,189,255,127,167,212,255,125,166,
211,255,123,165,210,255,120,163,209,255,118,162,208,255,116,160,208,255,114,
159,207,255,114,159,207,255,114,159,207,255,114,159,207,255,114,159,207,255,
114,159,207,255,114,159,207,255,114,159,207,255,114,159,207,255,114,159,207,
255,114,159,207,255,114,159,207,255,114,159,207,255,114,159,207,255,117,161,
208,255,110,152,200,254,58,106,168,123,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,104,104,104,205,134,134,134,255,102,102,102,255,
80,105,137,255,112,153,201,255,118,161,209,255,115,160,208,255,113,158,207,
255,112,158,207,255,112,158,207,255,112,158,207,255,112,158,207,255,112,158,
207,255,112,158,207,255,112,158,206,255,112,158,206,255,112,157,206,255,111,
157,206,255,111,157,206,255,111,157,206,255,111,157,206,255,111,157,206,255,
111,157,206,255,111,157,206,255,111,157,206,255,118,162,208,255,77,125,181,
231,52,101,164,37,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,102,102,102,189,145,145,145,255,106,107,108,255,70,112,164,255,113,
159,208,255,108,155,206,255,108,155,206,255,108,155,205,255,107,155,205,255,
107,155,205,255,107,155,205,255,107,155,205,255,107,154,205,255,107,154,205,
255,107,154,205,255,107,154,205,255,107,154,205,255,106,154,205,255,106,154,
205,255,106,154,205,255,106,154,205,255,106,154,205,255,106,154,205,255,106,
154,205,255,106,154,205,255,109,155,206,255,60,109,170,207,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,92,92,92,
168,122,122,122,255,75,95,119,255,86,133,187,255,104,152,204,255,103,152,
204,255,103,152,204,255,103,152,204,255,102,151,204,255,102,151,204,255,102,
151,204,255,102,151,204,255,102,151,204,255,102,151,204,255,102,151,204,255,
102,151,204,255,101,151,204,255,101,151,204,255,101,151,204,255,101,151,204,
255,101,151,204,255,101,151,204,255,101,150,204,255,101,150,204,255,102,150,
204,255,82,131,188,246,52,98,157,100,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,0,0,0,12,77,77,77,146,100,104,109,255,
62,104,157,255,97,148,203,255,98,149,203,255,98,148,203,255,98,148,203,
255,97,148,203,255,97,148,203,255,97,148,203,255,97,148,203,255,97,148,
203,255,97,148,203,255,97,148,203,255,97,148,203,255,97,148,203,255,97,
148,203,255,97,148,203,255,97,148,203,255,97,148,203,255,97,148,203,255,
97,148,203,255,97,148,203,255,97,148,203,255,96,147,203,255,58,107,166,
228,9,17,28,30,0,0,0,3,255,255,255,0,255,255,255,0,255,255,
255,0,0,0,0,14,49,49,49,74,67,91,121,243,60,106,164,254,64,
108,163,253,63,108,163,253,63,108,163,253,63,108,163,253,64,108,163,253,
64,108,163,253,63,108,163,253,63,108,163,253,63,108,163,253,63,108,163,
253,63,108,163,253,64,108,163,253,64,108,163,253,64,108,163,253,64,108,
163,253,64,108,163,253,64,108,163,253,64,108,163,253,64,108,163,253,63,
108,163,252,62,109,168,238,58,106,165,234,40,74,119,113,0,0,0,26,
0,0,0,4,255,255,255,0,255,255,255,0,255,255,255,0,0,0,0,
1,0,0,0,20,6,6,6,38,11,11,11,54,10,10,10,57,9,9,
9,61,9,9,9,61,9,9,9,61,9,9,9,61,9,9,9,61,9,
9,9,61,9,9,9,61,9,9,9,61,9,9,9,61,9,9,9,61,
9,9,9,61,9,9,9,61,9,9,9,61,9,9,9,61,9,9,9,
61,9,9,9,61,9,9,9,61,9,9,9,61,3,3,3,58,0,0,
0,51,0,0,0,44,0,0,0,30,0,0,0,12,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
0,0,0,4,0,0,0,12,0,0,0,18,0,0,0,21,0,0,0,
21,0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,21,0,0,
0,21,0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,21,0,
0,0,21,0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,21,
0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,16,0,0,0,
9,0,0,0,1,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,
0
};

View File

@@ -1,229 +0,0 @@
//------------------------------------------------------------------------------
// Original: Document_save.svg
// Size: 32x32
// Format: RGBA
// Conversion:
// 1) SVG to 32x32 PNG with Inkscape
// 2) PNG to RGBA with ImageMagick (convert icon_save.png icon_save.rgba)
// 3) RGBA to C code with bin2c (bin2c icon_save.rgba icon_save > icon_save.h)
//------------------------------------------------------------------------------
static const unsigned char icon_save[] = {
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,34,74,136,45,39,82,143,155,52,92,148,
216,63,100,155,212,56,94,150,200,37,80,141,165,33,71,136,47,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,35,70,132,29,45,
85,143,203,99,132,177,231,141,168,202,255,151,176,209,255,149,174,207,255,
146,172,206,255,132,160,198,255,103,136,179,237,49,89,147,166,39,78,137,
13,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,31,71,133,25,65,101,154,204,151,176,208,199,146,174,
207,232,142,169,204,255,144,170,205,255,140,168,203,255,136,165,202,255,131,
161,200,255,130,160,199,255,130,158,196,254,64,100,153,226,32,74,138,24,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,35,70,139,22,
57,94,149,192,153,176,206,165,103,132,177,208,79,113,162,216,73,110,160,
225,96,128,173,236,134,162,199,255,135,165,202,255,128,159,198,255,123,155,
196,255,119,152,194,255,134,162,199,255,66,103,156,204,0,0,255,1,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,43,83,141,147,118,143,181,155,45,
85,143,177,33,71,130,47,255,255,255,0,255,255,255,0,35,71,135,36,
43,84,144,197,122,152,190,247,127,159,198,255,119,152,194,255,115,149,192,
255,111,146,191,255,122,152,191,248,34,78,137,128,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,39,78,137,13,60,98,151,162,36,78,138,161,0,0,255,1,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,0,0,255,1,47,
86,145,207,135,163,200,255,115,149,192,255,111,146,190,255,107,142,189,255,
120,153,195,255,78,113,163,232,0,128,128,2,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,36,77,138,50,
43,84,143,136,26,77,128,10,85,85,85,3,83,83,83,102,83,83,83,
136,83,83,83,136,83,83,83,136,83,83,83,136,72,80,95,153,104,134,
175,247,115,149,192,255,107,142,189,255,103,139,187,255,99,137,185,255,116,
144,183,249,70,80,97,154,83,83,83,136,83,83,83,136,83,83,83,136,
83,83,83,136,83,83,83,136,84,84,84,70,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,35,78,137,65,34,74,136,45,255,
255,255,0,96,96,96,175,222,222,222,254,239,239,239,253,238,238,238,253,
238,238,238,253,238,238,238,253,237,237,237,252,100,130,173,255,119,152,194,
255,102,139,187,255,98,136,185,255,94,133,183,255,123,152,191,255,155,172,
195,253,230,230,230,252,229,229,229,252,228,228,228,252,228,228,228,252,227,
227,227,252,171,171,171,254,83,83,83,80,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,31,75,137,41,0,85,170,3,85,85,85,30,176,176,
176,254,233,234,234,255,153,169,192,255,142,161,187,255,142,161,188,255,141,
160,187,255,141,160,187,255,79,112,161,255,119,152,194,255,97,135,184,255,
94,133,183,255,90,130,181,255,128,158,196,255,76,109,157,255,138,157,184,
255,137,156,183,255,136,155,182,255,136,155,182,255,161,174,192,255,231,231,
231,254,105,105,105,204,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
36,73,146,7,255,255,255,0,82,82,82,124,231,231,231,253,227,227,227,
255,166,179,198,255,86,118,165,255,119,150,191,255,116,148,189,255,118,149,
190,255,121,151,192,255,116,150,193,255,93,132,182,255,89,129,181,255,85,
126,179,255,116,149,193,255,125,155,194,255,125,154,194,255,123,153,192,255,
134,162,198,255,72,107,156,255,182,191,202,255,224,224,224,255,172,172,172,
255,81,81,81,41,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,124,124,124,228,240,240,240,255,225,225,225,255,228,228,228,255,
148,165,190,255,108,139,181,255,106,142,189,255,93,132,183,255,92,131,182,
255,90,130,181,255,87,128,180,255,84,125,178,255,81,123,177,255,77,120,
175,255,70,115,172,255,66,111,170,255,97,136,184,255,107,136,178,255,162,
175,193,255,220,220,220,255,216,216,216,255,220,220,220,252,83,83,83,141,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,82,82,82,62,200,200,
200,255,229,229,229,255,224,224,224,255,229,229,229,255,232,232,232,255,133,
154,185,255,114,144,185,255,99,137,185,255,86,127,179,255,84,125,178,255,
79,121,176,255,69,114,172,255,61,108,168,255,54,102,165,255,52,101,164,
255,77,120,175,255,112,142,183,255,142,160,187,255,221,221,221,255,217,217,
217,255,216,216,216,255,226,226,226,255,132,132,132,241,85,85,85,6,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,86,86,86,159,237,237,237,253,224,224,224,
255,229,229,229,255,229,229,229,255,228,228,228,255,225,225,225,255,112,138,
174,255,99,134,179,255,65,111,170,255,53,102,164,255,52,101,164,255,52,
101,164,255,52,101,164,255,52,101,164,255,69,114,172,255,118,148,188,255,
117,140,175,255,220,220,220,255,220,220,220,255,219,219,219,255,219,219,219,
255,217,217,217,255,192,192,192,254,82,82,82,84,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,93,
93,93,11,156,156,156,248,234,234,234,255,226,226,226,255,225,225,225,255,
223,223,223,255,219,219,219,255,216,216,216,255,213,213,213,255,94,123,164,
255,104,137,181,255,62,109,169,255,52,101,164,255,52,101,164,255,52,101,
164,255,62,108,168,255,120,150,191,255,94,123,164,255,211,211,211,255,213,
213,213,255,214,214,214,255,216,216,216,255,217,217,217,255,216,216,216,255,
224,224,224,253,97,97,97,189,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,82,82,82,96,218,218,
218,254,222,222,222,255,222,222,222,255,219,219,219,255,216,216,216,255,213,
213,213,255,213,213,213,255,212,212,212,255,209,210,211,255,86,117,160,255,
111,144,188,255,60,107,168,255,52,101,164,255,56,104,166,255,118,149,191,
255,82,113,158,255,201,201,203,255,206,206,206,255,209,209,209,255,211,211,
211,255,212,212,212,255,215,215,215,255,217,217,217,255,220,220,220,255,157,
157,157,254,85,85,85,30,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,107,107,107,201,236,236,236,253,218,218,218,
255,223,223,223,255,215,215,215,255,213,213,213,255,213,213,213,255,212,212,
212,255,210,210,210,255,207,207,207,255,199,200,202,255,79,110,156,255,116,
148,190,255,59,106,167,255,114,147,190,255,80,113,160,255,189,191,194,255,
201,201,201,255,205,205,205,255,206,206,206,255,208,208,208,255,211,211,211,
255,213,213,213,255,218,218,218,255,211,211,211,255,206,206,206,252,82,82,
82,127,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,80,
80,80,35,181,181,181,254,226,226,226,255,218,218,218,255,220,220,220,255,
225,225,225,255,218,218,218,255,215,215,215,255,212,212,212,255,210,210,210,
255,206,206,206,255,203,203,203,255,192,194,197,255,79,112,159,255,131,160,
197,255,84,117,162,255,180,185,191,255,201,201,201,255,203,203,203,255,205,
205,205,255,208,208,208,255,210,210,210,255,212,212,212,255,224,224,224,255,
214,214,214,255,212,212,212,255,221,221,221,255,120,120,120,232,128,128,128,
2,255,255,255,0,255,255,255,0,255,255,255,0,82,82,82,130,226,226,
226,252,219,219,219,255,219,219,219,255,218,218,218,255,220,220,220,255,229,
229,229,255,221,221,221,255,215,215,215,255,213,213,213,255,210,210,210,255,
206,206,206,255,206,206,206,255,189,192,198,255,66,100,151,255,173,180,192,
255,205,205,205,255,206,206,206,255,207,207,207,255,210,210,210,255,211,211,
211,255,218,218,218,255,226,226,226,255,215,215,215,255,212,212,212,255,213,
213,213,255,214,214,214,255,175,175,175,255,83,83,83,71,255,255,255,0,
255,255,255,0,0,0,0,1,134,134,134,234,231,231,231,255,222,222,222,
255,224,224,224,255,219,219,219,255,219,219,219,255,218,218,218,255,226,226,
226,255,230,230,230,255,227,227,227,255,219,219,219,255,215,215,215,255,213,
213,213,255,211,211,211,255,208,209,209,255,213,213,213,255,213,213,213,255,
216,216,216,255,220,220,220,255,226,226,226,255,229,229,229,255,222,222,222,
255,213,213,213,255,214,214,214,255,213,213,213,255,222,222,222,255,215,215,
215,255,215,215,215,252,91,91,91,174,255,255,255,0,255,255,255,0,80,
80,80,32,190,190,190,255,223,223,223,255,221,221,221,255,225,225,225,255,
218,218,218,255,218,218,218,255,219,219,219,255,219,219,219,255,219,219,219,
255,222,222,222,255,229,229,229,255,232,232,232,255,233,233,233,255,234,234,
234,255,235,235,235,255,234,234,234,255,232,232,232,255,230,230,230,255,227,
227,227,255,220,220,220,255,215,215,215,255,215,215,215,255,214,214,214,255,
213,213,213,255,213,213,213,255,220,220,220,255,213,213,213,255,218,218,218,
255,139,139,139,244,255,255,255,0,255,255,255,0,83,83,83,55,211,211,
211,255,235,235,235,255,233,233,233,255,234,234,234,255,234,234,234,255,233,
233,233,255,233,233,233,255,233,233,233,255,233,233,233,255,233,233,233,255,
233,233,233,255,232,232,232,255,232,232,232,255,232,232,232,255,232,232,232,
255,232,232,232,255,232,232,232,255,231,231,231,255,231,231,231,255,230,230,
230,255,230,230,230,255,229,229,229,255,229,229,229,255,229,229,229,255,228,
228,228,255,228,228,228,255,227,227,227,255,227,227,227,255,128,128,128,250,
255,255,255,0,255,255,255,0,82,82,82,56,191,191,191,255,192,192,192,
255,187,187,187,255,186,186,186,255,185,185,185,255,184,184,184,255,183,183,
183,255,181,181,181,255,180,180,180,255,179,179,179,255,178,178,178,255,177,
177,177,255,175,175,175,255,174,174,174,255,173,173,173,255,172,172,172,255,
170,170,170,255,169,169,169,255,168,168,168,255,167,167,167,255,165,165,165,
255,164,164,164,255,163,163,163,255,162,162,162,255,160,160,160,255,159,159,
159,255,159,159,159,255,169,169,169,255,118,118,118,250,255,255,255,0,255,
255,255,0,82,82,82,56,189,189,189,255,191,191,191,255,187,187,187,255,
176,176,176,255,168,168,168,255,170,170,170,255,172,172,172,255,173,173,173,
255,174,174,174,255,175,175,175,255,175,175,175,255,175,175,175,255,175,175,
175,255,174,174,174,255,172,172,172,255,171,171,171,255,170,170,170,255,169,
169,169,255,178,178,178,255,169,169,169,255,167,167,167,255,172,172,172,255,
172,172,172,255,164,164,164,255,162,162,162,255,173,173,173,255,159,159,159,
255,168,168,168,255,117,117,117,250,255,255,255,0,255,255,255,0,82,82,
82,56,188,188,188,255,191,191,191,255,187,187,187,255,160,160,160,255,140,
140,140,255,149,149,149,255,154,154,154,255,160,160,160,255,166,166,166,255,
169,169,169,255,172,172,172,255,173,173,173,255,174,174,174,255,174,174,174,
255,172,172,172,255,171,171,171,255,169,169,169,255,168,168,168,255,190,190,
190,255,170,170,170,255,166,166,166,255,179,179,179,255,183,183,183,255,167,
167,167,255,162,162,162,255,183,183,183,255,159,159,159,255,167,167,167,255,
116,116,116,250,255,255,255,0,255,255,255,0,82,82,82,56,186,186,186,
255,191,191,191,255,186,186,186,255,165,165,165,255,141,141,141,255,148,148,
148,255,154,154,154,255,160,160,160,255,166,166,166,255,168,168,168,255,171,
171,171,255,173,173,173,255,174,174,174,255,173,173,173,255,171,171,171,255,
170,170,170,255,169,169,169,255,168,168,168,255,190,190,190,255,170,170,170,
255,166,166,166,255,179,179,179,255,182,182,182,255,166,166,166,255,162,162,
162,255,183,183,183,255,159,159,159,255,167,167,167,255,115,115,115,250,255,
255,255,0,0,0,0,3,70,70,70,65,185,185,185,255,191,191,191,255,
185,185,185,255,180,180,180,255,180,180,180,255,177,177,177,255,169,169,169,
255,166,166,166,255,166,166,166,255,168,168,168,255,171,171,171,255,173,173,
173,255,173,173,173,255,173,173,173,255,171,171,171,255,169,169,169,255,168,
168,168,255,167,167,167,255,190,190,190,255,170,170,170,255,165,165,165,255,
178,178,178,255,182,182,182,255,166,166,166,255,162,162,162,255,183,183,183,
255,159,159,159,255,166,166,166,255,114,114,114,250,0,0,0,6,0,0,
0,7,69,69,69,67,178,178,178,255,192,192,192,255,185,185,185,255,187,
187,187,255,191,191,191,255,192,192,192,255,192,192,192,255,192,192,192,255,
192,192,192,255,190,190,190,255,184,184,184,255,177,177,177,255,173,173,173,
255,171,171,171,255,171,171,171,255,169,169,169,255,168,168,168,255,166,166,
166,255,177,177,177,255,167,167,167,255,164,164,164,255,170,170,170,255,170,
170,170,255,162,162,162,255,161,161,161,255,170,170,170,255,159,159,159,255,
165,165,165,255,111,111,111,247,0,0,0,10,255,255,255,0,46,46,46,
17,120,120,120,242,198,198,198,252,201,201,201,251,200,200,200,251,198,198,
198,251,197,197,197,251,194,194,194,251,192,192,192,252,190,190,190,252,189,
189,189,252,187,187,187,251,185,185,185,251,183,183,183,252,181,181,181,252,
180,180,180,252,177,177,177,252,175,175,175,251,173,173,173,251,172,172,172,
251,169,169,169,251,167,167,167,251,165,165,165,251,164,164,164,250,162,162,
162,250,160,160,160,250,160,160,160,250,159,159,159,250,147,147,147,252,86,
86,86,182,0,0,0,2,255,255,255,0,255,255,255,0,82,82,82,31,
81,81,81,113,79,79,79,125,77,77,77,130,75,75,75,133,73,73,73,
136,72,72,72,139,70,70,70,141,69,69,69,144,68,68,68,146,67,67,
67,148,66,66,66,150,66,66,66,150,66,66,66,151,66,66,66,151,66,
66,66,151,66,66,66,150,67,67,67,149,68,68,68,146,69,69,69,145,
70,70,70,143,71,71,71,140,73,73,73,137,74,74,74,134,76,76,76,
131,78,78,78,127,81,81,81,123,84,84,84,100,85,85,85,12,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,0,0,0,2,
0,0,0,4,0,0,0,8,0,0,0,11,0,0,0,13,0,0,0,
16,0,0,0,18,0,0,0,20,0,0,0,20,0,0,0,19,0,0,
0,17,0,0,0,15,0,0,0,12,0,0,0,9,0,0,0,6,0,
0,0,3,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,
0
};

View File

@@ -1,229 +0,0 @@
//------------------------------------------------------------------------------
// Original: Texture.svg
// Size: 32x32
// Format: RGBA
// Conversion:
// 1) SVG to 32x32 PNG with Inkscape
// 2) PNG to RGBA with ImageMagick (convert icon_texture.png icon_texture.rgba)
// 3) RGBA to C code with bin2c (bin2c icon_texture.rgba icon_texture > icon_texture.h)
//------------------------------------------------------------------------------
static const unsigned char icon_texture[] = {
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,131,132,131,34,191,192,191,151,217,217,217,
212,220,221,220,219,220,221,220,219,220,221,220,219,220,221,220,219,220,221,
220,219,220,220,220,219,220,220,220,219,220,220,220,219,219,220,219,219,219,
220,219,219,219,219,218,219,218,219,218,219,218,219,218,219,217,218,217,219,
217,218,217,219,217,217,216,219,216,217,216,219,216,217,216,219,216,216,215,
219,215,216,215,219,215,215,214,219,214,215,214,219,214,215,214,219,214,214,
213,219,213,214,213,219,199,200,199,188,160,160,159,99,255,255,255,0,255,
255,255,0,186,186,186,156,248,249,248,255,248,249,248,255,248,249,248,255,
248,249,248,255,248,249,248,255,248,249,248,255,248,248,247,255,247,248,247,
255,247,248,247,255,246,247,246,255,246,247,246,255,246,247,246,255,245,246,
245,255,245,246,245,255,245,245,244,255,244,245,244,255,244,245,244,255,243,
244,243,255,243,244,243,255,243,243,242,255,242,243,242,255,242,243,242,255,
242,242,241,255,241,242,241,255,241,241,240,255,240,241,240,255,240,241,240,
255,240,240,239,255,231,232,231,246,58,58,58,20,255,255,255,0,211,212,
211,218,248,249,248,255,248,249,248,255,248,249,248,255,248,249,248,255,248,
249,248,255,248,249,248,255,247,248,247,255,247,248,247,255,246,247,246,255,
246,247,246,255,246,247,246,255,245,246,245,255,245,246,245,255,245,245,244,
255,244,245,244,255,244,245,244,255,243,244,243,255,243,244,243,255,243,243,
242,255,242,243,242,255,242,243,242,255,242,242,241,255,241,242,241,255,241,
241,240,255,240,241,240,255,240,241,240,255,240,240,239,255,239,240,239,255,
239,239,238,255,148,148,148,94,255,255,255,0,214,215,214,226,248,249,248,
255,248,249,248,255,248,249,248,255,248,249,248,255,248,249,248,255,247,248,
247,255,247,248,247,255,246,247,246,255,246,247,246,255,246,247,246,255,245,
246,245,255,245,246,245,255,245,245,244,255,244,245,244,255,244,245,244,255,
243,244,243,255,243,244,243,255,243,243,242,255,242,243,242,255,242,243,242,
255,242,242,241,255,241,242,241,255,241,241,240,255,240,241,240,255,240,241,
240,255,240,240,239,255,239,240,239,255,239,239,238,255,239,239,238,255,148,
149,148,111,255,255,255,0,214,215,214,227,248,249,248,255,248,249,248,255,
248,249,248,255,248,249,248,255,247,248,247,255,247,248,247,255,246,247,246,
255,246,247,246,255,246,247,246,255,245,246,245,255,245,246,245,255,245,245,
244,255,244,245,244,255,244,245,244,255,243,244,243,255,243,244,243,255,243,
243,242,255,242,243,242,255,242,243,242,255,242,242,241,255,241,242,241,255,
241,241,240,255,240,241,240,255,240,241,240,255,240,240,239,255,239,240,239,
255,239,239,238,255,239,239,238,255,238,239,238,255,147,147,147,112,255,255,
255,0,214,215,214,227,248,249,248,255,248,249,248,255,248,249,248,255,247,
248,247,255,247,248,247,255,246,247,246,255,246,247,246,255,246,247,246,255,
245,246,245,255,245,246,245,255,245,245,244,255,244,245,244,255,244,245,244,
255,243,244,243,255,243,244,243,255,243,243,242,255,242,243,242,255,242,243,
242,255,242,242,241,255,241,242,241,255,241,241,240,255,240,241,240,255,240,
241,240,255,240,240,239,255,239,240,239,255,239,239,238,255,239,239,238,255,
238,239,238,255,238,238,237,255,147,147,147,112,255,255,255,0,214,215,214,
227,248,249,248,255,248,249,248,255,63,118,176,255,71,126,186,255,72,126,
186,255,72,128,188,255,73,129,188,255,74,129,189,255,75,130,190,255,75,
131,191,255,76,132,191,255,76,133,192,255,77,134,193,255,78,135,194,255,
79,135,194,255,79,137,195,255,80,138,196,255,81,138,197,255,81,139,197,
255,82,140,198,255,82,141,199,255,83,142,200,255,84,143,200,255,85,144,
201,255,85,144,202,255,86,145,203,255,116,153,194,255,238,238,237,255,237,
238,237,255,147,147,146,112,255,255,255,0,214,215,214,227,248,249,248,255,
247,248,247,255,71,124,183,255,78,131,194,255,79,132,195,255,80,133,196,
255,81,134,197,255,81,136,198,255,82,137,199,255,83,138,200,255,84,139,
201,255,85,140,202,255,86,142,203,255,87,143,204,255,88,144,205,255,89,
145,206,255,89,146,207,255,90,148,208,255,91,149,209,255,92,150,210,255,
93,151,211,255,94,152,212,255,95,154,213,255,96,155,214,255,97,156,215,
255,97,157,216,255,123,161,199,255,237,238,237,255,237,237,236,255,147,147,
146,112,255,255,255,0,214,215,214,227,247,248,247,255,247,248,247,255,79,
130,183,255,89,139,194,255,86,137,194,255,83,135,194,255,80,133,194,255,
78,131,194,255,79,133,195,255,80,134,196,255,84,131,189,255,86,126,181,
255,83,123,178,255,83,121,175,255,81,119,174,255,79,117,171,255,78,114,
168,255,77,112,166,255,75,110,164,255,73,108,161,255,73,105,159,255,71,
103,157,255,69,101,153,255,68,100,152,255,74,112,166,255,89,142,200,255,
122,160,198,255,237,238,237,255,237,237,236,255,146,147,146,112,255,255,255,
0,213,214,213,227,247,248,247,255,247,248,247,255,98,143,189,255,100,147,
194,255,97,145,194,255,94,143,194,255,91,140,194,255,88,138,194,255,85,
136,194,255,85,133,191,255,85,128,185,255,83,126,182,255,82,124,180,255,
81,123,179,255,80,121,177,255,79,119,176,255,78,117,174,255,77,116,172,
255,76,114,170,255,75,113,169,255,75,112,166,255,73,110,165,255,71,109,
163,255,71,107,162,255,71,108,162,255,75,114,170,255,127,159,196,255,237,
237,236,255,236,237,236,255,146,146,145,112,255,255,255,0,213,214,213,227,
247,248,247,255,246,247,246,255,100,145,188,255,110,155,194,255,107,153,194,
255,104,150,194,255,101,148,194,255,98,146,194,255,96,144,194,255,92,142,
194,255,90,140,194,255,87,137,194,255,84,135,194,255,81,133,194,255,78,
131,194,255,79,132,195,255,80,133,196,255,81,135,197,255,82,136,198,255,
82,137,199,255,82,136,199,255,79,133,195,255,76,130,189,255,72,124,182,
255,67,117,174,255,62,110,165,255,117,142,174,255,236,237,236,255,236,236,
235,255,146,146,145,112,255,255,255,0,213,214,213,227,246,247,246,255,246,
247,246,255,107,150,187,255,121,163,194,255,118,160,194,255,115,158,194,255,
112,156,194,255,109,154,194,255,106,152,194,255,103,150,194,255,100,147,194,
255,97,145,194,255,94,143,194,255,91,141,194,255,87,138,193,255,80,131,
188,255,72,122,182,255,64,113,173,255,56,103,161,255,47,91,148,255,41,
83,138,255,38,79,132,255,35,74,126,255,31,69,120,255,28,64,113,255,
24,59,107,255,121,141,170,255,236,236,235,255,236,236,235,255,145,146,145,
112,255,255,255,0,212,213,212,227,246,247,246,255,246,246,245,255,115,156,
187,255,131,171,194,255,128,168,194,255,126,166,194,255,123,164,194,255,120,
162,194,255,117,160,194,255,114,157,194,255,107,152,194,255,92,140,190,255,
78,128,184,255,68,118,177,255,60,108,171,255,56,104,164,255,53,100,159,
255,50,96,153,255,47,91,148,255,44,87,142,255,40,82,136,255,37,77,
130,255,34,73,124,255,30,68,118,255,27,63,112,255,24,58,106,255,120,
141,169,255,236,236,235,255,235,236,235,255,145,145,145,112,255,255,255,0,
212,213,212,227,246,246,245,255,245,246,245,255,115,156,186,255,136,174,194,
255,136,174,194,255,136,174,194,255,132,172,193,255,116,158,191,255,96,142,
188,255,77,127,184,255,65,117,179,255,63,114,177,255,62,112,174,255,59,
109,170,255,57,105,166,255,54,102,161,255,51,98,156,255,49,93,151,255,
45,89,145,255,42,85,139,255,39,80,134,255,36,76,128,255,33,71,122,
255,29,66,116,255,26,62,110,255,23,57,104,255,120,140,168,255,235,236,
235,255,235,235,234,255,145,145,145,112,255,255,255,0,212,212,212,227,245,
246,245,255,245,246,245,255,143,163,170,255,147,178,193,255,133,172,193,255,
100,143,182,255,67,116,173,255,61,111,173,255,62,112,174,255,62,112,174,
255,61,111,173,255,60,110,171,255,59,108,169,255,57,105,165,255,55,102,
161,255,52,98,157,255,49,95,152,255,47,91,147,255,44,87,142,255,41,
82,136,255,38,78,131,255,34,74,125,255,31,69,120,255,28,65,114,255,
25,60,108,255,22,55,102,255,119,140,168,255,235,235,234,255,235,235,234,
255,145,145,144,112,255,255,255,0,212,212,212,227,245,246,245,255,244,245,
244,255,179,178,163,255,160,160,144,255,119,117,100,255,83,89,96,255,62,
98,145,255,58,107,167,255,58,107,168,255,58,107,168,255,58,107,167,255,
57,105,166,255,56,103,163,255,54,101,160,255,52,98,156,255,50,95,152,
255,47,91,148,255,44,88,143,255,42,84,138,255,39,80,133,255,36,76,
128,255,33,71,123,255,30,67,117,255,27,63,111,255,23,58,106,255,20,
54,100,255,119,139,166,255,235,235,234,255,234,235,234,255,145,145,144,112,
255,255,255,0,212,212,212,227,244,245,244,255,244,245,244,255,128,133,117,
255,169,158,132,255,148,140,112,255,104,103,83,255,111,108,91,255,91,90,
85,255,72,91,115,255,59,97,146,255,55,102,161,255,54,101,160,255,52,
99,157,255,51,97,155,255,49,94,151,255,47,91,148,255,45,88,144,255,
42,84,139,255,40,81,134,255,37,77,130,255,34,73,125,255,31,69,119,
255,28,65,114,255,25,60,109,255,22,56,103,255,19,52,98,255,118,138,
165,255,234,235,234,255,234,234,233,255,145,145,144,112,255,255,255,0,212,
212,211,227,244,245,244,255,244,245,244,255,124,128,111,255,140,133,107,255,
87,88,64,255,114,113,93,255,165,154,129,255,128,121,105,255,116,117,94,
255,107,108,87,255,107,96,83,255,96,92,90,255,70,88,112,255,51,90,
140,255,46,90,146,255,44,87,143,255,42,84,139,255,40,81,135,255,37,
77,130,255,35,74,126,255,35,70,119,255,29,66,116,255,26,62,111,255,
23,58,106,255,20,54,100,255,17,49,95,255,117,137,164,255,234,234,233,
255,234,234,233,255,144,144,144,112,255,255,255,0,211,212,211,227,244,245,
244,255,243,244,243,255,122,126,107,255,97,98,76,255,101,100,78,255,116,
113,99,255,159,146,122,255,149,139,114,255,151,138,115,255,146,136,111,255,
117,106,87,255,140,125,103,255,123,106,87,255,109,94,79,255,57,83,119,
255,41,83,138,255,39,80,134,255,37,77,130,255,35,74,126,255,79,88,
95,255,113,106,89,255,60,72,90,255,24,59,107,255,21,55,102,255,18,
51,97,255,15,47,92,255,116,136,162,255,234,234,233,255,233,233,232,255,
144,144,144,112,255,255,255,0,211,212,211,227,243,244,243,255,243,244,243,
255,245,245,244,255,245,246,245,255,245,246,245,255,245,245,245,255,245,245,
245,255,245,245,244,255,244,245,244,255,244,245,244,255,244,244,243,255,243,
244,243,255,243,243,242,255,243,243,242,255,242,243,242,255,242,242,242,255,
242,242,242,255,242,242,241,255,242,242,241,255,241,242,241,255,241,241,240,
255,241,241,240,255,240,240,239,255,240,240,239,255,239,240,239,255,239,239,
239,255,238,238,237,255,233,233,232,255,233,233,232,255,144,144,144,112,255,
255,255,0,210,211,210,227,243,244,243,255,243,243,242,255,242,243,242,255,
242,243,242,255,242,242,241,255,241,242,241,255,241,241,240,255,240,241,240,
255,240,241,240,255,240,240,239,255,239,240,239,255,239,239,238,255,239,239,
238,255,238,239,238,255,238,238,237,255,237,238,237,255,237,237,236,255,237,
237,236,255,236,237,236,255,236,236,235,255,236,236,235,255,235,235,234,255,
235,235,234,255,234,235,234,255,234,234,233,255,234,234,233,255,233,233,232,
255,233,233,232,255,233,233,232,255,144,144,143,112,255,255,255,0,210,211,
210,227,243,243,242,255,242,243,242,255,242,243,242,255,242,242,241,255,241,
242,241,255,241,241,240,255,240,241,240,255,240,241,240,255,240,240,239,255,
239,240,239,255,239,239,238,255,239,239,238,255,238,239,238,255,238,238,237,
255,237,238,237,255,237,237,236,255,237,237,236,255,236,237,236,255,236,236,
235,255,236,236,235,255,235,235,234,255,235,235,234,255,234,235,234,255,234,
234,233,255,234,234,233,255,233,233,232,255,233,233,232,255,233,233,232,255,
232,232,231,255,144,144,143,112,255,255,255,0,210,210,209,227,242,243,242,
255,242,243,242,255,242,242,241,255,241,242,241,255,241,241,240,255,240,241,
240,255,240,241,240,255,240,240,239,255,239,240,239,255,239,239,238,255,239,
239,238,255,238,239,238,255,238,238,237,255,237,238,237,255,237,237,236,255,
237,237,236,255,236,237,236,255,236,236,235,255,236,236,235,255,235,235,234,
255,235,235,234,255,234,235,234,255,234,234,233,255,234,234,233,255,233,233,
232,255,233,233,232,255,233,233,232,255,232,232,231,255,232,232,231,255,143,
143,143,112,255,255,255,0,188,189,188,202,242,243,242,255,242,242,241,255,
241,242,241,255,241,241,240,255,241,241,240,255,240,241,240,255,240,240,239,
255,239,240,239,255,239,239,238,255,239,239,238,255,238,239,238,255,238,238,
237,255,238,238,237,255,237,237,236,255,237,237,236,255,236,237,236,255,236,
236,235,255,236,236,235,255,235,236,235,255,235,235,234,255,234,235,234,255,
234,234,233,255,234,234,233,255,233,233,232,255,233,233,232,255,233,233,232,
255,232,232,231,255,232,232,231,255,231,232,231,255,104,104,104,66,255,255,
255,0,136,136,136,122,232,232,231,248,241,242,241,255,241,242,241,255,241,
241,240,255,240,241,240,255,240,240,239,255,239,240,239,255,239,240,239,255,
239,239,238,255,238,239,238,255,238,238,237,255,238,238,237,255,237,238,237,
255,237,237,236,255,236,237,236,255,236,236,235,255,236,236,235,255,235,236,
235,255,235,235,234,255,235,235,234,255,234,234,233,255,234,234,233,255,233,
234,233,255,233,233,232,255,233,233,232,255,232,232,231,255,232,232,231,255,
231,232,231,255,187,187,186,220,26,26,26,5,255,255,255,0,26,26,26,
5,36,36,36,67,109,109,109,141,117,117,117,151,117,117,117,151,117,117,
116,151,116,117,116,151,116,117,116,151,116,116,116,151,116,116,116,151,116,
116,115,151,116,116,115,151,115,116,115,151,115,115,115,151,115,115,115,151,
115,115,115,151,115,115,115,151,115,115,115,151,115,115,114,151,115,115,114,
151,114,114,114,151,114,114,114,151,114,114,114,151,114,114,113,151,114,114,
113,151,113,113,113,151,113,113,113,151,113,113,113,151,74,74,74,107,26,
26,26,32,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
255,255,0,255,255,255,0,255,255,255,0,
0
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,18 +0,0 @@
Copyright information
=====================
Name: OpenCTM Icon
License: zlib license / by Marcus Geelnard
Icons: openctm.ico
Name: Tango Icons
License: Public Domain / by the Tango! Desktop Project
URL: http://tango.freedesktop.org/Tango_Desktop_Project
Icons: Document-open.svg
Document-save.svg
Help-browser.svg
Name: Human icons
License: Creative Commons Attribution ShareAlike 2.5 / by the Tango! Desktop Project
URL: http://tango.freedesktop.org/Tango_Desktop_Project
Icons: Texture.svg

View File

@@ -1,134 +0,0 @@
//-----------------------------------------------------------------------------
// Product: OpenCTM tools
// File: image.cpp
// Description: Implementation of the Image class.
//-----------------------------------------------------------------------------
// Copyright (c) 2009-2010 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//-----------------------------------------------------------------------------
#include <stdexcept>
#include <cstdio>
#include <jpeglib.h>
#include <pnglite.h>
#include "image.h"
#include "common.h"
using namespace std;
/// Flip the image vertically.
void Image::FlipVertically()
{
if((mWidth <= 0) || (mHeight <= 0))
return;
for(int y = 0; y < mHeight / 2; ++ y)
{
for(int x = 0; x < mWidth; ++ x)
{
for(int k = 0; k < mComponents; ++ k)
{
unsigned char tmp = mData[(y * mWidth + x) * mComponents + k];
mData[(y * mWidth + x) * mComponents + k] = mData[((mHeight - 1 - y) * mWidth + x) * mComponents + k];
mData[((mHeight - 1 - y) * mWidth + x) * mComponents + k] = tmp;
}
}
}
}
/// Load image from a JPEG file.
void Image::LoadJPEG(const char * aFileName)
{
FILE * inFile = fopen(aFileName, "rb");
if(inFile != NULL)
{
// Init libjpeg resources
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, inFile);
// Read JPEG header
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
SetSize(cinfo.output_width, cinfo.output_height, cinfo.output_components);
// Read pixel data
for(int i = 0; i < mHeight; ++ i)
{
unsigned char * scanLines[1];
scanLines[0] = &mData[(mHeight - 1 - i) * mWidth * mComponents];
jpeg_read_scanlines(&cinfo, scanLines, 1);
}
// Finalize libjpeg resources
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
// Close input file
fclose(inFile);
}
}
/// Load image from a PNG file.
void Image::LoadPNG(const char * aFileName)
{
bool success = false;
png_t p;
png_init(0, 0);
if(png_open_file(&p, aFileName) == PNG_NO_ERROR)
{
if((p.depth == 8) && ((p.color_type == PNG_GREYSCALE) ||
(p.color_type == PNG_TRUECOLOR) ||
(p.color_type == PNG_TRUECOLOR_ALPHA)) && (p.width > 0) &&
(p.height > 0) && (p.bpp >= 1) && (p.bpp <= 4))
{
SetSize(p.width, p.height, p.bpp);
if(png_get_data(&p, &mData[0]) == PNG_NO_ERROR)
{
FlipVertically();
success = true;
}
}
png_close_file(&p);
}
// Did we have an error?
if(!success)
{
Clear();
throw runtime_error("Unable to load PNG file.");
}
}
/// Load an image from a file (any supported format).
void Image::LoadFromFile(const char * aFileName)
{
string fileExt = UpperCase(ExtractFileExt(string(aFileName)));
if((fileExt == string(".JPG")) || (fileExt == string(".JPEG")))
LoadJPEG(aFileName);
else if(fileExt == string(".PNG"))
LoadPNG(aFileName);
else
throw runtime_error("Unknown input file extension.");
}

Some files were not shown because too many files have changed in this diff Show More