tavli

diff src/scenery.cc @ 15:b1a195c3ee16

added shaders
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 28 Jun 2015 08:34:24 +0300
parents 283eb6e9f0a3
children 986c0b76513f
line diff
     1.1 --- a/src/scenery.cc	Sun Jun 28 07:44:23 2015 +0300
     1.2 +++ b/src/scenery.cc	Sun Jun 28 08:34:24 2015 +0300
     1.3 @@ -7,6 +7,7 @@
     1.4  #include "object.h"
     1.5  #include "revol.h"
     1.6  #include "image.h"
     1.7 +#include "sdr.h"
     1.8  
     1.9  static bool gen_textures();
    1.10  
    1.11 @@ -18,9 +19,9 @@
    1.12  	{3, 0},	// mid 0
    1.13  	{5.8, 0},
    1.14  	{5.99, 0},	// mid 1
    1.15 -	{6, -0.15},
    1.16 -	{6.15, -0.15},	// mid 2
    1.17 -	{6.2, -0.4}
    1.18 +	{6, -0.1},
    1.19 +	{6.1, -0.1},	// mid 2
    1.20 +	{6.13, -0.3}
    1.21  };
    1.22  static const BezCurve table_curve = {
    1.23  	sizeof table_cp / sizeof *table_cp,
    1.24 @@ -39,7 +40,7 @@
    1.25  	Matrix4x4 xform;
    1.26  
    1.27  	Mesh *table = new Mesh;
    1.28 -	gen_revol(table, 48, 12, bezier_revol, bezier_revol_normal, (void*)&table_curve);
    1.29 +	gen_revol(table, 48, 16, bezier_revol, bezier_revol_normal, (void*)&table_curve);
    1.30  	table->texcoord_gen_plane(Vector3(0, 1, 0), Vector3(1, 0, 0));
    1.31  	xform.set_scaling(Vector3(0.5, 0.5, 0.5));
    1.32  	xform.translate(Vector3(1, 1, 0));
    1.33 @@ -51,10 +52,11 @@
    1.34  
    1.35  	Object *otable = new Object;
    1.36  	otable->set_mesh(table);
    1.37 -	otable->mtl.diffuse = Vector3(0.6, 0.6, 0.6);
    1.38 -	otable->mtl.specular = Vector3(0.8, 0.8, 0.8);
    1.39 +	otable->mtl.diffuse = Vector3(1, 1, 1);
    1.40 +	otable->mtl.specular = Vector3(0.7, 0.7, 0.7);
    1.41  	otable->xform().set_translation(Vector3(0, -0.025, 0));
    1.42  	otable->set_texture(img_marble.texture());
    1.43 +	otable->set_shader(sdr_phong);
    1.44  	obj.push_back(otable);
    1.45  
    1.46  
    1.47 @@ -113,7 +115,7 @@
    1.48  			float u = (float)j / (float)img_marble.width;
    1.49  
    1.50  			float marble_val = marble(u, v);
    1.51 -			Vector3 color = lerp(marble_col2, marble_col1, marble_val);
    1.52 +			Vector3 color = lerp(marble_col2, marble_col1, marble_val) * 0.6;
    1.53  
    1.54  			int r = (int)(color.x * 255.0);
    1.55  			int g = (int)(color.y * 255.0);