aurora: Rename light att fields

This commit is contained in:
Luke Street 2022-05-10 19:37:06 -04:00
parent 59cf0255bf
commit eab2c577dd
3 changed files with 8 additions and 8 deletions

View File

@ -71,8 +71,8 @@ struct Light {
zeus::CVector3f pos{0.f, 0.f, 0.f};
zeus::CVector3f dir{0.f, 0.f, -1.f};
zeus::CColor color{0.f, 1.f};
zeus::CVector3f linAtt{1.f, 0.f, 0.f};
zeus::CVector3f angAtt{1.f, 0.f, 0.f};
zeus::CVector3f cosAtt{1.f, 0.f, 0.f};
zeus::CVector3f distAtt{1.f, 0.f, 0.f};
};
#ifndef NDEBUG

View File

@ -359,8 +359,8 @@ void GXLoadLightObjImm(const GX::LightObj* light, GX::LightID id) {
aurora::gfx::Light realLight;
realLight.pos.assign(light->px, light->py, light->pz);
realLight.dir.assign(light->nx, light->ny, light->nz);
realLight.angAtt.assign(light->a0, light->a1, light->a2);
realLight.linAtt.assign(light->k0, light->k1, light->k2);
realLight.cosAtt.assign(light->a0, light->a1, light->a2);
realLight.distAtt.assign(light->k0, light->k1, light->k2);
realLight.color.fromRGBA8(light->color.color[0], light->color.color[1], light->color.color[2], light->color.color[3]);
g_gxState.lights[idx] = realLight;
}

View File

@ -847,8 +847,8 @@ wgpu::ShaderModule build_shader(const ShaderConfig& config, const ShaderInfo& in
" pos: vec3<f32>,\n"
" dir: vec3<f32>,\n"
" color: vec4<f32>,\n"
" lin_att: vec3<f32>,\n"
" ang_att: vec3<f32>,\n"
" cos_att: vec3<f32>,\n"
" dist_att: vec3<f32>,\n"
"};";
addedLightStruct = true;
}
@ -873,8 +873,8 @@ wgpu::ShaderModule build_shader(const ShaderConfig& config, const ShaderInfo& in
} else if (cc.attnFn == GX::AF_SPOT) {
lightAttnFn = fmt::format(FMT_STRING(R"""(
var cosine = max(0.0, dot(ldir, light.dir));
var cos_attn = dot(light.ang_att, vec3<f32>(1.0, cosine, cosine * cosine));
var dist_attn = dot(light.lin_att, vec3<f32>(1.0, dist, dist2));
var cos_attn = dot(light.cos_att, vec3<f32>(1.0, cosine, cosine * cosine));
var dist_attn = dot(light.dist_att, vec3<f32>(1.0, dist, dist2));
attn = max(0.0, cos_attn / dist_attn);)"""));
} else if (cc.attnFn == GX::AF_SPEC) {
diffFn = GX::DF_NONE;