diff --git a/add/oriel.hlsl b/add/oriel.hlsl index eba21d6..991ede8 100644 --- a/add/oriel.hlsl +++ b/add/oriel.hlsl @@ -8,6 +8,7 @@ float _ypos; float3 _dimensions; float3 _center; float _crown; +float4x4 _matrix; Texture2D tex; // : register(t0); SamplerState tex_s; // : register(s0); @@ -50,9 +51,6 @@ psIn vs(vsIn input, uint id : SV_InstanceID) { o.uv = input.uv; o.color = input.col; - // float lighting = dot(o.norm, normalize(float3(-0.3, 0.6, 0.1))); - // lighting = (clamp(lighting, 0, 1) * 0.8) + 0.2; - // o.color.rgb = o.color.rgb * lighting; // * sk_inst[id].color; return o; } @@ -107,6 +105,8 @@ float oriel(float3 ro, float3 rd) { return dist; } + + float map(float3 pos) { // pos.x = _center.x + pos.x; // pos.y = _center.y + pos.y; @@ -122,7 +122,9 @@ float map(float3 pos) { // d.y = _height; // float orielCrown = sdBoxFrame(pos - _center, d, 0.000); - float box = sdBox(pos - _center, float3(0.1, 0.1, 0.1)); + // float box = sdBox(pos, float3(0.1, 0.1, 0.1)); + float box = sdBox((float3)mul(float4(pos, 1), _matrix), float3(0.1, 0.1, 0.1)); + // return lerp(sphere, octo, time); float plane = sdPlane(pos + float3(0, 1.5, 0), float3(0, 1, 0), 0); @@ -204,6 +206,7 @@ psOut ps(psIn input) { dif *= ao * sh; col = float3(0.1, 0.5, 0.3) * amb + float3(0.6, 0.8, 0.3) * dif; + // if (sdBox(pos - _center, _dimensions / 2) == 0.0) { diff --git a/app/Monolith.cs b/app/Monolith.cs index dd6f72e..5671b65 100644 --- a/app/Monolith.cs +++ b/app/Monolith.cs @@ -5,6 +5,7 @@ SKSettings settings = new SKSettings { appName = "oriels", assetsFolder = "add", depthMode = DepthMode.D32, + disableUnfocusedSleep = true, }; if (!SK.Initialize(settings)) Environment.Exit(1); diff --git a/app/Oriel.cs b/app/Oriel.cs index ab1d71e..c63365e 100644 --- a/app/Oriel.cs +++ b/app/Oriel.cs @@ -69,6 +69,10 @@ public class Oriel { data.time = (float)Time.Total; buffer.Set(data); + Matrix matrix = Matrix.TR(bounds.center + Vec3.Up * (float)Math.Sin(Time.Elapsedf), Quat.FromAngles(0, Time.Elapsedf * 60, 0)).Inverse; + // matrix. = (float)Math.Sin(Time.Elapsedf); + mat.SetMatrix("_matrix", matrix); + // circle around center // bounds.center = Quat.FromAngles(0, 0, Time.Totalf * 60) * Vec3.Up * 0.3f; // bounds.dimensions = _dimensions * (1f + (MathF.Sin(Time.Totalf * 3) * 0.3f));