blob: 309ae0632843972594641db1f47f9be10538d1ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
uniform vec4 color = vec4(0.0, 0.0, 1.0, 1.0);
#ifdef OB_TEXTURE
uniform sampler2D image;
#endif
uniform mat3 normalWorldMatrix;
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
in vec3 normal_viewport;
#endif /* NORMAL_VIEWPORT_PASS_ENABLED */
#ifdef OB_TEXTURE
in vec2 uv_interp;
#endif
layout(std140) uniform world_block {
WorldData world_data;
};
layout(location=0) out vec4 transparentAccum;
void main()
{
vec4 diffuse_color;
#ifdef OB_SOLID
diffuse_color = color;
#endif /* OB_SOLID */
#ifdef OB_TEXTURE
diffuse_color = texture(image, uv_interp);
#endif /* OB_TEXTURE */
#ifdef V3D_LIGHTING_STUDIO
#ifdef STUDIOLIGHT_ORIENTATION_CAMERA
vec3 diffuse_light = get_camera_diffuse_light(world_data, normal_viewport);
#endif
#ifdef STUDIOLIGHT_ORIENTATION_WORLD
vec3 normal_world = normalWorldMatrix * normal_viewport;
vec3 diffuse_light = get_world_diffuse_light(world_data, normal_world);
#endif
vec3 shaded_color = diffuse_light * diffuse_color.rgb;
#else /* V3D_LIGHTING_STUDIO */
vec3 shaded_color = diffuse_color.rgb;
#endif /* V3D_LIGHTING_STUDIO */
float alpha = 0.5 ;
vec4 premultiplied = vec4(shaded_color.rgb * alpha, alpha);
transparentAccum = calculate_transparent_accum(premultiplied);
}
|