1 /***************************************************************************
2 
3     file                 : ac3d.cpp
4     created              : Wed May 29 22:11:21 CEST 2002
5     copyright            : (C) 2001 by Eric Espie
6     email                : eric.espie@torcs.org
7     version              : $Id: ac3d.cpp,v 1.1.6.3 2012/07/11 15:26:08 berniw Exp $
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  *                                                                         *
13  *   This program is free software; you can redistribute it and/or modify  *
14  *   it under the terms of the GNU General Public License as published by  *
15  *   the Free Software Foundation; either version 2 of the License, or     *
16  *   (at your option) any later version.                                   *
17  *                                                                         *
18  ***************************************************************************/
19 
20 /** @file
21 
22     @author	<a href=mailto:eric.espie@torcs.org>Eric Espie</a>
23     @version	$Id: ac3d.cpp,v 1.1.6.3 2012/07/11 15:26:08 berniw Exp $
24 */
25 
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <ctype.h>
29 #ifndef WIN32
30 #include <unistd.h>
31 #endif
32 
33 #include <tgf.h>
34 
35 #include "ac3d.h"
36 
37 
38 
39 FILE *
Ac3dOpen(char * filename,int nbObjects)40 Ac3dOpen(char *filename, int nbObjects)
41 {
42     FILE *save_fd;
43 
44     save_fd = fopen(filename, "w");
45 
46     if (save_fd == NULL) {
47 	    GfOut("Failed to open '%s' for writing", filename);
48 	    return NULL;
49     }
50 
51     fprintf(save_fd, "AC3Db\n");
52     fprintf(save_fd, "MATERIAL \"\" rgb 0.4 0.4 0.4  amb 0.8 0.8 0.8  emis 0.4 0.4 0.4  spec 0.5 0.5 0.5  shi 50  trans 0\n");
53 
54     fprintf(save_fd, "OBJECT world\n");
55     fprintf(save_fd, "kids %d\n", nbObjects);
56 
57     return save_fd;
58 }
59 
60 
61 int
Ac3dGroup(FILE * save_fd,const char * name,int nbObjects)62 Ac3dGroup(FILE *save_fd, const char *name, int nbObjects)
63 {
64     fprintf(save_fd, "OBJECT group\n");
65     fprintf(save_fd, "name \"%s\"\n", name);
66     fprintf(save_fd, "kids %d\n", nbObjects);
67 
68     return 0;
69 }
70 
71 void
Ac3dClose(FILE * save_fd)72 Ac3dClose(FILE *save_fd)
73 {
74     fclose(save_fd);
75 }
76