XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFE.SpaceEngineers.AgentBridge

【SpaceEngineer】AI调试插件

公开
关注 0 Fork 0 Star 0
UTF-8
// Resample the engine's live HDR far probe in world-direction coordinates.
// No CPU readback, baked sky colour, or screen-colour approximation.
TextureCube<float4> engineProbe : register(t0);
SamplerState linearClamp : register(s0);
RWTexture2D<float4> environmentOutput : register(u0);
[numthreads(8,8,1)]
void CopyEnvironment(uint3 id:SV_DispatchThreadID) {
    uint w,h;environmentOutput.GetDimensions(w,h);if(any(id.xy>=uint2(w,h)))return;
    float2 uv=(float2(id.xy)+.5)/float2(w,h);
    float theta=uv.y*3.14159265359,phi=(uv.x-.5)*6.28318530718;
    float3 d=float3(sin(theta)*cos(phi),cos(theta),sin(theta)*sin(phi));
    // The installed renderer's probe coordinates mirror the world X axis.
    float3 c=engineProbe.SampleLevel(linearClamp,float3(-d.x,d.y,d.z),0).rgb;
    environmentOutput[id.xy]=float4(all(isfinite(c))?max(c,0):0,1);
}