Skip to content

Commit

Permalink
A bunch of small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Honeybunch committed Nov 24, 2023
1 parent e042f1d commit 0bf3fb3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/scenes/PBRTest.glb
Git LFS file not shown
4 changes: 2 additions & 2 deletions assets/scenes/pbr_test.blend
Git LFS file not shown
4 changes: 1 addition & 3 deletions source/gltf_P3N3T4U2.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct Interpolators {
float3 tangent : TANGENT0;
float3 binormal : BINORMAL0;
float2 uv : TEXCOORD0;
float4 clip : TEXCOORD1;
};

Interpolators vert(VertexIn i) {
Expand All @@ -42,7 +41,6 @@ Interpolators vert(VertexIn i) {
o.tangent = normalize(mul(orientation, i.tangent.xyz));
o.binormal = normalize(cross(o.tangent, o.normal) * i.tangent.w);
o.uv = uv_transform(i.uv, material_data.tex_transform);
o.clip = clip_pos;
return o;
}

Expand All @@ -65,7 +63,7 @@ float4 frag(Interpolators i, bool front_face : SV_IsFrontFace) : SV_TARGET {

float3 V = normalize(camera_data.view_pos - i.world_pos);
float3 R = reflect(-V, N);
float2 screen_uv = (i.clip.xy / i.clip.w) * 0.5 + 0.5;
float2 screen_uv = (i.clip_pos.xy / i.clip_pos.w) * 0.5 + 0.5;

float4 out_color = 0;
if (consts.perm & GLTF_PERM_PBR_METALLIC_ROUGHNESS) {
Expand Down
2 changes: 1 addition & 1 deletion source/irradiance.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ float4 frag(Interpolators i) : SV_TARGET {
float3 tmp_vec = cos(phi) * right + sin(phi) * up;
float3 sample_vec = cos(theta) * normal + sin(theta) * tmp_vec;

// Clamp each sample to 1 to avoid blowout
// Clamp each sample to 10 to avoid blowout
irradiance += min(env_map.Sample(material_sampler, sample_vec).rgb, 10) *
cos(theta) * sin(theta);
sample_count++;
Expand Down
1 change: 1 addition & 0 deletions source/noclipcontrollersystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void noclip_update_tick(ecs_iter_t *it) {

translate(&transform->transform, velocity);
rotate(&transform->transform, angular_velocity);
transform->dirty = true;
}
TracyCZoneEnd(ctx);
}
Expand Down
4 changes: 3 additions & 1 deletion source/thirdpersonsystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ void update_tp_movement(flecs::world &ecs, float delta_time,

// Construct target position to move the camera to
// TODO: Make this adjustable by the player
float distance = 10.0f;
static float distance = 10.0f;
distance += input.mouse.wheel.y;
distance = clampf(distance, 5, 15);
float3 camera_pos = body_to_cam * distance;

// TODO: The local space offset we want the camera to focus on
Expand Down

0 comments on commit 0bf3fb3

Please sign in to comment.