tga & normals
[csRadar.git] / csRadar.h
1 #include <stdint.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <math.h>
6 #include <time.h>
7 #include <stdarg.h>
8
9 // CSR lib
10 #include "csrLog.h" // Y
11 #include "csrOpt.h" // Y
12 #include "csrTypes.h" // Y
13 #include "csrMath.h" // Y
14 #include "csrMem.h" // Y
15 #include "csrIO.h" // Y
16 #include "csrComb.h" // Y
17 #include "csrPlatform.h" // Y
18
19 // Valve formats
20 #include "vdf.h" // Y
21 #include "vpk.h" // Y
22 #include "vfilesys.h" // Y
23
24 #include "vmdl.h" // Y
25 #include "vmf.h" // Y
26
27 // Drawing
28 #ifdef CSR_EXECUTABLE
29 #include "csr32f.h"
30 #include "csrTga.h"
31 #endif
32
33 #include "csrDraw.h" // Y
34
35 static const u32 csr_build = 3;
36 static const u32 csr_api_version = 1;
37
38 typedef struct csr_api csr_api;
39 typedef struct csr_opt_str csr_opt_str;
40
41 struct csr_api
42 {
43 // Floating arguments from main's argv
44 struct csr_opt_str
45 {
46 char *str;
47
48 enum inferred_type
49 {
50 k_iftype_vmf,
51 k_iftype_visgroup,
52 k_iftype_classname
53 }
54 type;
55 }
56 strings[ 20 ];
57
58 int num_strings;
59
60 float padding;
61 u32 resolution;
62 int write_txt;
63 char output_path[ 512 ]; // Full path eg. /home/harry/my_map.vmf
64 char vmf_name[ 128 ]; // Just the base name eg. my_map
65 EMSAA sampling_mode;
66
67 // Main API interface
68 vmf_map *map;
69 csr_target target;
70
71 u32 api_version;
72 };
73
74 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt );
75
76 #ifdef CSR_EXECUTABLE
77 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt )
78 {
79 if( opt->type == k_iftype_visgroup )
80 {
81 filter->visgroup = opt->str;
82 filter->classname = NULL;
83 }
84 else
85 {
86 filter->classname = opt->str;
87 filter->visgroup = NULL;
88 }
89 }
90 #endif
91
92 #ifndef CSR_EXECUTABLE
93 static int csr_init( csr_api *api )
94 {
95 if( api->api_version > csr_api_version )
96 {
97 log_warn( "API Version out of date. Host: %u, Plugin: %u\n", api->api_version, csr_api_version );
98 return 0;
99 }
100
101 return 1;
102 }
103 #endif