diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a6a00c8a..438b3f0ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,7 +305,6 @@ IF(EXISTS "${PROJECT_SOURCE_DIR}/source/") # MESSAGE(STATUS "WARNING... the following game tools will NOT be built since we cannot find wxWidgets on this machine") # MESSAGE(STATUS "map editor, g3d viewer") #endif() - ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/source/tools/glexemel ) ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/source/tests ) ENDIF() diff --git a/mk/windows/vs2015-32/ZetaGlest.sln b/mk/windows/vs2015-32/ZetaGlest.sln index fdc429045..f2cdf1680 100644 --- a/mk/windows/vs2015-32/ZetaGlest.sln +++ b/mk/windows/vs2015-32/ZetaGlest.sln @@ -7,8 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzetaglest", "libzetagles EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zetaglest", "zetaglest.vcxproj", "{6B0C65F1-D031-46AF-AC0D-7C38892D2952}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}" @@ -32,12 +30,6 @@ Global {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x64.Build.0 = Release|x64 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x86.ActiveCfg = Release|Win32 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x86.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.ActiveCfg = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.Build.0 = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x86.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x86.Build.0 = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.ActiveCfg = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.Build.0 = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|x64.ActiveCfg = Release|x64 diff --git a/mk/windows/vs2015-32/g2xml.vcxproj b/mk/windows/vs2015-32/g2xml.vcxproj deleted file mode 100644 index 814bab31a..000000000 --- a/mk/windows/vs2015-32/g2xml.vcxproj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Release - Win32 - - - Release - x64 - - - - {407355A4-D12A-4E3B-A7EB-A835E573B376} - g2xml - Win32Proj - g2xml - 8.1 - - - - Application - Unicode - true - v140 - - - Application - Unicode - true - v140 - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - false - false - false - false - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - - Full - true - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - StreamingSIMDExtensions2 - AnySuitable - Speed - - - true - Console - true - true - MachineX86 - - - - - Full - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - - - 4996 - AnySuitable - Speed - - - true - Console - true - true - - - - - - - - - \ No newline at end of file diff --git a/mk/windows/vs2015-64/ZetaGlest.sln b/mk/windows/vs2015-64/ZetaGlest.sln index 10fc8a0ac..0b1a2ff2b 100644 --- a/mk/windows/vs2015-64/ZetaGlest.sln +++ b/mk/windows/vs2015-64/ZetaGlest.sln @@ -11,8 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -53,14 +51,6 @@ Global {5D09BE33-81EC-450B-8A7B-2E7B941ADC56}.Release|Win32.Build.0 = Release|Win32 {5D09BE33-81EC-450B-8A7B-2E7B941ADC56}.Release|x64.ActiveCfg = Release|x64 {5D09BE33-81EC-450B-8A7B-2E7B941ADC56}.Release|x64.Build.0 = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Debug|Win32.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Debug|Win32.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Debug|x64.ActiveCfg = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Debug|x64.Build.0 = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.ActiveCfg = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/mk/windows/vs2015-64/g2xml.vcxproj b/mk/windows/vs2015-64/g2xml.vcxproj deleted file mode 100644 index 14478eb4c..000000000 --- a/mk/windows/vs2015-64/g2xml.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Release - Win32 - - - Release - x64 - - - - {407355A4-D12A-4E3B-A7EB-A835E573B376} - g2xml - Win32Proj - g2xml - 8.1 - - - - Application - Unicode - true - v140 - - - Application - Unicode - true - v140 - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - false - false - false - false - - - g2xml - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - StreamingSIMDExtensions2 - - - true - Console - true - true - MachineX86 - - - - - Full - true - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - NotSet - 4996 - AnySuitable - Speed - false - - - true - Console - true - true - - - - - - - - - \ No newline at end of file diff --git a/mk/windows/vs2017-32/ZetaGlest.sln b/mk/windows/vs2017-32/ZetaGlest.sln index b27774ac0..d95af4437 100644 --- a/mk/windows/vs2017-32/ZetaGlest.sln +++ b/mk/windows/vs2017-32/ZetaGlest.sln @@ -7,8 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzetaglest", "libzetagles EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zetaglest", "zetaglest.vcxproj", "{6B0C65F1-D031-46AF-AC0D-7C38892D2952}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}" @@ -32,12 +30,6 @@ Global {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x64.Build.0 = Release|x64 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x86.ActiveCfg = Release|Win32 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x86.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.ActiveCfg = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.Build.0 = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x86.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x86.Build.0 = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.ActiveCfg = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.Build.0 = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|x64.ActiveCfg = Release|x64 diff --git a/mk/windows/vs2017-32/g2xml.vcxproj b/mk/windows/vs2017-32/g2xml.vcxproj deleted file mode 100644 index 142052261..000000000 --- a/mk/windows/vs2017-32/g2xml.vcxproj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Release - Win32 - - - Release - x64 - - - - {407355A4-D12A-4E3B-A7EB-A835E573B376} - g2xml - Win32Proj - g2xml - 8.1 - - - - Application - Unicode - true - v141 - - - Application - Unicode - true - v141 - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - false - false - false - false - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - - Full - true - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - StreamingSIMDExtensions2 - AnySuitable - Speed - - - true - Console - true - true - MachineX86 - - - - - Full - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - - - 4996 - AnySuitable - Speed - - - true - Console - true - true - - - - - - - - - \ No newline at end of file diff --git a/mk/windows/vs2017-64/ZetaGlest.sln b/mk/windows/vs2017-64/ZetaGlest.sln index 367640a68..2ee31bb9a 100644 --- a/mk/windows/vs2017-64/ZetaGlest.sln +++ b/mk/windows/vs2017-64/ZetaGlest.sln @@ -7,8 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzetaglest", "libzetagles EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zetaglest", "zetaglest.vcxproj", "{6B0C65F1-D031-46AF-AC0D-7C38892D2952}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}" @@ -27,10 +25,6 @@ Global {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|Win32.Build.0 = Release|Win32 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x64.ActiveCfg = Release|x64 {6B0C65F1-D031-46AF-AC0D-7C38892D2952}.Release|x64.Build.0 = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.ActiveCfg = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|Win32.Build.0 = Release|Win32 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.ActiveCfg = Release|x64 - {407355A4-D12A-4E3B-A7EB-A835E573B376}.Release|x64.Build.0 = Release|x64 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.ActiveCfg = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|Win32.Build.0 = Release|Win32 {FE5C7C7C-F109-44F5-8329-25A4E24F162C}.Release|x64.ActiveCfg = Release|x64 diff --git a/mk/windows/vs2017-64/g2xml.vcxproj b/mk/windows/vs2017-64/g2xml.vcxproj deleted file mode 100644 index 43acd9940..000000000 --- a/mk/windows/vs2017-64/g2xml.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Release - Win32 - - - Release - x64 - - - - {407355A4-D12A-4E3B-A7EB-A835E573B376} - g2xml - Win32Proj - g2xml - 8.1 - - - - Application - Unicode - true - v141 - - - Application - Unicode - true - v141 - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - false - false - false - false - - - g2xml - - - g2xml - $(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\ - $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\ - - - - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - StreamingSIMDExtensions2 - - - true - Console - true - true - MachineX86 - - - - - Full - true - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - true - NotSet - 4996 - AnySuitable - Speed - false - - - true - Console - true - true - - - - - - - - - \ No newline at end of file diff --git a/source/tools/glexemel/g3d_support.py b/source/tools/g3d_support.py similarity index 100% rename from source/tools/glexemel/g3d_support.py rename to source/tools/g3d_support.py diff --git a/source/tools/glexemel/.gitignore b/source/tools/glexemel/.gitignore deleted file mode 100644 index c013e5dc4..000000000 --- a/source/tools/glexemel/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -g2xml -xml2g - -/*.dSYM/ diff --git a/source/tools/glexemel/CMakeLists.txt b/source/tools/glexemel/CMakeLists.txt deleted file mode 100644 index f30d0c29d..000000000 --- a/source/tools/glexemel/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# glexemel - -OPTION(BUILD_MODEL_IMPORT_EXPORT_TOOLS "Build model import/export tools" OFF) -MESSAGE(STATUS "Build Model Import/Export Tools = ${BUILD_MODEL_IMPORT_EXPORT_TOOLS}") - -IF(BUILD_MODEL_IMPORT_EXPORT_TOOLS) - - add_executable(g2xml g2xml.c g3dv4.h) - - string (FIND ${CMAKE_SYSTEM_NAME} "BSD" found_BSD) - IF (found_BSD) - SET(CMAKE_INCLUDE_PATH /usr/local/include) - ENDIF() - - find_package(LibXml2) - IF(LIBXML2_FOUND) - include_directories(${CMAKE_INCLUDE_PATH} ${LIBXML2_INCLUDE_DIR}) - add_executable(xml2g xml2g.c g3dv4.h) - target_link_libraries(xml2g ${LIBXML2_LIBRARIES}) - ELSE() - MESSAGE(STATUS "WARNING... xml2g will NOT be built since we cannot find libXml2 on this machine") - ENDIF() -ENDIF() diff --git a/source/tools/glexemel/COPYING b/source/tools/glexemel/COPYING deleted file mode 100644 index 14db8fc79..000000000 --- a/source/tools/glexemel/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/source/tools/glexemel/INSTALL b/source/tools/glexemel/INSTALL deleted file mode 100644 index 9d705dde1..000000000 --- a/source/tools/glexemel/INSTALL +++ /dev/null @@ -1,11 +0,0 @@ -Sorry - no autotools support (yet!). - -You will need: - 1) GNU Make (or an equivalent). - 2) An ANSI C compiler (eg: gcc). - 3) libxml2 (http://xmlsoft.org) - the XML parser for GNOME. - -Just copy Makefile.linux to Makefile: - $ cp Makefile.linux Makefile -Then edit Makefile to suit your needs (it's *very* simple). - diff --git a/source/tools/glexemel/Makefile.linux b/source/tools/glexemel/Makefile.linux deleted file mode 100644 index 8de1f7d28..000000000 --- a/source/tools/glexemel/Makefile.linux +++ /dev/null @@ -1,30 +0,0 @@ -# You need to edit this Makefile for your specific platform - -# CC is the name of your C compiler -CC=gcc -# CFLAGS are the flags that you want to pass to the C compiler -CFLAGS=-Wall -ansi -pedantic -# IDIRS specify the include directories to use -IDIRS=-I/usr/include/libxml2 -# LIBS specify the libraries (libxml2) -LIBS=-lxml2 -# INSTALLDIR specifies the directory to which the binaries should be installed -INSTALLDIR=/usr/local/bin -# CP specifies the copy command for the system -CP=cp - -all: g2xml xml2g - -g2xml: - ${CC} ${CFLAGS} ${IDIRS} g2xml.c -o g2xml ${LIBS} - -xml2g: - ${CC} ${CFLAGS} ${IDIRS} xml2g.c -o xml2g ${LIBS} - -install: - ${CP} g2xml ${INSTALLDIR}/. - ${CP} xml2g ${INSTALLDIR}/. - ${CP} g3d.dtd ${INSTALLDIR}/. - -clean: - rm -f g2xml xml2g diff --git a/source/tools/glexemel/README b/source/tools/glexemel/README deleted file mode 100644 index ec077e910..000000000 --- a/source/tools/glexemel/README +++ /dev/null @@ -1,13 +0,0 @@ -=== GLEXEMEL === -An XML format for the G3D file format used by the game Glest: - http://www.glest.org - -This XML format allows for exporters to create XML file descriptions that -can then be converted to binary. - -Note: This package is not yet part of Glest, although it is offered for -inclusion should the developers wish. - -Copyright (C) Jonathan Merritt 2005. -This package may be distributed under the terms of the GNU General Public -License (see the file COPYING for more details). diff --git a/source/tools/glexemel/g2xml.c b/source/tools/glexemel/g2xml.c deleted file mode 100644 index 0150b92a5..000000000 --- a/source/tools/glexemel/g2xml.c +++ /dev/null @@ -1,340 +0,0 @@ -/** - * File: g2xml.c - * Written: Jonathan Merritt - * - * Description: - * Converts G3D format files into an XML representation. - * - * Copyright (C) Jonathan Merritt 2005. - * This file may be distributed under the terms of the GNU General Public - * License. - */ - -#include -#include -#include - -#include "g3dv4.h" - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - - - - /** - * Forward function declarations. - */ -int g3d2xml(FILE *infile, FILE *outfile); -void usage(char *execname); - - - -/** - * Program entry point. - * - * @param argc: Number of arguments passed to the program. - * @param argv: Array of string arguments. - * - * @returns: EXIT_SUCCESS or EXIT_FAILURE depending upon success or failure - * of the conversion to XML. - */ -int main(int argc, char **argv) { - char *infilename, *outfilename; - FILE *infile, *outfile; - int successFlag; - - /* parse command line arguments */ - if (argc != 3) { - usage(argv[0]); - return (EXIT_FAILURE); - } else { - infilename = argv[1]; - outfilename = argv[2]; - } - - /* attempt to open the input and output files */ -//#ifdef WIN32 -// infile = _wfopen(utf8_decode(infilename).c_str(), L"rb"); -//#else - infile = fopen(infilename, "rb"); - //#endif - if (infile == NULL) { - printf("Could not open file \"%s\" for binary reading.\n", - infilename); - return (EXIT_FAILURE); - } - //#ifdef WIN32 - // outfile = _wfopen(utf8_decode(outfilename).c_str(), L"w"); - //#else - outfile = fopen(outfilename, "w"); - //#endif - if (outfile == NULL) { - printf("Could not open file \"%s\" for writing.\n", - outfilename); - fclose(infile); - return (EXIT_FAILURE); - } - - /* perform the XML conversion */ - successFlag = g3d2xml(infile, outfile); - - /* close the two files */ - fclose(infile); - fclose(outfile); - - /* return a success or failure flag */ - if (successFlag) - return (EXIT_SUCCESS); - else - return (EXIT_FAILURE); -} - - - - -/** - * Prints a "Usage:" string for the program. - * - * @param execname: Executable name of the program. - */ -void usage(char *execname) { - printf("Usage:\n"); - printf(" %s infile.g3d outfile.xml\n", execname); - - return; -} - - - -/** - * Performs the conversion from the G3D file format to XML. - * - * @param infile: G3D binary file, opened as "rb", for input. - * @param outfile: Text file, opened as "w", for XML output. - * - * @returns: TRUE if conversion to XML was successful, and FALSE otherwise. - */ -int g3d2xml(FILE *infile, FILE *outfile) { - struct FileHeader fileHeader; - struct ModelHeader modelHeader; - struct MeshHeader meshHeader; - size_t nBytes; - uint8 textureName[NAMESIZE + 1]; - float32 *fdata; - uint32 *idata; - unsigned int ii, jj, kk; - - /* read in the FileHeader */ - nBytes = sizeof(struct FileHeader); - if (fread(&fileHeader, nBytes, 1, infile) != 1) { - printf("Could not read file header!\n"); - return FALSE; - } - if (strncmp((char*) fileHeader.id, "G3D", 3) != 0) { - printf("Expected \"G3D\" id was not found!\n"); - return FALSE; - } - if (fileHeader.version != 4) { - printf("Version 4 expected, but version %d found!\n", - fileHeader.version); - return FALSE; - } - fprintf(outfile, "\n"); - fprintf(outfile, "\n"); - fprintf(outfile, "\n"); - fprintf(outfile, "\n", fileHeader.version); - - /* read in the ModelHeader */ - nBytes = sizeof(struct ModelHeader); - if (fread(&modelHeader, nBytes, 1, infile) != 1) { - printf("Could not read model header!\n"); - return FALSE; - } - if (modelHeader.type != mtMorphMesh) { - printf("Unrecognized mesh type!\n"); - return FALSE; - } - - /* read in the meshes */ - for (ii = 0; ii < modelHeader.meshCount; ii++) { - /* read in the MeshHeader */ - nBytes = sizeof(struct MeshHeader); - if (fread(&meshHeader, nBytes, 1, infile) != 1) { - printf("Could not read mesh header!\n"); - return FALSE; - } - meshHeader.name[NAMESIZE - 1] = 0; - /* write out XML mesh header */ - fprintf(outfile, "\t\n"); - - /* write out diffuse and specular colors */ - fprintf(outfile, "\t\t\n"); - fprintf(outfile, "\t\t\t\n", - meshHeader.diffuseColor[0], - meshHeader.diffuseColor[1], - meshHeader.diffuseColor[2]); - fprintf(outfile, "\t\t\n"); - fprintf(outfile, "\t\t\n"); - fprintf(outfile, "\t\t\t\n", - meshHeader.specularColor[0], - meshHeader.specularColor[1], - meshHeader.specularColor[2]); - fprintf(outfile, "\t\t\n"); - - /* read / write the texture name if present */ - if (meshHeader.textures) { - memset(&textureName[0], 0, NAMESIZE + 1); - nBytes = NAMESIZE; - if (fread(&textureName, nBytes, 1, infile) != 1) { - printf("Could not read texture name!\n"); - return FALSE; - } - textureName[NAMESIZE] = 0; - fprintf(outfile, "\t\t\n", - textureName); - } - - /* read / write each set of vertex data */ - for (jj = 0; jj < meshHeader.frameCount; jj++) { - nBytes = sizeof(float32)*meshHeader.vertexCount * 3; - fdata = malloc(nBytes); - if (fdata == NULL) { - printf("Could not allocate buffer!\n"); - return FALSE; - } - if (fread(fdata, nBytes, 1, infile) != 1) { - printf("Could not read vertex data!\n"); - free(fdata); - return FALSE; - } - fprintf(outfile, "\t\t\n", - jj); - for (kk = 0; kk < meshHeader.vertexCount; kk++) { - fprintf(outfile, "\t\t\t\n", - fdata[3 * kk + 2]); - } - fprintf(outfile, "\t\t\n"); - free(fdata); - } - - /* read / write each set of normal data */ - for (jj = 0; jj < meshHeader.frameCount; jj++) { - nBytes = sizeof(float32)*meshHeader.vertexCount * 3; - fdata = malloc(nBytes); - if (fdata == NULL) { - printf("Could not allocate buffer!\n"); - return FALSE; - } - if (fread(fdata, nBytes, 1, infile) != 1) { - printf("Could not read normal data!\n"); - free(fdata); - return FALSE; - } - fprintf(outfile, "\t\t\n", - jj); - for (kk = 0; kk < meshHeader.vertexCount; kk++) { - fprintf(outfile, "\t\t\t\n", - fdata[3 * kk + 2]); - } - fprintf(outfile, "\t\t\n"); - free(fdata); - } - - /* read / write texture coordinates */ - if (meshHeader.textures) { - nBytes = sizeof(float32)*meshHeader.vertexCount * 2; - fdata = malloc(nBytes); - if (fdata == NULL) { - printf("Could not allocate buffer!\n"); - return FALSE; - } - if (fread(fdata, nBytes, 1, infile) != 1) { - printf("Could not read texture coords!\n"); - free(fdata); - return FALSE; - } - fprintf(outfile, "\t\t\n"); - for (kk = 0; kk < meshHeader.vertexCount; kk++) { - fprintf(outfile, "\t\t\t\n", - fdata[2 * kk + 1]); - } - fprintf(outfile, "\t\t\n"); - free(fdata); - } - - /* read / write face indices */ - nBytes = sizeof(uint32)*meshHeader.indexCount; - idata = malloc(nBytes); - if (idata == NULL) { - printf("Could not allocate buffer!\n"); - return FALSE; - } - if (fread(idata, nBytes, 1, infile) != 1) { - printf("Could not read indexes!\n"); - free(idata); - return FALSE; - } - fprintf(outfile, "\t\t\n"); - for (kk = 0; kk < meshHeader.indexCount; kk++) { - fprintf(outfile, "\t\t\t\n", - idata[kk]); - } - fprintf(outfile, "\t\t\n"); - free(idata); - - fprintf(outfile, "\t\n"); - } - - fprintf(outfile, "\n"); - - return TRUE; - -} - diff --git a/source/tools/glexemel/g3d.dtd b/source/tools/glexemel/g3d.dtd deleted file mode 100644 index f1822b6a4..000000000 --- a/source/tools/glexemel/g3d.dtd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/tools/glexemel/g3d_logo.png b/source/tools/glexemel/g3d_logo.png deleted file mode 100644 index 70852fe84..000000000 Binary files a/source/tools/glexemel/g3d_logo.png and /dev/null differ diff --git a/source/tools/glexemel/g3dv4.h b/source/tools/glexemel/g3dv4.h deleted file mode 100644 index 8738adcd5..000000000 --- a/source/tools/glexemel/g3dv4.h +++ /dev/null @@ -1,61 +0,0 @@ -// ============================================================== -// This file is part of Glest Shared Library (www.glest.org) -// -// Copyright (C) 2001-2008 Martiño Figueroa -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== -/** - * File: g3dv4.h - * - * Description: - * Data types used by the G3D format. - */ - -#ifndef G3DV4_HEADER -#define G3DV4_HEADER -// bug fix from wiki -#pragma pack(push, 1) - -typedef float float32; -typedef unsigned char uint8; -typedef unsigned short int uint16; -typedef unsigned int uint32; - -#define NAMESIZE 64 - -struct FileHeader{ - uint8 id[3]; - uint8 version; -}; - -struct ModelHeader{ - uint16 meshCount; - uint8 type; -}; -enum ModelType{ - mtMorphMesh -}; - -struct MeshHeader{ - uint8 name[NAMESIZE]; - uint32 frameCount; - uint32 vertexCount; - uint32 indexCount; - float32 diffuseColor[3]; - float32 specularColor[3]; - float32 specularPower; - float32 opacity; - uint32 properties; - uint32 textures; -}; -enum MeshPropertyFlag{ - mpfTwoSided= 0, - mpfCustomColor= 1 -}; - -#pragma pack(pop) -#endif diff --git a/source/tools/glexemel/xml2g.c b/source/tools/glexemel/xml2g.c deleted file mode 100644 index 9020201f5..000000000 --- a/source/tools/glexemel/xml2g.c +++ /dev/null @@ -1,672 +0,0 @@ -/** - * File: xml2g.c - * Written: Jonathan Merritt - * - * Description: - * Converts G3Dv4 XML files into the binary representation used in the game. - * Requirements: - * libxml2 - * - * Copyright (C) Jonathan Merritt 2005. - * This file may be distributed under the terms of the GNU General Public - * License. - */ - -#include -#include -#include -#include -#include -#include - -#include "g3dv4.h" - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - - -/** - * Forward function declarations. - */ -int xml2g3d(xmlDocPtr doc, FILE *outfile); -void usage(char *execname); -unsigned int countChildren(xmlNode *n, xmlChar *name); -int processMesh(xmlNode *n, FILE *outfile); -int readColorChild(xmlNode *n, char *childName, float32 *color); -int processVertices(xmlNode *n, FILE *outfile, uint32 vertexCount); -int processNormals(xmlNode *n, FILE *outfile, uint32 vertexCount); -int processTexcoords(xmlNode *n, FILE *outfile, uint32 vertexCount); -int processIndices(xmlNode *n, FILE *outfile, uint32 indexCount); - - -/** - * Program entry point. - * - * @param argc: Number of arguments passed to the program. - * @param argv: Array of string arguments. - * - * @returns: EXIT_SUCCESS or EXIT_FAILURE depending upon success or failure - * of the conversion to XML. - */ -int main(int argc, char **argv) -{ - char *infilename, *outfilename; - FILE *outfile; - int successFlag; - xmlParserCtxtPtr ctxt; - xmlDocPtr doc; - - /* parse command line arguments */ - if (argc != 3) - { - usage(argv[0]); - return (EXIT_FAILURE); - } - else - { - infilename = argv[1]; - outfilename = argv[2]; - } - - /* attempt to parse the XML file */ - LIBXML_TEST_VERSION - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) - { - printf("Failed to allocate XML parser context!\n"); - return (EXIT_FAILURE); - } - doc = xmlCtxtReadFile(ctxt, infilename, NULL, XML_PARSE_DTDVALID); - if (doc == NULL) - { - printf("Could not parse XML file \"%s\"!\n", infilename); - xmlFreeParserCtxt(ctxt); - return (EXIT_FAILURE); - } - - /* attempt to open the output binary file */ -//#ifdef WIN32 -// outfile = _wfopen(utf8_decode(outfilename).c_str(), L"wb"); -//#else - outfile = fopen(outfilename, "wb"); -//#endif - if (outfile == NULL) { - printf("Could not open file \"%s\" for writing!\n", - outfilename); - xmlFreeDoc(doc); - xmlFreeParserCtxt(ctxt); - xmlCleanupParser(); - return (EXIT_FAILURE); - } - - /* perform the conversion: XML -> binary */ - successFlag = xml2g3d(doc, outfile); - - /* close the files */ - xmlFreeDoc(doc); - xmlFreeParserCtxt(ctxt); - xmlCleanupParser(); - fclose(outfile); - - /* return a success or failure flag */ - if (successFlag) - return (EXIT_SUCCESS); - else - return (EXIT_FAILURE); - -} - - - -/** - * Prints a "Usage:" string for the program. - * - * @param execname: Executable name of the program. - */ -void usage(char *execname) -{ - printf("Usage:\n"); - printf(" %s infile.xml outfile.g3d\n", execname); - - return; -} - - - -/** - * Performs the conversion from the XML file format to the G3D binary format. - * - * @param doc: XML DOM document for input. - * @param outfile: Binary file, opened as "wb", for output. - */ -int xml2g3d(xmlDocPtr doc, FILE *outfile) -{ - struct FileHeader fh; - struct ModelHeader mh; - xmlNode *root_element; - xmlNode *curNode; - xmlChar version[] = "version"; - - /* fetch the root element and check it */ - root_element = xmlDocGetRootElement(doc); - assert(root_element->type == XML_ELEMENT_NODE); - if (strcmp((char*)root_element->name, "G3D") != 0) - { - printf("G3D document not found!\n"); - return FALSE; - } - if (strcmp((char*)xmlGetProp(root_element, version), "4") != 0) - { - printf("Only version 4 G3D documents can be handled!\n"); - return FALSE; - } - - /* write out the file header */ - memset(&fh, 0, sizeof(struct FileHeader)); - fh.id[0] = 'G'; fh.id[1] = '3'; fh.id[2] = 'D'; fh.version=4; - fwrite(&fh, sizeof(struct FileHeader), 1, outfile); - - /* write out the model header */ - memset(&mh, 0, sizeof(struct ModelHeader)); - mh.meshCount = (uint16)countChildren(root_element, (xmlChar*)"Mesh"); - mh.type = 0; - fwrite(&mh, sizeof(struct ModelHeader), 1, outfile); - - /* process each mesh in the file */ - curNode = root_element->children; - for (; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "Mesh") == 0) - { - if (processMesh(curNode, outfile) == FALSE) - return FALSE; - } - } - } - - return TRUE; -} - - - -/** - * Counts the number of child nodes with the specified name. - * - * @param n: Node to count the children from. - * @param name: Name of the child nodes to count. - * - * @return: The number of child nodes. - */ -unsigned int countChildren(xmlNode *n, xmlChar *name) -{ - unsigned int count = 0; - xmlNode *curNode = NULL; - - for (curNode = n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, (char*)name) == 0) - count++; - } - } - - return count; -} - - - -/** - * Processes all elements from the XML file. - * - * @param n: element - * @param outfile: Binary file, opened as "wb", for output. - * - * @return: TRUE if successful, FALSE otherwise. - */ -int processMesh(xmlNode *n, FILE *outfile) -{ - xmlChar name[] = "name"; - xmlChar frameCount[] = "frameCount"; - xmlChar vertexCount[] = "vertexCount"; - xmlChar indexCount[] = "indexCount"; - xmlChar specularPower[] = "specularPower"; - xmlChar opacity[] = "opacity"; - xmlChar twoSided[] = "twoSided"; - xmlChar customColor[] = "customColor"; - xmlChar diffuseTexture[] = "diffuseTexture"; - - float32 color[3]; - - struct MeshHeader mh; - uint8 texname[NAMESIZE+1]; - - int foundFlag = FALSE; - xmlNode *texn = NULL; - xmlNode *curNode = NULL; - - /* make sure we're dealing with a element */ - assert(strcmp((char*)n->name, "Mesh") == 0); - - /* populate the MeshHeader structure appropriately */ - memset(&mh, 0, sizeof(struct MeshHeader)); - strncpy((char*)mh.name, (char*)xmlGetProp(n, name), NAMESIZE-1); - mh.frameCount = (uint32)atoi((char*)xmlGetProp(n, frameCount)); - mh.vertexCount = (uint32)atoi((char*)xmlGetProp(n, vertexCount)); - mh.indexCount = (uint32)atoi((char*)xmlGetProp(n, indexCount)); - if (readColorChild(n, "Diffuse", color) == FALSE) - return FALSE; - mh.diffuseColor[0] = color[0]; - mh.diffuseColor[1] = color[1]; - mh.diffuseColor[2] = color[2]; - if (readColorChild(n, "Specular", color) == FALSE) - return FALSE; - mh.specularColor[0] = color[0]; - mh.specularColor[1] = color[1]; - mh.specularColor[2] = color[2]; - mh.specularPower = (float32)atof((char*)xmlGetProp(n, specularPower)); - mh.opacity = (float32)atof((char*)xmlGetProp(n, opacity)); - mh.properties = 0; - if (strcmp((char*)xmlGetProp(n, twoSided), "true") == 0) - mh.properties += (0x1 << mpfTwoSided); - if (strcmp((char*)xmlGetProp(n, customColor), "true") == 0) - mh.properties += (0x1 << mpfCustomColor); - mh.textures = 0; - if (strcmp((char*)xmlGetProp(n, diffuseTexture), "true") == 0) - mh.textures = 1; - - /* write the MeshHeader */ - fwrite(&mh, sizeof(struct MeshHeader), 1, outfile); - - /* if we have a texture, then also write its name */ - foundFlag = FALSE; - if (mh.textures) - { - for (texn=n->children; texn; texn = texn->next) - { - if (texn->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)texn->name, "Texture") == 0) - { - foundFlag = TRUE; - break; - } - } - } - if (foundFlag == FALSE) - { - printf("Could not find element!\n"); - return FALSE; - } - memset(texname, 0, NAMESIZE+1); - strncpy((char*)texname, - (char*)xmlGetProp(texn, (xmlChar*)"name"), NAMESIZE); - fwrite(texname, NAMESIZE, 1, outfile); - } - - /* write out vertices */ - foundFlag = FALSE; - for (curNode=n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "Vertices") == 0) - { - foundFlag = TRUE; - if (processVertices(curNode, outfile, - mh.vertexCount) == FALSE) - { - return FALSE; - } - } - } - } - if (foundFlag == FALSE) - { - printf("No found!\n"); - return FALSE; - } - - /* write out normals */ - foundFlag = FALSE; - for (curNode=n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "Normals") == 0) - { - foundFlag = TRUE; - if (processNormals(curNode, outfile, - mh.vertexCount) == FALSE) - { - return FALSE; - } - } - } - } - if (foundFlag == FALSE) - { - printf("No found!\n"); - return FALSE; - } - - /* write out texture coordinates */ - if (mh.textures) - { - foundFlag = FALSE; - for (curNode=n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "TexCoords") - == 0) - { - foundFlag = TRUE; - if (processTexcoords(curNode, - outfile, mh.vertexCount) == - FALSE) - { - return FALSE; - } - } - } - } - if (foundFlag == FALSE) - { - printf("No found!\n"); - return FALSE; - } - } - - /* write out indices */ - foundFlag = FALSE; - for (curNode=n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "Indices") == 0) - { - foundFlag = TRUE; - if (processIndices(curNode, outfile, - mh.indexCount) == FALSE) - { - return FALSE; - } - } - } - } - if (foundFlag == FALSE) - { - printf("No found!\n"); - } - - return TRUE; -} - - - -/** - * Reads the child of a child of a node. - * - * For example: - * - * - * - * - * - * If is passed in as n and childNode is the string "Diffuse", then - * the method will read the element from within the element. - * - * @param n: Node from which the children should be read. - * @param childNode: Name of the child element that owns a element. - * @param color: float32[3] array to hold RGB color. - * - * @return TRUE if the method succeeds, FALSE otherwise. - */ -int readColorChild(xmlNode *n, char *childNode, float32 *color) -{ - int foundFlag = FALSE; - double r,g,b; - xmlNode *curNode = NULL; - - /* make sure that n is an element */ - assert(n->type == XML_ELEMENT_NODE); - - /* search for the first child node matching the given name */ - for (curNode=n->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, (char*)childNode) == 0) - { - foundFlag = TRUE; - break; - } - } - } - if (foundFlag == FALSE) - { - printf("Could not find child node \"%s\"!\n", childNode); - return FALSE; - } - - /* search for a node child */ - for (curNode=curNode->children; curNode; curNode = curNode->next) - { - if (curNode->type == XML_ELEMENT_NODE) - { - if (strcmp((char*)curNode->name, "Color") == 0) - { - r = atof((char*)xmlGetProp(curNode, - (xmlChar*)"r")); - g = atof((char*)xmlGetProp(curNode, - (xmlChar*)"g")); - b = atof((char*)xmlGetProp(curNode, - (xmlChar*)"b")); - color[0] = (float32)r; - color[1] = (float32)g; - color[2] = (float32)b; - return TRUE; - } - } - } - printf("Could not find child of \"%s\"!\n", childNode); - return FALSE; -} - - - -/** - * Writes vertices into the binary file. - * - * @param n: element. - * @param outfile: Binary file, opened as "wb", for output. - * @param vertexCount: Expected number of vertices to process. - * - * @return: TRUE if the method succeeds, FALSE otherwise. - */ -int processVertices(xmlNode *n, FILE *outfile, uint32 vertexCount) -{ - xmlNode *v; - uint32 counted_vertices = 0; - float32 p[3]; - - /* check we've been passed a element */ - assert(n->type == XML_ELEMENT_NODE); - assert(strcmp((char*)n->name, "Vertices") == 0); - - /* iterate over all children */ - for (v=n->children; v; v=v->next) - { - if ((v->type == XML_ELEMENT_NODE) && - (strcmp((char*)v->name, "Vertex") == 0)) - { - counted_vertices++; - p[0] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"x")); - p[1] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"y")); - p[2] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"z")); - fwrite(p, 3*sizeof(float32), 1, outfile); - } - } - - /* check that the correct number of vertices were processed */ - if (counted_vertices != vertexCount) - { - printf("Found %u vertices, expected %u!\n", - counted_vertices, vertexCount); - return FALSE; - } - - return TRUE; -} - - - -/** - * Writes normals into the binary file. - * - * @param n: element. - * @param outfile: Binary file, opened as "wb", for output. - * @param vertexCount: Expected number of normals to process. - * - * @return: TRUE if the method succeeds, FALSE otherwise. - */ -int processNormals(xmlNode *n, FILE *outfile, uint32 vertexCount) -{ - xmlNode *v; - uint32 counted_normals = 0; - float32 p[3]; - - /* check we've been passed a element */ - assert(n->type == XML_ELEMENT_NODE); - assert(strcmp((char*)n->name, "Normals") == 0); - - /* iterate over all elements */ - for (v=n->children; v; v=v->next) - { - if ((v->type == XML_ELEMENT_NODE) && - (strcmp((char*)v->name, "Normal") == 0)) - { - counted_normals++; - p[0] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"x")); - p[1] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"y")); - p[2] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"z")); - fwrite(p, 3*sizeof(float32), 1, outfile); - } - } - - /* check that the correct number of normals were processed */ - if (counted_normals != vertexCount) - { - printf("Found %u normals, expected %u!\n", - counted_normals, vertexCount); - return FALSE; - } - - return TRUE; -} - - - -/** - * Writes texture coordinates into the binary file. - * - * @param n: element. - * @param outfile: Binary file, opened as "wb", for output. - * @param vertexCount: Expected number of vertices to process. - * - * @return: TRUE if the method succeeds, FALSE otherwise. - */ -int processTexcoords(xmlNode *n, FILE *outfile, uint32 vertexCount) -{ - xmlNode *v; - uint32 counted_texco = 0; - float32 p[2]; - - /* check we've been passed a element */ - assert(n->type == XML_ELEMENT_NODE); - assert(strcmp((char*)n->name, "TexCoords") == 0); - - /* iterate over all children */ - for (v=n->children; v; v=v->next) - { - if ((v->type == XML_ELEMENT_NODE) && - (strcmp((char*)v->name, "ST") == 0)) - { - ++counted_texco; - p[0] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"s")); - p[1] = (float32)atof((char*)xmlGetProp(v, - (xmlChar*)"t")); - fwrite(p, 2*sizeof(float32), 1, outfile); - } - } - - /* check that the correct number of texco were processed */ - if (counted_texco != vertexCount) - { - printf("Found %u texture coordinates, expected %u!\n", - counted_texco, vertexCount); - return FALSE; - } - - return TRUE; -} - - - -/** - * Writes indices into the binary file. - * - * @param n: element. - * @param outfile: Binary file, opened as "wb", for output. - * @param indexCount: Expected number of indices to process. - * - * @return: TRUE if the method succeeds, FALSE otherwise. - */ -int processIndices(xmlNode *n, FILE *outfile, uint32 indexCount) -{ - xmlNode *v; - uint32 counted_indices = 0; - uint32 index; - - /* check we've been passed an element */ - assert(n->type == XML_ELEMENT_NODE); - assert(strcmp((char*)n->name, "Indices") == 0); - - /* iterate over all children */ - for (v=n->children; v; v=v->next) - { - if ((v->type == XML_ELEMENT_NODE) && - (strcmp((char*)v->name, "Ix") == 0)) - { - ++counted_indices; - index = (uint32)atoi((char*)xmlGetProp(v, - (xmlChar*)"i")); - fwrite(&index, 1*sizeof(uint32), 1, outfile); - } - } - - /* check that the correct number of indices were processed */ - if (counted_indices != indexCount) - { - printf("Found %u indices, expected %u!\n", - counted_indices, indexCount); - return FALSE; - } - - return TRUE; -} -