head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC6:1.1.1.1
	netbsd-11-0-RC5:1.1.1.1
	netbsd-11-0-RC4:1.1.1.1
	netbsd-11-0-RC3:1.1.1.1
	netbsd-11-0-RC2:1.1.1.1
	netbsd-11-0-RC1:1.1.1.1
	netbsd-11:1.1.1.1.0.10
	netbsd-11-base:1.1.1.1
	netbsd-10-1-RELEASE:1.1.1.1
	netbsd-8-3-RELEASE:1.1.1.1
	netbsd-9-4-RELEASE:1.1.1.1
	netbsd-10-0-RELEASE:1.1.1.1
	netbsd-10-0-RC6:1.1.1.1
	netbsd-10-0-RC5:1.1.1.1
	netbsd-10-0-RC4:1.1.1.1
	netbsd-10-0-RC3:1.1.1.1
	netbsd-10-0-RC2:1.1.1.1
	netbsd-10-0-RC1:1.1.1.1
	netbsd-10:1.1.1.1.0.8
	netbsd-10-base:1.1.1.1
	netbsd-9-3-RELEASE:1.1.1.1
	netbsd-9-2-RELEASE:1.1.1.1
	netbsd-9-1-RELEASE:1.1.1.1
	netbsd-8-2-RELEASE:1.1.1.1
	netbsd-9-0-RELEASE:1.1.1.1
	netbsd-9-0-RC2:1.1.1.1
	netbsd-9-0-RC1:1.1.1.1
	netbsd-9:1.1.1.1.0.6
	netbsd-9-base:1.1.1.1
	netbsd-8-1-RELEASE:1.1.1.1
	netbsd-8-1-RC1:1.1.1.1
	mesa-demos-8-4-0:1.1.1.1
	netbsd-7-2-RELEASE:1.1.1.1.2.2
	netbsd-8-0-RELEASE:1.1.1.1
	netbsd-8-0-RC2:1.1.1.1
	netbsd-8-0-RC1:1.1.1.1
	netbsd-7-1-2-RELEASE:1.1.1.1.2.2
	netbsd-7-1-1-RELEASE:1.1.1.1.2.2
	netbsd-8:1.1.1.1.0.4
	netbsd-8-base:1.1.1.1
	netbsd-7-1:1.1.1.1.2.2.0.4
	netbsd-7-1-RELEASE:1.1.1.1.2.2
	netbsd-7-1-RC2:1.1.1.1.2.2
	netbsd-7-1-RC1:1.1.1.1.2.2
	netbsd-7-0-2-RELEASE:1.1.1.1.2.2
	netbsd-7-0-1-RELEASE:1.1.1.1.2.2
	netbsd-7-0:1.1.1.1.2.2.0.2
	netbsd-7-0-RELEASE:1.1.1.1.2.2
	netbsd-7-0-RC3:1.1.1.1.2.2
	netbsd-7-0-RC2:1.1.1.1.2.2
	netbsd-7-0-RC1:1.1.1.1.2.2
	netbsd-7:1.1.1.1.0.2
	mesa-demos-8-2-0:1.1.1.1
	xorg:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2014.12.16.06.01.19;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	JHkLWGb9LgMxce2y;

1.1.1.1
date	2014.12.16.06.01.19;	author mrg;	state Exp;
branches
	1.1.1.1.2.1;
next	;
commitid	JHkLWGb9LgMxce2y;

1.1.1.1.2.1
date	2014.12.16.06.01.19;	author snj;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	HBvt2MfSKnG9W63y;

1.1.1.1.2.2
date	2014.12.23.02.55.03;	author snj;	state Exp;
branches;
next	;
commitid	HBvt2MfSKnG9W63y;


desc
@@


1.1
log
@Initial revision
@
text
@//
// Fragment shader for procedural bumps
//
// Authors: John Kessenich, Randi Rost
//
// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. 
//
// See 3Dlabs-License.txt for license information
//

varying vec3 LightDir;
varying vec3 EyeDir;

uniform vec3  SurfaceColor;    // = (0.7, 0.6, 0.18)
uniform float BumpDensity;     // = 16.0
uniform float BumpSize;        // = 0.15
uniform float SpecularFactor;  // = 0.5

void main()
{
    vec3 litColor;
    vec2 c = BumpDensity * gl_TexCoord[0].st;
    vec2 p = fract(c) - vec2(0.5);

    float d, f;
    d = p.x * p.x + p.y * p.y;
    f = inversesqrt(d + 1.0);

    if (d >= BumpSize)
        { p = vec2(0.0); f = 1.0; }

    vec3 normDelta = vec3(p.x, p.y, 1.0) * f;
    litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0);
    vec3 reflectDir = reflect(LightDir, normDelta);
    
    float spec = max(dot(EyeDir, reflectDir), 0.0);
    spec *= SpecularFactor;
    litColor = min(litColor + spec, vec3(1.0));

    gl_FragColor = vec4(litColor, 1.0);
}
@


1.1.1.1
log
@initial import of mesa-demos-8.2.0
@
text
@@


1.1.1.1.2.1
log
@file CH11-bumpmap.frag was added on branch netbsd-7 on 2014-12-23 02:55:03 +0000
@
text
@d1 41
@


1.1.1.1.2.2
log
@Apply patch (requested by mrg in ticket 341):
Add split-out versions of glu-9.0.0, glw-8.0.0, and mesa-demos-8.2.0.
@
text
@a0 41
//
// Fragment shader for procedural bumps
//
// Authors: John Kessenich, Randi Rost
//
// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. 
//
// See 3Dlabs-License.txt for license information
//

varying vec3 LightDir;
varying vec3 EyeDir;

uniform vec3  SurfaceColor;    // = (0.7, 0.6, 0.18)
uniform float BumpDensity;     // = 16.0
uniform float BumpSize;        // = 0.15
uniform float SpecularFactor;  // = 0.5

void main()
{
    vec3 litColor;
    vec2 c = BumpDensity * gl_TexCoord[0].st;
    vec2 p = fract(c) - vec2(0.5);

    float d, f;
    d = p.x * p.x + p.y * p.y;
    f = inversesqrt(d + 1.0);

    if (d >= BumpSize)
        { p = vec2(0.0); f = 1.0; }

    vec3 normDelta = vec3(p.x, p.y, 1.0) * f;
    litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0);
    vec3 reflectDir = reflect(LightDir, normDelta);
    
    float spec = max(dot(EyeDir, reflectDir), 0.0);
    spec *= SpecularFactor;
    litColor = min(litColor + spec, vec3(1.0));

    gl_FragColor = vec4(litColor, 1.0);
}
@


