2ba228a486
The whole implementation of the new driver was provided by the folks from Amundis (http://amundis.fr/index.php?lang=en). There are more projects to come from them. Many thanks to Thibault and his colleagues for providing the code for inclusion in the engine. Please note that you have to remove not only the OpenGL driver (automatically done in IrrCompileConfig once the ogl-es driver is enabled there), but also the linking against the opengl32.lib in the project files. Otherwise no rendering will happen. Also note that the driver currently does not support all features of the engine. Some materials are not fully working, the shadow system seems to be missing, and the mipmapping is broken. These things will be fixed in future bug fixes. git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@3370 dfc29bdd-3216-0410-991c-e03cc46cb475
36 lines
1.1 KiB
GLSL
36 lines
1.1 KiB
GLSL
// Copyright (C) 2009-2010 Amundis
|
|
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
|
// and OpenGL ES driver implemented by Christian Stehno
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
#define MAX_LIGHTS 2
|
|
|
|
precision mediump float;
|
|
|
|
uniform sampler2D texture0;
|
|
uniform sampler2D texture1;
|
|
|
|
varying vec4 varTexCoord;
|
|
varying vec3 varLightVector[MAX_LIGHTS];
|
|
varying vec4 varLightColor[MAX_LIGHTS];
|
|
|
|
varying vec4 debug;
|
|
|
|
void main(void)
|
|
{
|
|
// fetch color and normal map
|
|
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
|
|
vec4 colorMap = texture2D(texture0, varTexCoord.xy);
|
|
|
|
// calculate color of light 0
|
|
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
|
|
|
|
// calculate color of light 1
|
|
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
|
|
|
|
//luminance * base color
|
|
color *= colorMap;
|
|
color.a = varLightColor[0].a;
|
|
|
|
gl_FragColor = color;
|
|
} |