Skip to content

Instantly share code, notes, and snippets.

@rauf
Created July 5, 2016 13:04
Show Gist options
  • Save rauf/3401f42100bdb8c532dfd5ec338a1ae8 to your computer and use it in GitHub Desktop.
Save rauf/3401f42100bdb8c532dfd5ec338a1ae8 to your computer and use it in GitHub Desktop.
shader code log
07-05 18:32:01.570 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.578 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.589 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.597 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.609 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_COLOR
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.618 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.624 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.636 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.653 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.789 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.794 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.808 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.823 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.837 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.846 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.855 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled vertex shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
//lights definitions
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
#endif
//Attributes
attribute vec4 gfVertex;
#ifdef GF_GL_HAS_LIGHT
attribute vec3 gfNormal;
#endif
#ifdef GF_GL_HAS_TEXTURE
attribute vec4 gfMultiTexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
attribute vec4 gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
//Generic (Scene) uniforms
uniform gfLight lights[LIGHTS_MAX];
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
uniform float gfFogDensity;
uniform int gfFogType;
uniform float gfFogVisibility;
#endif
//Matrices
uniform mat4 gfModelViewMatrix;
uniform mat4 gfProjectionMatrix;
#ifdef GF_GL_HAS_LIGHT
uniform mat4 gfNormalMatrix;
#endif
#ifdef GF_GL_HAS_TEXTURE
uniform mat4 gfTextureMatrix;
uniform bool hasTextureMatrix;
#endif
//Clipping
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
uniform vec4 clipPlane[CLIPS_MAX];
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec4 gfEye; //camera
varying vec3 m_normal; //normal
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
#ifdef GF_GL_HAS_LIGHT
float fog()
{
float fog, eyeDist = length(gfEye-gfVertex);
if(gfFogType==FOG_TYPE_LINEAR){
fog= (gfFogVisibility-eyeDist)/gfFogVisibility;
}else if(gfFogType==FOG_TYPE_EXP){
fog= exp(-(gfEye.z * gfFogDensity));
}else if(gfFogType==FOG_TYPE_EXP2){
fog= (gfEye.z * gfFogDensity);
fog = exp(-(fog * fog));
}
return clamp(fog, 0.0, 1.0);
}
#endif
void main(void)
{
#ifndef GF_GL_HAS_LIGHT
vec4 gfEye;
#endif
gfEye = gfModelViewMatrix * gfVertex;
#ifdef GF_GL_HAS_COLOR
m_color = gfMeshColor;
#endif
#ifdef GF_GL_HAS_LIGHT
m_normal = normalize( vec3(gfNormalMatrix * vec4(gfNormal, 0.0)) );
for(int i=0; i<LIGHTS_MAX; i++){
if (i==gfNumLights) break;
if ( lights[i].type == L_SPOT || lights[i].type == L_POINT ) {
lightVector[i] = lights[i].position.xyz - gfEye.xyz;
} else {
//if it is a directional light, position SHOULD indicate direction (modified implementation - check before committing)
lightVector[i] = lights[i].direction.xyz;
}
}
gfFogFactor = gfFogEnabled ? fog() : 1.0;
#endif
#ifdef GF_GL_HAS_TEXTURE
if (hasTextureMatrix) {
TexCoord = vec2(gfTextureMatrix * gfMultiTexCoord);
} else {
TexCoord = vec2(gfMultiTexCoord);
}
#endif
#ifdef GF_GL_HAS_CLIP
//clipPlane are given in eye coordinate
for (int i=0; i<CLIPS_MAX; i++) {
if (i==gfNumClippers) break;
clipDistance[i] = dot(gfEye.xyz, clipPlane[i].xyz) + clipPlane[i].w;
}
#endif
gl_Position = gfProjectionMatrix * gfEye;
}
**********************
07-05 18:32:01.865 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_float, dot(normal, lightVnorm)); //ndotl
float ha
07-05 18:32:01.921 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_float, dot(normal, ligh
07-05 18:32:02.007 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_float
07-05 18:32:02.361 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float
07-05 18:32:02.629 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_float, dot(normal, lightV
07-05 18:32:02.662 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zer
07-05 18:32:02.711 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float l
07-05 18:32:02.953 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0,
07-05 18:32:03.231 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_float,
07-05 18:32:03.282 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float l
07-05 18:32:03.350 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1
07-05 18:32:03.790 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
no
07-05 18:32:04.258 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float lig
07-05 18:32:04.316 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -
07-05 18:32:04.382 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
norm
07-05 18:32:04.743 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with S
07-05 18:32:05.147 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
float light_cos = max(zero_f
07-05 18:32:05.206 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1
07-05 18:32:05.506 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0, -1.0);
}
flo
07-05 18:32:05.578 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
07-05 18:32:05.912 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
normal *= vec3(-1.0, -1.0
07-05 18:32:06.013 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shad
07-05 18:32:06.433 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -> Not compliant with Shading Language v1.0
07-05 18:32:06.514 9816-13700/com.gpac.Osmo4 I/GF_LOG_COMPOSE: [GLSL] Compiled fragment shader code ****
#version 100
#define GF_GL_HAS_LIGHT
#define LIGHTS_MAX 4
#define GF_GL_HAS_COLOR
#define GF_GL_HAS_TEXTURE
#define CLIPS_MAX 2
#define GF_GL_HAS_CLIP
#define GF_GL_IS_YUV
/**
* Shader implementing: Clipping, Texturing (RGB and YUV), Lighting, Fog
**/
//version defined first, at shader compilation
#if defined(GL_ES)
#if defined(GL_FRAGMENT_PRECISION_HIGH)
precision highp float; //ES2.0 supporting highp
#else
precision mediump float; //Default
#endif
#endif
//#pragma STDGL invariant(all) //removed due to incompatibility with the emulator
//LIGHTS_MAX and CLIP_MAX defined at shader compilation
#ifdef GF_GL_HAS_LIGHT
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
#define L_DIRECTIONAL 0
#define L_SPOT 1
#define L_POINT 2
//Light Structure
struct gfLight{
#if defined(GL_ES)
lowp int type;
#else
int type;
#endif
vec4 position;
vec4 direction;
vec3 attenuation;
vec4 color;
float ambientIntensity; //it is not used - we calculate it inside the shader
float intensity;
float beamWidth; //it is not used - we calculate it inside the shader
float cutOffAngle;
};
//Generic (Scene) Uniforms
#if defined(GL_ES)
uniform lowp int gfNumLights;
#else
uniform int gfNumLights;
#endif
uniform bool gfLightTwoSide;
uniform gfLight lights[LIGHTS_MAX];
//Material and Lighting Properties
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor;
uniform vec4 gfSpecularColor;
uniform float gfShininess; //a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient;
uniform vec4 gfLightSpecular;
//Fog
uniform bool gfFogEnabled;
uniform vec3 gfFogColor;
#endif
uniform bool hasMaterial2D;
uniform vec4 gfEmissionColor;
#ifdef GF_GL_HAS_COLOR
uniform bool hasMeshColor;
#endif
#ifdef GF_GL_HAS_CLIP
#if defined(GL_ES)
uniform lowp int gfNumClippers;
#else
uniform int gfNumClippers;
#endif
#endif
//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;
#ifdef GF_GL_HAS_TEXTURE
uniform int gfNumTextures;
//Texture samplers
#ifdef GF_GL_IS_YUV
uniform bool isNV21PixelFormat;
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;
#else
uniform sampler2D img;
#endif
//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164, 0.000, 1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164, 2.018, 0.000);
#endif
//Varyings
#ifdef GF_GL_HAS_LIGHT
varying vec3 m_normal;
varying vec4 gfEye;
varying vec3 lightVector[LIGHTS_MAX];
varying float gfFogFactor;
#endif
#ifdef GF_GL_HAS_TEXTURE
varying vec2 TexCoord;
#endif
#ifdef GF_GL_HAS_COLOR
varying vec4 m_color;
#endif
#ifdef GF_GL_HAS_CLIP
varying float clipDistance[CLIPS_MAX];
#endif
//constants
const float zero_float = 0.0;
const float one_float = 1.0;
#ifdef GF_GL_HAS_LIGHT
vec4 doLighting(int i){
vec4 lightColor = vec4(zero_float, zero_float, zero_float, zero_float);
float att = zero_float;
gfLight tempLight; //we use a temp gfLight, because array of straucts in fragment are not supported in android
vec3 lightVnorm; //normalized lightVector
vec3 lightV; //temp lightVector
vec3 halfVnorm; //temp lightVector
//FIXME - couldn't we use a light[i]. something here ?
if(i==0) { //ES2 does not support switch() statements
tempLight = lights[0];
lightV = lightVector[0];
halfVnorm = normalize( lightVector[0] + gfEye.xyz );
} else if (i==1) {
tempLight = lights[1];
lightV = lightVector[1];
halfVnorm = normalize( lightVector[1] + gfEye.xyz );
} else if(i==2) {
tempLight = lights[2];
lightV = lightVector[2];
halfVnorm = normalize( lightVector[2] + gfEye.xyz );
}
lightVnorm = normalize(lightV);
vec3 normal = normalize(m_normal);
if (gfLightTwoSide && (!gl_FrontFacing)){//light back face
//originally: normal *=-1; -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment