tavli

diff src/scenery.cc @ 19:37dead56f01e

fixed shadows
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Jun 2015 06:18:45 +0300
parents 986c0b76513f
children c2a2069a49ec
line diff
     1.1 --- a/src/scenery.cc	Mon Jun 29 01:29:36 2015 +0300
     1.2 +++ b/src/scenery.cc	Mon Jun 29 06:18:45 2015 +0300
     1.3 @@ -22,7 +22,9 @@
     1.4  	{5.99, 0},	// mid 1
     1.5  	{6, -0.1},
     1.6  	{6.1, -0.1},	// mid 2
     1.7 -	{6.13, -0.3}
     1.8 +	{6.13, -0.3},
     1.9 +	{3, -0.3},	// mid 3
    1.10 +	{0, -0.3}
    1.11  };
    1.12  static const BezCurve table_curve = {
    1.13  	sizeof table_cp / sizeof *table_cp,
    1.14 @@ -34,7 +36,6 @@
    1.15  
    1.16  bool init_scenery()
    1.17  {
    1.18 -	unsigned int sdr = opt.shadows && sdr_shadow ? sdr_shadow : sdr_phong;
    1.19  	if(!gen_textures()) {
    1.20  		return false;
    1.21  	}
    1.22 @@ -58,7 +59,6 @@
    1.23  	otable->mtl.specular = Vector3(0.7, 0.7, 0.7);
    1.24  	otable->xform().set_translation(Vector3(0, -0.025, 0));
    1.25  	otable->set_texture(img_marble.texture());
    1.26 -	otable->set_shader(sdr);
    1.27  	obj.push_back(otable);
    1.28  
    1.29  
    1.30 @@ -86,11 +86,14 @@
    1.31  
    1.32  void draw_scenery()
    1.33  {
    1.34 +	unsigned int sdr = opt.shadows && sdr_shadow ? sdr_shadow : sdr_phong;
    1.35 +
    1.36  	for(size_t i=0; i<obj.size(); i++) {
    1.37  		if(wireframe) {
    1.38  			obj[i]->draw_wire();
    1.39  			obj[i]->draw_normals(0.075);
    1.40  		} else {
    1.41 +			obj[i]->set_shader(sdr);
    1.42  			obj[i]->draw();
    1.43  		}
    1.44  	}