Test
This commit is contained in:
@@ -13,6 +13,7 @@ GameObject:
|
||||
- component: {fileID: 6532273981309083836}
|
||||
- component: {fileID: 1233264528206448334}
|
||||
- component: {fileID: 3532080573254851317}
|
||||
- component: {fileID: -4588376249929475000}
|
||||
m_Layer: 0
|
||||
m_Name: MainCamera
|
||||
m_TagString: MainCamera
|
||||
@@ -158,6 +159,19 @@ MonoBehaviour:
|
||||
_target: {fileID: 223370878831388739}
|
||||
_orbitAngle: 0
|
||||
_mouseOrbitSensitivity: 180
|
||||
--- !u!114 &-4588376249929475000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4229103394069051166}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 96f648f0eec386842a736291e9477f4d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Rendering.SpaceWarpShaderGlobals
|
||||
_useUnscaledTime: 1
|
||||
--- !u!1 &4648252273784777908
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -48,7 +48,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: VoxelWorld.Runtime::InfiniteWorld.VoxelWorld.VoxelWorldGenerator
|
||||
streamTarget: {fileID: 0}
|
||||
config: {fileID: 11400000, guid: b8cf28a5522134b479c23f017234070c, type: 2}
|
||||
_terrainShader: {fileID: 4800000, guid: ec80aebd8cb61f44cbfa6b7d5f087211, type: 3}
|
||||
_terrainShader: {fileID: 4800000, guid: 88453fab3fdf28e43aeb7d5c4beea68d, type: 3}
|
||||
--- !u!114 &6182401849027620011
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -152,6 +152,26 @@ namespace InfiniteWorld.VoxelWorld
|
||||
material.SetTexture("_TextureArray", textureArray);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_UseTextureArray"))
|
||||
{
|
||||
material.SetFloat("_UseTextureArray", 1f);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_UseBaseMap"))
|
||||
{
|
||||
material.SetFloat("_UseBaseMap", 0f);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_UseLightMap"))
|
||||
{
|
||||
material.SetFloat("_UseLightMap", 0f);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_UseFog"))
|
||||
{
|
||||
material.SetFloat("_UseFog", 1f);
|
||||
}
|
||||
|
||||
if (material.HasProperty("_BaseColor"))
|
||||
{
|
||||
material.SetColor("_BaseColor", Color.white);
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Rendering
|
||||
{
|
||||
[ExecuteAlways]
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public sealed class SpaceWarpShaderGlobals : MonoBehaviour
|
||||
{
|
||||
private static readonly int SpaceWarpCameraPositionId = Shader.PropertyToID("_SpaceWarpCameraPosition");
|
||||
private static readonly int SpaceWarpPreviousCameraPositionId = Shader.PropertyToID("_SpaceWarpPreviousCameraPosition");
|
||||
private static readonly int SpaceWarpCameraForwardId = Shader.PropertyToID("_SpaceWarpCameraForward");
|
||||
private static readonly int SpaceWarpFrameTimeId = Shader.PropertyToID("_SpaceWarpFrameTime");
|
||||
private static readonly int SpaceWarpTimeId = Shader.PropertyToID("_SpaceWarpTime");
|
||||
|
||||
[SerializeField] private bool _useUnscaledTime = true;
|
||||
|
||||
private Camera _camera;
|
||||
private Vector3 _previousPosition;
|
||||
private bool _initialized;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_camera = GetComponent<Camera>();
|
||||
RenderPipelineManager.beginCameraRendering += HandleBeginCameraRendering;
|
||||
PushGlobals(true);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RenderPipelineManager.beginCameraRendering -= HandleBeginCameraRendering;
|
||||
Shader.SetGlobalVector(SpaceWarpCameraPositionId, Vector4.zero);
|
||||
Shader.SetGlobalVector(SpaceWarpPreviousCameraPositionId, Vector4.zero);
|
||||
Shader.SetGlobalVector(SpaceWarpCameraForwardId, Vector4.zero);
|
||||
Shader.SetGlobalFloat(SpaceWarpFrameTimeId, 0f);
|
||||
Shader.SetGlobalFloat(SpaceWarpTimeId, 0f);
|
||||
_initialized = false;
|
||||
}
|
||||
|
||||
private void HandleBeginCameraRendering(ScriptableRenderContext context, Camera camera)
|
||||
{
|
||||
if (camera != _camera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PushGlobals(false);
|
||||
}
|
||||
|
||||
private void PushGlobals(bool resetPreviousPosition)
|
||||
{
|
||||
if (_camera == null)
|
||||
{
|
||||
_camera = GetComponent<Camera>();
|
||||
if (_camera == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Transform cameraTransform = _camera.transform;
|
||||
Vector3 currentPosition = cameraTransform.position;
|
||||
|
||||
if (resetPreviousPosition || !_initialized)
|
||||
{
|
||||
_previousPosition = currentPosition;
|
||||
}
|
||||
|
||||
float frameTime = Application.isPlaying
|
||||
? (_useUnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime)
|
||||
: Mathf.Max(Time.deltaTime, 1f / 60f);
|
||||
|
||||
float timeValue = Application.isPlaying
|
||||
? (_useUnscaledTime ? Time.unscaledTime : Time.time)
|
||||
: Time.realtimeSinceStartup;
|
||||
|
||||
Vector3 forward = cameraTransform.forward;
|
||||
Shader.SetGlobalVector(SpaceWarpCameraPositionId, new Vector4(currentPosition.x, currentPosition.y, currentPosition.z, 1f));
|
||||
Shader.SetGlobalVector(SpaceWarpPreviousCameraPositionId, new Vector4(_previousPosition.x, _previousPosition.y, _previousPosition.z, 1f));
|
||||
Shader.SetGlobalVector(SpaceWarpCameraForwardId, new Vector4(forward.x, forward.y, forward.z, 1f));
|
||||
Shader.SetGlobalFloat(SpaceWarpFrameTimeId, Mathf.Max(frameTime, 0.0001f));
|
||||
Shader.SetGlobalFloat(SpaceWarpTimeId, timeValue);
|
||||
|
||||
_previousPosition = currentPosition;
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96f648f0eec386842a736291e9477f4d
|
||||
@@ -0,0 +1,293 @@
|
||||
Shader "The Decline Of Warriors/Space Warp Universal"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_BaseMap("Base Map", 2D) = "white" {}
|
||||
_LightMap("Light Map", 2D) = "white" {}
|
||||
_TextureArray("Texture Array", 2DArray) = "white" {}
|
||||
_BaseColor("Base Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[ToggleUI] _UseBaseMap("Use Base Map", Float) = 1
|
||||
[ToggleUI] _UseTextureArray("Use Texture Array", Float) = 0
|
||||
[ToggleUI] _UseLightMap("Use Light Map", Float) = 0
|
||||
[ToggleUI] _UseVertexColor("Use Vertex Color", Float) = 1
|
||||
[ToggleUI] _UseFog("Use Fog", Float) = 1
|
||||
|
||||
[IntRange] _Mode("Warp Mode", Range(0, 9)) = 0
|
||||
_J("Warp Scale", Float) = 16
|
||||
_F5Distance("View Offset", Float) = 1
|
||||
|
||||
_AlphaClipThreshold("Alpha Clip Threshold", Range(0, 1)) = 0.001
|
||||
|
||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Float) = 2
|
||||
[Enum(Off, 0, On, 1)] _ZWrite("ZWrite", Float) = 1
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Src Blend", Float) = 1
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Dst Blend", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Forward"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
|
||||
Cull [_Cull]
|
||||
ZWrite [_ZWrite]
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 3.5
|
||||
#pragma require 2darray
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SAMPLER(sampler_BaseMap);
|
||||
TEXTURE2D(_LightMap);
|
||||
SAMPLER(sampler_LightMap);
|
||||
TEXTURE2D_ARRAY(_TextureArray);
|
||||
SAMPLER(sampler_TextureArray);
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
float4 _LightMap_ST;
|
||||
half4 _BaseColor;
|
||||
float _UseBaseMap;
|
||||
float _UseTextureArray;
|
||||
float _UseLightMap;
|
||||
float _UseVertexColor;
|
||||
float _UseFog;
|
||||
float _Mode;
|
||||
float _J;
|
||||
float _F5Distance;
|
||||
float _AlphaClipThreshold;
|
||||
CBUFFER_END
|
||||
|
||||
float4 _SpaceWarpCameraPosition;
|
||||
float4 _SpaceWarpPreviousCameraPosition;
|
||||
float4 _SpaceWarpCameraForward;
|
||||
float _SpaceWarpFrameTime;
|
||||
float _SpaceWarpTime;
|
||||
|
||||
static const float kPi = 3.14159265359;
|
||||
static const float kMinEpsilon = 1e-5;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 uv2 : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float2 lightUv : TEXCOORD1;
|
||||
float2 textureData : TEXCOORD2;
|
||||
half4 color : COLOR;
|
||||
float fogFactor : TEXCOORD3;
|
||||
};
|
||||
|
||||
float Dot2(float3 value)
|
||||
{
|
||||
return dot(value, value);
|
||||
}
|
||||
|
||||
float2 Rotate2D(float2 value, float angle)
|
||||
{
|
||||
float s = sin(angle);
|
||||
float c = cos(angle);
|
||||
return float2(c * value.x + s * value.y, -s * value.x + c * value.y);
|
||||
}
|
||||
|
||||
float3 WarpSafeNormalize(float3 value)
|
||||
{
|
||||
float lengthSquared = max(dot(value, value), kMinEpsilon);
|
||||
return value * rsqrt(lengthSquared);
|
||||
}
|
||||
|
||||
float3 InvertSpace(float3 position, float3 offset)
|
||||
{
|
||||
float3 shifted = position + offset;
|
||||
float shiftedLength = max(length(shifted), kMinEpsilon);
|
||||
shifted = WarpSafeNormalize(shifted) * (Dot2(offset) / shiftedLength);
|
||||
shifted = reflect(shifted, WarpSafeNormalize(offset));
|
||||
return shifted + offset;
|
||||
}
|
||||
|
||||
float3x3 Inverse3x3(float3x3 matrixValue)
|
||||
{
|
||||
float3 a = matrixValue[0];
|
||||
float3 b = matrixValue[1];
|
||||
float3 c = matrixValue[2];
|
||||
float3 r0 = cross(b, c);
|
||||
float3 r1 = cross(c, a);
|
||||
float3 r2 = cross(a, b);
|
||||
float determinant = dot(r2, c);
|
||||
float safeDeterminant = sign(determinant) * max(abs(determinant), kMinEpsilon);
|
||||
return transpose(float3x3(r0, r1, r2) / safeDeterminant);
|
||||
}
|
||||
|
||||
float3 Torusify(float3 position, float3 cameraPosition, float warpScale)
|
||||
{
|
||||
float k = warpScale * 0.5;
|
||||
float safeK = max(abs(k), kMinEpsilon);
|
||||
|
||||
position.y = tanh((position.y - cameraPosition.y) / safeK) * safeK;
|
||||
position.y -= k;
|
||||
position.xy = float2(-sin(position.x * kPi / warpScale) * position.y, cos(position.x * kPi / warpScale) * position.y) + float2(0.0, k);
|
||||
position.y += k;
|
||||
position.zy = float2(sin(position.z * kPi / warpScale) * position.y, cos(position.z * kPi / warpScale) * position.y) - float2(0.0, k);
|
||||
return position;
|
||||
}
|
||||
|
||||
float3 Cust1(float3 position, float distance)
|
||||
{
|
||||
float3 viewPosition = mul((float3x3)UNITY_MATRIX_V, position);
|
||||
viewPosition.z -= distance / 1.1;
|
||||
return mul((float3x3)UNITY_MATRIX_I_V, viewPosition);
|
||||
}
|
||||
|
||||
float3 Cust2(float3 position, float3 cameraPosition, float warpScale)
|
||||
{
|
||||
float3 torusLocal = Torusify(position + cameraPosition, cameraPosition, warpScale) - Torusify(cameraPosition, cameraPosition, warpScale);
|
||||
float3 vx = WarpSafeNormalize(Torusify(cameraPosition + float3(0.01, 0.0, 0.0), cameraPosition, warpScale) - Torusify(cameraPosition, cameraPosition, warpScale));
|
||||
float3 vy = WarpSafeNormalize(Torusify(cameraPosition + float3(0.0, 0.01, 0.0), cameraPosition, warpScale) - Torusify(cameraPosition, cameraPosition, warpScale));
|
||||
float3 vz = WarpSafeNormalize(Torusify(cameraPosition + float3(0.0, 0.0, 0.01), cameraPosition, warpScale) - Torusify(cameraPosition, cameraPosition, warpScale));
|
||||
float3x3 directionMatrix = float3x3(vx, vy, vz);
|
||||
return mul(Inverse3x3(directionMatrix), torusLocal);
|
||||
}
|
||||
|
||||
float3 Cust3(float3 position, float distance, float warpScale, float timeValue)
|
||||
{
|
||||
float angle = (sin(timeValue / 6.0) * distance) / warpScale;
|
||||
float s = sin(angle);
|
||||
float c = cos(angle);
|
||||
float3x3 rotation = float3x3(
|
||||
c, 0.0, -s,
|
||||
0.0, 1.0, 0.0,
|
||||
s, 0.0, c
|
||||
);
|
||||
return mul(position, rotation);
|
||||
}
|
||||
|
||||
float3 WarpPosition(float3 worldPosition)
|
||||
{
|
||||
float warpScale = max(_J, 1.0);
|
||||
float3 cameraPosition = _SpaceWarpCameraPosition.w > 0.5 ? _SpaceWarpCameraPosition.xyz : GetCameraPositionWS();
|
||||
float3 previousCameraPosition = _SpaceWarpPreviousCameraPosition.w > 0.5 ? _SpaceWarpPreviousCameraPosition.xyz : cameraPosition;
|
||||
float frameTime = max(_SpaceWarpFrameTime, 0.0001);
|
||||
float timeValue = _SpaceWarpTime > 0.0 ? _SpaceWarpTime : _Time.y;
|
||||
|
||||
float3 position = worldPosition - cameraPosition;
|
||||
float3 cameraVelocity = (cameraPosition - previousCameraPosition) / frameTime;
|
||||
float distance = length(position) / warpScale;
|
||||
|
||||
float x = position.x;
|
||||
float y = position.y;
|
||||
float z = position.z;
|
||||
float2 orbit = Rotate2D(float2(warpScale, 0.0), timeValue);
|
||||
|
||||
float3x3 solv = float3x3(
|
||||
pow(2.0, -y / warpScale), 0.0, 0.0,
|
||||
x / warpScale, 1.0, -z / warpScale,
|
||||
0.0, 0.0, pow(2.0, y / warpScale)
|
||||
);
|
||||
|
||||
int mode = (int)round(_Mode);
|
||||
|
||||
if (mode == 0)
|
||||
{
|
||||
position = InvertSpace(position, float3(orbit.y, 0.0, orbit.x));
|
||||
}
|
||||
else if (mode == 1)
|
||||
{
|
||||
position = InvertSpace(position, float3(orbit.x, orbit.y, 0.0));
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
position = InvertSpace(position, float3(0.0, orbit.x, orbit.y));
|
||||
}
|
||||
else if (mode == 3)
|
||||
{
|
||||
position += cameraVelocity * distance / warpScale;
|
||||
}
|
||||
else if (mode == 4)
|
||||
{
|
||||
position = InvertSpace(position, float3(0.0, warpScale, 0.0));
|
||||
}
|
||||
else if (mode == 5)
|
||||
{
|
||||
position = InvertSpace(position, float3(0.0, -warpScale, 0.0));
|
||||
}
|
||||
else if (mode == 6)
|
||||
{
|
||||
position = mul(position, solv);
|
||||
}
|
||||
else if (mode == 7)
|
||||
{
|
||||
position = Cust1(position, length(position));
|
||||
}
|
||||
else if (mode == 8)
|
||||
{
|
||||
position = Cust2(position, cameraPosition, warpScale);
|
||||
}
|
||||
else if (mode == 9)
|
||||
{
|
||||
position = Cust3(position, length(position), warpScale, timeValue);
|
||||
}
|
||||
|
||||
float3 cameraForward = _SpaceWarpCameraForward.w > 0.5 ? WarpSafeNormalize(_SpaceWarpCameraForward.xyz) : WarpSafeNormalize(GetWorldSpaceViewDir(worldPosition) * -1.0);
|
||||
return cameraPosition + position - cameraForward * _F5Distance;
|
||||
}
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
positionWS = WarpPosition(positionWS);
|
||||
|
||||
output.positionHCS = TransformWorldToHClip(positionWS);
|
||||
output.uv = TRANSFORM_TEX(input.uv, _BaseMap);
|
||||
output.lightUv = TRANSFORM_TEX(input.uv2, _LightMap);
|
||||
output.textureData = input.uv2;
|
||||
output.color = input.color;
|
||||
output.fogFactor = ComputeFogFactor(output.positionHCS.z);
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
half4 baseSample = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv);
|
||||
half4 arraySample = SAMPLE_TEXTURE2D_ARRAY(_TextureArray, sampler_TextureArray, frac(input.uv), input.textureData.x);
|
||||
half4 lightSample = SAMPLE_TEXTURE2D(_LightMap, sampler_LightMap, input.lightUv);
|
||||
half4 vertexColor = input.color;
|
||||
|
||||
baseSample = lerp(half4(1, 1, 1, 1), baseSample, saturate(_UseBaseMap));
|
||||
baseSample = lerp(baseSample, arraySample, saturate(_UseTextureArray));
|
||||
lightSample = lerp(half4(1, 1, 1, 1), lightSample, saturate(_UseLightMap));
|
||||
vertexColor = lerp(half4(1, 1, 1, 1), vertexColor, saturate(_UseVertexColor));
|
||||
|
||||
half4 color = baseSample * lightSample * vertexColor * _BaseColor;
|
||||
|
||||
clip(color.a - _AlphaClipThreshold);
|
||||
|
||||
if (_UseFog > 0.5)
|
||||
{
|
||||
color.rgb = MixFog(color.rgb, input.fogFactor);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88453fab3fdf28e43aeb7d5c4beea68d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -779,7 +779,7 @@ PlayerSettings:
|
||||
qnxGraphicConfPath:
|
||||
apiCompatibilityLevel: 6
|
||||
captureStartupLogs: {}
|
||||
activeInputHandler: 0
|
||||
activeInputHandler: 2
|
||||
windowsGamepadBackendHint: 0
|
||||
cloudProjectId: 16816b7b-2478-42d6-b9aa-1f22b82e4182
|
||||
framebufferDepthMemorylessMode: 0
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
HOW TO USE:
|
||||
edit functions "cust1 cust2 cust3" for custom functions 7 8 and 9.
|
||||
The distortion function is in "geomfunc".
|
||||
cam is player eye position, to make F5 model viewing easy,
|
||||
you don't have to use this in the functions.
|
||||
|
||||
|
||||
NOTES:
|
||||
P is gl_Vertex.
|
||||
p is P.xyz-eye.
|
||||
dpos is velocity (jittery at the moment, not sure why).
|
||||
|
||||
*/
|
||||
|
||||
#include "uniforms.glsl"
|
||||
#include "functionlibs.glsl"
|
||||
|
||||
const float E = 2.718281828459045;
|
||||
const float PI= 3.14159265359;
|
||||
vec3 dir=playerLookVector;
|
||||
//CUSTOM WARP FUNCTIONS
|
||||
// pos | velocity|campos |headpos |dist | variable| pos xyz |time | world pos |
|
||||
vec3 cust1(vec3 p,vec3 vel,vec3 cam,vec3 eye,float d, float J, float x,float y,float z,float t,float X,float Y,float Z){
|
||||
|
||||
p=mat3(gbufferModelView)*p;
|
||||
p.z-=d/1.1;
|
||||
p=mat3(gbufferModelViewInverse)*p;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
vec4 rot4(vec4 p,vec4 q){
|
||||
return(qmul(qmul(q,p),-q));
|
||||
|
||||
}
|
||||
vec3 torusify(vec3 p,vec3 cam,float J){
|
||||
float K=J/2;
|
||||
p.y=tanh((p.y-cam.y)/K)*K;
|
||||
p.y-=K;
|
||||
|
||||
p.xy=vec2(-sin(p.x*PI/J)*p.y,cos(p.x*PI/J)*p.y)+vec2(0,K);
|
||||
p.y+=K;
|
||||
p.zy=vec2(sin(p.z*PI/J)*p.y,cos(p.z*PI/J)*p.y)-vec2(0,K);
|
||||
return p;
|
||||
}
|
||||
vec3 camtor(vec3 cam,vec3 vx,float J){
|
||||
return vx;
|
||||
}
|
||||
|
||||
vec3 cust2(vec3 p,vec3 vel,vec3 cam,vec3 eye,float d, float J, float x,float y,float z,float t,float X,float Y,float Z){
|
||||
p=torusify(p+cam,cam,J)-torusify(cam,cam,J);
|
||||
|
||||
vec3 vx=normalize(torusify(cam+vec3(0.01,0,0),cam,J)-torusify(cam,cam,J));
|
||||
vec3 vy=normalize(torusify(cam+vec3(0,0.01,0),cam,J)-torusify(cam,cam,J));
|
||||
vec3 vz=normalize(torusify(cam+vec3(0,0,0.01),cam,J)-torusify(cam,cam,J));
|
||||
mat3 dirc=mat3(vx,vy,vz);
|
||||
p=inverse(dirc)*p;
|
||||
return p;
|
||||
}
|
||||
|
||||
vec3 cust3(vec3 p,vec3 vel,vec3 cam,vec3 eye,float d, float J, float x,float y,float z,float t,float X,float Y,float Z){
|
||||
float a=(sin(t/6)*d)/J;
|
||||
|
||||
mat3 NIL = mat3(
|
||||
cos(a),0,-sin(a),
|
||||
0,1,0,
|
||||
sin(a),0,cos(a));
|
||||
|
||||
return p*NIL;
|
||||
}
|
||||
|
||||
|
||||
#define MODE 0 // [0 1 2 3 4 5 6 7 8 9]
|
||||
#define J 16 // [1 2 4 8 16 32 64 128 256 512]
|
||||
|
||||
#define f5_distance 1 // [1 2 3 4 5 6 7 8 9 10]
|
||||
|
||||
|
||||
//this is the function that warps space
|
||||
vec4 geomfunc(vec4 P){
|
||||
//basic variables
|
||||
vec3 cam=eyePosition;
|
||||
vec3 eye=relativeEyePosition;
|
||||
vec3 p=P.xyz+eye;
|
||||
|
||||
vec3 dpos=(cameraPosition-previousCameraPosition)/frameTime;
|
||||
float x=p.x,y=p.y,z=p.z,w=gl_Vertex.w,t=(frameTimeCounter);
|
||||
float X=x+cameraPosition.x,Y=y+cameraPosition.y,Z=z+cameraPosition.z;
|
||||
float d=length(p.xyz)/J;
|
||||
//Solv geodesic approximation matrix that I found myself.
|
||||
vec2 o =rot(vec2(J,0),frameTimeCounter);
|
||||
|
||||
mat3 SOLV=mat3(
|
||||
pow(2,-y/J), 0, 0,
|
||||
x/J, 1, -z/J,
|
||||
0, 0, pow(2,y/J));
|
||||
|
||||
|
||||
switch (MODE){
|
||||
|
||||
case 0:
|
||||
p=inv(p,vec3(o.y,0,o.x));;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
p=inv(p,vec3(o.x,o.y,0));;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
p=inv(p,vec3(0,o.x,o.y));;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
p+=dpos*d/J;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
p=inv(p,vec3(0,J,0));;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
p=inv(p,vec3(0,-J,0));;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
p=p*SOLV;;
|
||||
break;
|
||||
|
||||
//custom 1
|
||||
case 7:
|
||||
p=cust1(p,dpos,cam,eye,length(p.xyz),J,x,y,z,t,X,Y,Z);
|
||||
break;
|
||||
|
||||
//custom 2
|
||||
case 8:
|
||||
p=cust2(p,dpos,cam,eye,length(p.xyz),J,x,y,z,t,X,Y,Z);
|
||||
break;
|
||||
|
||||
//custom 3
|
||||
case 9:
|
||||
p=cust3(p,dpos,cam,eye,length(p.xyz),J,x,y,z,t,X,Y,Z);
|
||||
break;
|
||||
|
||||
default:
|
||||
p=p;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return vec4(p-(eye*f5_distance),gl_Vertex.w);
|
||||
}
|
||||
/*
|
||||
vec3 cust1(vec3 p,vec3 velocity,vec3 cam,vec3 eye,float d, float J, float x,float y,float z,float t,float X,float Y,float Z){
|
||||
p=mat3(gbufferModelView)*p;
|
||||
p.z-=d/1.1;
|
||||
p=mat3(gbufferModelViewInverse)*p;
|
||||
|
||||
return p;
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,100 @@
|
||||
//Basic functions that should exist in glsl already, why arent they built in
|
||||
float pow2(float a){return pow(2,a);}
|
||||
vec2 pow2(vec2 a){return vec2(pow(2,a.x),pow(2,a.y));}
|
||||
vec3 pow2(vec3 a){return vec3(pow(2,a.x),pow(2,a.y),pow(2,a.z));}
|
||||
vec4 pow2(vec4 a){return vec4(pow(2,a.x),pow(2,a.y),pow(2,a.z),pow(2,a.w));}
|
||||
|
||||
float dot2(float a){return a*a;}
|
||||
float dot2(vec2 a){return dot(a,a);}
|
||||
float dot2(vec3 a){return dot(a,a);}
|
||||
float dot2(vec4 a){return dot(a,a);}
|
||||
|
||||
float mix3(float a,float b,float c,float fac){return mix(mix(a,b,fac),mix(b,c,fac),fac);}
|
||||
vec2 mix3(vec2 a,vec2 b,vec2 c,float fac){return mix(mix(a,b,fac),mix(b,c,fac),fac);}
|
||||
vec3 mix3(vec3 a,vec3 b,vec3 c,float fac){return mix(mix(a,b,fac),mix(b,c,fac),fac);}
|
||||
vec4 mix3(vec4 a,vec4 b,vec4 c,float fac){return mix(mix(a,b,fac),mix(b,c,fac),fac);}
|
||||
float mix4(float a,float b,float c,float d,float fac){return mix(mix(mix(a,b,fac),mix(b,c,fac),fac),mix(mix(b,c,fac),mix(c,d,fac),fac),fac);}
|
||||
vec2 mix4(vec2 a,vec2 b,vec2 c,vec2 d,float fac){return mix(mix(mix(a,b,fac),mix(b,c,fac),fac),mix(mix(b,c,fac),mix(c,d,fac),fac),fac);}
|
||||
vec3 mix4(vec3 a,vec3 b,vec3 c,vec3 d,float fac){return mix(mix(mix(a,b,fac),mix(b,c,fac),fac),mix(mix(b,c,fac),mix(c,d,fac),fac),fac);}
|
||||
vec4 mix4(vec4 a,vec4 b,vec4 c,vec4 d,float fac){return mix(mix(mix(a,b,fac),mix(b,c,fac),fac),mix(mix(b,c,fac),mix(c,d,fac),fac),fac);}
|
||||
|
||||
|
||||
mat3 rotation3d(vec3 axis, float angle) {
|
||||
axis = normalize(axis);
|
||||
float s = sin(angle);
|
||||
float c = cos(angle);
|
||||
float oc = 1.0 - c;
|
||||
|
||||
return mat3(
|
||||
oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,
|
||||
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,
|
||||
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//Super basic 2D rotation function.
|
||||
vec2 rot(vec2 p,float a){vec2 A = p.xy*mat2(cos(a),sin(a),-sin(a),cos(a));return A;}
|
||||
|
||||
//Inversion function.
|
||||
vec3 inv(vec3 p,vec3 ofset){
|
||||
p+=ofset;
|
||||
p=normalize(p)*(dot2(ofset)/length(p));
|
||||
p=reflect(p,normalize(ofset));
|
||||
return p+ofset;
|
||||
}
|
||||
|
||||
//Inversion function with inverted inversion position.
|
||||
vec3 inv2(vec3 p,vec3 dpos){
|
||||
return length(dpos)>0.0001?inv(p,normalize(dpos)*(1/length(dpos))):p;
|
||||
}
|
||||
|
||||
//quaternion stuff
|
||||
vec4 qmul(vec4 a, vec4 b) {
|
||||
return vec4(
|
||||
a.w * b.xyz + b.w * a.xyz + cross(a.xyz, b.xyz),
|
||||
a.w * b.w - dot(a.xyz, b.xyz)
|
||||
);
|
||||
}
|
||||
vec4 qinv(vec4 a){
|
||||
return normalize(a)*(1./length(a));
|
||||
}
|
||||
vec3 qrot(vec3 pos, vec3 axis, float angle) {
|
||||
vec4 q = vec4(sin(angle / 2.0) * axis, cos(angle / 2.0));
|
||||
vec4 partial = qmul(q, vec4(pos, 0));
|
||||
// Skip calculating the real part, since it's always 0
|
||||
return -partial.w * q.xyz + q.w * partial.xyz + cross(q.xyz, partial.xyz);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec3 getm(mat3 matr){
|
||||
return vec3(matr[0][0],matr[1][1],matr[2][2]);
|
||||
}
|
||||
|
||||
/*
|
||||
y=y-(J/2);
|
||||
vec4 P=vec4(sin(x*PI/J)*(J/2),cos(z*PI/J)*y,-sin(z*PI/J)*y,cos(x*PI/J));
|
||||
p=P.xyz/(1+P.w);
|
||||
|
||||
return (P.xyz/(1+P.w))+vec3(0,J/4,0);
|
||||
|
||||
|
||||
|
||||
mat3 NIL = mat3(
|
||||
cos(a)*cosh(a),0,-sin(a)*cosh(a),
|
||||
0,1,0,
|
||||
sin(a)*cosh(a),0,cos(a)*cosh(a));
|
||||
mat3 NIL2 = mat3(
|
||||
cos(a)*cosh(a),-sin(a)*cosh(a),0,
|
||||
sin(a)*cosh(a),cos(a)*cosh(a),0,
|
||||
0,0,1);
|
||||
mat3 SOLV=mat3(
|
||||
exp(-y/J), 0, 0,
|
||||
x/J, 1, -z/J,
|
||||
0, 0, exp(y/J));
|
||||
mat3 SOLV2=mat3(
|
||||
exp(z/J), 0, 0,
|
||||
0, exp(-z/J),0,
|
||||
-x/J, y/J, 1);
|
||||
*/
|
||||
@@ -0,0 +1,10 @@
|
||||
#version 120
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = color;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#version 120
|
||||
|
||||
#include "common.glsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
position = gbufferModelViewInverse * position;
|
||||
|
||||
position = geomfunc(position);
|
||||
|
||||
position = gbufferModelView * position;
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * texture2D(lightmap, lmcoord.st) * color;
|
||||
|
||||
gl_FragData[0].rgb = gl_FragData[0].rgb;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#version 120
|
||||
#include "common.glsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
position = gbufferModelViewInverse * position;
|
||||
|
||||
position=geomfunc(position);
|
||||
|
||||
position = gbufferModelView * position;
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * texture2D(lightmap, lmcoord.st) * color;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#version 120
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ftransform();
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 120
|
||||
//Upper & lower parts of the sky
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = color;
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#version 120
|
||||
//Upper & lower parts of the sky
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#version 120
|
||||
//Sun & moon
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * color;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
//Sun & moon
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ftransform();
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * texture2D(lightmap, lmcoord.st) * color;
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#version 120
|
||||
#include "common.glsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
vec2 rot(float a, float A, float B){
|
||||
return vec2((cos(a)*A)+(sin(a)*B),(-sin(a)*A)+(cos(a)*B));
|
||||
}
|
||||
void main()
|
||||
{
|
||||
vec4 p = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
p = gbufferModelViewInverse * p;
|
||||
|
||||
|
||||
p = geomfunc(p);
|
||||
|
||||
p = gbufferModelView * p;
|
||||
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * p;
|
||||
|
||||
|
||||
gl_FogFragCoord = 1;
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * texture2D(lightmap, lmcoord.st) * color;
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#version 120
|
||||
|
||||
#include "common.glsl"
|
||||
|
||||
|
||||
//#define WORLD_SPACE //Implements the deformation in World Space. Uses Screen Space if not enabled.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
position = gbufferModelViewInverse * position;
|
||||
|
||||
position = geomfunc(position);
|
||||
|
||||
position = gbufferModelView * position;
|
||||
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * texture2D(lightmap, lmcoord.st) * color;
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#version 120
|
||||
|
||||
#include "common.glsl"
|
||||
|
||||
|
||||
//#define WORLD_SPACE //Implements the deformation in World Space. Uses Screen Space if not enabled.
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
position = gbufferModelViewInverse * position;
|
||||
|
||||
position = geomfunc(position);
|
||||
|
||||
position = gbufferModelView * position;
|
||||
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#version 120
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(texture, texcoord.st) * color;
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#version 120
|
||||
|
||||
#include "common.glsl"
|
||||
|
||||
//#define WORLD_SPACE //Implements the deformation in World Space. Uses Screen Space if not enabled.
|
||||
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texcoord;
|
||||
varying vec4 lmcoord;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 position = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
position = gbufferModelViewInverse * position;
|
||||
|
||||
position = geomfunc(position);
|
||||
|
||||
position = gbufferModelView * position;
|
||||
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * position;
|
||||
|
||||
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
|
||||
|
||||
texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
color = gl_Color;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
option.J=Scale
|
||||
option.J.comment=Scale of the world.
|
||||
option.MODE=Distortion Mode
|
||||
option.MODE.comment 0: Rotation zx\n1: Rotation xy\n2: Rotation yz\n3: Relativity (Jittery)\n4: Uptown\n5: Downtown\n6: Solv Geodesics\n7: Custom 1\n8: Custom 2\n9: Custom 3
|
||||
option.f5_distance F5 Distance
|
||||
option.f5_distance.comment Camera distance when you press F5
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
#Properties:
|
||||
frustum.culling=false
|
||||
|
||||
sliders J
|
||||
|
||||
#Custom Uniforms
|
||||
variable.float.cameraSmoothX = smooth(((cameraPositionInt.x+cameraPositionFract.x)-(previousCameraPositionInt.x+previousCameraPositionFract.x))/frameTime, 1, 1)
|
||||
variable.float.cameraSmoothY = smooth(((cameraPositionInt.y+cameraPositionFract.y)-(previousCameraPositionInt.y+previousCameraPositionFract.y))/frameTime, 1, 1)
|
||||
variable.float.cameraSmoothZ = smooth(((cameraPositionInt.z+cameraPositionFract.z)-(previousCameraPositionInt.z+previousCameraPositionFract.z))/frameTime, 1, 1)
|
||||
|
||||
uniform.vec3.cameraSmooth = vec3(cameraSmoothX, cameraSmoothY,cameraSmoothZ)
|
||||
@@ -0,0 +1,39 @@
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferPreviousModelView;
|
||||
uniform mat4 gbufferPreviousProjection;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 cameraPositionFract;
|
||||
uniform vec3 cameraPositionInt;
|
||||
uniform vec3 cameraOffset;
|
||||
uniform vec3 playerLookVector;
|
||||
uniform vec3 upPosition;
|
||||
uniform vec3 previousCameraPosition;
|
||||
uniform vec3 previousCameraPositionFract;
|
||||
uniform vec3 previousCameraPositionInt;
|
||||
uniform vec3 relativeEyePosition;
|
||||
uniform float eyeAltitude;
|
||||
|
||||
uniform vec3 chunkOffset;
|
||||
|
||||
|
||||
uniform float frameTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float viewHeight;
|
||||
uniform float viewWidth;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uniform vec3 eyePosition;
|
||||
|
||||
|
||||
|
||||
uniform vec3 cameraSmooth;
|
||||
Reference in New Issue
Block a user