goat3d

changeset 101:a7c7fbeef93b

[goatview] fixed grid transparency
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 May 2014 05:29:55 +0300
parents fae6dc0fd462
children 0ea2b355bc96
files goatview/src/goatview.cc
diffstat 1 files changed, 18 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/goatview/src/goatview.cc	Wed May 21 05:09:33 2014 +0300
     1.2 +++ b/goatview/src/goatview.cc	Wed May 21 05:29:55 2014 +0300
     1.3 @@ -425,25 +425,25 @@
     1.4  	glRotatef(cam_phi, 1, 0, 0);
     1.5  	glRotatef(cam_theta, 0, 1, 0);
     1.6  
     1.7 -	draw_grid();
     1.8 -
     1.9 -	if(!scene) return;
    1.10 -
    1.11 -	if(use_nodes) {
    1.12 -		int node_count = goat3d_get_node_count(scene);
    1.13 -		for(int i=0; i<node_count; i++) {
    1.14 -			goat3d_node *node = goat3d_get_node(scene, i);
    1.15 -			if(!goat3d_get_node_parent(node)) {
    1.16 -				draw_node(node);	// only draw root nodes, the rest will be drawn recursively
    1.17 +	if(scene) {
    1.18 +		if(use_nodes) {
    1.19 +			int node_count = goat3d_get_node_count(scene);
    1.20 +			for(int i=0; i<node_count; i++) {
    1.21 +				goat3d_node *node = goat3d_get_node(scene, i);
    1.22 +				if(!goat3d_get_node_parent(node)) {
    1.23 +					draw_node(node);	// only draw root nodes, the rest will be drawn recursively
    1.24 +				}
    1.25 +			}
    1.26 +		} else {
    1.27 +			int mesh_count = goat3d_get_mesh_count(scene);
    1.28 +			for(int i=0; i<mesh_count; i++) {
    1.29 +				goat3d_mesh *mesh = goat3d_get_mesh(scene, i);
    1.30 +				draw_mesh(mesh);
    1.31  			}
    1.32  		}
    1.33 -	} else {
    1.34 -		int mesh_count = goat3d_get_mesh_count(scene);
    1.35 -		for(int i=0; i<mesh_count; i++) {
    1.36 -			goat3d_mesh *mesh = goat3d_get_mesh(scene, i);
    1.37 -			draw_mesh(mesh);
    1.38 -		}
    1.39  	}
    1.40 +
    1.41 +	draw_grid();
    1.42  }
    1.43  
    1.44  void GoatViewport::toggle_lighting()
    1.45 @@ -472,12 +472,13 @@
    1.46  	glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BITS);
    1.47  
    1.48  	glEnable(GL_BLEND);
    1.49 -	glDepthFunc(GL_ALWAYS);
    1.50 +	glDepthMask(0);
    1.51  
    1.52  	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    1.53  	draw_grid(sz0 * 2.0, 10, 1.0 - alpha);
    1.54  	draw_grid(sz1 * 2.0, 10, alpha);
    1.55  
    1.56 +	glDepthMask(1);
    1.57  	glPopAttrib();
    1.58  }
    1.59