Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SDK 0.5.0.1 #16

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1a71a43
Several fixes, added positional tracking
mattebb Oct 13, 2014
9136abf
WIP getting programmableRenderer working
mattebb Oct 22, 2014
85a671a
Working properly in programmableRenderer
mattebb Oct 23, 2014
2ff12f5
Cleanup, need cam.begin() and end()
mattebb Oct 26, 2014
f11364f
More fixes
mattebb Oct 27, 2014
a00a17d
Updated to SDK v0.43
mattebb Nov 2, 2014
7516700
Replace deprecated ovrHmd_GetEyePosePerEye
mattebb Nov 2, 2014
6e1fbbb
Cam works, doesn't work, works, doesn't work, now works...
mattebb Nov 2, 2014
3f570c6
For testing - get rid of viewAdjust
mattebb Nov 3, 2014
75f8f62
WIP code for SDK distortion rendering
mattebb Nov 3, 2014
45ed51a
Getting closer to SDK render working
mattebb Nov 4, 2014
910bfe6
#ifdefs now for SDK rendering, fixed final render target size
mattebb Nov 5, 2014
0f43c1e
Duh, matrix order
mattebb Nov 5, 2014
1fb51b7
Set low persistence on for SDK render
mattebb Nov 5, 2014
6b318bd
if, not ifdef
mattebb Nov 8, 2014
40153ab
SDK Render working in fixed function pipe now
mattebb Nov 15, 2014
6ca0291
Fix shaders for client distortion
mattebb Nov 24, 2014
4986e42
Cleanups, dismiss safety warning
mattebb Nov 24, 2014
8a50719
clean up frag shader
mattebb Nov 24, 2014
43464d3
Update project files
Feb 16, 2015
c9e78b9
Roll in patch from armadillu
Feb 16, 2015
c9d6945
Initialise hmdCaps properly
Feb 16, 2015
8194d78
adding orientation mat back
obviousjim Feb 25, 2015
25a2db0
Merge pull request #2 from obviousjim/mattebb-master
mattebb Feb 25, 2015
7db80df
Added recenter pose function
Feb 25, 2015
e1f2d3d
Update to 0.5.0.1 SDK
May 12, 2015
5ef5e4f
Some workarounds no longer needed
May 13, 2015
fa0b25b
Big refactor, preparing for dynamic HMD settings
May 13, 2015
42eb8fb
Restore quaternion convert
May 13, 2015
53009d7
First example modifying state at runtime
May 13, 2015
2466a42
Added functions to alter hmd settings and render target pixel density…
May 14, 2015
3b14dee
Remove PredictedOrientation stuff, not used any more
May 14, 2015
c4d7165
Remove last predictedOrientation vestiges
May 14, 2015
c3f8e7d
Remove Last predictedOrientation vestiges
May 14, 2015
ebf0b28
Configurable position tracking
May 14, 2015
34d91be
Position tracking leftovers
May 14, 2015
e1a5981
Cleanup of setup() method
May 14, 2015
8fb7c64
position tracking test
May 14, 2015
53fcb19
Added helper function for making OF Window fullscreen on the rift dis…
May 15, 2015
4685741
Add hooks for direct mode on Windows
May 15, 2015
84e7656
Function to retrieve user eye height from oculus config
May 15, 2015
09dcef6
Example improvements + performance tweaks
May 15, 2015
3ddabcc
Removed dependencies except for framework
May 15, 2015
f85031e
Restore old header paths, don't know why these were removed
Jul 9, 2015
8226341
cleaning
Jul 9, 2015
8426586
Get rid of old example
Jul 19, 2015
364d61e
Restored mouse picking
Jul 19, 2015
8c87815
Nasty judder fix!
Jul 25, 2015
5a6f60d
Fix OSX rift display finding function
Oct 13, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions example-OculusRiftRendering/src/main.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
647F8CA1199A793F006A51EB /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647F8CA0199A793F006A51EB /* CoreVideo.framework */; };
647F8DDF199AA4F1006A51EB /* ofxOculusDK2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 647F8D96199AA4F1006A51EB /* ofxOculusDK2.cpp */; };
BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; };
C9D106231B00E2BC00CA8511 /* LibOVR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9D106221B00E2BC00CA8511 /* LibOVR.framework */; };
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; };
E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; };
E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */; };
Expand Down Expand Up @@ -65,6 +66,7 @@
647F8D96199AA4F1006A51EB /* ofxOculusDK2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxOculusDK2.cpp; sourceTree = "<group>"; };
647F8D97199AA4F1006A51EB /* ofxOculusDK2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxOculusDK2.h; sourceTree = "<group>"; };
BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = "<group>"; };
C9D106221B00E2BC00CA8511 /* LibOVR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LibOVR.framework; path = ../libs/LibOVR/Lib/Mac/Release/LibOVR.framework; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
Expand All @@ -75,7 +77,7 @@
E45BE9770E8CC7DD009D7055 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
E45BE9790E8CC7DD009D7055 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
E4B69B5B0A3A1756003C02F2 /* OculusRenderingBasicDebug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OculusRenderingBasicDebug.app; sourceTree = BUILT_PRODUCTS_DIR; };
E4B69B5B0A3A1756003C02F2 /* OculusProgrammableRenderingDebug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OculusProgrammableRenderingDebug.app; sourceTree = BUILT_PRODUCTS_DIR; };
E4B69E1D0A3A1BDC003C02F2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; };
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = testApp.cpp; path = src/testApp.cpp; sourceTree = SOURCE_ROOT; };
E4B69E1F0A3A1BDC003C02F2 /* testApp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = testApp.h; path = src/testApp.h; sourceTree = SOURCE_ROOT; };
Expand All @@ -97,6 +99,7 @@
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */,
E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */,
E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */,
C9D106231B00E2BC00CA8511 /* LibOVR.framework in Frameworks */,
E45BE97D0E8CC7DD009D7055 /* AudioToolbox.framework in Frameworks */,
E45BE97E0E8CC7DD009D7055 /* Carbon.framework in Frameworks */,
E45BE97F0E8CC7DD009D7055 /* CoreAudio.framework in Frameworks */,
Expand Down Expand Up @@ -164,6 +167,7 @@
BBAB23CA13894EDB00AA2426 /* 3rd party frameworks */ = {
isa = PBXGroup;
children = (
C9D106221B00E2BC00CA8511 /* LibOVR.framework */,
BBAB23BE13894E4700AA2426 /* GLUT.framework */,
);
name = "3rd party frameworks";
Expand Down Expand Up @@ -194,7 +198,7 @@
E4EEC9E9138DF44700A80321 /* openFrameworks */,
BB4B014C10F69532006C3DED /* addons */,
E45BE5980E8CC70C009D7055 /* frameworks */,
E4B69B5B0A3A1756003C02F2 /* OculusRenderingBasicDebug.app */,
E4B69B5B0A3A1756003C02F2 /* OculusProgrammableRenderingDebug.app */,
);
sourceTree = "<group>";
};
Expand All @@ -221,9 +225,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
E4B69B5A0A3A1756003C02F2 /* OculusRenderingBasic */ = {
E4B69B5A0A3A1756003C02F2 /* OculusProgrammableRendering */ = {
isa = PBXNativeTarget;
buildConfigurationList = E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "OculusRenderingBasic" */;
buildConfigurationList = E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "OculusProgrammableRendering" */;
buildPhases = (
E4B69B580A3A1756003C02F2 /* Sources */,
E4B69B590A3A1756003C02F2 /* Frameworks */,
Expand All @@ -235,9 +239,9 @@
dependencies = (
E4EEB9AC138B136A00A80321 /* PBXTargetDependency */,
);
name = OculusRenderingBasic;
name = OculusProgrammableRendering;
productName = myOFApp;
productReference = E4B69B5B0A3A1756003C02F2 /* OculusRenderingBasicDebug.app */;
productReference = E4B69B5B0A3A1756003C02F2 /* OculusProgrammableRenderingDebug.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -248,7 +252,7 @@
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "OculusRenderingBasic" */;
buildConfigurationList = E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "OculusProgrammableRendering" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
Expand All @@ -269,7 +273,7 @@
);
projectRoot = "";
targets = (
E4B69B5A0A3A1756003C02F2 /* OculusRenderingBasic */,
E4B69B5A0A3A1756003C02F2 /* OculusProgrammableRendering */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -383,17 +387,22 @@
E4B69B600A3A1757003C02F2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
/Users/matt/Documents/Code/of_v0.8.4_osx_release/addons/ofxOculusDK2/libs/LibOVR/Lib/Mac/Release,
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/glut/lib/osx\"";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_CPP_RTTI = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_MODEL_TUNING = G4;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
GCC_STRICT_ALIASING = NO;
INFOPLIST_FILE = "openFrameworks-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
Expand Down Expand Up @@ -462,24 +471,30 @@
/Users/elias/Development/openFrameworks/addons/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Debug,
/Users/elias/Development/openFrameworks/addons/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Release,
);
PRODUCT_NAME = OculusRenderingBasicDebug;
PRODUCT_NAME = OculusProgrammableRenderingDebug;
SDKROOT = macosx10.9;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
E4B69B610A3A1757003C02F2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
/Users/matt/Documents/Code/of_v0.8.4_osx_release/addons/ofxOculusDK2/libs/LibOVR/Lib/Mac/Release,
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/glut/lib/osx\"";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_ENABLE_CPP_RTTI = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G4;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
GCC_STRICT_ALIASING = NO;
INFOPLIST_FILE = "openFrameworks-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
Expand Down Expand Up @@ -548,15 +563,16 @@
/Users/elias/Development/openFrameworks/addons/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Debug,
/Users/elias/Development/openFrameworks/addons/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Release,
);
PRODUCT_NAME = OculusRenderingBasic;
PRODUCT_NAME = OculusProgrammableRendering;
SDKROOT = macosx10.9;
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "OculusRenderingBasic" */ = {
E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "OculusProgrammableRendering" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E4B69B4E0A3A1720003C02F2 /* Debug */,
Expand All @@ -565,7 +581,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "OculusRenderingBasic" */ = {
E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "OculusProgrammableRendering" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E4B69B600A3A1757003C02F2 /* Debug */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ OF_PATH = ../../..
ADDONS_PATH = $(OF_PATH)/addons

// ofxOculusRift
OFX_OCULUSRIFT_HEADERS = $(ADDONS_PATH)/ofxOculusDK2/src $(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Include $(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Src

OFX_OCULUSRIFT_LIBS = "$(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Release/libovr.a"
OFX_OCULUSRIFT_HEADERS = $(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/include/ $(ADDONS_PATH)/ofxOculusDK2/src


// all addons
Expand Down
24 changes: 24 additions & 0 deletions example-ProgrammableRendering/bin/data/Shaders/simple.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#version 330

uniform mat4 modelViewProjectionMatrix; // automatically imported by OF
uniform mat4 modelViewMatrix; // automatically imported by OF
uniform mat4 normalMatrix; // the normal matrix (the inversed-then-transposed modelView matrix)
uniform int lightsNumber;

in vec4 eyeSpaceVertexPos, ambientGlobal;
in vec3 vertex_normal, interp_eyePos;

out vec4 fragColor;

void main()
{
vec3 n;

fragColor = ambientGlobal;
/* a fragment shader can't write an in variable, hence we need
a new variable to store the normalized interpolated normal */
n = normalize(vertex_normal);

fragColor += dot(n, normalize(vec3(0,100,0)- eyeSpaceVertexPos)) * vec3(.8,.8,0);
fragColor.w = 1.0;
}
20 changes: 20 additions & 0 deletions example-ProgrammableRendering/bin/data/Shaders/simple.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 330

uniform mat4 modelViewProjectionMatrix; // automatically imported by OF
uniform mat4 modelViewMatrix; // automatically imported by OF
uniform mat4 normalMatrix; // the normal matrix (the inversed-then-transposed modelView matrix)

in vec4 position; // in local space
in vec3 normal; // in local space

out vec4 eyeSpaceVertexPos, ambientGlobal;
out vec3 vertex_normal, interp_eyePos;


void main() {
ambientGlobal = material.emission; // no global lighting for the moment
eyeSpaceVertexPos = modelViewMatrix * position;
vertex_normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);
interp_eyePos = vec3(-eyeSpaceVertexPos);
gl_Position = modelViewProjectionMatrix * position;
}
20 changes: 20 additions & 0 deletions example-ProgrammableRendering/bin/data/Shaders_GL3/HmdWarpDK2.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 150

uniform sampler2D Texture;
uniform vec2 TextureScale;

in vec4 oColor;
in vec2 oTexCoord0;
in vec2 oTexCoord1;
in vec2 oTexCoord2;

out vec4 fragColor;

void main()
{
fragColor.r = oColor.r * texture(Texture, oTexCoord0).r;
fragColor.g = oColor.g * texture(Texture, oTexCoord1).g;
fragColor.b = oColor.b * texture(Texture, oTexCoord2).b;

fragColor.a = 1.0;
}
86 changes: 86 additions & 0 deletions example-ProgrammableRendering/bin/data/Shaders_GL3/HmdWarpDK2.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#version 150

// #extension GL_ARB_texture_rectangle : enable

uniform vec2 EyeToSourceUVScale;
uniform vec2 EyeToSourceUVOffset;
uniform mat4 EyeRotationStart;
uniform mat4 EyeRotationEnd;

in vec4 position;
in vec4 color;
in vec3 normal;
// in vec2 TexCoord0;
// in vec2 TexCoord1;
// in vec2 TexCoord2;

out vec4 oColor;
out vec2 oTexCoord0;
out vec2 oTexCoord1;
out vec2 oTexCoord2;

// varying vec4 oColor;
// varying vec2 oTexCoord0;
// varying vec2 oTexCoord1;
// varying vec2 oTexCoord2;

void main()
{
// gl_Position.x = gl_Vertex.x;
// gl_Position.y = gl_Vertex.y;
gl_Position.x = position.x;
gl_Position.y = position.y;
gl_Position.z = .0;
gl_Position.w = 1.0;

// Vertex inputs are in TanEyeAngle space for the R,G,B channels (i.e. after chromatic aberration and distortion).
// These are now "real world" vectors in direction (x,y,1) relative to the eye of the HMD.
vec3 TanEyeAngleR = vec3 ( normal.x, normal.y, 1.0 );
vec3 TanEyeAngleG = vec3 ( color.r, color.g, 1.0 );
vec3 TanEyeAngleB = vec3 ( color.b, color.a, 1.0 );
// vec3 TanEyeAngleR = vec3 ( TexCoord0.x, TexCoord0.y, 1.0 );
// vec3 TanEyeAngleG = vec3 ( TexCoord1.x, TexCoord1.y, 1.0 );
// vec3 TanEyeAngleB = vec3 ( TexCoord2.x, TexCoord2.y, 1.0 );

mat3 EyeRotation;
EyeRotation[0] = mix ( EyeRotationStart[0], EyeRotationEnd[0], position.z ).xyz;
EyeRotation[1] = mix ( EyeRotationStart[1], EyeRotationEnd[1], position.z ).xyz;
EyeRotation[2] = mix ( EyeRotationStart[2], EyeRotationEnd[2], position.z ).xyz;

// EyeRotation[0] = mix ( EyeRotationStart[0], EyeRotationEnd[0], Color.a ).xyz;
// EyeRotation[1] = mix ( EyeRotationStart[1], EyeRotationEnd[1], Color.a ).xyz;
// EyeRotation[2] = mix ( EyeRotationStart[2], EyeRotationEnd[2], Color.a ).xyz;

vec3 TransformedR = EyeRotation * TanEyeAngleR;
vec3 TransformedG = EyeRotation * TanEyeAngleG;
vec3 TransformedB = EyeRotation * TanEyeAngleB;

// Project them back onto the Z=1 plane of the rendered images.
float RecipZR = 1.0 / TransformedR.z;
float RecipZG = 1.0 / TransformedG.z;
float RecipZB = 1.0 / TransformedB.z;
vec2 FlattenedR = vec2 ( TransformedR.x * RecipZR, TransformedR.y * RecipZR );
vec2 FlattenedG = vec2 ( TransformedG.x * RecipZG, TransformedG.y * RecipZG );
vec2 FlattenedB = vec2 ( TransformedB.x * RecipZB, TransformedB.y * RecipZB );

// These are now still in TanEyeAngle space.
// Scale them into the correct [0-1],[0-1] UV lookup space (depending on eye)
vec2 SrcCoordR = FlattenedR * EyeToSourceUVScale + EyeToSourceUVOffset;
vec2 SrcCoordG = FlattenedG * EyeToSourceUVScale + EyeToSourceUVOffset;
vec2 SrcCoordB = FlattenedB * EyeToSourceUVScale + EyeToSourceUVOffset;

oTexCoord0 = SrcCoordR;
oTexCoord0.y = 1.0-oTexCoord0.y;
oTexCoord1 = SrcCoordG;
oTexCoord1.y = 1.0-oTexCoord1.y;
oTexCoord2 = SrcCoordB;
oTexCoord2.y = 1.0-oTexCoord2.y;

// oTexCoord0 = SrcCoordR;
// oTexCoord1 = SrcCoordG;
// oTexCoord2 = SrcCoordB;

oColor = vec4(normal.z, normal.z, normal.z, normal.z);
//oColor = vec4(Color.r, Color.r, Color.r, Color.r); // Used for vignette fade.

}
Loading