Merge commit 'upstream/0.20'
Andrew Caudwell
14 years ago
0 | 0.20: | |
1 | * Added bloom effect (turn off with --disable-bloom). | |
2 | * Added support for Mercurial (thanks to Justin Love for gource.style). | |
3 | * --start-position option now works in combination with --disable-progress. | |
4 | ||
5 | 0.19: | |
6 | * Use time_t instead of long for timestamps. | |
7 | ||
8 | 0.18: | |
9 | * Fixed camera movement while the simulation is paused. | |
10 | ||
11 | 0.17: | |
12 | * Show correct month for CVS logs. | |
13 | * Added time scaling (Bitshifter). | |
14 | ||
15 | 0.16: | |
16 | * Added --hide-dirnames option. | |
17 | * Added --user-scale option. | |
18 | * Added --date-format option (Pat Notz). | |
19 | * Fix bug when encountering long log lines. | |
20 | * Fixed incorrect parsing of trivial merges. | |
21 | * Fixed building issues on OSX. | |
22 | ||
23 | 0.15: | |
24 | * Added PPM output support for creating videos (Johannes Schindelin). | |
25 | * Added experimental Apache combined access log support (--log-format apache). | |
26 | * Added --stop-position and --stop-on-idle options (useful for making videos). | |
27 | * Added --max-file-lag option to limit how long after a commit file changes can take to appear. | |
28 | * Added --no-renames to the git log command as they don't display correctly. | |
29 | * Added --max-user-speed and --user-friction as options. | |
30 | * Now builds on OSX Leopard (with the required libaries installed). | |
31 | * Caught raw exception from replace_invalid(). | |
32 | * Added CXXFLAGS. You may want to override the default (eg CXXFLAGS=-O3 ./configure). | |
33 | ||
34 | 0.14: | |
35 | * Updated SVN instructions. | |
36 | ||
37 | 0.13: | |
38 | * Removed single quotes from log command (fixes running gource --git-log-command in back ticks) | |
39 | * Added SVN instructions. | |
40 | * Fixed manpage hyphens. | |
41 | ||
42 | 0.12: | |
43 | * Added --enable-ttf-font-dir=DIR option to configure (to specify the ttf-freefont directory). | |
44 | * UTF-8 support using UTF8-CPP (http://utfcpp.sourceforge.net/). | |
45 | * Changed the git log command (see --git-log-command) to require less work to parse. | |
46 | Log files generated with the previous git-log command used by gource should continue to work. | |
47 | * Allow --seconds-per-day value less than 1.0. | |
48 | * Added --git-branch command. | |
49 | * Added --loop command. | |
50 | * Added --crop command. | |
51 | ||
52 | 0.11: | |
53 | * Made N key skip to next entry. | |
54 | * Documented --user-image-dir flag. | |
55 | * temp file name now uses uid instead of time | |
56 | ||
57 | 0.1: | |
58 | * First release. |
14 | 14 | mkdir -p -m 755 $(DESTDIR)/$(bindir) |
15 | 15 | mkdir -p -m 755 ${DESTDIR}/$(gourcedatadir) |
16 | 16 | mkdir -p -m 755 ${DESTDIR}/$(mandir)/man1 |
17 | cp data/*.tga ${DESTDIR}/$(gourcedatadir)/ | |
17 | 18 | cp data/*.png ${DESTDIR}/$(gourcedatadir)/ |
19 | cp data/gource.style ${DESTDIR}/$(gourcedatadir)/ | |
18 | 20 | cp gource ${DESTDIR}/$(bindir)/ |
19 | 21 | sed 's|GOURCE_DATADIR|$(gourcedatadir)|g' data/gource.1 > ${DESTDIR}/$(mandir)/man1/gource.1 |
20 | 22 | gzip -f9 ${DESTDIR}/$(mandir)/man1/gource.1 |
14 | 14 | 3. Installation |
15 | 15 | 4. Using Gource |
16 | 16 | 5. Building Gource |
17 | 6. Changes | |
18 | 7. Copyright | |
17 | 6. Copyright | |
19 | 18 | |
20 | 19 | 1. Description |
21 | 20 | =============== |
88 | 87 | Get the git log of a branch other than the current one. |
89 | 88 | |
90 | 89 | --git-log-command |
91 | Print the git-log command used by gource. | |
90 | Print the git log command used by gource. | |
91 | ||
92 | --hg-log-command | |
93 | Print the hg log (Mercurial) command used by gource. | |
92 | 94 | |
93 | 95 | --cvs-exp-command |
94 | 96 | Print the cvs-exp.pl log command used by gource. |
120 | 122 | --multi-sampling |
121 | 123 | Enable multi-sampling. |
122 | 124 | |
125 | --bloom-multiplier FLOAT | |
126 | Adjust the amount of bloom. | |
127 | ||
128 | --bloom-intensity FLOAT | |
129 | Adjust the intensity of the bloom. | |
130 | ||
123 | 131 | --disable-progress |
124 | 132 | Disable progress bar. |
125 | 133 | |
134 | --disable-bloom | |
135 | Disable bloom effect. | |
136 | ||
126 | 137 | --max-files |
127 | 138 | Set the maximum number of files. Excess files will be discarded. |
128 | 139 | |
141 | 152 | --hide-users |
142 | 153 | Hide users. |
143 | 154 | |
155 | --hide-tree | |
156 | Hide tree. | |
157 | ||
158 | --hide-files | |
159 | Hide files. | |
160 | ||
144 | 161 | --hide-usernames |
145 | 162 | Hide usernames. |
146 | 163 | |
162 | 179 | path Either a git directory, a pre-generated log file (see --git-log-command, --cvs-exp-command or the custom |
163 | 180 | log format) or '-' to read STDIN. If path is ommited gource will attempt to read a git log from the current directory. |
164 | 181 | |
165 | Git Examples: | |
166 | ||
167 | View the log of the Git respository in the current path: | |
182 | Git and Mercurial Examples: | |
183 | ||
184 | View the log of the respository in the current path: | |
168 | 185 | |
169 | 186 | gource |
170 | 187 | |
171 | View the log of a Git project in the specified directory: | |
188 | View the log of a project in the specified directory: | |
172 | 189 | |
173 | 190 | gource my-project-dir |
174 | 191 | |
175 | Save a copy of the log using in a special git-log format and play it back. Use --git-log-command to get the git-log | |
176 | options you should use: | |
192 | Save a copy of the log using in a special log format and play it back (example is for Git, Mercurial users see --hg-log-command): | |
177 | 193 | |
178 | 194 | cd my-git-project |
179 | 195 | `gource --git-log-command` > my-git-project.log |
192 | 208 | |
193 | 209 | Custom Log Format: |
194 | 210 | |
195 | If you want to use Gource with something other than the supported systems, there is a pipe delimited custom log format: | |
211 | If you want to use Gource with something other than the supported systems, there is a pipe ('|') delimited custom log format: | |
196 | 212 | |
197 | 213 | timestamp - A unix timestamp of when the update occured. |
198 | 214 | username - The name of the user who made the update. |
205 | 221 | You can create a video of Gource using the --output-ppm-stream option. This creates an uncompressed sequence of |
206 | 222 | screenshots in PPM format which can then be processed by another program (such as ffmpeg) to produce a video file. |
207 | 223 | |
208 | The below command line will create a video at 60fps in h264 format (assumes you have ffmpeg with h264 support): | |
209 | ||
210 | gource --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - gource.h264 | |
224 | The below command line will create a video at 60fps in x264 format (assumes you have ffmpeg with x264 support): | |
225 | ||
226 | gource --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 gource.mp4 | |
211 | 227 | |
212 | 228 | Interface: |
213 | 229 | |
258 | 274 | On Windows I recommend compiling the project gource.win32.cbp |
259 | 275 | with the Code Blocks IDE (www.codeblocks.org). |
260 | 276 | |
261 | 6. Changes | |
262 | ========== | |
263 | ||
264 | 0.17: | |
265 | * Show correct month for CVS logs. | |
266 | * Added time scaling (Bitshifter). | |
267 | ||
268 | 0.16: | |
269 | * Added --hide-dirnames option. | |
270 | * Added --user-scale option. | |
271 | * Added --date-format option (Pat Notz). | |
272 | * Fix bug when encountering long log lines. | |
273 | * Fixed incorrect parsing of trivial merges. | |
274 | * Fixed building issues on OSX. | |
275 | ||
276 | 0.15: | |
277 | * Added PPM output support for creating videos (Johannes Schindelin). | |
278 | * Added experimental Apache combined access log support (--log-format apache). | |
279 | * Added --stop-position and --stop-on-idle options (useful for making videos). | |
280 | * Added --max-file-lag option to limit how long after a commit file changes can take to appear. | |
281 | * Added --no-renames to the git log command as they don't display correctly. | |
282 | * Added --max-user-speed and --user-friction as options. | |
283 | * Now builds on OSX Leopard (with the required libaries installed). | |
284 | * Caught raw exception from replace_invalid(). | |
285 | * Added CXXFLAGS. You may want to override the default (eg CXXFLAGS=-O3 ./configure). | |
286 | ||
287 | 0.14: | |
288 | * Updated SVN instructions. | |
289 | ||
290 | 0.13: | |
291 | * Removed single quotes from log command (fixes running gource --git-log-command in back ticks) | |
292 | * Added SVN instructions. | |
293 | * Fixed manpage hyphens. | |
294 | ||
295 | 0.12: | |
296 | * Added --enable-ttf-font-dir=DIR option to configure (to specify the ttf-freefont directory). | |
297 | * UTF-8 support using UTF8-CPP (http://utfcpp.sourceforge.net/). | |
298 | * Changed the git log command (see --git-log-command) to require less work to parse. | |
299 | Log files generated with the previous git-log command used by gource should continue to work. | |
300 | * Allow --seconds-per-day value less than 1.0. | |
301 | * Added --git-branch command. | |
302 | * Added --loop command. | |
303 | * Added --crop command. | |
304 | ||
305 | 0.11: | |
306 | * Made N key skip to next entry. | |
307 | * Documented --user-image-dir flag. | |
308 | * temp file name now uses uid instead of time | |
309 | ||
310 | 0.1: | |
311 | * First release. | |
312 | ||
313 | 7. Copyright | |
277 | 6. Copyright | |
314 | 278 | ============ |
315 | 279 | |
316 | 280 | Gource - software version control visualization |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.61 for Gource 0.1. | |
2 | # Generated by GNU Autoconf 2.61 for Gource 0.20. | |
3 | 3 | # |
4 | 4 | # Report bugs to <acaudwell@gmail.com>. |
5 | 5 | # |
573 | 573 | # Identity of this package. |
574 | 574 | PACKAGE_NAME='Gource' |
575 | 575 | PACKAGE_TARNAME='gource' |
576 | PACKAGE_VERSION='0.1' | |
577 | PACKAGE_STRING='Gource 0.1' | |
576 | PACKAGE_VERSION='0.20' | |
577 | PACKAGE_STRING='Gource 0.20' | |
578 | 578 | PACKAGE_BUGREPORT='acaudwell@gmail.com' |
579 | 579 | |
580 | 580 | ac_unique_file="src/main.h" |
1215 | 1215 | # Omit some internal or obsolete options to make the list less imposing. |
1216 | 1216 | # This message is too long to be a string in the A/UX 3.1 sh. |
1217 | 1217 | cat <<_ACEOF |
1218 | \`configure' configures Gource 0.1 to adapt to many kinds of systems. | |
1218 | \`configure' configures Gource 0.20 to adapt to many kinds of systems. | |
1219 | 1219 | |
1220 | 1220 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1221 | 1221 | |
1284 | 1284 | |
1285 | 1285 | if test -n "$ac_init_help"; then |
1286 | 1286 | case $ac_init_help in |
1287 | short | recursive ) echo "Configuration of Gource 0.1:";; | |
1287 | short | recursive ) echo "Configuration of Gource 0.20:";; | |
1288 | 1288 | esac |
1289 | 1289 | cat <<\_ACEOF |
1290 | 1290 | |
1387 | 1387 | test -n "$ac_init_help" && exit $ac_status |
1388 | 1388 | if $ac_init_version; then |
1389 | 1389 | cat <<\_ACEOF |
1390 | Gource configure 0.1 | |
1390 | Gource configure 0.20 | |
1391 | 1391 | generated by GNU Autoconf 2.61 |
1392 | 1392 | |
1393 | 1393 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
1401 | 1401 | This file contains any messages produced by compilers while |
1402 | 1402 | running configure, to aid debugging if configure makes a mistake. |
1403 | 1403 | |
1404 | It was created by Gource $as_me 0.1, which was | |
1404 | It was created by Gource $as_me 0.20, which was | |
1405 | 1405 | generated by GNU Autoconf 2.61. Invocation command line was |
1406 | 1406 | |
1407 | 1407 | $ $0 $@ |
9797 | 9797 | # report actual input values of CONFIG_FILES etc. instead of their |
9798 | 9798 | # values after options handling. |
9799 | 9799 | ac_log=" |
9800 | This file was extended by Gource $as_me 0.1, which was | |
9800 | This file was extended by Gource $as_me 0.20, which was | |
9801 | 9801 | generated by GNU Autoconf 2.61. Invocation command line was |
9802 | 9802 | |
9803 | 9803 | CONFIG_FILES = $CONFIG_FILES |
9840 | 9840 | _ACEOF |
9841 | 9841 | cat >>$CONFIG_STATUS <<_ACEOF |
9842 | 9842 | ac_cs_version="\\ |
9843 | Gource config.status 0.1 | |
9843 | Gource config.status 0.20 | |
9844 | 9844 | configured by $0, generated by GNU Autoconf 2.61, |
9845 | 9845 | with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
9846 | 9846 |
2 | 2 | |
3 | 3 | AC_PREREQ(2.61) |
4 | 4 | |
5 | AC_INIT(Gource, 0.1, [acaudwell@gmail.com]) | |
5 | AC_INIT(Gource, 0.20, [acaudwell@gmail.com]) | |
6 | 6 | AC_CONFIG_SRCDIR([src/main.h]) |
7 | 7 | |
8 | 8 | AC_CANONICAL_HOST |
Binary diff not shown
58 | 58 | Get the git log of a branch other than the current one. |
59 | 59 | .TP |
60 | 60 | \fB\-\-git\-log\-command\fR |
61 | Print the git-log command used by \fIgource\fR. | |
61 | Print the git log command used by \fIgource\fR. | |
62 | .TP | |
63 | \fB\-\-hg\-log\-command\fR | |
64 | Print the hg log command (Mercurial) used by \fIgource\fR. | |
62 | 65 | .TP |
63 | 66 | \fB\-\-cvs\-exp\-command\fR |
64 | 67 | Print the cvs-exp.pl log command used by \fIgource\fR. |
90 | 93 | \fB\-\-multi\-sampling\fR |
91 | 94 | Enable multi-sampling. |
92 | 95 | .TP |
96 | \fB\-\-bloom\-multiplier FLOAT\fR | |
97 | Adjust the amount of bloom. | |
98 | .TP | |
99 | \fB\-\-bloom\-intensity FLOAT\fR | |
100 | Adjust the intensity of the bloom. | |
101 | .TP | |
93 | 102 | \fB\-\-disable\-progress\fR |
94 | 103 | Disable progress bar. |
95 | 104 | .TP |
105 | \fB\-\-disable\-bloom\fR | |
106 | Disable bloom effect. | |
107 | .TP | |
96 | 108 | \fB\-\-max\-files\fR |
97 | 109 | Set the maximum number of files. Excess files will be discarded. |
98 | 110 | .TP |
111 | 123 | \fB\-\-hide\-users\fR |
112 | 124 | Hide users. |
113 | 125 | .TP |
126 | \fB\-\-hide\-tree\fR | |
127 | Hide tree. | |
128 | .TP | |
129 | \fB\-\-hide\-files\fR | |
130 | Hide files. | |
131 | .TP | |
114 | 132 | \fB\-\-hide\-usernames\fR |
115 | 133 | Hide usernames. |
116 | 134 | .TP |
131 | 149 | .TP |
132 | 150 | \fBpath\fR |
133 | 151 | Either a Git directory, a pre-generated log file (see -\-git\-log\-command, -\-cvs\-exp\-command or the custom log format) or '\-' to read STDIN. If path is ommited \fIgource\fR will attempt to read a git log from the current directory. |
134 | .SH GIT EXAMPLES | |
135 | ||
136 | View the log of the Git respository in the current path: | |
152 | .SH GIT AND MERCURIAL EXAMPLES | |
153 | ||
154 | View the log of the respository in the current path: | |
137 | 155 | |
138 | 156 | .ti 10 |
139 | 157 | \fIgource\fR |
140 | 158 | |
141 | View the log of a Git project in the specified directory: | |
159 | View the log of a project in the specified directory: | |
142 | 160 | |
143 | 161 | .ti 10 |
144 | 162 | \fIgource\fR my\-project\-dir |
145 | 163 | |
146 | Save a copy of the log using in a special git-log format and play it back. Use \-\-git-log-command to get the git-log options you should use: | |
164 | Save a copy of the log using in a special log format and play it back (example is for Git, Mercurial users see \-\-hg\-log-command): | |
147 | 165 | |
148 | 166 | .ti 10 |
149 | 167 | cd my\-git\-project |
162 | 180 | CVS - http://code.google.com/p/gource/wiki/CVS |
163 | 181 | .ti 10 |
164 | 182 | SVN - http://code.google.com/p/gource/wiki/SVN |
165 | .ti 10 | |
166 | Mercurial - http://code.google.com/p/gource/wiki/Mercurial | |
167 | 183 | |
168 | 184 | .SH CUSTOM LOG FORMAT |
169 | 185 | |
170 | If you want to use Gource with something other than the supported systems, there is a pipe delimited custom log format: | |
186 | If you want to use Gource with something other than the supported systems, there is a pipe ('|') delimited custom log format: | |
171 | 187 | |
172 | 188 | .ti 10 |
173 | 189 | timestamp - A unix timestamp of when the update occured. |
184 | 200 | You can create a video of Gource using the \-\-output\-ppm\-stream option. This creates an uncompressed sequence of |
185 | 201 | screenshots in PPM format which can then be processed by another program (such as ffmpeg) to produce a video file. |
186 | 202 | |
187 | The below command line will create a video at 60fps in h264 format (assumes you have ffmpeg with h264 support): | |
188 | ||
189 | .ti 10 | |
190 | gource \-\-output-ppm-stream \- | ffmpeg \-y \-b 3000K \-r 60 \-f image2pipe \-vcodec ppm \-i \- gource.h264 | |
203 | The below command line will create a video at 60fps in x264 format (assumes you have ffmpeg with x264 support): | |
204 | ||
205 | .ti 10 | |
206 | gource \-\-output-ppm-stream \- | ffmpeg \-y \-b 3000K \-r 60 \-f image2pipe \-vcodec ppm \-i \- \-vcodec libx264 gource.mp4 | |
191 | 207 | |
192 | 208 | .SH INTERFACE |
193 | 209 | The time shown in the top left of the screen is set initially from the first log entry read and is incremented according to the simulation speed (\-\-seconds\-per\-day). |
0 | changeset = '{file_adds}{file_copies}{file_mods}{file_dels}' | |
1 | file_mod = "{date|hgdate}|{author|person}|M|{file_mod}\n" | |
2 | file_add = "{date|hgdate}|{author|person}|A|{file_add}\n" | |
3 | file_del = "{date|hgdate}|{author|person}|D|{file_del}\n" | |
4 | file_copy = "{date|hgdate}|{author|person}|A|{name}\n" |
5 | 5 | SUBDIRS = core |
6 | 6 | CXX = g++ |
7 | 7 | CC = gcc |
8 | objects = zoomcamera.o slider.o spline.o dirnode.o action.o pawn.o file.o user.o gource.o commitlog.o git.o gitraw.o custom.o cvs-exp.o apache.o ppm.o main.o | |
8 | objects = zoomcamera.o slider.o spline.o dirnode.o action.o pawn.o file.o user.o gource.o commitlog.o git.o hg.o gitraw.o custom.o cvs-exp.o apache.o ppm.o main.o | |
9 | 9 | |
10 | 10 | all: |
11 | 11 | for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} all ); done |
45 | 45 | void RAction::draw(float dt) { |
46 | 46 | if(isFinished()) return; |
47 | 47 | |
48 | glDisable(GL_TEXTURE_2D); | |
49 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
50 | glEnable(GL_BLEND); | |
51 | ||
52 | 48 | vec2f src = source->getPos(); |
53 | 49 | vec2f dest = target->getAbsolutePos(); |
54 | 50 | |
67 | 63 | |
68 | 64 | glBegin(GL_QUADS); |
69 | 65 | glColor4fv(col2); |
70 | ||
66 | glTexCoord2f(0.0,0.0); | |
71 | 67 | glVertex2f(src.x - offset_src.x, src.y - offset_src.y); |
68 | glTexCoord2f(0.0,1.0); | |
72 | 69 | glVertex2f(src.x + offset_src.x, src.y + offset_src.y); |
73 | 70 | |
74 | 71 | glColor4fv(col1); |
72 | glTexCoord2f(1.0,1.0); | |
73 | glVertex2f(dest.x + offset.x, dest.y + offset.y); | |
74 | glTexCoord2f(1.0,0.0); | |
75 | glVertex2f(dest.x - offset.x, dest.y - offset.y); | |
76 | glEnd(); | |
75 | 77 | |
78 | /* | |
79 | glBegin(GL_QUADS); | |
80 | glColor4fv(col2); | |
81 | glTexCoord2f(0.0,0.0); | |
82 | glVertex2f(src.x - offset_src.x, src.y - offset_src.y); | |
83 | glTexCoord2f(1.0,0.0); | |
84 | glVertex2f(src.x + offset_src.x, src.y + offset_src.y); | |
85 | ||
86 | glColor4fv(col1); | |
87 | glTexCoord2f(0.0,0.0); | |
76 | 88 | glVertex2f(dest.x + offset.x, dest.y + offset.y); |
77 | glVertex2f(dest.x - offset.x, dest.y - offset.y); | |
89 | glTexCoord2f(1.0,0.0); | |
90 | glVertex2f(dest.x - offset.x, dest.y - offset.y); | |
78 | 91 | glEnd(); |
92 | */ | |
79 | 93 | } |
80 | 94 | |
81 | 95 | CreateAction::CreateAction(RUser* source, RFile* target, float addedtime) : RAction(source, target, addedtime) { |
191 | 191 | return false; |
192 | 192 | } |
193 | 193 | |
194 | std::string RCommitLog::createTempLog() { | |
195 | //create temp file | |
196 | char logfile_buff[1024]; | |
197 | ||
198 | #ifdef _WIN32 | |
199 | DWORD tmplen = GetTempPath(0, ""); | |
200 | ||
201 | if(tmplen == 0) return 0; | |
202 | ||
203 | std::vector<TCHAR> temp(tmplen+1); | |
204 | ||
205 | tmplen = GetTempPath(static_cast<DWORD>(temp.size()), &temp[0]); | |
206 | ||
207 | if(tmplen == 0 || tmplen >= temp.size()) return 0; | |
208 | ||
209 | std::string temp_file_path(temp.begin(), | |
210 | temp.begin() + static_cast<std::size_t>(tmplen)); | |
211 | ||
212 | temp_file_path += "gource.tmp"; | |
213 | ||
214 | sprintf(logfile_buff, "%s", temp_file_path.c_str()); | |
215 | #else | |
216 | uid_t myuid = getuid(); | |
217 | sprintf(logfile_buff, "/tmp/gource-%d.tmp", myuid); | |
218 | #endif | |
219 | temp_file = std::string(logfile_buff); | |
220 | ||
221 | return temp_file; | |
222 | } | |
223 | ||
194 | 224 | // RCommitFile |
195 | 225 | |
196 | 226 | RCommitFile::RCommitFile(std::string filename, std::string action, vec3f colour) { |
235 | 265 | return true; |
236 | 266 | } |
237 | 267 | |
238 | ||
239 | 268 | void RCommit::debug() { |
240 | 269 | debugLog("files:\n"); |
241 | 270 |
41 | 41 | class RCommit { |
42 | 42 | vec3f fileColour(std::string filename); |
43 | 43 | public: |
44 | long timestamp; | |
44 | time_t timestamp; | |
45 | 45 | std::string username; |
46 | 46 | |
47 | 47 | std::list<RCommitFile> files; |
73 | 73 | |
74 | 74 | bool checkFirstChar(int firstChar, std::istream& stream); |
75 | 75 | |
76 | std::string createTempLog(); | |
77 | ||
76 | 78 | virtual bool parseCommit(RCommit& commit) { return false; }; |
77 | 79 | public: |
78 | 80 | RCommitLog(std::string logfile, int firstChar = -1); |
41 | 41 | SDLAppDisplay::~SDLAppDisplay() { |
42 | 42 | } |
43 | 43 | |
44 | void SDLAppDisplay::displayArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs) { | |
45 | ||
46 | for (int i=1; i<argc; i++) { | |
47 | debugLog("argv[%d] = %s\n", i, argv[i]); | |
48 | ||
49 | if (!strcmp(argv[i],"-f")) { | |
50 | *fullscreen = 1; | |
51 | continue; | |
52 | } | |
53 | else if (!strcmp(argv[i],"-w")) { | |
54 | *fullscreen = 0; | |
55 | continue; | |
56 | } | |
57 | ||
58 | //get video mode | |
59 | if(strchr(argv[i], '-') != 0 && strlen(argv[i])>1) { | |
60 | std::string argstr(argv[i], 1, strlen(argv[i])-1); | |
61 | debugLog("%s\n", argstr.c_str()); | |
62 | size_t x = argstr.rfind("x"); | |
63 | ||
64 | if(x != std::string::npos) { | |
65 | std::string widthstr = argstr.substr(0, x); | |
66 | std::string heightstr = argstr.substr(x+1); | |
67 | ||
68 | int width = atoi(widthstr.c_str()); | |
69 | int height = atoi(heightstr.c_str()); | |
70 | ||
71 | if(width!=0 && height!=0) { | |
72 | debugLog("w=%d, h=%d\n",width,height); | |
73 | ||
74 | *xres = width; | |
75 | *yres = height; | |
76 | continue; | |
77 | } | |
78 | } | |
79 | } | |
80 | ||
81 | // non display argument | |
82 | if(otherargs != 0) { | |
83 | otherargs->push_back(std::string(argv[i])); | |
84 | } | |
85 | } | |
86 | } | |
87 | ||
88 | 44 | void SDLAppDisplay::setClearColour(vec3f colour) { |
89 | 45 | clearColour = colour; |
90 | 46 | } |
95 | 51 | return flags; |
96 | 52 | } |
97 | 53 | |
98 | std::string SDLAppDisplay::getPath() { | |
99 | return path; | |
100 | } | |
101 | ||
102 | bool SDLAppDisplay::dirExists(std::string path) { | |
103 | struct stat st; | |
104 | return !stat(path.c_str(), &st) && S_ISDIR(st.st_mode); | |
105 | } | |
106 | ||
107 | void SDLAppDisplay::detectPath() { | |
108 | ||
109 | std::string resource_dir = "data/"; | |
110 | std::string fonts_dir = "data/fonts/"; | |
111 | #ifdef _WIN32 | |
112 | char szAppPath[MAX_PATH]; | |
113 | GetModuleFileName(0, szAppPath, MAX_PATH); | |
114 | ||
115 | // Extract directory | |
116 | std::string exepath = std::string(szAppPath); | |
117 | ||
118 | int pos = exepath.rfind("\\"); | |
119 | ||
120 | path = exepath.substr(0, pos+1); | |
121 | resource_dir = path + std::string("\\data\\"); | |
122 | fonts_dir = path + std::string("\\data\\fonts\\"); | |
123 | #endif | |
124 | ||
125 | #ifdef SDLAPP_RESOURCE_DIR | |
126 | if (dirExists(SDLAPP_RESOURCE_DIR)) { | |
127 | resource_dir = SDLAPP_RESOURCE_DIR; | |
128 | fonts_dir = SDLAPP_RESOURCE_DIR + std::string("/fonts/"); | |
129 | } | |
130 | #endif | |
131 | ||
132 | #ifdef SDLAPP_FONT_DIR | |
133 | if (dirExists(SDLAPP_FONT_DIR)) { | |
134 | fonts_dir = SDLAPP_FONT_DIR; | |
135 | } | |
136 | #endif | |
137 | ||
138 | texturemanager.setDir(resource_dir); | |
139 | fontmanager.setDir(fonts_dir); | |
140 | } | |
141 | ||
142 | 54 | void SDLAppDisplay::enableVsync(bool vsync) { |
143 | 55 | this->vsync = vsync; |
144 | 56 | } |
158 | 70 | } |
159 | 71 | |
160 | 72 | void SDLAppDisplay::init(std::string window_title, int width, int height, bool fullscreen) { |
161 | detectPath(); | |
162 | 73 | |
163 | 74 | this->width = width; |
164 | 75 | this->height = height; |
46 | 46 | class SDLAppDisplay { |
47 | 47 | SDL_Surface *surface; |
48 | 48 | |
49 | std::string path; | |
50 | ||
51 | 49 | bool enable_shaders; |
52 | 50 | bool enable_alpha; |
53 | 51 | bool vsync; |
62 | 60 | |
63 | 61 | SDLAppDisplay(); |
64 | 62 | ~SDLAppDisplay(); |
65 | ||
66 | void displayArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs = 0); | |
67 | 63 | |
68 | 64 | void init(std::string window_title, int xres, int yres, bool fullscreen); |
69 | 65 | |
84 | 80 | void mode3D(float fov, float znear, float zfar); |
85 | 81 | void mode2D(); |
86 | 82 | |
87 | std::string getPath(); | |
88 | ||
89 | bool dirExists(std::string path); | |
90 | void detectPath(); | |
91 | ||
92 | 83 | vec4f currentColour(); |
93 | 84 | |
94 | 85 | void renderToTexture(GLuint target, int width, int height, GLenum internalFormat); |
26 | 26 | |
27 | 27 | #include "sdlapp.h" |
28 | 28 | |
29 | std::string gSDLAppResourceDir; | |
30 | ||
31 | #ifdef _WIN32 | |
32 | std::string gSDLAppPathSeparator = "\\"; | |
33 | #else | |
34 | std::string gSDLAppPathSeparator = "/"; | |
35 | #endif | |
36 | ||
37 | bool SDLAppDirExists(std::string dir) { | |
38 | struct stat st; | |
39 | return !stat(dir.c_str(), &st) && S_ISDIR(st.st_mode); | |
40 | } | |
41 | ||
42 | void SDLAppInit() { | |
43 | if(gSDLAppResourceDir.size()>0) return; | |
44 | ||
45 | std::string resource_dir = "data/"; | |
46 | std::string fonts_dir = "data/fonts/"; | |
47 | #ifdef _WIN32 | |
48 | char szAppPath[MAX_PATH]; | |
49 | GetModuleFileName(0, szAppPath, MAX_PATH); | |
50 | ||
51 | // Extract directory | |
52 | std::string exepath = std::string(szAppPath); | |
53 | ||
54 | int pos = exepath.rfind("\\"); | |
55 | ||
56 | path = exepath.substr(0, pos+1); | |
57 | resource_dir = path + std::string("\\data\\"); | |
58 | fonts_dir = path + std::string("\\data\\fonts\\"); | |
59 | #else | |
60 | //get working directory | |
61 | char cwd_buff[1024]; | |
62 | ||
63 | if(getcwd(cwd_buff, 1024) == cwd_buff) { | |
64 | resource_dir = std::string(cwd_buff) + std::string("/") + resource_dir; | |
65 | fonts_dir = std::string(cwd_buff) + std::string("/") + fonts_dir; | |
66 | } | |
67 | ||
68 | #endif | |
69 | ||
70 | #ifdef SDLAPP_RESOURCE_DIR | |
71 | if (SDLAppDirExists(SDLAPP_RESOURCE_DIR)) { | |
72 | resource_dir = SDLAPP_RESOURCE_DIR; | |
73 | fonts_dir = SDLAPP_RESOURCE_DIR + std::string("/fonts/"); | |
74 | } | |
75 | #endif | |
76 | ||
77 | #ifdef SDLAPP_FONT_DIR | |
78 | if (SDLAppDirExists(SDLAPP_FONT_DIR)) { | |
79 | fonts_dir = SDLAPP_FONT_DIR; | |
80 | } | |
81 | #endif | |
82 | ||
83 | texturemanager.setDir(resource_dir); | |
84 | fontmanager.setDir(fonts_dir); | |
85 | ||
86 | gSDLAppResourceDir = resource_dir; | |
87 | } | |
88 | ||
89 | void SDLAppParseArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs) { | |
90 | SDLAppInit(); | |
91 | ||
92 | for (int i=1; i<argc; i++) { | |
93 | debugLog("argv[%d] = %s\n", i, argv[i]); | |
94 | ||
95 | if (!strcmp(argv[i],"-f")) { | |
96 | *fullscreen = 1; | |
97 | continue; | |
98 | } | |
99 | else if (!strcmp(argv[i],"-w")) { | |
100 | *fullscreen = 0; | |
101 | continue; | |
102 | } | |
103 | ||
104 | //get video mode | |
105 | if(strchr(argv[i], '-') != 0 && strlen(argv[i])>1) { | |
106 | std::string argstr(argv[i], 1, strlen(argv[i])-1); | |
107 | debugLog("%s\n", argstr.c_str()); | |
108 | size_t x = argstr.rfind("x"); | |
109 | ||
110 | if(x != std::string::npos) { | |
111 | std::string widthstr = argstr.substr(0, x); | |
112 | std::string heightstr = argstr.substr(x+1); | |
113 | ||
114 | int width = atoi(widthstr.c_str()); | |
115 | int height = atoi(heightstr.c_str()); | |
116 | ||
117 | if(width!=0 && height!=0) { | |
118 | debugLog("w=%d, h=%d\n",width,height); | |
119 | ||
120 | *xres = width; | |
121 | *yres = height; | |
122 | continue; | |
123 | } | |
124 | } | |
125 | } | |
126 | ||
127 | // non display argument | |
128 | if(otherargs != 0) { | |
129 | otherargs->push_back(std::string(argv[i])); | |
130 | } | |
131 | } | |
132 | } | |
133 | ||
29 | 134 | SDLApp::SDLApp() { |
30 | 135 | fps=0; |
31 | 136 | return_code=0; |
32 | 32 | |
33 | 33 | #include <vector> |
34 | 34 | |
35 | extern std::string gSDLAppResourceDir; | |
36 | extern std::string gSDLAppPathSeparator; | |
37 | ||
38 | void SDLAppInit(); | |
39 | bool SDLAppDirExists(std::string dir); | |
40 | void SDLAppParseArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs = 0); | |
41 | ||
35 | 42 | class SDLApp { |
36 | 43 | int frame_count; |
37 | 44 | int fps_updater; |
16 | 16 | |
17 | 17 | #include "custom.h" |
18 | 18 | |
19 | Regex custom_regex("^([0-9]+)\\|([^|]+)\\|([ADM]?)\\|([^|]+)(?:\\|#?([A-F0-9]{6}))?"); | |
19 | Regex custom_regex("^([0-9]+)\\|([^|]*)\\|([ADM]?)\\|([^|]+)(?:\\|#?([A-F0-9]{6}))?"); | |
20 | 20 | |
21 | 21 | CustomLog::CustomLog(std::string logfile) : RCommitLog(logfile) { |
22 | 22 | } |
53 | 53 | |
54 | 54 | commit.username = entries[1]; |
55 | 55 | |
56 | if(commit.username.size()==0) { | |
57 | commit.username = "Unknown"; | |
58 | } | |
59 | ||
56 | 60 | std::string action = "A"; |
57 | 61 | |
58 | 62 | if(entries[2].size()>0) { |
67 | 71 | colour = parseColour(entries[4]); |
68 | 72 | } |
69 | 73 | |
70 | debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(), | |
71 | commit.timestamp, commit.username.c_str(), action.c_str()); | |
74 | // debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(), | |
75 | // commit.timestamp, commit.username.c_str(), action.c_str()); | |
72 | 76 | |
73 | 77 | if(has_colour) { |
74 | 78 | commit.addFile(entries[3], action, colour); |
76 | 80 | commit.addFile(entries[3], action); |
77 | 81 | } |
78 | 82 | |
79 | commit.debug(); | |
83 | //commit.debug(); | |
80 | 84 | |
81 | 85 | return true; |
82 | 86 | } |
24 | 24 | |
25 | 25 | float gGourceElasticity = 0.0; |
26 | 26 | |
27 | float gGourceBloomMultiplier = 1.0; | |
28 | float gGourceBloomIntensity = 0.75; | |
29 | ||
27 | 30 | bool gGourceNodeDebug = false; |
28 | 31 | bool gGourceGravity = true; |
29 | 32 | bool gGourceDrawDirName = true; |
33 | 36 | int gGourceFileInnerLoops = 0; |
34 | 37 | |
35 | 38 | std::map<std::string, RDirNode*> gGourceDirMap; |
36 | ||
37 | TextureResource* beamtex = 0; | |
38 | 39 | |
39 | 40 | RDirNode::RDirNode(RDirNode* parent, std::string abspath) { |
40 | 41 | |
53 | 54 | pos = parentPos; |
54 | 55 | } else { |
55 | 56 | pos = vec2f(0.0f, 0.0f); |
56 | } | |
57 | ||
58 | if(beamtex==0) { | |
59 | beamtex = texturemanager.grab("beam.png"); | |
60 | 57 | } |
61 | 58 | |
62 | 59 | float padded_file_radius = gGourceFileDiameter * 0.5; |
1003 | 1000 | |
1004 | 1001 | void RDirNode::drawEdgeShadows(float dt) { |
1005 | 1002 | |
1006 | if(parent==0) glBindTexture(GL_TEXTURE_2D, beamtex->textureid); | |
1007 | ||
1008 | 1003 | for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { |
1009 | 1004 | RDirNode* child = (*it); |
1010 | 1005 | |
1019 | 1014 | |
1020 | 1015 | void RDirNode::drawEdges(float dt) { |
1021 | 1016 | |
1022 | if(parent==0) glBindTexture(GL_TEXTURE_2D, beamtex->textureid); | |
1023 | ||
1024 | 1017 | for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { |
1025 | 1018 | RDirNode* child = (*it); |
1026 | 1019 | |
1030 | 1023 | |
1031 | 1024 | child->drawEdges(dt); |
1032 | 1025 | } |
1026 | } | |
1027 | } | |
1028 | ||
1029 | void RDirNode::drawBloom(Frustum& frustum, float dt) { | |
1030 | ||
1031 | if(isVisible() && frustum.boundsInFrustum(quadItemBounds)) { | |
1032 | ||
1033 | float bloom_radius = dir_radius * 2.0 * gGourceBloomMultiplier; | |
1034 | ||
1035 | vec4f bloom_col = col * gGourceBloomIntensity; | |
1036 | ||
1037 | glColor4f(bloom_col.x, bloom_col.y, bloom_col.z, 1.0); | |
1038 | ||
1039 | glPushMatrix(); | |
1040 | glTranslatef(pos.x, pos.y, 0.0); | |
1041 | ||
1042 | glBegin(GL_QUADS); | |
1043 | glTexCoord2f(1.0, 1.0); | |
1044 | glVertex2f(bloom_radius,bloom_radius); | |
1045 | glTexCoord2f(1.0, 0.0); | |
1046 | glVertex2f(bloom_radius,-bloom_radius); | |
1047 | glTexCoord2f(0.0, 0.0); | |
1048 | glVertex2f(-bloom_radius,-bloom_radius); | |
1049 | glTexCoord2f(0.0, 1.0); | |
1050 | glVertex2f(-bloom_radius,bloom_radius); | |
1051 | glEnd(); | |
1052 | glPopMatrix(); | |
1053 | ||
1054 | } | |
1055 | ||
1056 | for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { | |
1057 | RDirNode* node = (*it); | |
1058 | node->drawBloom(frustum,dt); | |
1033 | 1059 | } |
1034 | 1060 | } |
1035 | 1061 |
174 | 174 | void drawEdges(float dt); |
175 | 175 | void drawEdgeShadows(float dt); |
176 | 176 | |
177 | void drawBloom(Frustum& frustum, float dt); | |
178 | ||
177 | 179 | void drawShadows(Frustum& frustum, float dt); |
178 | 180 | void drawFiles(Frustum& frustum, float dt); |
179 | 181 | void drawSimple(Frustum& frustum, float dt); |
191 | 193 | extern float gGourceForceGravity; |
192 | 194 | extern bool gGourceDrawDirName; |
193 | 195 | |
196 | extern float gGourceBloomMultiplier; | |
197 | extern float gGourceBloomIntensity; | |
194 | 198 | extern float gGourceElasticity; |
195 | 199 | |
196 | 200 | extern std::map<std::string, RDirNode*> gGourceDirMap; |
62 | 62 | std::string command = getLogCommand(); |
63 | 63 | |
64 | 64 | //create temp file |
65 | char cmd_buff[2048]; | |
66 | char logfile_buff[1024]; | |
67 | ||
68 | #ifdef _WIN32 | |
69 | DWORD tmplen = GetTempPath(0, ""); | |
70 | ||
71 | if(tmplen == 0) return 0; | |
72 | ||
73 | std::vector<TCHAR> temp(tmplen+1); | |
74 | ||
75 | tmplen = GetTempPath(static_cast<DWORD>(temp.size()), &temp[0]); | |
76 | ||
77 | if(tmplen == 0 || tmplen >= temp.size()) return 0; | |
78 | ||
79 | std::string temp_file_path(temp.begin(), | |
80 | temp.begin() + static_cast<std::size_t>(tmplen)); | |
81 | ||
82 | temp_file_path += "gource.tmp"; | |
83 | ||
84 | sprintf(logfile_buff, "%s", temp_file_path.c_str()); | |
85 | #else | |
86 | uid_t myuid = getuid(); | |
87 | sprintf(logfile_buff, "/tmp/gource-%d.tmp", myuid); | |
88 | #endif | |
89 | ||
90 | sprintf(cmd_buff, "%s > %s", command.c_str(), logfile_buff); | |
91 | temp_file = std::string(logfile_buff); | |
65 | createTempLog(); | |
92 | 66 | |
93 | 67 | if(chdir(dir.c_str()) != 0) { |
94 | 68 | return 0; |
95 | 69 | } |
96 | 70 | |
71 | char cmd_buff[2048]; | |
72 | sprintf(cmd_buff, "%s > %s", command.c_str(), temp_file.c_str()); | |
73 | ||
97 | 74 | int command_rc = system(cmd_buff); |
98 | 75 | |
99 | 76 | if(command_rc != 0) { |
77 | chdir(cwd_buff); | |
100 | 78 | return 0; |
101 | 79 | } |
102 | 80 | |
103 | 81 | // check for new-enough Git version |
104 | 82 | // if %aN does not appear to be supported try %an |
105 | std::ifstream in(logfile_buff); | |
83 | std::ifstream in(temp_file.c_str()); | |
106 | 84 | char firstBytes[9]; |
107 | 85 | in.read(firstBytes, 8); |
108 | 86 | in.close(); |
18 | 18 | |
19 | 19 | float gGourceAutoSkipSeconds = 3.0; |
20 | 20 | bool gGourceFileLoop = false; |
21 | bool gGourceHideTree = false; | |
22 | bool gGourceHideFiles = false; | |
21 | 23 | bool gGourceHideUsernames = false; |
22 | 24 | bool gGourceHideDate = false; |
25 | bool gGourceDisableBloom = false; | |
23 | 26 | bool gGourceDisableProgress = false; |
24 | 27 | bool gGourceQuadTreeDebug = false; |
25 | 28 | |
116 | 119 | RECT windowRect; |
117 | 120 | if(GetWindowRect(consoleWindow, &windowRect)) { |
118 | 121 | float width = windowRect.right - windowRect.left; |
119 | MoveWindow(consoleWindow,windowRect.left,windowRect.top,width,850,true); | |
122 | MoveWindow(consoleWindow,windowRect.left,windowRect.top,width,1000,true); | |
120 | 123 | } |
121 | 124 | } |
122 | 125 | #endif |
153 | 156 | |
154 | 157 | printf(" --log-format FORMAT Specify format of log (git,cvs,custom)\n"); |
155 | 158 | printf(" --git-branch Get the git log of a particular branch\n"); |
156 | printf(" --git-log-command Show git-log command used by gource\n"); | |
157 | printf(" --cvs-exp-command Show cvs-exp.pl log command used by gource\n\n"); | |
159 | printf(" --git-log-command Show git log command used by gource\n"); | |
160 | printf(" --cvs-exp-command Show cvs-exp.pl log command used by gource\n"); | |
161 | printf(" --hg-log-command Show hg log (Mercurial) command used by gource\n\n"); | |
158 | 162 | |
159 | 163 | printf(" --multi-sampling Enable multi-sampling\n"); |
160 | 164 | printf(" --crop AXIS Crop view on an axis (vertical,horizontal)\n\n"); |
161 | 165 | |
166 | printf(" --bloom-multiplier Adjust the amount of bloom (default: 1.0)\n"); | |
167 | printf(" --bloom-intensity Adjust the intensity of the bloom (default: 0.75)\n\n"); | |
168 | ||
162 | 169 | printf(" --disable-auto-skip Disable auto skipping\n"); |
163 | printf(" --disable-progress Disable the progress bar\n\n"); | |
170 | printf(" --disable-progress Disable the progress bar\n"); | |
171 | printf(" --disable-bloom Disable bloom effect\n\n"); | |
164 | 172 | |
165 | 173 | printf(" --hide-users Hide users\n"); |
174 | printf(" --hide-tree Hide the tree\n"); | |
175 | printf(" --hide-files Hide files\n"); | |
166 | 176 | printf(" --hide-usernames Hide usernames\n"); |
167 | 177 | printf(" --hide-filenames Hide filenames\n"); |
168 | 178 | printf(" --hide-dirnames Hide directory names\n"); |
218 | 228 | delete clog; |
219 | 229 | } |
220 | 230 | |
231 | if(gGourceLogFormat == "hg") { | |
232 | clog = new MercurialLog(logfile); | |
233 | if(clog->checkFormat()) return clog; | |
234 | delete clog; | |
235 | } | |
236 | ||
221 | 237 | if(gGourceLogFormat == "cvs") { |
222 | 238 | clog = new CVSEXPCommitLog(logfile); |
223 | 239 | if(clog->checkFormat()) return clog; |
246 | 262 | |
247 | 263 | delete clog; |
248 | 264 | |
265 | //mercurial | |
266 | debugLog("trying mercurial...\n"); | |
267 | clog = new MercurialLog(logfile); | |
268 | if(clog->checkFormat()) return clog; | |
269 | ||
270 | delete clog; | |
271 | ||
249 | 272 | //git raw |
250 | 273 | debugLog("trying git raw...\n"); |
251 | 274 | clog = new GitRawCommitLog(logfile); |
295 | 318 | font.dropShadow(true); |
296 | 319 | font.roundCoordinates(true); |
297 | 320 | |
321 | bloomtex = texturemanager.grab("bloom.tga"); | |
322 | beamtex = texturemanager.grab("beam.png"); | |
323 | ||
298 | 324 | start_position = 0.0; |
299 | 325 | stop_position = 0.0; |
300 | 326 | |
327 | 353 | |
328 | 354 | root = 0; |
329 | 355 | |
330 | background_colour = vec3f(0.25, 0.25, 0.25); | |
356 | background_colour = vec3f(0.0, 0.0, 0.0); | |
331 | 357 | |
332 | 358 | //min phsyics rate 60fps (ie maximum allowed delta 1.0/60) |
333 | 359 | max_tick_rate = 1.0 / 60.0; |
890 | 916 | void Gource::seekTo(float percent) { |
891 | 917 | debugLog("seekTo(%.2f)\n", percent); |
892 | 918 | |
893 | if(!canSeek()) return; | |
919 | if(commitlog == 0 || !commitlog->isSeekable()) return; | |
894 | 920 | |
895 | 921 | // end pause |
896 | 922 | if(paused) paused = false; |
1268 | 1294 | if(logfile.size() == 0 || logfile == ".") { |
1269 | 1295 | SDL_Quit(); |
1270 | 1296 | gource_help(""); |
1271 | } else if(display.dirExists(logfile)) { | |
1297 | } else if(SDLAppDirExists(logfile)) { | |
1272 | 1298 | gource_quit("Directory not supported."); |
1273 | 1299 | } else { |
1274 | 1300 | gource_quit("Unsupported log format. You may need to regenerate your log file."); |
1282 | 1308 | |
1283 | 1309 | slider.logic(dt); |
1284 | 1310 | |
1285 | if(paused) return; | |
1311 | //still want to update camera while paused | |
1312 | if(paused) { | |
1313 | updateCamera(dt); | |
1314 | return; | |
1315 | } | |
1286 | 1316 | |
1287 | 1317 | // get more entries |
1288 | 1318 | if(commitqueue.size() == 0) { |
1312 | 1342 | subseconds -= (int) subseconds; |
1313 | 1343 | } |
1314 | 1344 | |
1315 | currtime += seconds; | |
1345 | currtime += seconds; | |
1316 | 1346 | |
1317 | 1347 | // delete files |
1318 | 1348 | for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) { |
1489 | 1519 | font.print(display.width/2 - width/2, display.height/2 - 10, "%s", loading_message.c_str()); |
1490 | 1520 | } |
1491 | 1521 | |
1492 | void Gource::draw(float t, float dt) { | |
1493 | ||
1522 | void Gource::drawBackground(float dt) { | |
1494 | 1523 | display.setClearColour(background_colour); |
1495 | 1524 | display.clear(); |
1496 | ||
1497 | if(draw_loading) { | |
1498 | loadingScreen(); | |
1499 | draw_loading = false; | |
1500 | return; | |
1501 | } | |
1502 | ||
1503 | Frustum frustum(camera); | |
1504 | ||
1505 | trace_time = SDL_GetTicks(); | |
1506 | ||
1507 | mousetrace(frustum,dt); | |
1508 | ||
1509 | trace_time = SDL_GetTicks() - trace_time; | |
1510 | ||
1511 | glMatrixMode(GL_PROJECTION); | |
1512 | glLoadIdentity(); | |
1513 | ||
1514 | camera.focus(); | |
1515 | ||
1516 | glMatrixMode(GL_MODELVIEW); | |
1517 | glLoadIdentity(); | |
1518 | ||
1525 | } | |
1526 | ||
1527 | void Gource::drawTree(Frustum& frustum, float dt) { | |
1519 | 1528 | draw_tree_time = SDL_GetTicks(); |
1520 | 1529 | |
1521 | 1530 | root->calcEdges(); |
1530 | 1539 | glPushMatrix(); |
1531 | 1540 | glLoadIdentity(); |
1532 | 1541 | |
1533 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
1534 | 1542 | glEnable(GL_BLEND); |
1535 | 1543 | glEnable(GL_TEXTURE_2D); |
1536 | 1544 | |
1537 | //draw edges | |
1538 | root->drawEdgeShadows(dt); | |
1539 | root->drawEdges(dt); | |
1545 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
1546 | ||
1547 | if(!gGourceHideTree) { | |
1548 | glBindTexture(GL_TEXTURE_2D, beamtex->textureid); | |
1549 | ||
1550 | root->drawEdgeShadows(dt); | |
1551 | root->drawEdges(dt); | |
1552 | } | |
1540 | 1553 | |
1541 | 1554 | //switch back |
1542 | 1555 | glMatrixMode(GL_PROJECTION); |
1548 | 1561 | glEnable(GL_TEXTURE_2D); |
1549 | 1562 | glEnable(GL_BLEND); |
1550 | 1563 | |
1564 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
1565 | ||
1551 | 1566 | //draw shadows |
1552 | 1567 | |
1553 | 1568 | if(!gGourceHideUsers) { |
1556 | 1571 | } |
1557 | 1572 | } |
1558 | 1573 | |
1559 | root->drawShadows(frustum, dt); | |
1574 | if(!gGourceHideFiles) { | |
1575 | root->drawShadows(frustum, dt); | |
1576 | } | |
1577 | ||
1578 | drawActions(dt); | |
1579 | ||
1580 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
1581 | ||
1582 | if(!trace_debug) { | |
1583 | if(!gGourceHideFiles) { | |
1584 | root->drawFiles(frustum,dt); | |
1585 | } | |
1586 | } else { | |
1587 | root->drawSimple(frustum,dt); | |
1588 | } | |
1589 | ||
1590 | draw_tree_time = SDL_GetTicks() - draw_tree_time; | |
1591 | } | |
1592 | ||
1593 | void Gource::drawActions(float dt) { | |
1594 | if(gGourceHideUsers) return; | |
1595 | ||
1596 | glBindTexture(GL_TEXTURE_2D, beamtex->textureid); | |
1597 | glEnable(GL_TEXTURE_2D); | |
1598 | glEnable(GL_BLEND); | |
1599 | ||
1600 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
1560 | 1601 | |
1561 | 1602 | //draw actions |
1562 | 1603 | for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) { |
1563 | 1604 | it->second->drawActions(dt); |
1564 | 1605 | } |
1606 | } | |
1607 | ||
1608 | void Gource::drawBloom(Frustum &frustum, float dt) { | |
1609 | if(gGourceDisableBloom) return; | |
1610 | ||
1611 | glEnable(GL_TEXTURE_2D); | |
1612 | glEnable(GL_BLEND); | |
1613 | ||
1614 | //draw 'gourceian blur' around dirnodes | |
1615 | glBindTexture(GL_TEXTURE_2D, bloomtex->textureid); | |
1616 | glBlendFunc (GL_ONE, GL_ONE); | |
1617 | root->drawBloom(frustum, dt); | |
1565 | 1618 | |
1566 | 1619 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1567 | ||
1568 | glColor4f(0.0, 1.0, 0.0, 1.0); | |
1569 | trace_debug ? root->drawSimple(frustum,dt) : root->drawFiles(frustum,dt); | |
1570 | ||
1571 | draw_tree_time = SDL_GetTicks() - draw_tree_time; | |
1620 | } | |
1621 | ||
1622 | void Gource::draw(float t, float dt) { | |
1623 | ||
1624 | display.mode2D(); | |
1625 | ||
1626 | drawBackground(dt); | |
1627 | ||
1628 | if(draw_loading) { | |
1629 | loadingScreen(); | |
1630 | draw_loading = false; | |
1631 | return; | |
1632 | } | |
1633 | ||
1634 | Frustum frustum(camera); | |
1635 | ||
1636 | trace_time = SDL_GetTicks(); | |
1637 | ||
1638 | mousetrace(frustum,dt); | |
1639 | ||
1640 | trace_time = SDL_GetTicks() - trace_time; | |
1641 | ||
1642 | glMatrixMode(GL_PROJECTION); | |
1643 | glLoadIdentity(); | |
1644 | ||
1645 | camera.focus(); | |
1646 | ||
1647 | glMatrixMode(GL_MODELVIEW); | |
1648 | glLoadIdentity(); | |
1649 | ||
1650 | //draw tree | |
1651 | drawTree(frustum, dt); | |
1572 | 1652 | |
1573 | 1653 | glColor4f(1.0, 1.0, 0.0, 1.0); |
1574 | 1654 | for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) { |
1575 | 1655 | trace_debug ? it->second->drawSimple(dt) : it->second->draw(dt); |
1576 | 1656 | } |
1577 | 1657 | |
1578 | ||
1579 | 1658 | glEnable(GL_TEXTURE_2D); |
1580 | 1659 | glEnable(GL_BLEND); |
1581 | 1660 | |
1582 | root->drawNames(font,frustum); | |
1583 | ||
1584 | if(!gGourceHideUsernames) { | |
1661 | //draw bloom | |
1662 | drawBloom(frustum, dt); | |
1663 | ||
1664 | if(!(gGourceHideFiles || gGourceHideFilenames)) { | |
1665 | root->drawNames(font,frustum); | |
1666 | } | |
1667 | ||
1668 | if(!(gGourceHideUsernames || gGourceHideUsers)) { | |
1585 | 1669 | for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) { |
1586 | 1670 | it->second->drawName(); |
1587 | 1671 | } |
17 | 17 | #ifndef GOURCE_H |
18 | 18 | #define GOURCE_H |
19 | 19 | |
20 | #define GOURCE_VERSION "0.17" | |
20 | #define GOURCE_VERSION "0.20" | |
21 | 21 | |
22 | 22 | #ifdef _WIN32 |
23 | 23 | #include "windows.h" |
35 | 35 | #include "core/regex.h" |
36 | 36 | |
37 | 37 | #include "git.h" |
38 | #include "hg.h" | |
38 | 39 | #include "gitraw.h" |
39 | 40 | #include "cvs-exp.h" |
40 | 41 | #include "custom.h" |
98 | 99 | std::string displaydate; |
99 | 100 | int date_x_offset; |
100 | 101 | |
102 | TextureResource* bloomtex; | |
103 | TextureResource* beamtex; | |
104 | ||
101 | 105 | FXFont font, fontlarge, fontmedium; |
102 | 106 | |
103 | 107 | bool first_read; |
108 | 112 | int frameskip; |
109 | 113 | int framecount; |
110 | 114 | |
115 | time_t currtime; | |
111 | 116 | float runtime; |
112 | long currtime; | |
113 | 117 | float subseconds; |
114 | 118 | |
115 | 119 | float splash; |
172 | 176 | void zoom(bool zoomin); |
173 | 177 | |
174 | 178 | void loadingScreen(); |
179 | void drawBackground(float dt); | |
180 | void drawActions(float dt); | |
181 | void drawTree(Frustum &frustum, float dt); | |
182 | void drawBloom(Frustum &frustum, float dt); | |
175 | 183 | public: |
176 | 184 | Gource(std::string logfile); |
177 | 185 | ~Gource(); |
200 | 208 | |
201 | 209 | extern float gGourceAutoSkipSeconds; |
202 | 210 | extern bool gGourceHideUsernames; |
211 | extern bool gGourceDisableBloom; | |
203 | 212 | extern bool gGourceHideDate; |
213 | extern bool gGourceHideFiles; | |
214 | extern bool gGourceHideTree; | |
204 | 215 | extern bool gGourceDisableProgress; |
205 | 216 | extern bool gGourceFileLoop; |
206 | 217 | extern int gGourceMaxFiles; |
0 | /* | |
1 | Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com) | |
2 | ||
3 | This program is free software; you can redistribute it and/or | |
4 | modify it under the terms of the GNU General Public License | |
5 | as published by the Free Software Foundation; either version | |
6 | 3 of the License, or (at your option) any later version. | |
7 | ||
8 | This program is distributed in the hope that it will be useful, | |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | GNU General Public License for more details. | |
12 | ||
13 | You should have received a copy of the GNU General Public License | |
14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | */ | |
16 | ||
17 | #include "hg.h" | |
18 | ||
19 | Regex hg_regex("^([0-9]+) -?[0-9]+\\|([^|]+)\\|([ADM]?)\\|(.+)$"); | |
20 | ||
21 | // parse Mercurial log entries (using the gource.style template) | |
22 | ||
23 | std::string gGourceMercurialCommand() { | |
24 | ||
25 | std::string gource_style_path = gSDLAppResourceDir + std::string("gource.style"); | |
26 | ||
27 | return std::string("hg log --style ") + gource_style_path; | |
28 | } | |
29 | ||
30 | MercurialLog::MercurialLog(std::string logfile) : RCommitLog(logfile) { | |
31 | ||
32 | log_command = gGourceMercurialCommand(); | |
33 | ||
34 | //can generate log from directory | |
35 | if(!logf && is_dir) { | |
36 | logf = generateLog(logfile); | |
37 | ||
38 | if(logf) { | |
39 | success = true; | |
40 | seekable = true; | |
41 | } | |
42 | } | |
43 | } | |
44 | ||
45 | BaseLog* MercurialLog::generateLog(std::string dir) { | |
46 | ||
47 | //does directory have a .git ? | |
48 | std::string hgdir = dir + std::string("/.hg"); | |
49 | struct stat dirinfo; | |
50 | int stat_rc = stat(hgdir.c_str(), &dirinfo); | |
51 | if(stat_rc!=0 || !(dirinfo.st_mode & S_IFDIR)) { | |
52 | return 0; | |
53 | } | |
54 | ||
55 | std::string command = getLogCommand(); | |
56 | ||
57 | createTempLog(); | |
58 | ||
59 | char cmd_buff[2048]; | |
60 | sprintf(cmd_buff, "%s %s > %s", command.c_str(), dir.c_str(), temp_file.c_str()); | |
61 | ||
62 | int command_rc = system(cmd_buff); | |
63 | ||
64 | if(command_rc != 0) { | |
65 | return 0; | |
66 | } | |
67 | ||
68 | BaseLog* seeklog = new SeekLog(temp_file); | |
69 | ||
70 | return seeklog; | |
71 | } | |
72 | ||
73 | ||
74 | bool MercurialLog::parseCommit(RCommit& commit) { | |
75 | ||
76 | std::string line; | |
77 | std::vector<std::string> entries; | |
78 | ||
79 | if(!logf->getNextLine(line)) return false; | |
80 | ||
81 | //custom line | |
82 | if(!hg_regex.match(line, &entries)) return false; | |
83 | ||
84 | commit.timestamp = atol(entries[0].c_str()); | |
85 | ||
86 | commit.username = entries[1]; | |
87 | ||
88 | std::string action = "A"; | |
89 | ||
90 | if(entries[2].size()>0) { | |
91 | action = entries[2]; | |
92 | } | |
93 | ||
94 | bool has_colour = false; | |
95 | vec3f colour; | |
96 | ||
97 | // debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(), | |
98 | // commit.timestamp, commit.username.c_str(), action.c_str()); | |
99 | ||
100 | if(has_colour) { | |
101 | commit.addFile(entries[3], action, colour); | |
102 | } else { | |
103 | commit.addFile(entries[3], action); | |
104 | } | |
105 | ||
106 | //commit.debug(); | |
107 | ||
108 | return true; | |
109 | }⏎ |
0 | /* | |
1 | Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com) | |
2 | ||
3 | This program is free software; you can redistribute it and/or | |
4 | modify it under the terms of the GNU General Public License | |
5 | as published by the Free Software Foundation; either version | |
6 | 3 of the License, or (at your option) any later version. | |
7 | ||
8 | This program is distributed in the hope that it will be useful, | |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | GNU General Public License for more details. | |
12 | ||
13 | You should have received a copy of the GNU General Public License | |
14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | */ | |
16 | ||
17 | #ifndef MERCURIALLOG_H | |
18 | #define MERCURIALLOG_H | |
19 | ||
20 | #include "commitlog.h" | |
21 | ||
22 | std::string gGourceMercurialCommand(); | |
23 | ||
24 | class MercurialLog : public RCommitLog { | |
25 | protected: | |
26 | bool parseCommit(RCommit& commit); | |
27 | BaseLog* generateLog(std::string dir); | |
28 | public: | |
29 | MercurialLog(std::string logfile); | |
30 | }; | |
31 | ||
32 | #endif⏎ |
22 | 22 | int height = 768; |
23 | 23 | bool fullscreen=false; |
24 | 24 | bool multisample=false; |
25 | vec3f background = vec3f(0.25, 0.25, 0.25); | |
25 | vec3f background = vec3f(0.1, 0.1, 0.1); | |
26 | 26 | |
27 | 27 | int video_framerate = 60; |
28 | 28 | std::string ppm_file_name; |
39 | 39 | |
40 | 40 | std::vector<std::string> arguments; |
41 | 41 | |
42 | display.displayArgs(argc, argv, &width, &height, &fullscreen, &arguments); | |
42 | SDLAppParseArgs(argc, argv, &width, &height, &fullscreen, &arguments); | |
43 | 43 | |
44 | 44 | for(int i=0;i<arguments.size();i++) { |
45 | 45 | std::string args = arguments[i]; |
65 | 65 | continue; |
66 | 66 | } |
67 | 67 | |
68 | if(args == "--git-log-command" || args == "--cvs-exp-command") { | |
69 | ||
70 | if(args == "--git-log-command") { | |
68 | if(args == "--git-log-command") { | |
71 | 69 | gource_info(gGourceGitLogCommand); |
72 | } else { | |
70 | } | |
71 | ||
72 | if(args == "--cvs-exp-command") { | |
73 | 73 | gource_info(gGourceCvsExpLogCommand); |
74 | } | |
75 | } | |
74 | } | |
75 | ||
76 | if(args == "--hg-log-command") { | |
77 | std::string command = gGourceMercurialCommand(); | |
78 | ||
79 | gource_info(command); | |
80 | } | |
81 | ||
76 | 82 | |
77 | 83 | if(args == "--date-format") { |
78 | 84 | |
100 | 106 | continue; |
101 | 107 | } |
102 | 108 | |
109 | if(args == "--disable-bloom") { | |
110 | gGourceDisableBloom = true; | |
111 | continue; | |
112 | } | |
113 | ||
103 | 114 | if(args == "--hide-users") { |
104 | 115 | gGourceHideUsers = true; |
116 | continue; | |
117 | } | |
118 | ||
119 | if(args == "--hide-tree") { | |
120 | gGourceHideTree = true; | |
121 | continue; | |
122 | } | |
123 | ||
124 | if(args == "--hide-files") { | |
125 | gGourceHideFiles = true; | |
105 | 126 | continue; |
106 | 127 | } |
107 | 128 | |
193 | 214 | continue; |
194 | 215 | } |
195 | 216 | |
217 | if(args == "--bloom-intensity") { | |
218 | if((i+1)>=arguments.size()) { | |
219 | gource_help("specify bloom-intensity (float)"); | |
220 | } | |
221 | ||
222 | gGourceBloomIntensity = atof(arguments[++i].c_str()); | |
223 | ||
224 | if(gGourceBloomIntensity<=0.0) { | |
225 | gource_help("invalid bloom-intensity value"); | |
226 | } | |
227 | ||
228 | continue; | |
229 | } | |
230 | ||
231 | if(args == "--bloom-multiplier") { | |
232 | ||
233 | if((i+1)>=arguments.size()) { | |
234 | gource_help("specify bloom-multiplier (float)"); | |
235 | } | |
236 | ||
237 | gGourceBloomMultiplier = atof(arguments[++i].c_str()); | |
238 | ||
239 | if(gGourceBloomMultiplier<=0.0) { | |
240 | gource_help("invalid bloom-multiplier value"); | |
241 | } | |
242 | ||
243 | continue; | |
244 | } | |
245 | ||
196 | 246 | if(args == "-e" || args == "--elasticity") { |
197 | 247 | |
198 | 248 | if((i+1)>=arguments.size()) { |