diff --git a/Micro.bat b/Micro.bat index 1a3a8c3..3218f3d 100644 --- a/Micro.bat +++ b/Micro.bat @@ -1,3 +1,5 @@ +@REM make console window active +@REM powershell -window normal -command "" dotnet build pause cd bin/Debug diff --git a/add/shaders/frame.hlsl b/add/shaders/frame.hlsl index 4cc5a3f..9402cc1 100644 --- a/add/shaders/frame.hlsl +++ b/add/shaders/frame.hlsl @@ -20,13 +20,13 @@ struct psIn { float3 campos : POSITION2; float3 camdir : NORMAL1; uint view_id : SV_RenderTargetArrayIndex; - uint id : SV_VertexID; + // uint id : SV_InstanceID; }; psIn vs(vsIn input, uint id : SV_InstanceID) { psIn o; - o.view_id = id % sk_view_count; - id = id / sk_view_count; + o.view_id = id % sk_view_count; + id = id / sk_view_count; o.world = mul(input.pos, sk_inst[id].world); o.pos = mul(o.world, sk_viewproj[o.view_id]); @@ -37,7 +37,7 @@ psIn vs(vsIn input, uint id : SV_InstanceID) { o.campos = sk_camera_pos[o.view_id].xyz; o.camdir = sk_camera_dir[o.view_id].xyz; - o.id = id; + // o.id = id; return o; } @@ -68,7 +68,7 @@ float4 ps(psIn input) : SV_TARGET { float3 flatnorm = (input.col.rgb - float3(0.5, 0.5, 0.5)) * 2; - flatnorm = normalize(mul(flatnorm, (float3x3)sk_inst[input.id].world)); + // flatnorm = normalize(mul(flatnorm, (float3x3)sk_inst[input.id].world)); // float3 cross = input.camDir * input.norm; float dist = length(input.world.xyz - input.campos); diff --git a/app/Space/Mono.cs b/app/Space/Mono.cs index df0799c..23a676f 100644 --- a/app/Space/Mono.cs +++ b/app/Space/Mono.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; // [X] stretch cursor move -// [ ] points *arbitrary for now -// [ ] follow player *cam? matrix? name? +// [X] nodes *point of reference rather than interest for now +// [X] follow player *cam? matrix? name? // [ ] orbital view // [ ] dummy enemies // [ ] trackballer spin @@ -27,15 +27,17 @@ public class Mono { public void Init() { Oriels.PullRequest.Noise noise = Oriels.Mono.inst.noise; - + // place nodes around a 10x4x10 cube + float scalar = 3f; for (int i = 0; i < nodes.Length; i++) { nodes[i] = new Node( new Vec3( - noise.value * 5f, - noise.value * 2f, - noise.value * 5f - ) + noise.value * 5f * scalar, + noise.value * 2f * scalar, + noise.value * 5f * scalar + ), + noise.uvalue ); } @@ -45,13 +47,14 @@ public class Mono { public void Frame() { Oriels.Rig rig = Oriels.Mono.inst.rig; Oriels.Oriel oriel = Oriels.Mono.inst.oriel; - + Matrix simMatrix = Matrix.TRS( - new Vec3(0, 0, 0), //-oriel.bounds.dimensions.y / 2.01f, -playerWorldPos.z), + -playerPos * 0.5f * oriel.bounds.dimensions.y, //-oriel.bounds.dimensions.y / 2.01f, -playerWorldPos.z), Quat.Identity, Vec3.One * 0.5f * oriel.bounds.dimensions.y ); + // stretch cursor pattern: // stretch = dist(offHand, mainHand) // max(stretch - deadzone, 0) @@ -65,6 +68,12 @@ public class Mono { Vec3 cursor = rig.rCon.pos + rig.rCon.ori * Vec3.Forward * stretch * 3; Vec3 localCursor = simMatrix.Inverse.Transform(oriel.matrix.Transform(cursor)); + localCursor = new Vec3( + MathF.Sin(Time.Totalf * 2f) * 3f, + MathF.Sin(Time.Totalf * 0.5f) * 3f, + MathF.Sin(Time.Totalf * 1f) * 3f + ); + // fly player towards cursor: // playerPos += (localCursor - playerPos).Normalized * 1f * Time.Elapsedf; pidX.p = moveP; pidY.p = moveP; pidZ.p = moveP; @@ -82,7 +91,7 @@ public class Mono { for (int i = 0; i < nodes.Length; i++) { meshCube.Draw(oriel.matOriel, Matrix.TRS(nodes[i].pos, Quat.Identity, Vec3.One * 1f) * simMatrix * oriel.matrix.Inverse, - Color.White + Color.HSV(nodes[i].hue, 1f, 1f) ); } @@ -175,8 +184,10 @@ public class Mono { public class Node { public Vec3 pos; + public float hue; - public Node(Vec3 pos) { + public Node(Vec3 pos, float hue) { this.pos = pos; + this.hue = hue; } } \ No newline at end of file diff --git a/app/_Init.cs b/app/_Init.cs index f3e36b2..c60f344 100644 --- a/app/_Init.cs +++ b/app/_Init.cs @@ -7,6 +7,7 @@ SKSettings settings = new SKSettings { assetsFolder = "add", depthMode = DepthMode.D32, disableUnfocusedSleep = true, + displayPreference = DisplayMode.Flatscreen, }; if (!SK.Initialize(settings)) Environment.Exit(1); diff --git a/oriels.csproj b/oriels.csproj index 07f2f1a..8e78513 100644 --- a/oriels.csproj +++ b/oriels.csproj @@ -7,7 +7,7 @@ - +