Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/shaders/glsl/terrain_common.vs
#version 120 | #version 120 | ||||
#include "common/shadows_vertex.h" | |||||
uniform mat4 transform; | uniform mat4 transform; | ||||
uniform vec3 cameraPos; | uniform vec3 cameraPos; | ||||
#ifdef GL_ES | #ifdef GL_ES | ||||
uniform mediump vec3 sunDir; | uniform mediump vec3 sunDir; | ||||
uniform mediump vec3 sunColor; | uniform mediump vec3 sunColor; | ||||
#else | #else | ||||
uniform vec3 sunDir; | uniform vec3 sunDir; | ||||
uniform vec3 sunColor; | uniform vec3 sunColor; | ||||
#endif | #endif | ||||
uniform vec2 textureTransform; | uniform vec2 textureTransform; | ||||
uniform vec2 losTransform; | uniform vec2 losTransform; | ||||
uniform mat4 shadowTransform; | |||||
#if USE_SHADOW_SAMPLER && USE_SHADOW_PCF | |||||
uniform vec4 shadowScale; | |||||
#endif | |||||
varying vec3 v_lighting; | varying vec3 v_lighting; | ||||
#if USE_SHADOW | |||||
varying vec4 v_shadow; | |||||
#endif | |||||
varying vec2 v_los; | varying vec2 v_los; | ||||
varying vec2 v_blend; | varying vec2 v_blend; | ||||
#if USE_TRIPLANAR | #if USE_TRIPLANAR | ||||
varying vec3 v_tex; | varying vec3 v_tex; | ||||
#else | #else | ||||
varying vec2 v_tex; | varying vec2 v_tex; | ||||
#endif | #endif | ||||
varying vec3 v_normal; | varying vec3 v_normal; | ||||
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP | #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP | ||||
#if USE_NORMAL_MAP | #if USE_NORMAL_MAP | ||||
varying vec4 v_tangent; | varying vec4 v_tangent; | ||||
varying vec3 v_bitangent; | varying vec3 v_bitangent; | ||||
#endif | #endif | ||||
#if USE_SPECULAR || USE_SPECULAR_MAP | #if USE_SPECULAR || USE_SPECULAR_MAP | ||||
varying vec3 v_half; | varying vec3 v_half; | ||||
#endif | #endif | ||||
#endif | #endif | ||||
attribute vec3 a_vertex; | attribute vec3 a_vertex; | ||||
attribute vec3 a_normal; | attribute vec3 a_normal; | ||||
attribute vec2 a_uv0; | attribute vec2 a_uv0; | ||||
attribute vec2 a_uv1; | attribute vec2 a_uv1; | ||||
void main() | void main() | ||||
{ | { | ||||
vec4 position = vec4(a_vertex, 1.0); | vec4 position = vec4(a_vertex, 1.0); | ||||
Show All 28 Lines | #if GL_ES | ||||
#endif | #endif | ||||
#endif | #endif | ||||
#endif | #endif | ||||
#if BLEND | #if BLEND | ||||
v_blend = a_uv1; | v_blend = a_uv1; | ||||
#endif | #endif | ||||
#if USE_SHADOW | calculatePositionInShadowSpace(vec4(a_vertex, 1.0)); | ||||
v_shadow = shadowTransform * vec4(a_vertex, 1.0); | |||||
#if USE_SHADOW_SAMPLER && USE_SHADOW_PCF | |||||
v_shadow.xy *= shadowScale.xy; | |||||
#endif | |||||
#endif | |||||
v_normal = a_normal; | v_normal = a_normal; | ||||
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_TRIPLANAR | #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_TRIPLANAR | ||||
#if USE_NORMAL_MAP | #if USE_NORMAL_MAP | ||||
vec3 t = vec3(1.0, 0.0, 0.0); | vec3 t = vec3(1.0, 0.0, 0.0); | ||||
t = normalize(t - v_normal * dot(v_normal, t)); | t = normalize(t - v_normal * dot(v_normal, t)); | ||||
v_tangent = vec4(t, -1.0); | v_tangent = vec4(t, -1.0); | ||||
Show All 14 Lines |
Wildfire Games · Phabricator