From a4a7b82bb70a305b8d0c585001ea8d32cf4ab71f Mon Sep 17 00:00:00 2001 From: Fatbag Date: Sat, 10 Mar 2012 14:56:32 -0600 Subject: [PATCH] Added prerelease version of libvitaboy 1.0.1 --- Libraries/FileHandler/iff/iffexport.c | 12 +-- Libraries/libvitaboy/CHANGES | 18 +++-- Libraries/libvitaboy/README | 2 +- Libraries/libvitaboy/Renderer.cpp | 67 ++++++++-------- Libraries/libvitaboy/libvitaboy.hpp | 52 ++++++++---- Libraries/libvitaboy/mesh.cpp | 68 ++++++++-------- Tools/CMakeLists.txt | 4 +- Tools/iff2html/CMakeLists.txt | 0 Tools/iff2html/iff2html.c | 109 ++++++++++++++++++++++++++ Tools/iff2html/output.html | 45 +++++++++++ 10 files changed, 281 insertions(+), 96 deletions(-) create mode 100644 Tools/iff2html/CMakeLists.txt create mode 100644 Tools/iff2html/iff2html.c create mode 100644 Tools/iff2html/output.html diff --git a/Libraries/FileHandler/iff/iffexport.c b/Libraries/FileHandler/iff/iffexport.c index 5a850ef..8dd485f 100644 --- a/Libraries/FileHandler/iff/iffexport.c +++ b/Libraries/FileHandler/iff/iffexport.c @@ -30,7 +30,7 @@ int main(int argc, char *argv[]){ unsigned chunkcount, chunk = 0; IFFFile * IFFFileInfo; IFFChunkNode * ChunkNode; - + if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ printf("Usage: iffexport [-f] infile OutDirectory\n" "Export the resources of an EA IFF file.\n" @@ -41,7 +41,7 @@ int main(int argc, char *argv[]){ "Home page: \n"); return 0; } - + if(argc >= 4 && !strcmp(argv[1], "-f")){ overwrite++; InFile = argv[2]; @@ -79,7 +79,7 @@ int main(int argc, char *argv[]){ return -1; } CloseHandle(hFile); - + /**** ** Load header information */ @@ -102,10 +102,10 @@ int main(int argc, char *argv[]){ printf("%sChunk data is corrupt.", "iffexport: error: "); return -1; } - + chunkcount = IFFFileInfo->ChunkCount; printf("This IFF file contains %u chunks.\n\nExporting\n", chunkcount); - + /**** ** Extract each entry */ @@ -137,6 +137,6 @@ int main(int argc, char *argv[]){ WriteFile(hFile, ChunkNode->Chunk.Data, ChunkNode->Chunk.Size-76, &bytestransferred, NULL); CloseHandle(hFile); } - + return 0; } \ No newline at end of file diff --git a/Libraries/libvitaboy/CHANGES b/Libraries/libvitaboy/CHANGES index 83015da..b64bbff 100644 --- a/Libraries/libvitaboy/CHANGES +++ b/Libraries/libvitaboy/CHANGES @@ -1,8 +1,14 @@ +libvitaboy 1.0.1 (2012-03-10) Fatbag + + * Corrected the BlendVertices function; blend vertices tug real vertices, not the other way around + * Interleaved all vertex data (coords, texcoords, normals, blend weights) into the VertexData array + + libvitaboy 1.0.0 (2012-03-04) Fatbag - * first stable release - * read support for ANIM, APR, BND, COL, HAG, MESH, OFT, PO, SKEL - * working rendering and animation of characters in OpenGL - * basic keyboard controls - * support for environments: MinGW - * support for platforms: i686, x86-64 \ No newline at end of file + * First stable release + * Read support for ANIM, APR, BND, COL, HAG, MESH, OFT, PO, SKEL + * Working rendering and animation of characters in OpenGL + * Basic keyboard controls + * Support for environments: MinGW + * Support for platforms: i686, x86-64 \ No newline at end of file diff --git a/Libraries/libvitaboy/README b/Libraries/libvitaboy/README index 19b2290..d8a2d41 100644 --- a/Libraries/libvitaboy/README +++ b/Libraries/libvitaboy/README @@ -28,7 +28,7 @@ Formats include: 1. What this library will do for you -You can use this library to render a character in a fixed location. +You can use this library to render a character in a predetermined location. 2. Compiling diff --git a/Libraries/libvitaboy/Renderer.cpp b/Libraries/libvitaboy/Renderer.cpp index 7afd773..644b33a 100644 --- a/Libraries/libvitaboy/Renderer.cpp +++ b/Libraries/libvitaboy/Renderer.cpp @@ -61,9 +61,12 @@ bool active=true; bool fullscreen=false; float zoom = -10; +struct BasicVertex_t { + float x, y, z; +}; struct CharacterPlacement_t { - Vertex_t Translation; - Vertex_t Rotation; + BasicVertex_t Translation; + BasicVertex_t Rotation; }; CharacterPlacement_t Character = {{0,-3,0}, {0,0,0}}; @@ -197,29 +200,29 @@ void TransformVertices(Bone_t& Bone) } if(BoneIndex < Mesh.BindingCount){ - for(unsigned i=0; i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include +#include "iff.h" + +int main(int argc, char *argv[]){ + HANDLE hFile; + int overwrite = 0; + char *InFile, *OutDirectory; + HANDLE ProcessHeap = GetProcessHeap(); + DWORD FileSize; + DWORD bytestransferred = 0; + uint8_t * IFFData; + unsigned chunkcount, chunk = 0; + IFFFile * IFFFileInfo; + IFFChunkNode * ChunkNode; + + if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ + printf("Usage: iff2html [-f] infile outfile\n" + "Produce an HTML webpage describing an EA IFF file.\n" + "Use -f to force overwriting without confirmation.\n" + "\n" + "Report bugs to .\n" + "iff2html is maintained by the Niotso project.\n" + "Home page: \n"); + return 0; + } + + if(argc >= 4 && !strcmp(argv[1], "-f")){ + overwrite++; + InFile = argv[2]; + OutDirectory = argv[3]; + }else{ + InFile = argv[1]; + OutDirectory = argv[2]; + } + + /**** + ** Open the file and read in entire contents to memory + */ + + hFile = CreateFile(InFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if(hFile == INVALID_HANDLE_VALUE){ + if(GetLastError() == ERROR_FILE_NOT_FOUND){ + printf("%sThe specified input file does not exist.", "iff2html: error: "); + return -1; + } + printf("%sThe input file could not be opened for reading.", "iff2html: error: "); + return -1; + } + FileSize = GetFileSize(hFile, NULL); + if(FileSize < 64){ + printf("%sNot a valid IFF file.", "iff2html: error: "); + return -1; + } + IFFData = HeapAlloc(ProcessHeap, HEAP_NO_SERIALIZE, FileSize); + if(IFFData == NULL){ + printf("%sMemory for this file could not be allocated.", "iff2html: error: "); + return -1; + } + if(!ReadFile(hFile, IFFData, FileSize, &bytestransferred, NULL) || bytestransferred != FileSize){ + printf("%sThe input file could not be read.", "iff2html: error: "); + return -1; + } + CloseHandle(hFile); + + /**** + ** Load header information + */ + + IFFFileInfo = iff_create(); + if(IFFFileInfo == NULL){ + printf("%sMemory for this file could not be allocated.", "iff2html: error: "); + return -1; + } + if(!iff_read_header(IFFFileInfo, IFFData, FileSize)){ + printf("%sNot a valid IFF file.", "iff2html: error: "); + return -1; + } + + /**** + ** Load entry information + */ + + if(!iff_enumerate_chunks(IFFFileInfo, IFFData+64, FileSize-64)){ + printf("%sChunk data is corrupt.", "iff2html: error: "); + return -1; + } + + chunkcount = IFFFileInfo->ChunkCount; + + return 0; +} \ No newline at end of file diff --git a/Tools/iff2html/output.html b/Tools/iff2html/output.html new file mode 100644 index 0000000..462fd5f --- /dev/null +++ b/Tools/iff2html/output.html @@ -0,0 +1,45 @@ + + + + + + + +behavior.iff (iff2html) + + + +

behavior.iff

+
+
9809b96803833f2891ddd31e474795a9 (md5), 42.4kB (43,446 bytes)
+
Dumped by iff2html.
+ +
Contents – x chunks
+ +
+ + \ No newline at end of file