浏览代码

Merge branch 'master' into metal

/main
Antti Tapaninen 8 年前
当前提交
1e761801
共有 3 个文件被更改,包括 6 次插入3 次删除
  1. 3
      Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
  2. 3
      Assets/ScriptableRenderPipeline/common/CubeToSpherical.shader
  3. 3
      Assets/ScriptableRenderPipeline/common/ShaderBase.h

3
Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl


// Texture format sampling
// ----------------------------------------------------------------------------
float2 DirectionToLatLongCoordinate(float3 dir)
float2 DirectionToLatLongCoordinate(float3 dir_in)
float3 dir = normalize(dir_in);
// coordinate frame is (-Z, X) meaning negative Z is primary axis and X is secondary axis.
return float2(1.0 - 0.5 * INV_PI * atan2(dir.x, -dir.z), asin(dir.y) * INV_PI + 0.5);
}

3
Assets/ScriptableRenderPipeline/common/CubeToSpherical.shader


return o;
}
half2 DirectionToSphericalTexCoordinate(half3 dir) // use this for the lookup
half2 DirectionToSphericalTexCoordinate(half3 dir_in) // use this for the lookup
half3 dir = normalize(dir_in);
// coordinate frame is (-Z,X) meaning negative Z is primary axis and X is secondary axis.
float recipPi = 1.0/3.1415926535897932384626433832795;
return half2( 1.0-0.5*recipPi*atan2(dir.x, -dir.z), asin(dir.y)*recipPi+0.5 );

3
Assets/ScriptableRenderPipeline/common/ShaderBase.h


#ifndef __SHADERBASE_H__
#define __SHADERBASE_H__
half2 DirectionToSphericalTexCoordinate(half3 dir)
half2 DirectionToSphericalTexCoordinate(half3 dir_in)
half3 dir = normalize(dir_in);
// coordinate frame is (-Z,X) meaning negative Z is primary axis and X is secondary axis.
float recipPi = 1.0 / 3.1415926535897932384626433832795;
return half2(1.0 - 0.5 * recipPi * atan2(dir.x, -dir.z), asin(dir.y) * recipPi + 0.5);

正在加载...
取消
保存