summaryrefslogtreecommitdiffstats
path: root/res/effectlib/coordinateSource.glsllib
diff options
context:
space:
mode:
Diffstat (limited to 'res/effectlib/coordinateSource.glsllib')
-rw-r--r--res/effectlib/coordinateSource.glsllib24
1 files changed, 24 insertions, 0 deletions
diff --git a/res/effectlib/coordinateSource.glsllib b/res/effectlib/coordinateSource.glsllib
new file mode 100644
index 0000000..cfab74d
--- /dev/null
+++ b/res/effectlib/coordinateSource.glsllib
@@ -0,0 +1,24 @@
+texture_coordinate_info coordinateSource( in int coordinateSystem, in int textureSpace )
+{
+ texture_coordinate_info tci;
+ switch( coordinateSystem )
+ {
+ case texture_coordinate_object :
+ tci.position = varObjPos;
+ tci.tangent_u = normalize( varObjTangent );
+ tci.tangent_v = normalize( varObjBinormal );
+ break;
+ case texture_coordinate_world :
+ tci.position = varWorldPos;
+ tci.tangent_u = normalize( varTangent );
+ tci.tangent_v = normalize( varBinormal );
+ break;
+ case texture_coordinate_uvw :
+ default :
+ tci.position = varTexCoord0;
+ tci.tangent_u = normalize( varTangent );
+ tci.tangent_v = normalize( varBinormal );
+ break;
+ }
+ return( tci );
+}