pruned in prep for multi oriel
28
.old/shader-snips.hlsl
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// float3 local = input.world - _center;
|
||||||
|
// clip(sign(_size - local.x) * sign(_size - local.y) * sign(_size - local.z));
|
||||||
|
// clip(sign(local.x + _size) * sign(local.y + _size) * sign(local.z + _size));
|
||||||
|
|
||||||
|
|
||||||
|
// scale RGB by perceived luminance
|
||||||
|
// float value = (c.r + c.r + c.g + c.g + c.g + c.b) / 6;
|
||||||
|
// c *= value;
|
||||||
|
|
||||||
|
|
||||||
|
// if (trunc(H * 100) % 2 == 0) {
|
||||||
|
// c = float3(1, 1, 1) - c;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// float3 local = (input.world - _center) / _size * 2;
|
||||||
|
// float2 plane = float2(local.x, local.y);
|
||||||
|
// float H = acos(normalize(plane).y) / 3.141592653589793;
|
||||||
|
// if (sign(plane.x) < 0) {
|
||||||
|
// H = (1 - H + 1) / 2;
|
||||||
|
// } else {
|
||||||
|
// H = H / 2;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// float C = distance(float2(0, 0), plane);
|
||||||
|
// float L = (1 + local.z) / 2;
|
||||||
|
// float3 c = HCLtoRGB(H, C, (L + 0.05) / 1.05);
|
||||||
|
// c *= L;
|
3
Niko.bat
|
@ -1,3 +0,0 @@
|
||||||
git fetch
|
|
||||||
git pull
|
|
||||||
Micro.bat
|
|
|
@ -1,11 +0,0 @@
|
||||||
Model Information:
|
|
||||||
* title: Megaman X4 - Cyber Space
|
|
||||||
* source: https://sketchfab.com/3d-models/megaman-x4-cyber-space-5fdca251c4734ec49e77c72903b1d234
|
|
||||||
* author: Sah Niemeyer (https://sketchfab.com/sahailaway)
|
|
||||||
|
|
||||||
Model License:
|
|
||||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
|
||||||
* requirements: Author must be credited. Commercial use is allowed.
|
|
||||||
|
|
||||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
|
||||||
This work is based on "Megaman X4 - Cyber Space" (https://sketchfab.com/3d-models/megaman-x4-cyber-space-5fdca251c4734ec49e77c72903b1d234) by Sah Niemeyer (https://sketchfab.com/sahailaway) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
|
37519
add/megaman/scene.gltf
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 540 KiB |
Before Width: | Height: | Size: 832 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1,011 B |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 988 B |
Before Width: | Height: | Size: 618 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2 MiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2.3 MiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 2 MiB |
|
@ -1,11 +0,0 @@
|
||||||
Model Information:
|
|
||||||
* title: White Hart House
|
|
||||||
* source: https://sketchfab.com/3d-models/white-hart-house-7f4084ed27634b0596061a6f9811cb64
|
|
||||||
* author: 9of9 (https://sketchfab.com/9of9)
|
|
||||||
|
|
||||||
Model License:
|
|
||||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
|
||||||
* requirements: Author must be credited. Commercial use is allowed.
|
|
||||||
|
|
||||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
|
||||||
This work is based on "White Hart House" (https://sketchfab.com/3d-models/white-hart-house-7f4084ed27634b0596061a6f9811cb64) by 9of9 (https://sketchfab.com/9of9) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
|
|
@ -1,23 +1,30 @@
|
||||||
#include "stereokit.hlsli"
|
#include "stereokit.hlsli"
|
||||||
|
|
||||||
// --name = dofdev/oriel
|
// --name = dofdev/oriel
|
||||||
float3 _center;
|
//--diffuse = white
|
||||||
float3 _dimensions;
|
|
||||||
float3 _light;
|
float3 _center;
|
||||||
float4x4 _matrix;
|
float3 _dimensions;
|
||||||
|
float3 _light;
|
||||||
|
float4x4 _matrix;
|
||||||
|
|
||||||
|
Texture2D diffuse : register(t0);
|
||||||
|
SamplerState diffuse_s : register(s0);
|
||||||
|
|
||||||
struct vsIn {
|
struct vsIn {
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float3 normal : NORMAL;
|
float3 normal : NORMAL;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
float3 color : COLOR0;
|
float3 color : COLOR0;
|
||||||
};
|
};
|
||||||
struct psIn {
|
struct psIn {
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
float3 world : WORLD;
|
float3 world : WORLD;
|
||||||
float3 normal : NORMAL;
|
float3 normal : NORMAL;
|
||||||
float4 color : COLOR0;
|
float4 color : COLOR0;
|
||||||
float3 camdir : TEXCOORD0;
|
float3 camdir : TEXCOORD1;
|
||||||
float3 campos : TEXCOORD1;
|
float3 campos : TEXCOORD2;
|
||||||
uint view_id : SV_RenderTargetArrayIndex;
|
uint view_id : SV_RenderTargetArrayIndex;
|
||||||
};
|
};
|
||||||
struct psOut {
|
struct psOut {
|
||||||
|
@ -35,6 +42,7 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
|
||||||
o.world = mul(input.position, sk_inst[id].world).xyz;
|
o.world = mul(input.position, sk_inst[id].world).xyz;
|
||||||
o.position = mul(float4(o.world, 1), sk_viewproj[o.view_id]);
|
o.position = mul(float4(o.world, 1), sk_viewproj[o.view_id]);
|
||||||
o.normal = normalize(mul(input.normal, (float3x3)sk_inst[id].world));
|
o.normal = normalize(mul(input.normal, (float3x3)sk_inst[id].world));
|
||||||
|
o.uv = input.uv;
|
||||||
o.color = float4(input.color * sk_inst[id].color.rgb, 1);
|
o.color = float4(input.color * sk_inst[id].color.rgb, 1);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
|
@ -64,7 +72,6 @@ float raymarch(float3 origin, float3 direction) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float3 pos = origin + dist * direction;
|
float3 pos = origin + dist * direction;
|
||||||
float step = sdBox(pos, _dimensions / 2.0);
|
float step = sdBox(pos, _dimensions / 2.0);
|
||||||
// float step = sdSphere(pos, _dimensions.y / 2.0);
|
|
||||||
if (step < 0.0001 || dist > 100) break; // 100 == distmax
|
if (step < 0.0001 || dist > 100) break; // 100 == distmax
|
||||||
dist += step;
|
dist += step;
|
||||||
}
|
}
|
||||||
|
@ -74,12 +81,11 @@ float raymarch(float3 origin, float3 direction) {
|
||||||
|
|
||||||
psOut ps(psIn input) {
|
psOut ps(psIn input) {
|
||||||
psOut o;
|
psOut o;
|
||||||
o.color = input.color;
|
o.color = input.color * diffuse.Sample(diffuse_s, input.uv);
|
||||||
o.depth = input.position.z;
|
o.depth = input.position.z;
|
||||||
|
|
||||||
float3 origin = input.campos;
|
float3 origin = input.campos;
|
||||||
float3 direction = normalize(input.world - origin);
|
float3 direction = normalize(input.world - origin);
|
||||||
// origin = ;
|
|
||||||
float ol = raymarch(origin, direction);
|
float ol = raymarch(origin, direction);
|
||||||
clip(100 - (ol + 1));
|
clip(100 - (ol + 1));
|
||||||
|
|
||||||
|
@ -87,18 +93,14 @@ psOut ps(psIn input) {
|
||||||
|
|
||||||
clip(distance(input.campos, input.world) - distance(input.campos, origin));
|
clip(distance(input.campos, input.world) - distance(input.campos, origin));
|
||||||
|
|
||||||
// normalize(input.world - _center)
|
|
||||||
float t = 1 - (1 + dot(input.normal, _light)) / 2;
|
float t = 1 - (1 + dot(input.normal, _light)) / 2;
|
||||||
// float3 light = lerp(float3(0.05, 0.05, 0.1), float3(0.95, 0.95, 0.9), t);
|
|
||||||
// o.color = float4(o.color.rgb * light, 1);
|
|
||||||
o.color = float4(o.color.rgb * t, 1);
|
o.color = float4(o.color.rgb * t, 1);
|
||||||
|
|
||||||
|
|
||||||
// backface
|
// backface
|
||||||
float3 localPos = mul(float4(input.world, 1), _matrix).xyz;
|
float3 localPos = mul(float4(input.world, 1), _matrix).xyz;
|
||||||
|
|
||||||
// localPos.y < -_dimensions.y / 2.99
|
if (localPos.y < -_dimensions.y / 2) {
|
||||||
if (localPos.y < -_dimensions.y / 2.99) {
|
|
||||||
clip(-1);
|
clip(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,33 +109,3 @@ psOut ps(psIn input) {
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// float3 local = input.world - _center;
|
|
||||||
// clip(sign(_size - local.x) * sign(_size - local.y) * sign(_size - local.z));
|
|
||||||
// clip(sign(local.x + _size) * sign(local.y + _size) * sign(local.z + _size));
|
|
||||||
|
|
||||||
|
|
||||||
// scale RGB by perceived luminance
|
|
||||||
// float value = (c.r + c.r + c.g + c.g + c.g + c.b) / 6;
|
|
||||||
// c *= value;
|
|
||||||
|
|
||||||
|
|
||||||
// if (trunc(H * 100) % 2 == 0) {
|
|
||||||
// c = float3(1, 1, 1) - c;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// float3 local = (input.world - _center) / _size * 2;
|
|
||||||
// float2 plane = float2(local.x, local.y);
|
|
||||||
// float H = acos(normalize(plane).y) / 3.141592653589793;
|
|
||||||
// if (sign(plane.x) < 0) {
|
|
||||||
// H = (1 - H + 1) / 2;
|
|
||||||
// } else {
|
|
||||||
// H = H / 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// float C = distance(float2(0, 0), plane);
|
|
||||||
// float L = (1 + local.z) / 2;
|
|
||||||
// float3 c = HCLtoRGB(H, C, (L + 0.05) / 1.05);
|
|
||||||
// c *= L;
|
|
|
@ -8,10 +8,11 @@ struct vsIn {
|
||||||
float3 norm : NORMAL;
|
float3 norm : NORMAL;
|
||||||
};
|
};
|
||||||
struct psIn {
|
struct psIn {
|
||||||
float4 pos : SV_POSITION;
|
float4 pos : SV_POSITION;
|
||||||
float4 col : COLOR;
|
float4 col : COLOR;
|
||||||
float4 world : WORLD;
|
float4 camDir : POSITION0;
|
||||||
uint view_id : SV_RenderTargetArrayIndex;
|
float4 world : WORLD;
|
||||||
|
uint view_id : SV_RenderTargetArrayIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
psIn vs(vsIn input, uint id : SV_InstanceID) {
|
psIn vs(vsIn input, uint id : SV_InstanceID) {
|
||||||
|
@ -27,7 +28,7 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
|
||||||
|
|
||||||
// float4 viewPosition = mul(input.pos, sk_view[o.view_id]);
|
// float4 viewPosition = mul(input.pos, sk_view[o.view_id]);
|
||||||
// o.pos = mul(viewPosition, sk_proj[o.view_id]);
|
// o.pos = mul(viewPosition, sk_proj[o.view_id]);
|
||||||
|
o.camDir = sk_camera_dir[0];
|
||||||
|
|
||||||
|
|
||||||
o.world = mul(input.pos, sk_inst[id].world);
|
o.world = mul(input.pos, sk_inst[id].world);
|
||||||
|
@ -39,16 +40,18 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
|
||||||
|
|
||||||
float4 ps(psIn input) : SV_TARGET {
|
float4 ps(psIn input) : SV_TARGET {
|
||||||
float4 c = input.col;
|
float4 c = input.col;
|
||||||
float3 rLocal = (input.world.xyz - _rGlovePos) * 6;
|
// float3 rLocal = (input.world.xyz - _rGlovePos) / 2;
|
||||||
c.r = 1 - min(abs(rLocal.x), 1.0);
|
// c.r = 1 - min(abs(rLocal.x), 1.0);
|
||||||
c.g = 1 - min(abs(rLocal.y), 1.0);
|
// c.g = 1 - min(abs(rLocal.y), 1.0);
|
||||||
c.b = 1 - min(abs(rLocal.z), 1.0);
|
// c.b = 1 - min(abs(rLocal.z), 1.0);
|
||||||
|
|
||||||
float m = min(c.r, min(c.g, c.b));
|
|
||||||
c.rgb *= m;
|
|
||||||
// if (m == 0) {
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
// float m = min(c.r, min(c.g, c.b));
|
||||||
|
// c.rgb *= m;
|
||||||
|
|
||||||
|
c.r = input.camDir.x;
|
||||||
|
c.g = input.camDir.y;
|
||||||
|
c.b = input.camDir.z;
|
||||||
|
c.a = 0.3;
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
19
app/App.cs
|
@ -1,16 +1,5 @@
|
||||||
using System;
|
interface IApp { // <T> ?
|
||||||
using StereoKit;
|
void Initialize();
|
||||||
|
void Update();
|
||||||
interface IApp<T> {
|
void Shutdown();
|
||||||
void Step();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class App {
|
|
||||||
public App() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Step() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
62
app/Mono.cs
|
@ -12,7 +12,6 @@ if (!SK.Initialize(settings))
|
||||||
|
|
||||||
Input.HandSolid(Handed.Max, false);
|
Input.HandSolid(Handed.Max, false);
|
||||||
Input.HandVisible(Handed.Max, true);
|
Input.HandVisible(Handed.Max, true);
|
||||||
// TextStyle style = Text.MakeStyle(Font.FromFile("DMMono-Regular.ttf"), 0.1f, Color.White);
|
|
||||||
|
|
||||||
Mono mono = Mono.inst;
|
Mono mono = Mono.inst;
|
||||||
while (SK.Step(() => {
|
while (SK.Step(() => {
|
||||||
|
@ -58,6 +57,7 @@ public class Mono {
|
||||||
|
|
||||||
Vec3 boardDir = Vec3.Forward;
|
Vec3 boardDir = Vec3.Forward;
|
||||||
public void Step() {
|
public void Step() {
|
||||||
|
|
||||||
rig.Step();
|
rig.Step();
|
||||||
scene.Step();
|
scene.Step();
|
||||||
|
|
||||||
|
@ -69,70 +69,12 @@ public class Mono {
|
||||||
|
|
||||||
// cubicCon.Step();
|
// cubicCon.Step();
|
||||||
|
|
||||||
// Vec3 fullstick = rig.Fullstick(false);
|
|
||||||
|
|
||||||
// colorCube.Palm(lCon.device);
|
// colorCube.Palm(lCon.device);
|
||||||
|
|
||||||
oriel.Step();
|
oriel.Step();
|
||||||
////
|
|
||||||
|
|
||||||
// °board [ pseudo code ]
|
// -------------------------------------------------
|
||||||
// // handling = 200±
|
|
||||||
// // speed = 10±
|
|
||||||
// // board.dir = Vec3.fwd
|
|
||||||
|
|
||||||
// // con.grip.frameDown:
|
|
||||||
// // handle = con
|
|
||||||
|
|
||||||
// // board.pos = FloorCenter
|
|
||||||
// // newDir = handle.pos.X0Z - board.pos.X0Z
|
|
||||||
// // board.dir = newDir.MagSq > 0.001f ? newDir.normalized : board.dir
|
|
||||||
// // board.ori = Quat.LookDir(board.dir)
|
|
||||||
|
|
||||||
// // twist = handle.grip * -(Quat.LookDir(board.dir).Inverse * handle.backhandDir).x
|
|
||||||
// // rig.ori *= Quat(0, twist * handling * delta, 0)
|
|
||||||
|
|
||||||
// // accel = handle.trigger
|
|
||||||
// // rig.pos += board.dir * accel * speed * delta
|
|
||||||
|
|
||||||
|
|
||||||
// // °board [ implementation ]
|
|
||||||
// float handling = 200;
|
|
||||||
// float speed = 10;
|
|
||||||
|
|
||||||
// Vec3 boardPos = rig.FloorCenter;
|
|
||||||
// Vec3 newDir = rig.HandleCon.pos.X0Z - boardPos.X0Z;
|
|
||||||
// boardDir = newDir.MagnitudeSq > 0.001f ? newDir.Normalized : boardDir;
|
|
||||||
// Quat boardOri = Quat.LookDir(boardDir);
|
|
||||||
|
|
||||||
// float twist = rig.HandleCon.device.grip * -(Quat.LookDir(boardDir).Inverse * rig.HandleCon.backhandDir).x;
|
|
||||||
// rig.ori *= Quat.FromAngles(0f, twist * handling * Time.Elapsedf, 0f);
|
|
||||||
|
|
||||||
// float accel = rig.HandleCon.device.trigger;
|
|
||||||
// rig.pos += boardDir * accel * speed * Time.Elapsedf;
|
|
||||||
|
|
||||||
// // Lines.Add(rig.HandleCon.pos, rig.HandleCon.pos + rig.HandleCon.backhandDir, Color.White, 0.01f);
|
|
||||||
// Mesh.Cube.Draw(Material.Default, Matrix.TRS(boardPos, boardOri, new Vec3(0.18f, 0.06f, 0.6f)));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DEPRECATED
|
|
||||||
// PullRequest.Slerp(boardDir.Normalized, handleDelta.Normalized, handleDelta.Magnitude * handling * Time.Elapsedf) : boardDir;
|
|
||||||
// Quat from = Quat.LookAt(rig.Head.position, rig.HandleCon.pos);
|
|
||||||
// Lines.Add(rig.HandleCon.pos, rig.HandleCon.pos + from * Vec3.Up, Color.Black, 0.01f);
|
|
||||||
|
|
||||||
|
|
||||||
// does the FloorCenter move with the CameraRoot?
|
|
||||||
|
|
||||||
// having a board underneath my feet and a virtual handlebar in my hand
|
|
||||||
// did a lot to improve the quality of the experience (+immersion -sickness)
|
|
||||||
// the ability and quality at which this can be propagated is higher than I first imagined
|
|
||||||
|
|
||||||
// next?
|
|
||||||
// lean turning (head moving in relation to hand, doesn't that happen a little already?)
|
|
||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
|
100
app/Oriel.cs
|
@ -4,12 +4,11 @@ using System.Collections.Generic;
|
||||||
using StereoKit;
|
using StereoKit;
|
||||||
|
|
||||||
public class Oriel {
|
public class Oriel {
|
||||||
static Material matFrame = new Material(Shader.FromFile("wireframe.hlsl"));
|
static Material matFrame = new Material(Shader.FromFile("shaders/wireframe.hlsl"));
|
||||||
static Material matPanes = new Material(Shader.FromFile("panes.hlsl"));
|
static Material matPanes = new Material(Shader.FromFile("shaders/panes.hlsl"));
|
||||||
static Material matOriel = new Material(Shader.FromFile("oriel.hlsl"));
|
static Material matOriel = new Material(Shader.FromFile("shaders/oriel.hlsl"));
|
||||||
static Model modelArena = Model.FromFile("megaman/scene.gltf");
|
|
||||||
static Model model = Model.FromFile("colorball.glb");
|
static Model model = Model.FromFile("colorball.glb");
|
||||||
Mesh meshCube, meshFrame;
|
Mesh meshCube;
|
||||||
|
|
||||||
public Bounds bounds;
|
public Bounds bounds;
|
||||||
public Quat ori;
|
public Quat ori;
|
||||||
|
@ -18,9 +17,6 @@ public class Oriel {
|
||||||
public bool drawAxis = false;
|
public bool drawAxis = false;
|
||||||
|
|
||||||
bool adjusting = false;
|
bool adjusting = false;
|
||||||
// bool scalingOriel = false;
|
|
||||||
// bool draggingOriel = false;
|
|
||||||
// bool rotatingOriel = false;
|
|
||||||
Quat qOffset = Quat.Identity;
|
Quat qOffset = Quat.Identity;
|
||||||
Vec3 vOffset = Vec3.Zero;
|
Vec3 vOffset = Vec3.Zero;
|
||||||
Vec3 lOffset = Vec3.Zero;
|
Vec3 lOffset = Vec3.Zero;
|
||||||
|
@ -37,41 +33,13 @@ public class Oriel {
|
||||||
matrix = Matrix.TR(bounds.center, ori).Inverse;
|
matrix = Matrix.TR(bounds.center, ori).Inverse;
|
||||||
|
|
||||||
matFrame.SetMat(102, Cull.None, true);
|
matFrame.SetMat(102, Cull.None, true);
|
||||||
|
matFrame.Transparency = Transparency.Add;
|
||||||
matPanes.SetMat(100, Cull.Front, false);
|
matPanes.SetMat(100, Cull.Front, false);
|
||||||
matOriel.SetMat(101, Cull.None, true);
|
matOriel.SetMat(101, Cull.None, true);
|
||||||
|
|
||||||
meshFrame = model.GetMesh("Wireframe");
|
// meshFrame = model.GetMesh("Wireframe");
|
||||||
meshCube = Mesh.Cube;
|
meshCube = Mesh.Cube;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
meshCube = Mesh.Sphere;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Gen();
|
Gen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +114,6 @@ public class Oriel {
|
||||||
detect.z == 0 ? 1 : 0
|
detect.z == 0 ? 1 : 0
|
||||||
);
|
);
|
||||||
|
|
||||||
// Quat q = Quat.FromAngles(up * Vec2.AngleBetween(dir.XZ, detect.XZ));
|
|
||||||
|
|
||||||
// a quick reset function, as the rotation gets fucked
|
|
||||||
|
|
||||||
Quat q = Quat.LookAt(Vec3.Zero, dir, up);
|
Quat q = Quat.LookAt(Vec3.Zero, dir, up);
|
||||||
|
|
||||||
if (!adjusting) {
|
if (!adjusting) {
|
||||||
|
@ -169,24 +133,13 @@ public class Oriel {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// meet the user halfway, as there is a lot of context provided with where they grab the oriel
|
|
||||||
// instead of a discrete handle and interaction
|
|
||||||
|
|
||||||
|
|
||||||
// circle around center
|
|
||||||
// bounds.center = Vec3.Forward * 3 + Quat.FromAngles(0, 0, Time.Totalf * 60) * Vec3.Up * 0.3f;
|
|
||||||
// bounds.dimensions.y = _dimensions.y * (1f + (MathF.Sin(Time.Totalf * 3) * 0.6f));
|
|
||||||
|
|
||||||
|
|
||||||
matrix = Matrix.TR(bounds.center, ori).Inverse;
|
matrix = Matrix.TR(bounds.center, ori).Inverse;
|
||||||
|
|
||||||
|
|
||||||
|
// matFrame.Wireframe = true;
|
||||||
matFrame.Wireframe = true;
|
|
||||||
matFrame.DepthTest = DepthTest.Always;
|
matFrame.DepthTest = DepthTest.Always;
|
||||||
matFrame.SetVector("_rGlovePos", rGlovePos);
|
matFrame.SetVector("_rGlovePos", rGlovePos);
|
||||||
// meshFrame.Draw(matFrame,
|
// meshCube.Draw(matFrame,
|
||||||
// Matrix.TRS(bounds.center, ori, bounds.dimensions),
|
// Matrix.TRS(bounds.center, ori, bounds.dimensions),
|
||||||
// new Color(0.1f, 0.1f, 0.1f)
|
// new Color(0.1f, 0.1f, 0.1f)
|
||||||
// );
|
// );
|
||||||
|
@ -198,10 +151,10 @@ public class Oriel {
|
||||||
|
|
||||||
// matPanes.DepthTest = DepthTest.Greater;
|
// matPanes.DepthTest = DepthTest.Greater;
|
||||||
matPanes["_matrix"] = (Matrix)System.Numerics.Matrix4x4.Transpose(matrix);
|
matPanes["_matrix"] = (Matrix)System.Numerics.Matrix4x4.Transpose(matrix);
|
||||||
// meshCube.Draw(matPanes,
|
meshCube.Draw(matPanes,
|
||||||
// Matrix.TRS(bounds.center, ori, bounds.dimensions),
|
Matrix.TRS(bounds.center, ori, bounds.dimensions),
|
||||||
// new Color(0.0f, 0.0f, 0.5f)
|
new Color(0.0f, 0.0f, 0.5f)
|
||||||
// );
|
);
|
||||||
|
|
||||||
matOriel.SetVector("_center", bounds.center);
|
matOriel.SetVector("_center", bounds.center);
|
||||||
matOriel.SetVector("_dimensions", bounds.dimensions);
|
matOriel.SetVector("_dimensions", bounds.dimensions);
|
||||||
|
@ -210,32 +163,10 @@ public class Oriel {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// placeholder "app"
|
||||||
// modelArena.Draw(Matrix.TRS(
|
|
||||||
// new Vec3(-1, -0.6f, 1.8f),
|
|
||||||
// Quat.FromAngles(0, -90, 0),
|
|
||||||
// Vec3.One * 0.002f
|
|
||||||
// ));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// APP
|
|
||||||
Vec3 playerWorldPos = playerPos * 0.5f * bounds.dimensions.y;
|
Vec3 playerWorldPos = playerPos * 0.5f * bounds.dimensions.y;
|
||||||
Matrix orielSimMatrix = Matrix.TRS(
|
Matrix orielSimMatrix = Matrix.TRS(
|
||||||
|
new Vec3(0, -bounds.dimensions.y / 2.01f, -playerWorldPos.z),
|
||||||
|
|
||||||
|
|
||||||
// new Vec3(0, -bounds.dimensions.y / 2, -playerWorldPos.z),
|
|
||||||
new Vec3(0, -bounds.dimensions.y / 3, -playerWorldPos.z),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Quat.Identity,
|
Quat.Identity,
|
||||||
Vec3.One * 0.5f * bounds.dimensions.y
|
Vec3.One * 0.5f * bounds.dimensions.y
|
||||||
);
|
);
|
||||||
|
@ -248,6 +179,9 @@ public class Oriel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mesh.Quad.Draw(matOriel,
|
Mesh.Quad.Draw(matOriel,
|
||||||
Matrix.TRS(Vec3.Zero, Quat.FromAngles(90, 0, 0), Vec3.One * 100f) * orielSimMatrix * matrix.Inverse,
|
Matrix.TRS(Vec3.Zero, Quat.FromAngles(90, 0, 0), Vec3.One * 100f) * orielSimMatrix * matrix.Inverse,
|
||||||
new Color(1.0f, 1.0f, 1.0f) * 0.3f
|
new Color(1.0f, 1.0f, 1.0f) * 0.3f
|
||||||
|
|
|
@ -99,11 +99,6 @@ public static class PullRequest {
|
||||||
return Vec3.Lerp(a * (float)Math.Sin(theta - theta * t) / sinTheta, b * (float)Math.Sin(theta * t) / sinTheta, t);
|
return Vec3.Lerp(a * (float)Math.Sin(theta - theta * t) / sinTheta, b * (float)Math.Sin(theta * t) / sinTheta, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Pose _pose = new Pose();
|
|
||||||
public static Pose WorldPose(this Pose pose, float scale = 1) {
|
|
||||||
return pose;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Noise {
|
public class Noise {
|
||||||
const uint CAP = 4294967295;
|
const uint CAP = 4294967295;
|
||||||
|
|
14
app/Scene.cs
|
@ -14,14 +14,11 @@ public class Scene {
|
||||||
BufferData data = new BufferData();
|
BufferData data = new BufferData();
|
||||||
|
|
||||||
Material matFloor = new Material(Shader.Default);
|
Material matFloor = new Material(Shader.Default);
|
||||||
// Model room = Model.FromFile("room/room.glb", Shader.FromFile("room.hlsl"));
|
Model shed = Model.FromFile("shed/shed.glb", Shader.FromFile("/shaders/room.hlsl"));
|
||||||
Model shed = Model.FromFile("shed/shed.glb", Shader.FromFile("room.hlsl"));
|
|
||||||
// Model skatepark = Model.FromFile("skatepark/scene.gltf", Shader.FromFile("room.hlsl"));
|
|
||||||
|
|
||||||
|
|
||||||
Solid floor;
|
Solid floor;
|
||||||
public Scene() {
|
public Scene() {
|
||||||
// Shader.FromFile("room.hlsl")
|
|
||||||
buffer = new MaterialBuffer<BufferData>(3); // index
|
buffer = new MaterialBuffer<BufferData>(3); // index
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,20 +50,11 @@ public class Scene {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// data.dimensions = Vec3.Zero;
|
// data.dimensions = Vec3.Zero;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
buffer.Set(data);
|
buffer.Set(data);
|
||||||
|
|
||||||
|
|
|
@ -19,19 +19,19 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="add/oriel.hlsl" />
|
<None Remove="add/shaders/oriel.hlsl" />
|
||||||
<None Remove="add/colorcube.hlsl" />
|
<None Remove="add/shaders/colorcube.hlsl" />
|
||||||
<None Remove="add/panes.hlsl" />
|
<None Remove="add/shaders/panes.hlsl" />
|
||||||
<None Remove="add/wireframe.hlsl" />
|
<None Remove="add/shaders/wireframe.hlsl" />
|
||||||
<None Remove="add/room.hlsl" />
|
<None Remove="add/shaders/room.hlsl" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SKShader Include="add/oriel.hlsl" />
|
<SKShader Include="add/shaders/oriel.hlsl" />
|
||||||
<SKShader Include="add/colorcube.hlsl" />
|
<SKShader Include="add/shaders/colorcube.hlsl" />
|
||||||
<SKShader Include="add/panes.hlsl" />
|
<SKShader Include="add/shaders/panes.hlsl" />
|
||||||
<SKShader Include="add/wireframe.hlsl" />
|
<SKShader Include="add/shaders/wireframe.hlsl" />
|
||||||
<SKShader Include="add/room.hlsl" />
|
<SKShader Include="add/shaders/room.hlsl" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|