From: Akiko Date: Mon, 8 Jun 2015 12:30:59 +0000 (+0200) Subject: - another big round of filename changes and include corrections X-Git-Url: http://community.linux-addicted.net/gitweb/?a=commitdiff_plain;h=145898445d5f22663182104e9cf72282eccb835a;p=genesis3d.git - another big round of filename changes and include corrections - also removed some duplicates --- diff --git a/G3D/Math/Box.c b/G3D/Box.c similarity index 100% rename from G3D/Math/Box.c rename to G3D/Box.c diff --git a/G3D/Math/Box.h b/G3D/Box.h similarity index 100% rename from G3D/Math/Box.h rename to G3D/Box.h diff --git a/G3D/CMakeLists.txt b/G3D/CMakeLists.txt index b89e02c..f4881ce 100644 --- a/G3D/CMakeLists.txt +++ b/G3D/CMakeLists.txt @@ -1 +1,2 @@ -ADD_LIBRARY (Genesis3D STATIC CSNetMgr.c) +ADD_LIBRARY (Genesis3D STATIC Box.c CRC32.c CSNetMgr.c Camera.c Entities.c ErrorLog.c ExtBox.c Font.c Ge.c + GeAssert.c Log.c Matrix33.c MemPool.c NetPlay.c) diff --git a/G3D/Math/crc32.c b/G3D/CRC32.c similarity index 97% rename from G3D/Math/crc32.c rename to G3D/CRC32.c index a93c074..68e61c4 100644 --- a/G3D/Math/crc32.c +++ b/G3D/CRC32.c @@ -19,7 +19,7 @@ /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ /* */ /****************************************************************************************/ -#include "crc32.h" +#include "CRC32.h" static uint32 crc_table[256] = { diff --git a/G3D/Math/crc32.h b/G3D/CRC32.h similarity index 97% rename from G3D/Math/crc32.h rename to G3D/CRC32.h index 110bed8..eaad4b9 100644 --- a/G3D/Math/crc32.h +++ b/G3D/CRC32.h @@ -22,7 +22,7 @@ #ifndef GE_CRC32_H #define GE_CRC32_H -#include "basetype.h" +#include "BaseType.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Camera.c b/G3D/Camera.c index e49bec5..5a86985 100644 --- a/G3D/Camera.c +++ b/G3D/Camera.c @@ -24,8 +24,8 @@ #include // memset #include "Camera.h" -#include "include/Ram.h" -#include "include/ErrorLog.h" +#include "Ram.h" +#include "ErrorLog.h" #include "G3D/Engine/Drivers/DCommon.h" typedef struct geCamera diff --git a/G3D/Camera.h b/G3D/Camera.h index ecceca0..02050ab 100644 --- a/G3D/Camera.h +++ b/G3D/Camera.h @@ -22,10 +22,10 @@ #ifndef GE_CAMERA_H #define GE_CAMERA_H -#include "include/BaseType.h" -#include "include/Vec3d.h" -#include "include/XForm3d.h" -#include "include/GeTypes.h" +#include "BaseType.h" +#include "Vec3d.h" +#include "XForm3d.h" +#include "GeTypes.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/VFile/dirtree.c b/G3D/DirTree.c similarity index 100% rename from G3D/VFile/dirtree.c rename to G3D/DirTree.c diff --git a/G3D/VFile/dirtree.h b/G3D/DirTree.h similarity index 100% rename from G3D/VFile/dirtree.h rename to G3D/DirTree.h diff --git a/G3D/VFile/dirtree-common.c b/G3D/DirTreeCommon.c similarity index 100% rename from G3D/VFile/dirtree-common.c rename to G3D/DirTreeCommon.c diff --git a/G3D/VFile/dirtree-common.h b/G3D/DirTreeCommon.h similarity index 100% rename from G3D/VFile/dirtree-common.h rename to G3D/DirTreeCommon.h diff --git a/G3D/Engine/BitmapList.h b/G3D/Engine/BitmapList.h index 30cb47d..f84c329 100644 --- a/G3D/Engine/BitmapList.h +++ b/G3D/Engine/BitmapList.h @@ -22,9 +22,9 @@ #ifndef BITMAPLIST_H #define BITMAPLIST_H -#include "include/GeTypes.h" +#include "G3D/GeTypes.h" #include "G3D/Engine/Drivers/DCommon.h" -#include "include/Bitmap.h" +#include "G3D/Bitmap.h" typedef struct BitmapList BitmapList; diff --git a/G3D/Engine/System.h b/G3D/Engine/System.h index 47c8472..10bea8b 100644 --- a/G3D/Engine/System.h +++ b/G3D/Engine/System.h @@ -24,8 +24,8 @@ //#define OLD_FONT -#include "include/ErrorLog.h" -#include "include/Genesis.h" +#include "G3D/ErrorLog.h" +#include "G3D/Genesis.h" #include #include "G3D/Engine/Drivers/DCommon.h" #include "G3D/Camera.h" diff --git a/G3D/Entities.c b/G3D/Entities.c index ef4a32b..5be4b75 100644 --- a/G3D/Entities.c +++ b/G3D/Entities.c @@ -23,14 +23,14 @@ #include #include "Entities.h" -#include "include/BaseType.h" -#include "include/ErrorLog.h" -#include "include/Vec3d.h" -#include "include/Ram.h" +#include "BaseType.h" +#include "ErrorLog.h" +#include "Vec3d.h" +#include "Ram.h" // These are temporary until we find a better way to get models pointers into the entity stuff -#include "G3D/World/World.h" -#include "G3D/World/GBSPFile.h" +#include "World.h" +#include "GBSPFile.h" //===================================================================================== diff --git a/G3D/Entities.h b/G3D/Entities.h index 49b2b09..20fc6f0 100644 --- a/G3D/Entities.h +++ b/G3D/Entities.h @@ -25,12 +25,12 @@ #include #include -#include "include/BaseType.h" -#include "include/ErrorLog.h" -#include "include/Vec3d.h" +#include "BaseType.h" +#include "ErrorLog.h" +#include "Vec3d.h" #include "G3D/Engine/System.h" -#include "World/World.h" -#include "include/Ram.h" +#include "World.h" +#include "Ram.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Support/ERRORLOG.C b/G3D/ErrorLog.c similarity index 100% rename from G3D/Support/ERRORLOG.C rename to G3D/ErrorLog.c diff --git a/G3D/Math/ExtBox.c b/G3D/ExtBox.c similarity index 100% rename from G3D/Math/ExtBox.c rename to G3D/ExtBox.c diff --git a/G3D/World/Fog.c b/G3D/Fog.c similarity index 100% rename from G3D/World/Fog.c rename to G3D/Fog.c diff --git a/G3D/World/Fog.h b/G3D/Fog.h similarity index 93% rename from G3D/World/Fog.h rename to G3D/Fog.h index 6531f02..9c0c18c 100644 --- a/G3D/World/Fog.h +++ b/G3D/Fog.h @@ -24,11 +24,11 @@ #include -#include "include/Vec3d.h" -#include "include/BaseType.h" -#include "include/GeTypes.h" -#include "include/Ram.h" -#include "include/ErrorLog.h" +#include "G3D/Vec3d.h" +#include "G3D/BaseType.h" +#include "G3D/GeTypes.h" +#include "G3D/Ram.h" +#include "G3D/ErrorLog.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Font/font.c b/G3D/Font.c similarity index 96% rename from G3D/Font/font.c rename to G3D/Font.c index 1c9f94d..36f8321 100644 --- a/G3D/Font/font.c +++ b/G3D/Font.c @@ -26,14 +26,14 @@ #include #pragma warning(default : 4201 4214 4115) -#include "extbox.h" -#include "ram.h" -#include "wgClip.h" +#include "ExtBox.h" +#include "Ram.h" +#include "WgClip.h" #include #include -#include "font.h" +#include "Font.h" #pragma warning (disable:4514) // unreferenced inline function (caused by Windows) diff --git a/G3D/Font.h b/G3D/Font.h index 9370505..29d1641 100644 --- a/G3D/Font.h +++ b/G3D/Font.h @@ -24,9 +24,9 @@ #define GE_FONT_H // includes -#include "genesis.h" -#include "basetype.h" -#include "bitmap.h" +#include "Genesis.h" +#include "BaseType.h" +#include "Bitmap.h" // ************************** // to use this API: diff --git a/G3D/Font/font.H b/G3D/Font/font.H deleted file mode 100644 index 9370505..0000000 --- a/G3D/Font/font.H +++ /dev/null @@ -1,269 +0,0 @@ -/****************************************************************************************/ -/* FONT.H */ -/* */ -/* Author: Thom Robertson */ -/* Description: Bitmapped font support interface */ -/* This implementation supports any TrueType fonts provided by Windows */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_FONT_H -#define GE_FONT_H - -// includes -#include "genesis.h" -#include "basetype.h" -#include "bitmap.h" -// ************************** -// to use this API: - -// 2. geFont_CreateFont(). - -// 3. (Optionally) geFont_AddCharacters(). -// 3A. Otherwise, IF you intend to use geFont_DrawText(), call geFont_AddBitmapBuffer(). - -// 4. Between geEngine_BeginFrame() and geEngine_EndFrame(), and after geEngine_RenderWorld(), -// geFont_DrawText(). You may call geFont_DrawTextToBitmap() anytime, though. - -// 5. When finished, geFont_Destroy(). - - - -//*************************************************************************************** -// these are bit flags for _DrawText(). Currently only _WORDWRAP is implemented, and without -// it, the function will still wrap, just not on word boundaries. -// Note that these will fail for non ascii fonts. -#define GE_FONT_WRAP 0x00000001 // wrap to fit inside the drawing rect -#define GE_FONT_WORDWRAP 0x00000002 // wrap on word boundaries -#define GE_FONT_JUST_RETURN_FIT 0x00000004 // returns number of characters that fit in drawing rectangle, WITHOUT drawing anything. -#define GE_FONT_JUSTIFY_RIGHT 0x00000008 -#define GE_FONT_JUSTIFY_CENTER 0x00000010 - -#ifdef __cplusplus -extern "C" { -#endif - -// opaque structure headers. -typedef struct geFont geFont; // an instance of a font - - -//*************************************************************************************** -GENESISAPI geFont *GENESISCC geFont_Create(const geEngine *Engine, const char *fontNameString, - const int fontSize, - const int fontWeight , const geBoolean antialiased) ; - // Creates a font, and returns a pointer to it. - // Pass in the string name of the TrueType font (case sensitive), and the height in pixels. - - // ARGUMENTS: - // fontNameString - char pointer to a string containing the case sensitive name of the font. - // fontSize - the pixel height of the requested font. - - // RETURNS: - // success: pointer to the newly created font. - // failure: NULL. - - // NOTE: the new font set has NO actual characters in it at first. You must add characters - // to it with the _AddCharacters() function before you can use the font. - // NOTE: all fonts start out with a grayscale palette, with the range 0 to 128. - -//*************************************************************************************** -GENESISAPI void GENESISCC geFont_CreateRef(geFont *font); - - -//*************************************************************************************** -GENESISAPI void GENESISCC geFont_Destroy(geFont **font); - // destroys a font. - - // ARGUMENTS: - // font - pointer to the font to be destroyed. - - // RETURNS: - // nothing. - -//*************************************************************************************** -GENESISAPI geBoolean GENESISCC geFont_AddCharacters(geFont *font, - unsigned char leastIndex, - unsigned char mostIndex - ); - // Adds a set of characters to the font defined by the ascii range passed in - // (leastIndex and mostIndex, inclusive). - - // ARGUMENTS: - // font - pointer to the font to add characters to. - // e - pointer to a valid geEngine. - // leastIndex and mostIndex - the ASCII range of characters to add. - // cellBuffer - an allocated hunk of ram to temproarily store the character image - // bufferSize - length of the above buffer - - // RETURNS: - // success: GE_TRUE. - // failure: GE_FALSE. - - // NOTES: - // This is the function that actually uses the - // Win32 GetGlyphOutline() function to draw the character onto a geBitmap, which can be - // blitted to the screen. - - -//******************************************************************************* -GENESISAPI void GENESISCC geFont_DestroyBitmapBuffer( geFont *font ); - // destroys any valid "scratch-pad" buffer attached to the geFont. - // ARGUMENTS: - // font - pointer to the geFont. - // - // NOTES: - // you'll rarely need to call this function; it's called by geFont_Destroy() anyway. - // Calling this function with a geFont that has no initialized buffer doesn't - // hurt anything. - -//******************************************************************************* -GENESISAPI geBoolean GENESISCC geFont_AddBitmapBuffer( - geFont *font, const uint32 width, const uint32 height); - // Adds a geBitmap to the geFont, to be used as a temporary "scratch-pad". This is - // required for using geFont_DrawText() when no characters have been added. - - // ARGUMENTS: - // font - pointer to the geFont to add a buffer to. - // width and height - the size of the buffer to create. Make sure this size is >= - // the biggest rectagle of text you'll want to write to the screen using this geFont - // and DrawText(). - - // RETURNS: - // success: GE_TRUE. - // failure: GE_FALSE. - - // NOTES: - // You don't need to call this function IF you _AddCharacters() to this geFont. - // You call this function for each geFont you need to use. geFont's don't share buffers. - // if you call this function on a geFont that already has a valid buffer, the buffer is - // destroyed, and replaced by the new one. - -//*************************************************************************************** -GENESISAPI geBoolean GENESISCC geFont_DrawText(geFont *font, const char *textString, - const GE_Rect *Rect, const GE_RGBA *Color, - uint32 flags, const GE_Rect *clipRect); - // This is the function you put between geEngine_BeginFrame() and _EndFrame(), the function - // that draws text to the screen. - - // ARGUMENTS: - // font - pointer to the font to draw with. IF the font has NO characters in it - // (added by geFont_AddCharacters() ) then a different, more windows-intensive way is - // used to draw out the characters. - // textString - pointer to the text string to output to the screen. - // Rect - screen rectangle to place the text within. - // Color - RGB color the text should be. - // flags - a bitfield of GE_FONT_ values. - // clipRect - pointer to a screen rectangle to clip the text to. MAY BE NULL, in which - // case the text is only clipped by the boundaries of the screen. - - // RETURNS: - // success: GE_TRUE. - // failure: GE_FALSE. - - // NOTES: - // Assuming you've added characters to the font, characters which have NOT been added - // WILL cause an assert if you try to draw them. - // Only GE_FONTSET_WORDWRAP is meaningfull right now. Using any other flags will cause - // an assert. - // As stated above, you can use an entirely different way of creating a string, by - // making a font with no characters in it. This - // jumps through Windows DIB hoops, and draws the text in a non-anti-aliased, but - // (hopefully) more unicode-tolerant way (DrawText() ). - - -//*************************************************************************************** -GENESISAPI geBoolean GENESISCC geFont_DrawTextToBitmap(geFont *font, const char *textString, - const GE_Rect *Rect, const GE_RGBA *Color, - uint32 flags, const GE_Rect *clipRect, - geBitmap *targetBitmap); - // This is the function you put between geEngine_BeginFrame() and _EndFrame(), the function - // that draws text to the screen. - - // ARGUMENTS: - // font - pointer to the font to draw with. IF the font has NO characters in it - // (added by geFont_AddCharacters() ) then a different, more windows-intensive way is - // used to draw out the characters. - // textString - pointer to the text string to output to the screen. - // Rect - screen rectangle to place the text within. - // Color - RGB color the text should be. - // flags - a bitfield of GE_FONT_ values. - // clipRect - pointer to a screen rectangle to clip the text to. MAY BE NULL, in which - // case the text is only clipped by the boundaries of the screen. - // targetBitmap - pointer to a target bitmap to draw the text into. MAY NOT BE NULL, - // and MUST BE GE_PIXELFORMAT_8BIT. - - // RETURNS: - // success: GE_TRUE. - // failure: GE_FALSE. - - // NOTES: - // Assuming you've added characters to the font, characters which have NOT been added - // WILL cause an assert if you try to draw them. - // Only GE_FONTSET_WORDWRAP is meaningfull right now. Using any other flags will cause - // an assert. - // As stated above, you can use an entirely different way of creating a string, by - // making a font with no characters in it. This - // jumps through Windows DIB hoops, and draws the text in a non-anti-aliased, but - // (hopefully) more unicode-tolerant way (DrawText() ). - // The Color argument is will be used to modify the existing palette of the targetBitmap - // passed in. Therefore, you won't be able to _DrawTextToBitmap() a red piece of text, - // then a green piece, then a blue piece. You'll end up with three lines of blue text. - - -//*************************************************************************************** -GENESISAPI int32 GENESISCC geFont_GetStringPixelWidth (geFont *font, const char *textString); -GENESISAPI int32 GENESISCC geFont_GetStringPixelHeight(geFont *font, const char *textString); - // These two functions return the pixel width and height of the string passed in. - - // ARGUMENTS: - // font - pointer to the font to draw with. - // textString - pointer to the text string to output to the screen. - - // RETURNS: - // success: a positive value in pixels. IF the text passed in contains characters - // which haven't been added to the font yet, BUT other characters HAVE - // been added, the function asserts. - // failure: -1. - // NOTES: - // these two functions assume no text wrapping! - -//*************************************************************************************** -GENESISAPI geBitmap* GENESISCC geFont_GetBuffer(geFont *font); - // This function returns a pointer to the drawing buffer contained by the font. - - // ARGUMENTS: - // font - pointer to the font. - - // RETURNS: - // a valid pointer to a geBitmap, OR NULL, signifying that the buffer wasn't initialized. - - -//*************************************************************************************** -GENESISAPI geBoolean GENESISCC geFont_GetCharMap(geFont *font, uint8 character, GE_Rect *Rect, - geBitmap **targetBitmap, int32 *fullWidth, int32 *fullHeight, - int32 *offsetX, int32 *offsetY); - -//*************************************************************************************** -GENESISAPI void GENESISCC geFont_EnableAntialiasing(geFont *font, const geBoolean anti); -//*************************************************************************************** -GENESISAPI geBoolean GENESISCC geFont_IsAntialiased(geFont *font); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/G3D/World/Frustum.c b/G3D/Frustum.c similarity index 100% rename from G3D/World/Frustum.c rename to G3D/Frustum.c diff --git a/G3D/World/Frustum.h b/G3D/Frustum.h similarity index 96% rename from G3D/World/Frustum.h rename to G3D/Frustum.h index aa21648..7bc5fd1 100644 --- a/G3D/World/Frustum.h +++ b/G3D/Frustum.h @@ -25,11 +25,11 @@ #include //#include -#include "include/BaseType.h" +#include "G3D/BaseType.h" #include "GBSPFile.h" -#include "include/Vec3d.h" +#include "G3D/Vec3d.h" #include "G3D/Camera.h" -#include "include/XForm3d.h" +#include "G3D/XForm3d.h" #include "Surface.h" #ifdef __cplusplus diff --git a/G3D/VFile/fsdos.c b/G3D/FsDos.c similarity index 100% rename from G3D/VFile/fsdos.c rename to G3D/FsDos.c diff --git a/G3D/VFile/fsdos.h b/G3D/FsDos.h similarity index 100% rename from G3D/VFile/fsdos.h rename to G3D/FsDos.h diff --git a/G3D/VFile/FSMEMORY.C b/G3D/FsMemory.c similarity index 100% rename from G3D/VFile/FSMEMORY.C rename to G3D/FsMemory.c diff --git a/G3D/VFile/FSMEMORY.H b/G3D/FsMemory.h similarity index 100% rename from G3D/VFile/FSMEMORY.H rename to G3D/FsMemory.h diff --git a/G3D/VFile/fsvfs.c b/G3D/FsVfs.c similarity index 100% rename from G3D/VFile/fsvfs.c rename to G3D/FsVfs.c diff --git a/G3D/VFile/fsvfs.h b/G3D/FsVfs.h similarity index 100% rename from G3D/VFile/fsvfs.h rename to G3D/FsVfs.h diff --git a/G3D/World/GBSPFile.c b/G3D/GBSPFile.c similarity index 100% rename from G3D/World/GBSPFile.c rename to G3D/GBSPFile.c diff --git a/G3D/World/GBSPFile.h b/G3D/GBSPFile.h similarity index 95% rename from G3D/World/GBSPFile.h rename to G3D/GBSPFile.h index a021040..c402f86 100644 --- a/G3D/World/GBSPFile.h +++ b/G3D/GBSPFile.h @@ -24,12 +24,12 @@ #include -#include "include/BaseType.h" -#include "include/Vec3d.h" +#include "G3D/BaseType.h" +#include "G3D/Vec3d.h" #include #include "G3D/Engine/Drivers/DCommon.h" -#include "include/VFile.h" -#include "include/Motion.h" +#include "G3D/VFile.h" +#include "G3D/Motion.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Ge.c b/G3D/Ge.c index 06ed4aa..1f4b5ca 100644 --- a/G3D/Ge.c +++ b/G3D/Ge.c @@ -24,24 +24,24 @@ #include #include -#include "include/Genesis.h" +#include "Genesis.h" #include "G3D/Engine/System.h" -#include "include/Ram.h" +#include "Ram.h" //#include "Sound.h" //#include "Sound3d.h" -#include "G3D/World/World.h" -#include "G3D/World/Surface.h" +#include "World.h" +#include "Surface.h" //#include "Camera.h" -#include "G3D/World/Light.h" -#include "G3D/World/Plane.h" +#include "Light.h" +#include "Plane.h" #include "Entities.h" -#include "G3D/World/Trace.h" -#include "G3D/World/User.h" +#include "Trace.h" +#include "User.h" //#include "Host.h" -#include "include/Motion.h" -#include "G3D/World/Vis.h" +#include "Motion.h" +#include "Vis.h" //===================================================================================== // local static globals diff --git a/G3D/Support/geAssert.c b/G3D/GeAssert.c similarity index 96% rename from G3D/Support/geAssert.c rename to G3D/GeAssert.c index 8ea7508..f7489f4 100644 --- a/G3D/Support/geAssert.c +++ b/G3D/GeAssert.c @@ -19,12 +19,12 @@ /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ /* */ /****************************************************************************************/ -#include "geAssert.h" +#include "GeAssert.h" #include #include #include #include - + // See geAssert.h for details. //void __cdecl _assertge (void *expr,void *filename,unsigned lineno); diff --git a/G3D/Support/geAssert.h b/G3D/GeAssert.h similarity index 100% rename from G3D/Support/geAssert.h rename to G3D/GeAssert.h diff --git a/G3D/World/Light.c b/G3D/Light.c similarity index 100% rename from G3D/World/Light.c rename to G3D/Light.c diff --git a/G3D/World/Light.h b/G3D/Light.h similarity index 96% rename from G3D/World/Light.h rename to G3D/Light.h index a18e24a..e13d199 100644 --- a/G3D/World/Light.h +++ b/G3D/Light.h @@ -25,8 +25,8 @@ #include //#include -#include "include/Genesis.h" -#include "include/BaseType.h" +#include "G3D/Genesis.h" +#include "G3D/BaseType.h" #include "G3D/Engine/System.h" #include "G3D/Engine/Drivers/DCommon.h" diff --git a/G3D/List.c b/G3D/List.c index 0f0859d..5b52e17 100644 --- a/G3D/List.c +++ b/G3D/List.c @@ -33,10 +33,10 @@ List_Ram can still be as high as 30% of the time! #include #include #include -#include "list.h" -#include "mempool.h" -#include "ram.h" -#include "crc32.h" +#include "List.h" +#include "MemPool.h" +#include "Ram.h" +#include "CRC32.h" /**********************************/ // Timer Stuff @@ -1119,18 +1119,20 @@ void Hash_Destroy(Hash *pHash) if ( pHash ) { HashNode *pList,*pNode,*pNext; - - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); Debug(pHash->Members += 2) // count Head & Tail pList = pHash->NodeList; LN_Walk_Editting(pNode,pList,pNext) { MemPool_FreeHunk(HashNodePool_g,pNode); - assert(pHash->Members > 1); + // FIXME: where does this member variable come from?!? + //assert(pHash->Members > 1); Debug(pHash->Members --) } - assert(pHash->Members == 1); + // FIXME: where does this member variable come from?!? + //assert(pHash->Members == 1); MemPool_FreeHunk(HashNodePool_g,pList); destroy(pHash); } @@ -1161,7 +1163,8 @@ HashNode *hn,**pTable,*Node,*Prev; Debug( int ListLen1; int ListLen2; int HashLen1; int HashLen2; int WalkLen) assert(pHash); - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); hn = MemPool_GetHunk(HashNodePool_g); assert(hn); @@ -1193,8 +1196,8 @@ Debug( int ListLen1; int ListLen2; int HashLen1; int HashLen2; int WalkLen) { Prev = Node; Node = LN_Next(Prev); - - assert(WalkLen < pHash->Members ); + // FIXME: where does this member variable come from?!? + //assert(WalkLen < pHash->Members ); Debug( WalkLen ++) assert(Prev->Hash <= Node->Hash); @@ -1211,9 +1214,11 @@ Debug( int ListLen1; int ListLen2; int HashLen1; int HashLen2; int WalkLen) Debug(pHash->Members ++) Debug(ListLen2 = Hash_ListLen(pHash,H)) - assert( ListLen2 == (ListLen1 + 1) ); + // FIXME: where does this member variable come from?!? + //assert( ListLen2 == (ListLen1 + 1) ); Debug(HashLen2 = Hash_NumMembers(pHash)) - assert( HashLen2 == (HashLen1 + 1) ); + // FIXME: where does this member variable come from?!? + //assert( HashLen2 == (HashLen1 + 1) ); return hn; } @@ -1226,7 +1231,8 @@ Debug( int ListLen1; int ListLen2;int HashLen1; int HashLen2) assert(pNode ); assert( pHash ); - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); assert( pNode->Hash > 0 && pNode->Hash < HASH_SIZE ); @@ -1235,7 +1241,8 @@ Debug( int ListLen1; int ListLen2;int HashLen1; int HashLen2) Debug( HashLen1 = Hash_NumMembers(pHash) ) Debug( ListLen1 = Hash_ListLen(pHash,H) ) - assert(pHash->Members > 0); + // FIXME: where does this member variable come from?!? + //assert(pHash->Members > 0); Debug(pHash->Members --) if ( *pHead == pNode ) @@ -1256,7 +1263,8 @@ Debug( int ListLen1; int ListLen2;int HashLen1; int HashLen2) Debug( HashLen2 = Hash_NumMembers(pHash) ) Debug( ListLen2 = Hash_ListLen(pHash,H) ) - assert( HashLen2 == (HashLen1 - 1) ); + // FIXME: where does this member variable come from?!? + //assert( HashLen2 == (HashLen1 - 1) ); } @@ -1266,7 +1274,8 @@ uint32 H; HashNode *pNode; assert(pHash ); - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); H = HASH(Key); assert( H > 0 && H < HASH_SIZE ); @@ -1296,7 +1305,8 @@ HashNode * LISTCALL Hash_WalkNext(Hash *pHash,HashNode *pNode) HashNode *pNext; assert(pHash); - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); if ( ! pNode ) { @@ -1328,7 +1338,8 @@ uint32 N; HashNode *pNode; assert(pHash); - assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); + // FIXME: where does this member variable come from?!? + //assert( pHash->MySelf1 == pHash && pHash->MySelf2 == pHash ); pNode = pHash->NodeList; assert( pNode->Hash == 0 ); @@ -1338,12 +1349,14 @@ HashNode *pNode; N = 0; while( pNode->Hash < HASH_SIZE ) { - assert( N < (uint32)pHash->Members ); + // FIXME: where does this member variable come from?!? + //assert( N < (uint32)pHash->Members ); pNode = LN_Next(pNode); N ++; } - assert( N == (uint32)pHash->Members ); + // FIXME: where does this member variable come from?!? + //assert( N == (uint32)pHash->Members ); return N; } diff --git a/G3D/List.h b/G3D/List.h index be02239..81b2ff8 100644 --- a/G3D/List.h +++ b/G3D/List.h @@ -23,7 +23,7 @@ /* */ /****************************************************************************************/ -#include "basetype.h" +#include "BaseType.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Support/log.c b/G3D/Log.c similarity index 100% rename from G3D/Support/log.c rename to G3D/Log.c diff --git a/G3D/Support/log.h b/G3D/Log.h similarity index 100% rename from G3D/Support/log.h rename to G3D/Log.h diff --git a/G3D/Math/ExtBox.h b/G3D/Math/ExtBox.h deleted file mode 100644 index cceced4..0000000 --- a/G3D/Math/ExtBox.h +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************************/ -/* EXTBOX.H */ -/* */ -/* Author: */ -/* Description: Axial aligned bounding box (extent box) support */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_EXTBOX_H -#define GE_EXTBOX_H - -#include "basetype.h" -#include "vec3d.h" - -#ifdef __cplusplus - extern "C" { -#endif - -typedef struct geExtBox -{ - geVec3d Min; - geVec3d Max; -} geExtBox; - -// Set the values in a box -void GENESISCC geExtBox_Set ( geExtBox *B, - geFloat X1, geFloat Y1, geFloat Z1, - geFloat X2, geFloat Y2, geFloat Z2 ); - -// Test a box for validity ( non NULL and max >= min ) -geBoolean GENESISCC geExtBox_IsValid( const geExtBox *B ); - -// Set box Min and Max to the passed point -void GENESISCC geExtBox_SetToPoint ( geExtBox *B, const geVec3d *Point ); - -// Extend a box to encompass the passed point -void GENESISCC geExtBox_ExtendToEnclose( geExtBox *B, const geVec3d *Point ); - -// Return result of box intersection. -// If no intersection, returns GE_FALSE and bResult is not modified. -// If intersection, returns GE_TRUE and fills bResult (if not NULL) -// with the intersected box, -// bResult may be one of b1 or b2. -// -geBoolean GENESISCC geExtBox_Intersection ( const geExtBox *B1, const geExtBox *B2, geExtBox *Result ); - -// computes union of b1 and b2 and returns in bResult. -void GENESISCC geExtBox_Union ( const geExtBox *B1, const geExtBox *B2, geExtBox *Result ); - -geBoolean GENESISCC geExtBox_ContainsPoint ( const geExtBox *B, const geVec3d *Point ); - -void GENESISCC geExtBox_GetTranslation ( const geExtBox *B, geVec3d *pCenter ); -void GENESISCC geExtBox_SetTranslation ( geExtBox *B, const geVec3d *pCenter ); -void GENESISCC geExtBox_Translate ( geExtBox *B, geFloat DX, geFloat DY, geFloat DZ ); - -void GENESISCC geExtBox_GetScaling ( const geExtBox *B, geVec3d *pScale ); -void GENESISCC geExtBox_SetScaling ( geExtBox *B, const geVec3d *pScale ); -void GENESISCC geExtBox_Scale ( geExtBox *B, geFloat DX, geFloat DY,geFloat DZ ); - -// Creates a box that encloses the entire area of a box that moves along linear path -void GENESISCC geExtBox_LinearSweep( const geExtBox *BoxToSweep, - const geVec3d *StartPoint, - const geVec3d *EndPoint, - geExtBox *EnclosingBox ); - -// Collides a ray with box B. The ray is directed, from Start to End. -// Only returns a ray hitting the outside of the box. -// on success, GE_TRUE is returned, and -// if T is non-NULL, T is returned as 0..1 where 0 is a collision at Start, and 1 is a collision at End -// if Normal is non-NULL, Normal is the surface normal of the box where the collision occured. -geBoolean GENESISCC geExtBox_RayCollision( const geExtBox *B, const geVec3d *Start, const geVec3d *End, - geFloat *T, geVec3d *Normal ); - -#ifdef __cplusplus - } -#endif - - - -#endif - diff --git a/G3D/Math/VEC3D.H b/G3D/Math/VEC3D.H deleted file mode 100644 index ed1f240..0000000 --- a/G3D/Math/VEC3D.H +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************************/ -/* VEC3D.H */ -/* */ -/* Author: */ -/* Description: 3D Vector interface */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_VEC3D_H -#define GE_VEC3D_H - -#include "basetype.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - geFloat X, Y, Z; -} geVec3d; - -#ifndef NDEBUG -GENESISAPI geFloat GENESISCC geVec3d_GetElement(geVec3d *V, int Index); -#else - #define geVec3d_GetElement(Vector,Index) (* ((&((Vector)->X)) + (Index) )) -#endif - -GENESISAPI void GENESISCC geVec3d_Set(geVec3d *V, geFloat X, geFloat Y, geFloat Z); -GENESISAPI void GENESISCC geVec3d_Get(const geVec3d *V, geFloat *X, geFloat *Y, geFloat *Z); - -GENESISAPI geFloat GENESISCC geVec3d_DotProduct(const geVec3d *V1, const geVec3d *V2); -GENESISAPI void GENESISCC geVec3d_CrossProduct(const geVec3d *V1, const geVec3d *V2, geVec3d *VResult); -GENESISAPI geBoolean GENESISCC geVec3d_Compare(const geVec3d *V1, const geVec3d *V2,geFloat tolarance); -GENESISAPI geFloat GENESISCC geVec3d_Normalize(geVec3d *V1); -GENESISAPI geBoolean GENESISCC geVec3d_IsNormalized(const geVec3d *V); -GENESISAPI void GENESISCC geVec3d_Scale(const geVec3d *VSrc, geFloat Scale, geVec3d *VDst); -GENESISAPI geFloat GENESISCC geVec3d_Length(const geVec3d *V1); -GENESISAPI geFloat GENESISCC geVec3d_LengthSquared(const geVec3d *V1); -GENESISAPI void GENESISCC geVec3d_Subtract(const geVec3d *V1, const geVec3d *V2, geVec3d *V1MinusV2); -GENESISAPI void GENESISCC geVec3d_Add(const geVec3d *V1, const geVec3d *V2, geVec3d *VSum); -GENESISAPI void GENESISCC geVec3d_Copy(const geVec3d *Vsrc, geVec3d *Vdst); -GENESISAPI void GENESISCC geVec3d_Clear(geVec3d *V); -GENESISAPI void GENESISCC geVec3d_Inverse(geVec3d *V); -GENESISAPI void GENESISCC geVec3d_MA(geVec3d *V1, geFloat Scale, const geVec3d *V2, geVec3d *V1PlusV2Scaled); -GENESISAPI void GENESISCC geVec3d_AddScaled(const geVec3d *V1, const geVec3d *V2, geFloat Scale, geVec3d *V1PlusV2Scaled); - -GENESISAPI geFloat GENESISCC geVec3d_DistanceBetween(const geVec3d *V1, const geVec3d *V2); // returns length of V1-V2 - -GENESISAPI geBoolean GENESISCC geVec3d_IsValid(const geVec3d *V); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/G3D/Math/Xform3d.h b/G3D/Math/Xform3d.h deleted file mode 100644 index 2a59fa5..0000000 --- a/G3D/Math/Xform3d.h +++ /dev/null @@ -1,225 +0,0 @@ -/****************************************************************************************/ -/* XFORM3D.H */ -/* */ -/* Author: */ -/* Description: 3D transform interface */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_XFORM_H -#define GE_XFORM_H - - -#include "Vec3d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - geFloat AX,AY,AZ; // e[0][0],e[0][1],e[0][2] - geFloat BX,BY,BZ; // e[1][0],e[1][1],e[1][2] - geFloat CX,CY,CZ; // e[2][0],e[2][1],e[2][2] - geVec3d Translation; // e[0][3],e[1][3],e[2][3] - // 0,0,0,1 // e[3][0],e[3][1],e[3][2] -} geXForm3d; - -/* this is essentially a 'standard' 4x4 transform matrix, - with the bottom row always 0,0,0,1 - - | AX, AY, AZ, Translation.X | - | BX, BY, BZ, Translation.Y | - | CX, CY, CZ, Translation.Z | - | 0, 0, 0, 1 | -*/ - -// all geXForm3d_Set* functions return a right-handed transform. - -#define GEXFORM3D_MINIMUM_SCALE (0.00001f) - - -GENESISAPI void GENESISCC geXForm3d_Copy( - const geXForm3d *Src, - geXForm3d *Dst); - // copies Src to Dst. - -GENESISAPI geBoolean GENESISCC geXForm3d_IsValid(const geXForm3d *M); - // returns GE_TRUE if M is 'valid' - // 'valid' means that M is non NULL, and there are no NAN's in the matrix. - -//MRB BEGIN -GENESISAPI geBoolean GENESISCC geXForm3d_IsIdentity(const geXForm3d *M); - // returns GE_TRUE if M is an identity matrix -//MRB END - -GENESISAPI geBoolean GENESISCC geXForm3d_IsOrthonormal(const geXForm3d *M); - // returns GE_TRUE if M is orthonormal - // (if the rows and columns are all normalized (transform has no scaling or shearing) - // and is orthogonal (row1 cross row2 = row3 & col1 cross col2 = col3) - // * does not check for right-handed convention * - -GENESISAPI geBoolean GENESISCC geXForm3d_IsOrthogonal(const geXForm3d *M); - // returns GE_TRUE if M is orthogonal - // (row1 cross row2 = row3 & col1 cross col2 = col3) - // * does not check for right-handed convention * - -GENESISAPI void GENESISCC geXForm3d_Orthonormalize(geXForm3d *M); - // essentially removes scaling (or other distortions) from - // an orthogonal (or nearly orthogonal) matrix - // returns a right-handed matrix - - -GENESISAPI void GENESISCC geXForm3d_SetIdentity(geXForm3d *M); - // sets M to an identity matrix (clears it) - -GENESISAPI void GENESISCC geXForm3d_SetXRotation(geXForm3d *M,geFloat RadianAngle); - // sets up a transform that rotates RadianAngle about X axis - // all existing contents of M are replaced - -GENESISAPI void GENESISCC geXForm3d_SetYRotation(geXForm3d *M,geFloat RadianAngle); - // sets up a transform that rotates RadianAngle about Y axis - // all existing contents of M are replaced - -GENESISAPI void GENESISCC geXForm3d_SetZRotation(geXForm3d *M,geFloat RadianAngle); - // sets up a transform that rotates RadianAngle about Z axis - // all existing contents of M are replaced - -GENESISAPI void GENESISCC geXForm3d_SetTranslation(geXForm3d *M,geFloat x, geFloat y, geFloat z); - // sets up a transform that translates x,y,z - // all existing contents of M are replaced - -GENESISAPI void GENESISCC geXForm3d_SetScaling(geXForm3d *M,geFloat x, geFloat y, geFloat z); - // sets up a transform that scales by x,y,z - // all existing contents of M are replaced - -GENESISAPI void GENESISCC geXForm3d_RotateX(geXForm3d *M,geFloat RadianAngle); - // Rotates M by RadianAngle about X axis - // applies the rotation to the existing contents of M - -GENESISAPI void GENESISCC geXForm3d_RotateY(geXForm3d *M,geFloat RadianAngle); - // Rotates M by RadianAngle about Y axis - // applies the rotation to the existing contents of M - -GENESISAPI void GENESISCC geXForm3d_RotateZ(geXForm3d *M,geFloat RadianAngle); - // Rotates M by RadianAngle about Z axis - // applies the rotation to the existing contents of M - -GENESISAPI void GENESISCC geXForm3d_Translate(geXForm3d *M,geFloat x, geFloat y, geFloat z); - // Translates M by x,y,z - // applies the translation to the existing contents of M - -GENESISAPI void GENESISCC geXForm3d_Scale(geXForm3d *M,geFloat x, geFloat y, geFloat z); - // Scales M by x,y,z - // applies the scale to the existing contents of M - -GENESISAPI void GENESISCC geXForm3d_Multiply( - const geXForm3d *M1, - const geXForm3d *M2, - geXForm3d *MProduct); - // MProduct = matrix multiply of M1*M2 - // Concatenates the transformation in the M2 matrix onto the transformation in M1 - -GENESISAPI void GENESISCC geXForm3d_Transform( - const geXForm3d *M, - const geVec3d *V, - geVec3d *Result); - // Result is Matrix M * Vector V: V Tranformed by M - -GENESISAPI void GENESISCC geXForm3d_TransformArray( const geXForm3d *XForm, - const geVec3d *Source, - geVec3d *Dest, - int32 Count); - -GENESISAPI void GENESISCC geXForm3d_Rotate( - const geXForm3d *M, - const geVec3d *V, - geVec3d *Result); - // Result is Matrix M * Vector V: V Rotated by M (no translation) - - -/*** -* - "Left,Up,In" are just the basis vectors in the new coordinate space. - You can get them by multiplying the unit bases into the transforms. -* -******/ - -GENESISAPI void GENESISCC geXForm3d_GetLeft(const geXForm3d *M, geVec3d *Left); - // Gets a vector that is 'left' in the frame of reference of M (facing -Z) - -GENESISAPI void GENESISCC geXForm3d_GetUp(const geXForm3d *M, geVec3d *Up); - // Gets a vector that is 'up' in the frame of reference of M (facing -Z) - -GENESISAPI void GENESISCC geXForm3d_GetIn(const geXForm3d *M, geVec3d *In); - // Gets a vector that is 'in' in the frame of reference of M (facing -Z) - -GENESISAPI void GENESISCC geXForm3d_GetTranspose(const geXForm3d *M, geXForm3d *MTranspose); - // Gets the Transpose transform of M (M^T) - // Transpose of a matrix is the switch of the rows and columns - // The transpose is usefull because it is rapidly computed and is equal to the inverse - // transform for orthonormal transforms [inverse is (M') where M*M' = Identity ] - -GENESISAPI void GENESISCC geXForm3d_TransposeTransform( - const geXForm3d *M, - const geVec3d *V, - geVec3d *Result); - // applies the transpose transform of M to V. Result = (M^T) * V - -/***** -* - the Euler angles are subsequent rotations : - by Angles->Z around the Z axis - then by Angles->Y around the Y axis, in the newly rotate coordinates - then by Angles->X around the X axis -* -******/ - -GENESISAPI void GENESISCC geXForm3d_GetEulerAngles(const geXForm3d *M, geVec3d *Angles); - // Finds Euler angles from M and puts them into Angles - -GENESISAPI void GENESISCC geXForm3d_SetEulerAngles(geXForm3d *M, const geVec3d *Angles); - // Applies Euler angles to build M - -GENESISAPI void GENESISCC geXForm3d_SetFromLeftUpIn( - geXForm3d *M, - const geVec3d *Left, - const geVec3d *Up, - const geVec3d *In); - // Builds an geXForm3d from orthonormal Left, Up and In vectors - -GENESISAPI void GENESISCC geXForm3d_Mirror( - const geXForm3d *Source, - const geVec3d *PlaneNormal, - geFloat PlaneDist, - geXForm3d *Dest); - // Mirrors a XForm3d about a plane - - -//-------------- - -#ifndef NDEBUG - GENESISAPI void GENESISCC geXForm3d_SetMaximalAssertionMode( geBoolean Enable ); -#else - #define geXForm3d_SetMaximalAssertionMode(Enable) -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/G3D/Math/quatern.h b/G3D/Math/quatern.h deleted file mode 100644 index d11ef61..0000000 --- a/G3D/Math/quatern.h +++ /dev/null @@ -1,237 +0,0 @@ -/****************************************************************************************/ -/* QUATERN.H */ -/* */ -/* Author: Mike Sandige */ -/* Description: Quaternion mathematical system interface */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_QUATERNION_H -#define GE_QUATERNION_H - -/*************************************************************************** - - The quatern module contains basic support for a quaternion object. - - quaternions are an extension of complex numbers that allows an - expression for rotation that can be easily interpolated. geQuaternion_s are also - more numericaly stable for repeated rotations than matrices. - - - A quaternion is a 4 element 'vector' [w,x,y,z] where: - - q = w + xi + yj + zk - i*i = -1 - j*j = -1 - k*k = -1 - i*j = -j*i = k - j*k = -k*j = i - k*i = -i*k = j - q' (conjugate) = w - xi - yj - zk - ||q|| (magnitude) = sqrt(q*q') = sqrt(w*w + x*x + y*y + z*z) - unit quaternion ||q|| == 1; this implies q' == qinverse - quaternions are associative (q1*q2)*q3 == q1*(q2*q3) - quaternions are not commutative q1*q2 != q2*q1 - qinverse (inverse (1/q) ) = q'/(q*q') - - q can be expressed by w + xi + yj + zk or [w,x,y,z] - or as in this implementation (s,v) where s=w, and v=[x,y,z] - - quaternions can represent a rotation. The rotation is an angle t, around a - unit vector u. q=(s,v); s= cos(t/2); v= u*sin(t/2). - - quaternions can apply the rotation to a point. let the point be p [px,py,pz], - and let P be a quaternion(0,p). Protated = q*P*qinverse - ( Protated = q*P*q' if q is a unit quaternion) - - concatenation rotations is similar to matrix concatenation. given two rotations - q1 and q2, to rotate by q1, then q2: let qc = (q2*q1), then the combined - rotation is given by qc*P*qcinverse (= qc*P*qc' if q is a unit quaternion) - - multiplication: - q1 = w1 + x1i + y1j + z1k - q2 = w2 + x2i + y2j + z2k - q1*q2 = q3 = - (w1*w2 - x1*x2 - y1*y2 - z1*z2) {w3} - (w1*x2 + x1*w2 + y1*z2 - z1*y2)i {x3} - (w1*y2 - x1*z2 + y1*w2 + z1*x2)j {y3} - (w1*z2 + x1*y2 + y1*x2 + z1*w2)k {z3} - - also, - q1 = (s1,v1) = [s1,(x1,y1,z1)] - q2 = (s2,v2) = [s2,(x2,y2,z2)] - q1*q2 = q3 = (s1*s2 - dot_product(v1,v2), {s3} - (s1*v2 + s2*v1 + cross_product(v1,v2)) {v3} - - - interpolation - it is possible (and sometimes reasonable) to interpolate between - two quaternions by interpolating each component. This does not quarantee a - resulting unit quaternion, and will result in an animation with non-linear - rotational velocity. - - spherical interpolation: (slerp) treat the quaternions as vectors - find the angle between them (w = arccos(q1 dot q2) ). - given 0<=t<=1, q(t) = q1*(sin((1-t)*w)/sin(w) + q2 * sin(t*w)/sin(w). - since q == -q, care must be taken to rotate the proper way. - - this implementation uses the notation quaternion q = (quatS,quatV) - where quatS is a scalar, and quatV is a 3 element vector. - -********************************************/ - -#include "basetype.h" -#include "xform3d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - geFloat W; - geFloat X,Y,Z; - //geVec3d QuatV; -} geQuaternion; - - -#define QUATERNION_PI (GE_PI) - -geBoolean GENESISCC geQuaternion_IsValid( const geQuaternion *Q ); - // return GE_TRUE if Q is non null and for has no NAN's in its components - -void GENESISCC geQuaternion_Set( geQuaternion *Q, geFloat W, geFloat X, geFloat Y, geFloat Z); - // set quaternion components. Doesn't normalize -void GENESISCC geQuaternion_SetVec3d( geQuaternion *Q, geFloat W, const geVec3d *V); - // set quaternion components. Doesn't normalize -GENESISAPI void GENESISCC geQuaternion_SetFromAxisAngle(geQuaternion *Q, const geVec3d *Axis, geFloat Theta); - // set a quaternion from an axis and a rotation around the axis -geBoolean GENESISCC geQuaternion_GetAxisAngle(const geQuaternion *Q, geVec3d *Axis, geFloat *Theta); - // gets an axis and angle of rotation around the axis from a quaternion - // returns GE_TRUE if there is an axis. - // returns GE_FALSE if there is no axis (and Axis is set to 0,0,0, and Theta is 0) - -void GENESISCC geQuaternion_Get( const geQuaternion *Q, - geFloat *W, geFloat *X, geFloat *Y, geFloat *Z); - // get quaternion components into W,X,Y,Z -void GENESISCC geQuaternion_GetVec3d( const geQuaternion *Q, geFloat *W, geVec3d *V); - // get quaternion components into W and V - -void GENESISCC geQuaternion_FromMatrix( - const geXForm3d *RotationMatrix, - geQuaternion *QDest); - // takes upper 3 by 3 portion of matrix (rotation sub matrix) - // and generates a quaternion - -GENESISAPI void GENESISCC geQuaternion_ToMatrix( - const geQuaternion *Q, - geXForm3d *RotationMatrixDest); - // takes a unit quaternion and makes RotationMatrixDest an equivelant rotation xform. - // (any translation in RotationMatrixDest will be list) - -void GENESISCC geQuaternion_Slerp( - const geQuaternion *Q0, - const geQuaternion *Q1, - geFloat T, - geQuaternion *QT); - // spherical interpolation between q0 and q1. 0<=t<=1 - // resulting quaternion is 'between' q0 and q1 - // with t==0 being all q0, and t==1 being all q1. - // returns a quaternion with a positive W - always takes shortest route - // through the positive W domain. - -void GENESISCC geQuaternion_SlerpNotShortest( - const geQuaternion *Q0, - const geQuaternion *Q1, - geFloat T, - geQuaternion *QT); - // spherical interpolation between q0 and q1. 0<=t<=1 - // resulting quaternion is 'between' q0 and q1 - // with t==0 being all q0, and t==1 being all q1. - - -void GENESISCC geQuaternion_Multiply( - const geQuaternion *Q1, - const geQuaternion *Q2, - geQuaternion *QProduct); - // multiplies q1 * q2, and places the result in q. - // no failure. renormalization not automatic - -void GENESISCC geQuaternion_Rotate( - const geQuaternion *Q, - const geVec3d *V, - geVec3d *VRotated); - // Rotates V by the quaternion Q, places the result in VRotated. - -geBoolean GENESISCC geQuaternion_IsUnit(const geQuaternion *Q); - // returns GE_TRUE if q is a unit quaternion. GE_FALSE otherwise. - -GENESISAPI geFloat GENESISCC geQuaternion_Normalize(geQuaternion *Q); - // normalizes q to be a unit quaternion. returns original magnitude of q - -GENESISAPI void GENESISCC geQuaternion_Copy(const geQuaternion *QSrc, geQuaternion *QDst); - // copies quaternion QSrc into QDst - -void GENESISCC geQuaternion_SetNoRotation(geQuaternion *Q); - // sets Q to be a quaternion with no rotation (like an identity matrix) - -void GENESISCC geQuaternion_Ln( - const geQuaternion *Q, - geQuaternion *LnQ); - // ln(Q) for unit quaternion only! - -void GENESISCC geQuaternion_Exp( - const geQuaternion *Q, - geQuaternion *ExpQ); - // exp(Q) for pure quaternion only! (zero scalar part (W)) - -void GENESISCC geQuaternion_Scale( - const geQuaternion *Q, - geFloat Scale, - geQuaternion *QScaled); - // Q = Q * Scale (result is not generally a unit quaternion!) - -void GENESISCC geQuaternion_Add( - const geQuaternion *Q1, - const geQuaternion *Q2, - geQuaternion *QSum); - // QSum = Q1 + Q2 (result is not generally a unit quaternion!) - -void GENESISCC geQuaternion_Subtract( - const geQuaternion *Q1, - const geQuaternion *Q2, - geQuaternion *QSum); - // QSum = Q1 - Q2 (result is not generally a unit quaternion!) - -void GENESISCC geQuaternion_Inverse(const geQuaternion *Q, geQuaternion *QInv); - // sets QInv to the inverse of Q. - -geFloat GENESISCC geQuaternion_Magnitude(const geQuaternion *Q); - // returns Magnitude of Q. - -geBoolean GENESISCC geQuaternion_Compare( geQuaternion *Q1, geQuaternion *Q2, geFloat Tolerance ); - // return GE_TRUE if quaternions differ elementwise by less than Tolerance. - - -#ifndef NDEBUG -void GENESISCC geQuaternion_SetMaximalAssertionMode( geBoolean Enable ); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif // GE_QUATERNION_H diff --git a/G3D/Physics/matrix33.c b/G3D/Matrix33.c similarity index 95% rename from G3D/Physics/matrix33.c rename to G3D/Matrix33.c index 5e04d28..8c410c6 100644 --- a/G3D/Physics/matrix33.c +++ b/G3D/Matrix33.c @@ -22,9 +22,9 @@ #include #include -#include "vec3d.h" -#include "xform3d.h" -#include "matrix33.h" +#include "Vec3d.h" +#include "XForm3d.h" +#include "Matrix33.h" void Matrix33_MakeCrossProductMatrix33(const geVec3d* v, Matrix33* m) diff --git a/G3D/Support/mempool.c b/G3D/MemPool.c similarity index 95% rename from G3D/Support/mempool.c rename to G3D/MemPool.c index 568e247..7b9523a 100644 --- a/G3D/Support/mempool.c +++ b/G3D/MemPool.c @@ -22,8 +22,8 @@ #include #include -#include "mempool.h" -#include "ram.h" +#include "MemPool.h" +#include "Ram.h" /* * MemPool is a 'root' level object (eg. 'list' uses us). We sit only above 'Ram' diff --git a/G3D/Support/mempool.h b/G3D/MemPool.h similarity index 100% rename from G3D/Support/mempool.h rename to G3D/MemPool.h diff --git a/G3D/NetPlay.c b/G3D/NetPlay.c index 85eeed2..da5387f 100644 --- a/G3D/NetPlay.c +++ b/G3D/NetPlay.c @@ -23,13 +23,12 @@ #include #include - #include #include #include #include "NetPlay.h" -#include "include/ErrorLog.h" +#include "ErrorLog.h" //#define INIT_GUID diff --git a/G3D/Path.h b/G3D/Path.h index b02a95d..1f9f14b 100644 --- a/G3D/Path.h +++ b/G3D/Path.h @@ -24,7 +24,7 @@ #include "BaseType.h" #include "XForm3d.h" -#include "Quatern.h" +#include "Quaternion.h" #include "VFile.h" #ifdef __cplusplus diff --git a/G3D/Physics/matrix33.h b/G3D/Physics/matrix33.h deleted file mode 100644 index e73cd0d..0000000 --- a/G3D/Physics/matrix33.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************************/ -/* MATRIX33.H */ -/* */ -/* Author: Jason Wood */ -/* Description: Pure 3x3 matrix */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef MATRIX33_H -#define MATRIX33_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - geFloat x[3][3]; -} Matrix33; - -void Matrix33_Copy(const Matrix33* m, Matrix33* c); -void Matrix33_SetIdentity(Matrix33* m); -void Matrix33_Add(const Matrix33* m1, const Matrix33* m2, Matrix33* res); -void Matrix33_Subtract(const Matrix33* m1, const Matrix33* m2, Matrix33* res); -void Matrix33_MultiplyVec3d(const Matrix33* m, const geVec3d* v, geVec3d* res); -void Matrix33_Multiply(const Matrix33* m1, const Matrix33* m2, Matrix33* res); -void Matrix33_MultiplyScalar(geFloat s, const Matrix33* m, Matrix33* res); -void Matrix33_GetTranspose(const Matrix33* m, Matrix33* t); -void Matrix33_GetInverse(const Matrix33* m, Matrix33* inv); -void Matrix33_MakeCrossProductMatrix33(const geVec3d* v, Matrix33* m); -void Matrix33_ExtractFromXForm3d(const geXForm3d* xform, Matrix33* m); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/G3D/World/Plane.c b/G3D/Plane.c similarity index 100% rename from G3D/World/Plane.c rename to G3D/Plane.c diff --git a/G3D/World/Plane.h b/G3D/Plane.h similarity index 100% rename from G3D/World/Plane.h rename to G3D/Plane.h diff --git a/G3D/PtrTypes.h b/G3D/PtrTypes.h index e5f5612..bbf79c8 100644 --- a/G3D/PtrTypes.h +++ b/G3D/PtrTypes.h @@ -22,7 +22,7 @@ #ifndef GE_PTRTYPES_H #define GE_PTRTYPES_H -#include "include/BaseType.h" +#include "BaseType.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Math/quatern.c b/G3D/Quaternion.c similarity index 100% rename from G3D/Math/quatern.c rename to G3D/Quaternion.c diff --git a/G3D/Quatern.h b/G3D/Quaternion.h similarity index 100% rename from G3D/Quatern.h rename to G3D/Quaternion.h diff --git a/G3D/Support/Ram.c b/G3D/Ram.c similarity index 100% rename from G3D/Support/Ram.c rename to G3D/Ram.c diff --git a/G3D/Support/ramdll.c b/G3D/RamDLL.c similarity index 100% rename from G3D/Support/ramdll.c rename to G3D/RamDLL.c diff --git a/G3D/Support/Errorlog.h b/G3D/Support/Errorlog.h deleted file mode 100644 index 1bdcff1..0000000 --- a/G3D/Support/Errorlog.h +++ /dev/null @@ -1,238 +0,0 @@ -/****************************************************************************************/ -/* ERRORLOG.H */ -/* */ -/* Author: Mike Sandige */ -/* Description: Generic error logging system interface */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_ERRORLOG_H -#define GE_ERRORLOG_H - -#include "basetype.h" - -#ifndef NDEBUG - #define ERRORLOG_FULL_REPORTING -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - GE_ERR_INVALID_DRIVER_HANDLE, // Driver not supported - GE_ERR_INVALID_MODE_HANDLE, // Mode not supported - GE_ERR_DRIVER_INIT_FAILED, // Could not init Driver - GE_ERR_DRIVER_ALLREADY_INITIALIZED, // Driver init failure - GE_ERR_DRIVER_NOT_FOUND, // File open error for driver - GE_ERR_DRIVER_NOT_INITIALIZED, // Driver shutdown failure - GE_ERR_INVALID_DRIVER, // Wrong driver version, or bad driver - GE_ERR_DRIVER_BEGIN_SCENE_FAILED, - GE_ERR_DRIVER_END_SCENE_FAILED, - GE_ERR_CREATE_SOUND_MANAGER_FAILED, - GE_ERR_CREATE_SOUND_BUFFER_FAILED, - GE_ERR_DS_ERROR, - GE_ERR_INVALID_WAV, - GE_ERR_NO_PERF_FREQ, - GE_ERR_FILE_OPEN_ERROR, - GE_ERR_FILE_READ_ERROR, - GE_ERR_FILE_WRITE_ERROR, - GE_ERR_PALETTE_LOAD_FAILURE, - GE_ERR_GBSP_LOAD_FAILURE, - GE_ERR_INVALID_PARMS, - GE_ERR_INVALID_CAMERA, - GE_ERR_RENDER_WORLD_FAILED, - GE_ERR_BEGIN_WORLD_FAILED, - GE_ERR_END_WORLD_FAILED, - GE_ERR_BEGIN_MODELS_FAILED, - GE_ERR_END_MODELS_FAILED, - GE_ERR_BEGIN_MESHES_FAILED, - GE_ERR_END_MESHES_FAILED, - GE_ERR_RENDER_MESH_FAILED, - GE_ERR_BAD_LMAP_EXTENTS, - GE_ERR_INVALID_TEXTURE, - GE_ERR_REGISTER_WORLD_TEXTURE_FAILED, - GE_ERR_REGISTER_LIGHTMAPS_FAILED, - GE_ERR_REGISTER_WORLD_PALETTE_FAILED, - GE_ERR_REGISTER_MISC_TEXTURE_FAILED, - GE_ERR_INVALID_MESH_FILE, - GE_ERR_LOAD_BITMAP_FAILED, - GE_ERR_MAX_MESH_DEFS, - GE_ERR_MESH_MAX_NODES, - GE_ERR_INVALID_MESH_MATERIAL, - GE_ERR_MAX_MESH_MATERIALS, - GE_ERR_MAX_MESH_CLIP_PLANES, - GE_ERR_RENDERQ_OVERFLOW, - GE_ERR_INVALID_LTYPE, - GE_ERR_MAX_ENTITIES, - GE_ERR_GET_ENTITY_DATA_ERROR, - GE_ERR_INVALID_ENTITY_FIELD_TYPE, - GE_ERR_MODEL_NOT_FOUND, - GE_ERR_MODEL_NOT_IN_ENTITY, - GE_ERR_MAX_TEXTURES, - GE_ERR_MAX_DECALS, - GE_ERR_MAX_VERTS, - GE_ERR_OUT_OF_MEMORY, - GE_ERR_INVALID_BSP_TAG, - GE_ERR_INVALID_BSP_VERSION, - GE_ERR_ERROR_READING_BSP_CHUNK, - ERR_PATH_CREATE_ENOMEM, // failure to create a path (memory allocation failed) - ERR_PATH_INSERT_R_KEYFRAME, // failure to insert a rotation keyframe - ERR_PATH_INSERT_T_KEYFRAME, // failure to insert a translation keyframe - ERR_PATH_DELETE_R_KEYFRAME, // failure to delete a rotation keyframe - ERR_PATH_DELETE_T_KEYFRAME, // failure to delete a translation keyframe - ERR_PATH_FILE_READ, // failure to read from file - ERR_PATH_FILE_VERSION, // tried to create path from file with wrong/bad version - ERR_PATH_FILE_PARSE, // failure to parse file (unexpected format problem) - ERR_PATH_FILE_WRITE, // failure to read from file - ERR_MOTION_CREATE_ENOMEM, // failure to create (memory allocation failed) - ERR_MOTION_ADDPATH_ENOMEM, // failure to add path into motion (memory allocation failed) - ERR_MOTION_ADDPATH_PATH, // failure to add path into motion (path creation failed) - ERR_MOTION_ADDPATH_BAD_NAME, // failure to add path into motion due to name conflict - ERR_MOTION_INSERT_EVENT, // failure to insert event (memory allocation failed or duplicate key) - ERR_MOTION_DELETE_EVENT, // failure to insert event - ERR_MOTION_FILE_READ, // failure to read from file - ERR_MOTION_FILE_WRITE, // failure to write to file - ERR_MOTION_FILE_PARSE, // failure to parse file (unexpected format problem) - ERR_TKARRAY_INSERT_IDENTICAL, // failure to insert into list because of existing identical key - ERR_TKARRAY_INSERT_ENOMEM, // failure to insert into list because of memory allocation failure - ERR_TKARRAY_DELETE_NOT_FOUND, // failure to delete from list because key was not found - ERR_TKARRAY_CREATE, // failure to create TKArray object (out of memroy) - ERR_TKARRAY_TOO_BIG, // TKArray object can't be added to - it's list is as big as it can get - ERR_VKARRAY_INSERT, // insertion to VKArray failed - ERR_QKARRAY_INSERT, // insertion to QKArray failed - ERR_POSE_CREATE_ENOMEM, // Motion object failed to create (memory allocation failed) - ERR_POSE_ADDJOINT_ENOMEM, // Motion_AddJoint failed to allocate/reallocate memory for new joint - ERR_TKEVENTS_CREATE_ENOMEM, // failure to create TKEvents object (memory allocation failed) - ERR_TKEVENTS_DELETE_NOT_FOUND, // failure to delete from list because key was not found - ERR_TKEVENTS_INSERT_ENOMEM, // failure to insert into list because of memory allocation failure - ERR_TKEVENTS_INSERT, // failure to insert into list - ERR_TKEVENTS_FILE_READ, // failure to read from data file - ERR_TKEVENTS_FILE_WRITE, // failure to write to data file - ERR_TKEVENTS_FILE_VERSION, // failure to read tkevents object: file has wrong version - ERR_TKEVENTS_FILE_PARSE, // failure to parse file (unexpected format problem) - ERR_STRBLOCK_ENOMEM, // failure to create, insert, or append (memory allocation failed) - ERR_STRBLOCK_STRLEN, // string too long to insert or append - ERR_STRBLOCK_FILE_READ, // failure to read from data file - ERR_STRBLOCK_FILE_WRITE, // failure to write to data file - ERR_STRBLOCK_FILE_PARSE, // failure to parse reading from input file (unexpected format problem) - ERR_BODY_ENOMEM, // failure to create, or add (memory allocation failed) - ERR_BODY_FILE_PARSE, // failure to parse reading from input file (unexpected format problem) - ERR_BODY_FILE_READ, // failure to read from data file - ERR_BODY_FILE_WRITE, // failure to write to data file - ERR_BODY_BONEXFARRAY, // XFArray object failed to return array, or array size doesn't match bone count - ERR_XFARRAY_ENOMEM, // failure to create. (memory allocation failure) - ERR_PUPPET_ENOMEM, // failure to create. (memory allocation failure) - ERR_PUPPET_RENDER, // failure to render. - ERR_PUPPET_NO_MATERIALS, // failure to create: associated body has no materials. - ERR_PUPPET_LOAD_TEXTURE, // failure to load texture - ERR_TEXPOOL_ENOMEM, // failure to create or add to. (memory allocation/reallocation failure) - ERR_TEXPOOL_TOO_BIG, // failure to add to pool, pool is too large. - ERR_TEXPOOL_LOAD_TEXTURE, // failure to load texture into pool - ERR_TEXPOOL_TEXTURE_NOT_FREE, // texture pool destroyed without first freeing all it's shared textures - ERR_ACTOR_ENOMEM, // failure to create. (memory allocation failure) - ERR_ACTOR_RENDER_PREP, // failure to prepare actor for rendering (bad Body or allocation failure) - ERR_ACTOR_RENDER_FAILED, // failure to render. failure to get geometry from Body - ERR_ACTOR_TOO_MANY_MOTIONS, // failure to add motion. too many. - ERR_ACTOR_FILE_READ, // failure to read from data file. - ERR_ACTOR_FILE_PARSE, // failure to parse reading from input file(unexpected format problem) - ERR_ACTOR_FILE_WRITE, // failure to write to data file. - GE_ERR_INVALID_MODEL_MOTION_FILE, // Bad model motion file (for bsp files) - GE_ERR_BAD_BSP_FILE_CHUNK_SIZE, // Chunk size does not match structure size of kind -//MRB BEGIN -//geSprite - ERR_SPRITE_ENOMEM, // failure to create. (memory allocation failure) - ERR_SPRITE_INVALIDBITMAP, // failure to use bitmap because bitmap was invalid -//MRB END -} geErrorLog_ErrorIDEnumType; - - -typedef enum -{ - GE_ERR_MEMORY_RESOURCE, - GE_ERR_DISPLAY_RESOURCE, - GE_ERR_SOUND_RESOURCE, - GE_ERR_SYSTEM_RESOURCE, - GE_ERR_INTERNAL_RESOURCE, - - GE_ERR_FILEIO_OPEN, - GE_ERR_FILEIO_CLOSE, - GE_ERR_FILEIO_READ, - GE_ERR_FILEIO_WRITE, - GE_ERR_FILEIO_FORMAT, - GE_ERR_FILEIO_VERSION, - - GE_ERR_LIST_FULL, - GE_ERR_DATA_FORMAT, - GE_ERR_SEARCH_FAILURE, -} geErrorLog_ErrorClassType; - -GENESISAPI void geErrorLog_Clear(void); - // clears error history - -GENESISAPI int geErrorLog_Count(void); - // reports size of current error log - -GENESISAPI void geErrorLog_AddExplicit(geErrorLog_ErrorClassType, - const char *ErrorIDString, - const char *ErrorFileString, - int LineNumber, - const char *UserString, - const char *Context); - // not intended to be used directly: use ErrorLog_Add or ErrorLog_AddString - - -#ifdef ERRORLOG_FULL_REPORTING - // 'Debug' version includes a textual error id, and the user string - - #define geErrorLog_Add(Error, Context) geErrorLog_AddExplicit(Error, #Error, __FILE__, __LINE__,"", Context) - // logs an error. - - #define geErrorLog_AddString(Error,String, Context) geErrorLog_AddExplicit(Error, #Error, __FILE__,__LINE__, String, Context) - // logs an error with additional identifing string. - -GENESISAPI geBoolean geErrorLog_AppendStringToLastError(const char *String);// use geErrorLog_AppendString - - #define geErrorLog_AppendString(XXX) geErrorLog_AppendStringToLastError(XXX) - // adds text to the previous logged error - -#else - // 'Release' version does not include the textual error id, or the user string - - #define geErrorLog_Add(Error, Context) geErrorLog_AddExplicit(Error, "", __FILE__, __LINE__,"", Context) - // logs an error. - - #define geErrorLog_AddString(Error,String, Context) geErrorLog_AddExplicit(Error, "", __FILE__,__LINE__, "", Context) - // logs an error with additional identifing string. - - #define geErrorLog_AppendString(XXX) - // adds text to the previous logged error - -#endif - -GENESISAPI geBoolean geErrorLog_Report(int History, geErrorLog_ErrorClassType *Error, const char **UserString); - // reports from the error log. - // history is 0 for most recent, 1.. for second most recent etc. - // returns GE_TRUE if report succeeded. GE_FALSE if it failed. - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/G3D/Support/RAM.H b/G3D/Support/RAM.H deleted file mode 100644 index 0fe751f..0000000 --- a/G3D/Support/RAM.H +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************************/ -/* RAM.H */ -/* */ -/* Author: */ -/* Description: Replacement for malloc, realloc and free */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef GE_RAM_H -#define GE_RAM_H - -#include "basetype.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int (* geRam_CriticalCallbackFunction)(void); - -/* - Set the critical callback function. ram_allocate will call the critical - callback function if it's unable to allocate memory. -*/ -GENESISAPI geRam_CriticalCallbackFunction geRam_SetCriticalCallback - ( - geRam_CriticalCallbackFunction callback - ); - -/* - increments or decrements a counter . if the counter is >0 - the critical callback function (if set) is called for a failed memory allocation. - add is added to the current counter value. the new counter value is returned. -*/ -GENESISAPI int geRam_EnableCriticalCallback(int add); - - -/* - Allocate memory of the given size. In debug mode, the memory is filled - with 0xA5, and we keep track of the amount of memory allocated. Also, in debug - mode, we track where the memory was allocated and can optionally provide a - report of allocated blocks. See geRam_ReportAllocations. -*/ -#ifndef NDEBUG - -#define geRam_Allocate(size) _geRam_DebugAllocate(size, __FILE__, __LINE__) - -// Do not call _geRam_DebugAllocate directly. -GENESISAPI void* _geRam_DebugAllocate(uint32 size, const char* pFile, int line); - -#else - -GENESISAPI void *geRam_Allocate(uint32 size); - -#endif - -/* - Free an allocated memory block. -*/ -GENESISAPI void geRam_Free_(void *ptr); - - extern void *StupidUnusedPointer; // never used, except to mask the - // possible warning you get if you use the geRam_Free macro below, without - // using the xxx pointer again in the same block. This is ugly. - -#define geRam_Free(xxx) geRam_Free_(xxx) ,(xxx)=NULL, StupidUnusedPointer=(xxx) - -/* - Reallocate memory. This function supports shrinking and expanding blocks, - and will also act like ram_allocate if the pointer passed to it is NULL. - It won't, however, free the memory if you pass it a 0 size. -*/ -#ifndef NDEBUG - -#define geRam_Realloc(ptr, newsize) _geRam_DebugRealloc(ptr, newsize, __FILE__, __LINE__) - -// Do not call _geRam_DebugRealloc directly. -GENESISAPI void* _geRam_DebugRealloc(void* ptr, uint32 size, const char* pFile, int line); - -#else - -GENESISAPI void *geRam_Realloc(void *ptr,uint32 newsize); - -#endif - -#ifndef NDEBUG - -GENESISAPI void geRam_ReportAllocations(void); - -#else - -#define geRam_ReportAllocations() - -#endif - -#ifndef NDEBUG - extern int32 geRam_CurrentlyUsed; - extern int32 geRam_NumberOfAllocations; - extern int32 geRam_MaximumUsed; - extern int32 geRam_MaximumNumberOfAllocations; - -GENESISAPI void geRam_AddAllocation(int n,uint32 size); -#else - #define geRam_AddAllocation(n,s) -#endif - -// allocate the ram & clear it. (calloc) -GENESISAPI void * geRam_AllocateClear(uint32 size); - -#define GE_RAM_ALLOCATE_STRUCT(type) (type *)geRam_Allocate (sizeof (type)) -#define GE_RAM_ALLOCATE_ARRAY(type,count) (type *)geRam_Allocate (sizeof (type) * (count)) - -#ifndef NDEBUG -#define GE_RAM_REALLOC_ARRAY(ptr,type,count) (type *)geRam_Realloc( (ptr), sizeof(type) * (count) );{type *XX=(ptr);} -#else -#define GE_RAM_REALLOC_ARRAY(ptr,type,count) (type *)geRam_Realloc( (ptr), sizeof(type) * (count) ) -#endif - -#ifndef NDEBUG -geBoolean geRam_IsValidPtr(void *ptr); -#endif - -#ifdef __cplusplus - } -#endif - -#endif - diff --git a/G3D/World/Surface.c b/G3D/Surface.c similarity index 100% rename from G3D/World/Surface.c rename to G3D/Surface.c diff --git a/G3D/World/Surface.h b/G3D/Surface.h similarity index 96% rename from G3D/World/Surface.h rename to G3D/Surface.h index 450d19a..eb4c5f3 100644 --- a/G3D/World/Surface.h +++ b/G3D/Surface.h @@ -25,9 +25,9 @@ #include #include -#include "include/BaseType.h" +#include "G3D/BaseType.h" #include "G3D/PtrTypes.h" -#include "include/Vec3d.h" +#include "G3D/Vec3d.h" #include "G3D/Engine/Drivers/DCommon.h" #ifdef __cplusplus diff --git a/G3D/World/Trace.c b/G3D/Trace.c similarity index 100% rename from G3D/World/Trace.c rename to G3D/Trace.c diff --git a/G3D/World/Trace.h b/G3D/Trace.h similarity index 95% rename from G3D/World/Trace.h rename to G3D/Trace.h index 3a8db35..7ccc9e8 100644 --- a/G3D/World/Trace.h +++ b/G3D/Trace.h @@ -25,10 +25,10 @@ #include #include -#include "include/Genesis.h" -#include "include/BaseType.h" -#include "include/Vec3d.h" -#include "World/World.h" +#include "Genesis.h" +#include "BaseType.h" +#include "Vec3d.h" +#include "World.h" //#include "System.h" #ifdef __cplusplus diff --git a/G3D/World/User.c b/G3D/User.c similarity index 100% rename from G3D/World/User.c rename to G3D/User.c diff --git a/G3D/World/User.h b/G3D/User.h similarity index 94% rename from G3D/World/User.h rename to G3D/User.h index 1d13778..f89fef6 100644 --- a/G3D/World/User.h +++ b/G3D/User.h @@ -25,11 +25,11 @@ #include #include -#include "include/BaseType.h" -#include "include/Vec3d.h" -#include "include/XForm3d.h" +#include "G3D/BaseType.h" +#include "G3D/Vec3d.h" +#include "G3D/XForm3d.h" #include "G3D/Camera.h" -#include "include/Genesis.h" +#include "G3D/Genesis.h" #include "World.h" #include "Surface.h" diff --git a/G3D/VFile/vfile._h b/G3D/VFile._h similarity index 100% rename from G3D/VFile/vfile._h rename to G3D/VFile._h diff --git a/G3D/VFile/vfile.c b/G3D/VFile.c similarity index 100% rename from G3D/VFile/vfile.c rename to G3D/VFile.c diff --git a/G3D/VFile/vfile.h b/G3D/VFile/vfile.h deleted file mode 100644 index bf06be9..0000000 --- a/G3D/VFile/vfile.h +++ /dev/null @@ -1,192 +0,0 @@ -/****************************************************************************************/ -/* VFILE.H */ -/* */ -/* Author: Eli Boling */ -/* Description: Virtual file interface */ -/* */ -/* The contents of this file are subject to the Genesis3D Public License */ -/* Version 1.01 (the "License"); you may not use this file except in */ -/* compliance with the License. You may obtain a copy of the License at */ -/* http://www.genesis3d.com */ -/* */ -/* Software distributed under the License is distributed on an "AS IS" */ -/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ -/* the License for the specific language governing rights and limitations */ -/* under the License. */ -/* */ -/* The Original Code is Genesis3D, released March 25, 1999. */ -/* Genesis3D Version 1.1 released November 15, 1999 */ -/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ -/* */ -/****************************************************************************************/ -#ifndef VFILE_H -#define VFILE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "basetype.h" - -typedef struct geVFile geVFile; - -//--------- Finder (Directory) -------------- -typedef struct geVFile_Finder geVFile_Finder; - -typedef int geVFile_TypeIdentifier; -typedef unsigned int geVFile_Attributes; - -typedef struct geVFile_Hints -{ - void * HintData; - int HintDataLength; -} geVFile_Hints; - -typedef struct geVFile_Time -{ - unsigned long Time1; - unsigned long Time2; -} geVFile_Time; - -#define GE_VFILE_ATTRIB_READONLY 0x00000001 -#define GE_VFILE_ATTRIB_DIRECTORY 0x00000002 - -typedef struct geVFile_Properties -{ - geVFile_Time Time; - geVFile_Attributes AttributeFlags; - long Size; - geVFile_Hints Hints; - char Name[1024]; -} geVFile_Properties; - -#ifdef _INC_WINDOWS -GENESISAPI void GENESISCC geVFile_TimeToWin32FileTime(const geVFile_Time *, LPFILETIME Win32FileTime); - // Converts a geVFile time to a Win32 FILETIME structure. This API is the - // way to get the file time into a format to do standardized date/time - // operations on. We do not provide date/time operations natively. -#endif - -GENESISAPI geVFile_Finder * GENESISCC geVFile_CreateFinder( - geVFile * FileSystem, - const char * FileSpec); - // Creates a finder object from which you can get iterated file names. - // This is findfirst/findnext functionality. - -GENESISAPI void GENESISCC geVFile_DestroyFinder(geVFile_Finder *Finder); - // Destroys a Finder object - -GENESISAPI geBoolean GENESISCC geVFile_FinderGetNextFile(geVFile_Finder *Finder); - // Tracks to the next file in the finder directory - -GENESISAPI geBoolean GENESISCC geVFile_FinderGetProperties(const geVFile_Finder *Finder, geVFile_Properties *Properties); - // Gets the file properties from a geVFile_Finder. You cannot set properties for - // a file through a finder. You have to set the properties through a geVFile. - -//--------- File System Operations ---- - -typedef struct geVFile_MemoryContext -{ - void * Data; - int DataLength; -} geVFile_MemoryContext; - -#define GE_VFILE_TYPE_DOS ( (geVFile_TypeIdentifier) 1L ) -#define GE_VFILE_TYPE_MEMORY ( (geVFile_TypeIdentifier) 2L ) -#define GE_VFILE_TYPE_VIRTUAL ( (geVFile_TypeIdentifier) 3L ) -//#define GE_VFILE_TYPE_CVIRTUAL ( (geVFile_TypeIdentifier) 4L ) - -// First three flags are mutually exclusive. Combining them will result in failure -// returns for both geVFile_OpenNewSystem and geVFile_Open. -#define GE_VFILE_OPEN_READONLY 0x00000001 -#define GE_VFILE_OPEN_UPDATE 0x00000002 -#define GE_VFILE_OPEN_CREATE 0x00000004 - -#define GE_VFILE_OPEN_DIRECTORY 0x00000008 - - -GENESISAPI geVFile * GENESISCC geVFile_OpenNewSystem( - geVFile * FS, - geVFile_TypeIdentifier FileSystemType, // { DOS, MEMORY, ETC ... }, - const char * Name, - void * Context, - unsigned int OpenModeFlags); - // Opens a file / file system. - -GENESISAPI geBoolean GENESISCC geVFile_UpdateContext(geVFile *FS, void *Context, int ContextSize); - -GENESISAPI geVFile * GENESISCC geVFile_GetContext(const geVFile *File); - // Returns the outer context in which File was opened. - -GENESISAPI geVFile * GENESISCC geVFile_Open( - geVFile * FS, - const char * Name, - unsigned int OpenModeFlags); - -/* -typedef enum -{ - geVFile_AppendPath, - geVFile_PrependPath, -} geVFile_SearchOrder; -*/ - -GENESISAPI geBoolean GENESISCC geVFile_AddPath(geVFile *FS1, const geVFile *FS2, geBoolean Append); - // Appends (or prepends) the path associated with FS2 into FS1. - // Append==GE_TRUE causes the FS2 to be searched AFTER FS1 - // Append==GE_FALSE causes the FS2 to be searched BEFORE FS1 - -/* perhaps geVFile_AppendPath and geVFile_PrependPath */ - - -GENESISAPI geBoolean GENESISCC geVFile_DeleteFile(geVFile *FS, const char *FileName); - // Deletes a file within a file system. Returns GE_TRUE on success, GE_FALSE - // on failure. - -GENESISAPI geBoolean GENESISCC geVFile_RenameFile(geVFile *FS, const char *FileName, const char *NewName); - // Renames a file within a file system. Returns GE_TRUE on success, GE_FALSE - // on failure. - -GENESISAPI geBoolean GENESISCC geVFile_FileExists(geVFile *FS, const char *FileName); - // Returns GE_TRUE if the file FileName exists in FS, GE_FALSE otherwise. - // Does not do any searching (?) - -//geVFile_VFileType geVFile_Register( all kinds of stuff ); - -GENESISAPI geBoolean GENESISCC geVFile_Close (geVFile *File); - // closes and destroys the File - -GENESISAPI void GENESISCC geVFile_CloseAPI (void); - -//---------- File Specific Operations ----------- - -typedef enum -{ - GE_VFILE_SEEKCUR = 0, - GE_VFILE_SEEKEND = 1, - GE_VFILE_SEEKSET = 2 -} geVFile_Whence; - -GENESISAPI geBoolean GENESISCC geVFile_GetS ( geVFile *File, void *Buff, int MaxLen); -GENESISAPI geBoolean GENESISCC geVFile_Read ( geVFile *File, void *Buff, int Count); -GENESISAPI geBoolean GENESISCC geVFile_Write ( geVFile *File, const void *Buff, int Count); -GENESISAPI geBoolean GENESISCC geVFile_Seek ( geVFile *File, int where, geVFile_Whence Whence); -GENESISAPI geBoolean GENESISCC geVFile_Printf ( geVFile *File, const char *Format, ...); -GENESISAPI geBoolean GENESISCC geVFile_EOF (const geVFile *File); -GENESISAPI geBoolean GENESISCC geVFile_Tell (const geVFile *File, long *Position); -GENESISAPI geBoolean GENESISCC geVFile_GetProperties(const geVFile *File, geVFile_Properties *Properties); -//geBoolean geVFile_GetName(geVFile *File, char *Buff, int MaxBuffLen); - // Gets the name of the file - -GENESISAPI geBoolean GENESISCC geVFile_Size (const geVFile *File, long *Size); -GENESISAPI geBoolean GENESISCC geVFile_SetSize ( geVFile *File, long Size); -GENESISAPI geBoolean GENESISCC geVFile_SetAttributes( geVFile *File, geVFile_Attributes Attributes); -GENESISAPI geBoolean GENESISCC geVFile_SetTime ( geVFile *File, const geVFile_Time *Time); -GENESISAPI geBoolean GENESISCC geVFile_SetHints ( geVFile *File, const geVFile_Hints *Hints); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/G3D/VFile/vfile_structs.h b/G3D/VFileStructs.h similarity index 100% rename from G3D/VFile/vfile_structs.h rename to G3D/VFileStructs.h diff --git a/G3D/Math/VEC3D.C b/G3D/Vec3d.c similarity index 100% rename from G3D/Math/VEC3D.C rename to G3D/Vec3d.c diff --git a/G3D/World/Vis.c b/G3D/Vis.c similarity index 100% rename from G3D/World/Vis.c rename to G3D/Vis.c diff --git a/G3D/World/Vis.h b/G3D/Vis.h similarity index 96% rename from G3D/World/Vis.h rename to G3D/Vis.h index e68375a..3ac624d 100644 --- a/G3D/World/Vis.h +++ b/G3D/Vis.h @@ -22,8 +22,8 @@ #ifndef GE_VIS_H #define GE_VIS_H -#include "include/Genesis.h" -#include "include/BaseType.h" +#include "G3D/Genesis.h" +#include "G3D/BaseType.h" #include "Frustum.h" diff --git a/G3D/World/WBitmap.c b/G3D/WBitmap.c similarity index 100% rename from G3D/World/WBitmap.c rename to G3D/WBitmap.c diff --git a/G3D/World/WBitmap.h b/G3D/WBitmap.h similarity index 96% rename from G3D/World/WBitmap.h rename to G3D/WBitmap.h index 15fd495..e12fcf3 100644 --- a/G3D/World/WBitmap.h +++ b/G3D/WBitmap.h @@ -24,9 +24,9 @@ #include -#include "include/BaseType.h" +#include "G3D/BaseType.h" #include "GBSPFile.h" -#include "include/Bitmap.h" +#include "G3D/Bitmap.h" #ifdef __cplusplus extern "C" { diff --git a/G3D/Font/wgClip.c b/G3D/WgClip.c similarity index 100% rename from G3D/Font/wgClip.c rename to G3D/WgClip.c diff --git a/G3D/Font/wgClip.H b/G3D/WgClip.h similarity index 96% rename from G3D/Font/wgClip.H rename to G3D/WgClip.h index 44160c7..b74f6df 100644 --- a/G3D/Font/wgClip.H +++ b/G3D/WgClip.h @@ -29,8 +29,8 @@ extern "C" { #define GE_CLIP_CENTER 1 #define GE_CLIP_CORNER 0 -#include "basetype.h" -#include "getypes.h" +#include "BaseType.h" +#include "GeTypes.h" //*************************************************************** // returns true if you need to draw at all. diff --git a/G3D/World/World.c b/G3D/World.c similarity index 100% rename from G3D/World/World.c rename to G3D/World.c diff --git a/G3D/World/World.h b/G3D/World.h similarity index 95% rename from G3D/World/World.h rename to G3D/World.h index fa49e01..0f80f76 100644 --- a/G3D/World/World.h +++ b/G3D/World.h @@ -22,11 +22,11 @@ #ifndef GE_WORLD_H #define GE_WORLD_H -#include "include/ErrorLog.h" +#include "G3D/ErrorLog.h" #include "G3D/PtrTypes.h" -#include "include/Genesis.h" +#include "G3D/Genesis.h" #include "GBSPFile.h" -#include "include/Motion.h" +#include "G3D/Motion.h" #include "Surface.h" #include "Fog.h" #include "WBitmap.h" @@ -35,12 +35,12 @@ #include "G3D/Engine/BitmapList.h" -#include "include/Actor.h" +#include "G3D/Actor.h" //MRB BEGIN //geSprite -#include "include/Sprite.h" -//MRB END +#include "G3D/Sprite.h" +//MRB END #ifdef __cplusplus extern "C" { diff --git a/G3D/Math/Xform3d.c b/G3D/XForm3d.c similarity index 100% rename from G3D/Math/Xform3d.c rename to G3D/XForm3d.c diff --git a/G3D/DrawBBox.c b/TestCode/DrawBBox.c similarity index 100% rename from G3D/DrawBBox.c rename to TestCode/DrawBBox.c diff --git a/cmake_distclean.sh b/cmake_distclean.sh index 4b9203c..c8bbe93 100755 --- a/cmake_distclean.sh +++ b/cmake_distclean.sh @@ -10,4 +10,9 @@ rm -rf G3D/CMakeFiles/ rm -rf G3D/Makefile rm -rf G3D/cmake_install.cmake +rm -rf GBSPLib/CMakeCache.txt +rm -rf GBSPLib/CMakeFiles/ +rm -rf GBSPLib/Makefile +rm -rf GBSPLib/cmake_install.cmake + Scripts/code_counter.sh