mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-16 11:13:04 +02:00
Conform model/overlay shaders
This commit is contained in:
parent
44d297e7e2
commit
a4cea0a307
3 changed files with 15 additions and 23 deletions
|
@ -1,7 +1,7 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
// model.vert
|
||||
// model.slv
|
||||
// vertex shader
|
||||
//
|
||||
// Created by Andrzej Kapolka on 10/14/13.
|
||||
|
@ -17,21 +17,18 @@
|
|||
<$declareStandardTransform()$>
|
||||
|
||||
const int MAX_TEXCOORDS = 2;
|
||||
|
||||
uniform mat4 texcoordMatrices[MAX_TEXCOORDS];
|
||||
|
||||
out vec4 _position;
|
||||
out vec3 _normal;
|
||||
out vec3 _color;
|
||||
out float _alpha;
|
||||
out vec2 _texCoord0;
|
||||
out vec4 _position;
|
||||
out vec3 _normal;
|
||||
|
||||
void main(void) {
|
||||
// pass along the diffuse color in linear space
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_alpha = inColor.w;
|
||||
|
||||
// and the texture coordinates
|
||||
_texCoord0 = (texcoordMatrices[0] * vec4(inTexCoord0.st, 0.0, 1.0)).st;
|
||||
|
||||
// standard transform
|
||||
|
|
|
@ -11,17 +11,15 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
// Everything about global lighting
|
||||
|
||||
<@include DeferredLighting.slh@>
|
||||
<@include model/Light.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
// Everything about light
|
||||
<@include model/Light.slh@>
|
||||
|
||||
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
|
||||
|
||||
// Need the light now
|
||||
|
@ -42,11 +40,10 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d
|
|||
return vec4(color, opacity);
|
||||
}
|
||||
|
||||
// the diffuse texture
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
in vec4 _position;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
@ -54,17 +51,15 @@ in float _alpha;
|
|||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
// Fetch diffuse map
|
||||
vec4 diffuse = texture(diffuseMap, _texCoord0);
|
||||
|
||||
Material mat = getMaterial();
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
float fragOpacity = getMaterialOpacity(mat) * diffuse.a * _alpha;
|
||||
vec3 fragDiffuse = getMaterialDiffuse(mat) * diffuse.rgb * _color;
|
||||
vec3 fragSpecular = getMaterialSpecular(mat);
|
||||
float fragGloss = getMaterialShininess(mat);
|
||||
float fragOpacity = getMaterialOpacity(mat) * diffuse.a * _alpha;
|
||||
|
||||
_fragColor = evalGlobalColor(1.0,
|
||||
fragPosition,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
// overlay3D.slv
|
||||
// vertex shader
|
||||
//
|
||||
// Created by Sam Gateau on 6/16/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
|
@ -15,22 +16,21 @@
|
|||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
out vec3 _color;
|
||||
out float _alpha;
|
||||
out vec2 _texCoord0;
|
||||
|
||||
out vec4 _position;
|
||||
out vec3 _normal;
|
||||
|
||||
out vec3 _color;
|
||||
out float _alpha;
|
||||
|
||||
void main(void) {
|
||||
_texCoord0 = inTexCoord0.xy;
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_alpha = inColor.w;
|
||||
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal.xyz)$>
|
||||
<$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue