3dphotoshoot

changeset 27:3d082c566b53 tip

fixed all the bugs, pc version works
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 18 Jun 2015 04:32:25 +0300
parents a460b1e5af4a
children
files libs/drawtext/font.c sdr/color.p.glsl sdr/font.p.glsl sdr/normvis.p.glsl sdr/tex.p.glsl src/assman.c src/game.cc src/pc/camera.c src/pc/main.c
diffstat 9 files changed, 26 insertions(+), 14 deletions(-) [+]
line diff
     1.1 --- a/libs/drawtext/font.c	Thu Jun 18 03:55:05 2015 +0300
     1.2 +++ b/libs/drawtext/font.c	Thu Jun 18 04:32:25 2015 +0300
     1.3 @@ -472,9 +472,9 @@
     1.4  	}
     1.5  
     1.6  	for(i=0; i<num_pixels; i++) {
     1.7 -		long c = ass_fgetc(fp);
     1.8 +		int c = ass_fgetc(fp);
     1.9  		if(c == -1) {
    1.10 -			fprintf(stderr, "unexpected end of file while reading pixels\n");
    1.11 +			fprintf(stderr, "unexpected end of file while reading pixels (%d/%d)\n", i, num_pixels);
    1.12  			goto err;
    1.13  		}
    1.14  		gmap->pixels[i] = 255 * c / max_pixval;
     2.1 --- a/sdr/color.p.glsl	Thu Jun 18 03:55:05 2015 +0300
     2.2 +++ b/sdr/color.p.glsl	Thu Jun 18 04:32:25 2015 +0300
     2.3 @@ -1,4 +1,6 @@
     2.4 -precision mediump float;
     2.5 +#ifdef GL_ES
     2.6 +precision lowp float;
     2.7 +#endif
     2.8  
     2.9  uniform vec4 color;
    2.10  
     3.1 --- a/sdr/font.p.glsl	Thu Jun 18 03:55:05 2015 +0300
     3.2 +++ b/sdr/font.p.glsl	Thu Jun 18 04:32:25 2015 +0300
     3.3 @@ -1,4 +1,6 @@
     3.4 -precision mediump float;
     3.5 +#ifdef GL_ES
     3.6 +precision lowp float;
     3.7 +#endif
     3.8  
     3.9  uniform sampler2D tex;
    3.10  uniform vec4 color;
     4.1 --- a/sdr/normvis.p.glsl	Thu Jun 18 03:55:05 2015 +0300
     4.2 +++ b/sdr/normvis.p.glsl	Thu Jun 18 04:32:25 2015 +0300
     4.3 @@ -1,10 +1,12 @@
     4.4 +#ifdef GL_ES
     4.5  precision mediump float;
     4.6 +#endif
     4.7  
     4.8  varying vec3 normal;
     4.9  
    4.10  void main()
    4.11  {
    4.12 -	vec3 ncol = normal * 0.5 + 0.5;
    4.13 +	vec3 ncol = normalize(normal) * 0.5 + 0.5;
    4.14  	gl_FragColor.rgb = ncol;
    4.15  	gl_FragColor.a = 1.0;
    4.16  }
     5.1 --- a/sdr/tex.p.glsl	Thu Jun 18 03:55:05 2015 +0300
     5.2 +++ b/sdr/tex.p.glsl	Thu Jun 18 04:32:25 2015 +0300
     5.3 @@ -1,4 +1,6 @@
     5.4 -precision mediump float;
     5.5 +#ifdef GL_ES
     5.6 +precision lowp float;
     5.7 +#endif
     5.8  
     5.9  uniform sampler2D tex;
    5.10  
     6.1 --- a/src/assman.c	Thu Jun 18 03:55:05 2015 +0300
     6.2 +++ b/src/assman.c	Thu Jun 18 04:32:25 2015 +0300
     6.3 @@ -1,13 +1,14 @@
     6.4 +#include <stdio.h>
     6.5  #include "assman.h"
     6.6  
     6.7  int ass_fgetc(ass_file *fp)
     6.8  {
     6.9 -	char c;
    6.10 +	unsigned char c;
    6.11  
    6.12  	if(ass_fread(&c, 1, 1, fp) < 1) {
    6.13  		return -1;
    6.14  	}
    6.15 -	return c;
    6.16 +	return (int)c;
    6.17  }
    6.18  
    6.19  char *ass_fgets(char *s, int size, ass_file *fp)
     7.1 --- a/src/game.cc	Thu Jun 18 03:55:05 2015 +0300
     7.2 +++ b/src/game.cc	Thu Jun 18 04:32:25 2015 +0300
     7.3 @@ -37,8 +37,8 @@
     7.4  
     7.5  extern "C" int game_init(void)
     7.6  {
     7.7 -	//glEnable(GL_DEPTH_TEST);
     7.8 -	//glEnable(GL_CULL_FACE);
     7.9 +	glEnable(GL_DEPTH_TEST);
    7.10 +	glEnable(GL_CULL_FACE);
    7.11  
    7.12  	glClearColor(0.4, 0.4, 0.4, 1);
    7.13  
    7.14 @@ -89,6 +89,8 @@
    7.15  
    7.16  	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    7.17  
    7.18 +	glDisable(GL_DEPTH_TEST);
    7.19 +
    7.20  	// draw video preview frame
    7.21  	gl_matrix_mode(GL_PROJECTION);
    7.22  	gl_push_matrix();
    7.23 @@ -112,6 +114,7 @@
    7.24  	gl_pop_matrix();
    7.25  	// done drawing preview
    7.26  
    7.27 +	glEnable(GL_DEPTH_TEST);
    7.28  
    7.29  	gl_matrix_mode(GL_MODELVIEW);
    7.30  	gl_load_identity();
     8.1 --- a/src/pc/camera.c	Thu Jun 18 03:55:05 2015 +0300
     8.2 +++ b/src/pc/camera.c	Thu Jun 18 04:32:25 2015 +0300
     8.3 @@ -28,9 +28,9 @@
     8.4  			float wave = cos(len * 4.0 * M_PI);
     8.5  			int band = wave >= 0 ? 0 : 1;
     8.6  
     8.7 -			*pptr++ = pal[band][chess][0];
     8.8 -			*pptr++ = pal[band][chess][1];
     8.9 -			*pptr++ = pal[band][chess][2];
    8.10 +			*pptr++ = pal[band][chess][0] / 2;
    8.11 +			*pptr++ = pal[band][chess][1] / 2;
    8.12 +			*pptr++ = pal[band][chess][2] / 2;
    8.13  		}
    8.14  	}
    8.15  
     9.1 --- a/src/pc/main.c	Thu Jun 18 03:55:05 2015 +0300
     9.2 +++ b/src/pc/main.c	Thu Jun 18 04:32:25 2015 +0300
     9.3 @@ -21,7 +21,7 @@
     9.4  int main(int argc, char **argv)
     9.5  {
     9.6  	glutInit(&argc, argv);
     9.7 -	glutInitWindowSize(800, 600);
     9.8 +	glutInitWindowSize(1280, 800);
     9.9  	glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    9.10  	glutCreateWindow("3dphotoshoot (PC)");
    9.11