mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Merge pull request #1003 from Lopuska/ribbon_opengl
Ribbon port for opengl
This commit is contained in:
commit
c20f29c672
10 changed files with 282 additions and 1 deletions
|
|
@ -29,6 +29,11 @@ new ShaderData( BasicRibbonShader )
|
||||||
DXVertexShaderFile = "shaders/common/ribbons/basicRibbonShaderV.hlsl";
|
DXVertexShaderFile = "shaders/common/ribbons/basicRibbonShaderV.hlsl";
|
||||||
DXPixelShaderFile = "shaders/common/ribbons/basicRibbonShaderP.hlsl";
|
DXPixelShaderFile = "shaders/common/ribbons/basicRibbonShaderP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderP.glsl";
|
||||||
|
|
||||||
|
samplerNames[0] = "$ribTex";
|
||||||
|
|
||||||
pixVersion = 2.0;
|
pixVersion = 2.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -46,3 +51,37 @@ singleton CustomMaterial( BasicRibbonMat )
|
||||||
|
|
||||||
preload = true;
|
preload = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This material can render a texture on top of a ribbon.
|
||||||
|
|
||||||
|
//Texture ribbon shader/////////////////////////////////////////////
|
||||||
|
|
||||||
|
new ShaderData( TexturedRibbonShader )
|
||||||
|
{
|
||||||
|
DXVertexShaderFile = "shaders/common/ribbons/texRibbonShaderV.hlsl";
|
||||||
|
DXPixelShaderFile = "shaders/common/ribbons/texRibbonShaderP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/ribbons/gl/texRibbonShaderV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/ribbons/gl/texRibbonShaderP.glsl";
|
||||||
|
|
||||||
|
samplerNames[0] = "$ribTex";
|
||||||
|
|
||||||
|
pixVersion = 2.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton CustomMaterial( TexturedRibbonMat )
|
||||||
|
{
|
||||||
|
shader = TexturedRibbonShader;
|
||||||
|
version = 2.0;
|
||||||
|
|
||||||
|
emissive[0] = true;
|
||||||
|
|
||||||
|
doubleSided = true;
|
||||||
|
translucent = true;
|
||||||
|
BlendOp = AddAlpha;
|
||||||
|
translucentBlendOp = AddAlpha;
|
||||||
|
|
||||||
|
sampler["ribTex"] = "art/ribbons/ribTex.png";
|
||||||
|
|
||||||
|
preload = true;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float4 _hpos;
|
||||||
|
in float2 _texCoord;
|
||||||
|
in float2 _shiftdata;
|
||||||
|
in float4 _color;
|
||||||
|
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
#define IN_texCoord _texCoord
|
||||||
|
#define IN_shiftdata _shiftdata
|
||||||
|
#define IN_color _color
|
||||||
|
|
||||||
|
out float4 OUT_col;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float fade = 1.0 - abs(IN_shiftdata.y - 0.5) * 2.0;
|
||||||
|
OUT_col.xyz = IN_color.xyz + pow(fade, 4) / 10;
|
||||||
|
OUT_col.a = IN_color.a * fade;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float2 vTexCoord0;
|
||||||
|
in float2 vTexCoord1;
|
||||||
|
in float3 vNormal;
|
||||||
|
in float4 vPosition;
|
||||||
|
in float4 vColor;
|
||||||
|
|
||||||
|
#define IN_texCoord vTexCoord0
|
||||||
|
#define IN_shiftdata vTexCoord1
|
||||||
|
#define IN_normal vNormal
|
||||||
|
#define IN_position vPosition
|
||||||
|
#define IN_color vColor
|
||||||
|
|
||||||
|
out float4 _hpos;
|
||||||
|
out float2 _texCoord;
|
||||||
|
out float2 _shiftdata;
|
||||||
|
out float4 _color;
|
||||||
|
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
#define OUT_texCoord _texCoord
|
||||||
|
#define OUT_shiftdata _shiftdata
|
||||||
|
#define OUT_color _color
|
||||||
|
|
||||||
|
uniform float4x4 modelview;
|
||||||
|
uniform float3 eyePos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_hpos = tMul(modelview, IN_position);
|
||||||
|
OUT_color = IN_color;
|
||||||
|
OUT_texCoord = IN_texCoord;
|
||||||
|
OUT_shiftdata = IN_shiftdata;
|
||||||
|
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
#include "../../gl/torque.glsl"
|
||||||
|
|
||||||
|
in float4 _hpos;
|
||||||
|
in float2 _texCoord;
|
||||||
|
in float2 _shiftdata;
|
||||||
|
in float4 _color;
|
||||||
|
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
#define IN_texCoord _texCoord
|
||||||
|
#define IN_shiftdata _shiftdata
|
||||||
|
#define IN_color _color
|
||||||
|
|
||||||
|
out float4 OUT_col;
|
||||||
|
uniform sampler2D ribTex;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float4 Tex = tex2D(ribTex,IN_texCoord);
|
||||||
|
Tex.a *= IN_color.a;
|
||||||
|
OUT_col = hdrEncode(Tex);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float2 vTexCoord0;
|
||||||
|
in float2 vTexCoord1;
|
||||||
|
in float3 vNormal;
|
||||||
|
in float4 vPosition;
|
||||||
|
in float4 vColor;
|
||||||
|
|
||||||
|
#define IN_texCoord vTexCoord0
|
||||||
|
#define IN_shiftdata vTexCoord1
|
||||||
|
#define IN_normal vNormal
|
||||||
|
#define IN_position vPosition
|
||||||
|
#define IN_color vColor
|
||||||
|
|
||||||
|
out float4 _hpos;
|
||||||
|
out float2 _texCoord;
|
||||||
|
out float2 _shiftdata;
|
||||||
|
out float4 _color;
|
||||||
|
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
#define OUT_texCoord _texCoord
|
||||||
|
#define OUT_shiftdata _shiftdata
|
||||||
|
#define OUT_color _color
|
||||||
|
|
||||||
|
uniform float4x4 modelview;
|
||||||
|
uniform float3 eyePos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_hpos = tMul(modelview, IN_position);
|
||||||
|
OUT_color = IN_color;
|
||||||
|
OUT_texCoord = IN_texCoord;
|
||||||
|
OUT_shiftdata = IN_shiftdata;
|
||||||
|
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
|
|
@ -29,6 +29,11 @@ new ShaderData( BasicRibbonShader )
|
||||||
DXVertexShaderFile = "shaders/common/ribbons/basicRibbonShaderV.hlsl";
|
DXVertexShaderFile = "shaders/common/ribbons/basicRibbonShaderV.hlsl";
|
||||||
DXPixelShaderFile = "shaders/common/ribbons/basicRibbonShaderP.hlsl";
|
DXPixelShaderFile = "shaders/common/ribbons/basicRibbonShaderP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderP.glsl";
|
||||||
|
|
||||||
|
samplerNames[0] = "$ribTex";
|
||||||
|
|
||||||
pixVersion = 2.0;
|
pixVersion = 2.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -56,6 +61,11 @@ new ShaderData( TexturedRibbonShader )
|
||||||
DXVertexShaderFile = "shaders/common/ribbons/texRibbonShaderV.hlsl";
|
DXVertexShaderFile = "shaders/common/ribbons/texRibbonShaderV.hlsl";
|
||||||
DXPixelShaderFile = "shaders/common/ribbons/texRibbonShaderP.hlsl";
|
DXPixelShaderFile = "shaders/common/ribbons/texRibbonShaderP.hlsl";
|
||||||
|
|
||||||
|
OGLVertexShaderFile = "shaders/common/ribbons/gl/texRibbonShaderV.glsl";
|
||||||
|
OGLPixelShaderFile = "shaders/common/ribbons/gl/texRibbonShaderP.glsl";
|
||||||
|
|
||||||
|
samplerNames[0] = "$ribTex";
|
||||||
|
|
||||||
pixVersion = 2.0;
|
pixVersion = 2.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float4 _hpos;
|
||||||
|
in float2 _texCoord;
|
||||||
|
in float2 _shiftdata;
|
||||||
|
in float4 _color;
|
||||||
|
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
#define IN_texCoord _texCoord
|
||||||
|
#define IN_shiftdata _shiftdata
|
||||||
|
#define IN_color _color
|
||||||
|
|
||||||
|
out float4 OUT_col;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float fade = 1.0 - abs(IN_shiftdata.y - 0.5) * 2.0;
|
||||||
|
OUT_col.xyz = IN_color.xyz + pow(fade, 4) / 10;
|
||||||
|
OUT_col.a = IN_color.a * fade;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float2 vTexCoord0;
|
||||||
|
in float2 vTexCoord1;
|
||||||
|
in float3 vNormal;
|
||||||
|
in float4 vPosition;
|
||||||
|
in float4 vColor;
|
||||||
|
|
||||||
|
#define IN_texCoord vTexCoord0
|
||||||
|
#define IN_shiftdata vTexCoord1
|
||||||
|
#define IN_normal vNormal
|
||||||
|
#define IN_position vPosition
|
||||||
|
#define IN_color vColor
|
||||||
|
|
||||||
|
out float4 _hpos;
|
||||||
|
out float2 _texCoord;
|
||||||
|
out float2 _shiftdata;
|
||||||
|
out float4 _color;
|
||||||
|
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
#define OUT_texCoord _texCoord
|
||||||
|
#define OUT_shiftdata _shiftdata
|
||||||
|
#define OUT_color _color
|
||||||
|
|
||||||
|
uniform float4x4 modelview;
|
||||||
|
uniform float3 eyePos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_hpos = tMul(modelview, IN_position);
|
||||||
|
OUT_color = IN_color;
|
||||||
|
OUT_texCoord = IN_texCoord;
|
||||||
|
OUT_shiftdata = IN_shiftdata;
|
||||||
|
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
#include "../../gl/torque.glsl"
|
||||||
|
|
||||||
|
in float4 _hpos;
|
||||||
|
in float2 _texCoord;
|
||||||
|
in float2 _shiftdata;
|
||||||
|
in float4 _color;
|
||||||
|
|
||||||
|
#define IN_hpos _hpos
|
||||||
|
#define IN_texCoord _texCoord
|
||||||
|
#define IN_shiftdata _shiftdata
|
||||||
|
#define IN_color _color
|
||||||
|
|
||||||
|
out float4 OUT_col;
|
||||||
|
uniform sampler2D ribTex;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float4 Tex = tex2D(ribTex,IN_texCoord);
|
||||||
|
Tex.a *= IN_color.a;
|
||||||
|
OUT_col = hdrEncode(Tex);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
in float2 vTexCoord0;
|
||||||
|
in float2 vTexCoord1;
|
||||||
|
in float3 vNormal;
|
||||||
|
in float4 vPosition;
|
||||||
|
in float4 vColor;
|
||||||
|
|
||||||
|
#define IN_texCoord vTexCoord0
|
||||||
|
#define IN_shiftdata vTexCoord1
|
||||||
|
#define IN_normal vNormal
|
||||||
|
#define IN_position vPosition
|
||||||
|
#define IN_color vColor
|
||||||
|
|
||||||
|
out float4 _hpos;
|
||||||
|
out float2 _texCoord;
|
||||||
|
out float2 _shiftdata;
|
||||||
|
out float4 _color;
|
||||||
|
|
||||||
|
#define OUT_hpos _hpos
|
||||||
|
#define OUT_texCoord _texCoord
|
||||||
|
#define OUT_shiftdata _shiftdata
|
||||||
|
#define OUT_color _color
|
||||||
|
|
||||||
|
uniform float4x4 modelview;
|
||||||
|
uniform float3 eyePos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
OUT_hpos = tMul(modelview, IN_position);
|
||||||
|
OUT_color = IN_color;
|
||||||
|
OUT_texCoord = IN_texCoord;
|
||||||
|
OUT_shiftdata = IN_shiftdata;
|
||||||
|
|
||||||
|
gl_Position = OUT_hpos;
|
||||||
|
correctSSP(gl_Position);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue