Reputation: 135
I am using a sampler to sample from texture:
constexpr sampler cubeSampler(filter::linear, mip_filter::none);
half4 res = cubeTexture.sample(cubeSampler, texVec);
The result is of type half4 but i need to cast it to float4 in order to perform math operations. How can i perform this cast?
Upvotes: 0
Views: 1654
Reputation: 31782
static_cast
works, or you can use the more terse converting constructor:
float4 res_float4 = float4(res);
Upvotes: 3
Reputation: 1773
constexpr sampler cubeSampler(filter::linear, mip_filter::none);
half4 res = cubeTexture.sample(cubeSampler, texVec);
// cast to float4:
float4 res_float4 = static_cast<float4>(res);
Upvotes: 1