/[Sims3RigEditor]/trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp
ViewVC logotype

Contents of /trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (show annotations) (download)
Sat Jul 31 01:44:00 2010 UTC (9 years, 7 months ago) by william
File size: 2808 byte(s)
commit - header redesign -- actually compiles now.

** Have some issues with loading for granny files, will fix in subsequent commits...

1 // gr2lib_cpp_UnitTest.cpp : main project file.
2
3 #include "stdafx.h"
4 #include "granny.h"
5 #include <stdio.h>
6 #include <iostream>
7 #include <stdlib.h>
8 #include <assert.h>
9
10 #include "..\gr2lib_cpp\grannyfile.h"
11 #include "..\gr2lib_cpp\gr2lib_rigeditor_frm.h"
12
13 using namespace std;
14 using namespace gr2lib::core;
15
16
17 void wait()
18 {
19 cout<<"\nPress {ENTER} to continue.";
20 cin.ignore(1);
21 }
22 int main(int argc, char const* argv[])
23 {
24
25 //grannyfile* grn_file = new grannyfile("C:\\temp\\S3_motorcycleChopper.gr2");
26 grannyfile* grn_file = new grannyfile("C:\\Program Files\\Granny Viewer\\Gryphon.gr2");
27
28 if (!grn_file->GrannyAPIVersion->APIVersionsMatch())
29 {
30 printf("Warning:\n\t Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
31 return EXIT_FAILURE;
32 }
33 else
34 {
35 printf("Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
36
37 if (grn_file->_grn_file == 0)
38 {
39 printf("Error: unable to load %s as a Granny file.\n", grn_file->GrannyFilename());
40 return EXIT_FAILURE;
41 }
42 else
43 {
44 if (grn_file->GrannyFileInfo == 0)
45 {
46 printf("Could not extract a granny_file_info from the file.\n");
47 return EXIT_FAILURE;
48 }
49 else
50 {
51 if (grn_file->GrannyFileInfo->ArtToolInfo)
52 {
53 printf("\nFile created by %s (%d.%d)\n",
54 grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName,
55 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMajorRevision,
56 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMinorRevision);
57 printf(" Coordinate system\n"
58 " Units per meter: %f\n"
59 " Right Vector: (%f %f %f)\n"
60 " Up Vector: (%f %f %f)\n"
61 " Back Vector: (%f %f %f)\n\n",
62 grn_file->GrannyFileInfo->ArtToolInfo->UnitsPerMeter,
63 grn_file->GrannyFileInfo->ArtToolInfo->RightVector[0], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[1], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[2],
64 grn_file->GrannyFileInfo->ArtToolInfo->UpVector[0], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[1], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[2],
65 grn_file->GrannyFileInfo->ArtToolInfo->BackVector[0], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[1], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[2]);
66 }
67
68 gr2lib_rigeditor_frm^ _editor = gcnew gr2lib_rigeditor_frm(grn_file);
69 _editor->ShowDialog();
70 printf("Art Tool Name: %s", grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName);
71 }
72 }
73
74 }
75
76
77 wait();
78 return 0;
79 }
80
81

  ViewVC Help
Powered by ViewVC 1.1.22