Compare commits

..

No commits in common. "8113b3c5678a48ad7fefbe30f1a746effb49e44b" and "7bfa3e0db37f35c2733c01379eb28b0b219ebaa5" have entirely different histories.

9 changed files with 50 additions and 278 deletions

BIN
Assets/meshes/assets.glb (Stored with Git LFS)

Binary file not shown.

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.slash" package="com.dofdev.slash"
android:versionCode="7" android:versionCode="48"
android:versionName="1.07" android:versionName="1.53"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" /> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
@ -17,43 +17,25 @@
<!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> --> <!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> -->
<!-- Generic OpenXR items --> <!-- Generic OpenXR items -->
<uses-feature <uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
android:name="android.hardware.vr.headtracking"
android:required="true"
android:version="1"
/>
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" /> <uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" /> <uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
<queries> <queries>
<provider <provider android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" />
android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" <intent> <action android:name="org.khronos.openxr.OpenXRRuntimeService" /> </intent>
/> <intent> <action android:name="org.khronos.openxr.OpenXRApiLayerService" /> </intent>
<intent> <action
android:name="org.khronos.openxr.OpenXRRuntimeService"
/> </intent>
<intent> <action
android:name="org.khronos.openxr.OpenXRApiLayerService"
/> </intent>
</queries> </queries>
<!-- Vive specific items --> <!-- Vive specific items -->
<uses-feature <uses-feature android:name="wave.feature.handtracking" android:required="false" />
android:name="wave.feature.handtracking" <uses-feature android:name="wave.feature.tracker" android:required="false" />
android:required="false"
/>
<uses-feature android:name="wave.feature.tracker" android:required="false" />
<!-- Snapdragon specific items --> <!-- Snapdragon specific items -->
<uses-permission <uses-permission android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission" android:required="false" />
android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission"
android:required="false"
/>
<queries> <queries>
<package android:name="com.qualcomm.qti.spaces.services" /> <package android:name="com.qualcomm.qti.spaces.services" />
<package android:name="com.qualcomm.qti.openxrruntime" /> <package android:name="com.qualcomm.qti.openxrruntime" />
<intent> <action <intent> <action android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND" /> </intent>
android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND"
/> </intent>
</queries> </queries>
<!-- Oculus specific items --> <!-- Oculus specific items -->
@ -63,26 +45,11 @@
<uses-permission android:name="com.oculus.permission.EYE_TRACKING" /> <uses-permission android:name="com.oculus.permission.EYE_TRACKING" />
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" /> <uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />
<uses-permission android:name="com.oculus.permission.USE_SCENE" /> <uses-permission android:name="com.oculus.permission.USE_SCENE" />
<uses-feature <uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" />
android:name="com.oculus.feature.PASSTHROUGH" <uses-feature android:name="oculus.software.handtracking" android:required="false" />
android:required="true" <uses-feature android:name="com.oculus.software.body_tracking" android:required="false" />
/> <uses-feature android:name="oculus.software.face_tracking" android:required="false" />
<uses-feature <uses-feature android:name="oculus.software.eye_tracking" android:required="false" />
android:name="oculus.software.handtracking"
android:required="false"
/>
<uses-feature
android:name="com.oculus.software.body_tracking"
android:required="false"
/>
<uses-feature
android:name="oculus.software.face_tracking"
android:required="false"
/>
<uses-feature
android:name="oculus.software.eye_tracking"
android:required="false"
/>
<application <application
android:allowBackup="false" android:allowBackup="false"
@ -92,23 +59,11 @@
android:supportsRtl="true" android:supportsRtl="true"
> >
<!-- Oculus --> <!-- Oculus -->
<meta-data <meta-data android:name="com.oculus.supportedDevices" android:value="quest2|quest3|questpro" />
android:name="com.oculus.supportedDevices" <meta-data android:name="com.oculus.handtracking.version" android:value="V2.0" />
android:value="quest2|quest3|questpro" <meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual" />
/>
<meta-data
android:name="com.oculus.handtracking.version"
android:value="V2.0"
/>
<meta-data
android:name="com.oculus.ossplash.background"
android:value="passthrough-contextual"
/>
<meta-data android:name="com.oculus.vr.focusaware" android:value="true" /> <meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
<uses-native-library <uses-native-library android:name="libopenxr_forwardloader.oculus.so" android:required="false" />
android:name="libopenxr_forwardloader.oculus.so"
android:required="false"
/>
<!-- Pico --> <!-- Pico -->
<meta-data android:name="pvr.app.type" android:value="vr" /> <meta-data android:name="pvr.app.type" android:value="vr" />
<meta-data android:name="handtracking" android:value="1" /> <meta-data android:name="handtracking" android:value="1" />
@ -131,4 +86,4 @@
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

@ -56,11 +56,6 @@ todo
stretch slash stretch slash
revolver revolver
flick reload flick reload
toylike level editor
(no details to get bogged down with)
shape environment
place structures
sprinkle
enemy design enemy design
dmg dmg
@ -68,12 +63,7 @@ todo
3 single types *fodder 3 single types *fodder
dmg, spd, def dmg, spd, def
3 double types *competent 3 double types *competent
dmg+spd, spd+def(offset annoyance with), def+dmg dmg+spd, spd+def, def+dmg
spd+def
offset annoyance with utility in gameplay
maybe it dashes into you and you can parry it back hard
and or able to sort of ride it around
bug(s) bug(s)
... ...

View file

@ -25,30 +25,10 @@ static class Arts
{ {
foreach (ModelNode node in assets_model.Nodes) foreach (ModelNode node in assets_model.Nodes)
{ {
if (node.Mesh != null && node.Child == null) // [!] sloppy way to differentiate if (node.Mesh != null)
{ {
meshes.Add(node.Name, node.Mesh); meshes.Add(node.Name, node.Mesh);
} }
else
{
// parse enemy cols
for (int i = 0; i < Mono.enemy_types.Length; i++)
{
Enemy enemy_type = Mono.enemy_types[i];
if (node.Name == enemy_type.col_ref)
{
ModelNode sibling = node.Child;
while (sibling != null)
{
enemy_type.cols.Add(new(
sibling.LocalTransform.Pose.position,
sibling.LocalTransform.Scale.x * 2.0f
));
sibling = sibling.Sibling;
}
}
}
}
} }
text_style = TextStyle.FromFont( text_style = TextStyle.FromFont(
@ -75,8 +55,7 @@ static class Arts
Matrix m4_world = Mono.world_pose.ToMatrix(); Matrix m4_world = Mono.world_pose.ToMatrix();
Hierarchy.Push(m4_world); Hierarchy.Push(m4_world);
// mesh test meshes["Food"].Draw(
meshes["_dmg"].Draw(
mat_mono, mat_mono,
Matrix.TRS( Matrix.TRS(
V.XYZ(0, 0, -1), V.XYZ(0, 0, -1),
@ -85,55 +64,13 @@ static class Arts
) )
); );
// bamboo
Mesh.Cube.Draw(
mat_unlit,
Matrix.TS(
V.XYZ(0, 1, -5),
V.XYZ(0.1f, 2, 0.1f)
),
Color.Hex(0xB9E7AFFF)
);
// unit cube
// Mesh.Cube.Draw(
// mat_unlit,
// Matrix.Identity,
// Color.Hex(0x13180AFF).ToLinear()
// );
// enemy
Enemy enemy_test = Mono.enemy_types[(int)(Time.Totalf % Mono.enemy_types.Length)];
enemy_test.pose.position = V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 1.0f, 0.666f, -3.0f);
enemy_test.pose.orientation = Quat.FromAngles(0, Time.Totalf * 30, 0);
for (int i = 0; i < enemy_test.cols.Count; i++)
{
Sphere col = enemy_test.cols[i];
Mesh.Sphere.Draw(
mat_mono,
Matrix.TS(
col.center,
col.radius * 2.0f
) * enemy_test.pose.ToMatrix(),
Color.Hex(0x13180AFF).ToLinear()
);
}
// eyes
// Mesh.Cube.Draw(
// mat_unlit,
// Rig.head.ToMatrix().Transform(),
// Color.Hex(0x13180AFF).ToLinear()
// );
// blade
Mesh mesh = new(); Mesh mesh = new();
Quat blade_ori = Rig.r_hld.orientation; Quat hand_rot = Quat.FromAngles(0, 0, SKMath.Sin(Time.Totalf * 6f) * 30f);
Vec3 blade_pos = Rig.r_hld.position; Vec3 hand_pos = V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 0.1f, 0, 0);
Vec3 tip_pos = blade_pos + blade_ori * V.XYZ(0, 0, 1); Vec3 tip_pos = hand_pos + hand_rot * V.XYZ(0, 1, 0);
mesh.SetData( mesh.SetData(
new Vertex[] { new Vertex[] {
new( blade_pos, V.XYZ(0,0,1)), new( hand_pos, V.XYZ(0,0,1)),
new( tip_pos, V.XYZ(0,0,1)), new( tip_pos, V.XYZ(0,0,1)),
new(last_tip_pos, V.XYZ(0,0,1)) new(last_tip_pos, V.XYZ(0,0,1))
}, },
@ -143,80 +80,22 @@ static class Arts
); );
mesh.Draw( mesh.Draw(
mat_slash, mat_slash,
Matrix.Identity, Matrix.T(0, -1.0f, -1)
Color.Hex(0xF9BF05FF).ToLinear()
); );
last_tip_pos = Vec3.Lerp(last_tip_pos, tip_pos, Time.Stepf / 0.1f); last_tip_pos = Vec3.Lerp(last_tip_pos, tip_pos, Time.Stepf / 0.1f);
// revolver
Quat rvolv_ori = Rig.l_aim.orientation;
Vec3 rvolv_pos = Rig.l_aim.position;
Ray ray = new(
rvolv_pos,
rvolv_ori * Vec3.Forward
);
Lines.Add(
ray,
10.0f, // [!] hardcoded design value
Color.Hex(0xF9BF05FF).ToLinear(),
U.cm
);
if (true) // hit test
{
Matrix enemy_m4 = enemy_test.pose.ToMatrix();
Ray local_ray = enemy_m4.Inverse.Transform(ray);
bool hit = false;
float min_dist = float.MaxValue;
Vec3 min_hit_pos = Vec3.Zero;
for (int i = 0; i < enemy_test.cols.Count; i++)
{
Sphere col = enemy_test.cols[i];
Vec3 hit_pos = Vec3.Zero;
if (col.Intersect(local_ray, out hit_pos))
{
float hit_dist = Vec3.Distance(hit_pos, local_ray.position);
if (hit_dist < min_dist)
{
hit = true;
min_dist = hit_dist;
min_hit_pos = hit_pos;
}
}
}
min_hit_pos = enemy_m4.Transform(min_hit_pos);
if (hit)
{
Mesh.Sphere.Draw(
mat_unlit,
Matrix.TS(
min_hit_pos,
4 * U.cm
),
Color.White
);
if (Rig.btn_select.delta == +1)
{
VFX.Play(min_hit_pos);
}
}
}
// particles // particles
Particle[] particles = VFX.particles; Particle[] particles = VFX.particles;
for (int i = 0; i < particles.Length; i++) for (int i = 0; i < particles.Length; i++)
{ {
Particle particle = particles[i]; Particle particle = particles[i];
Mesh.Cube.Draw( meshes["FoodParticle"].Draw(
mat_unlit, mat_mono,
Matrix.TRS( Matrix.TRS(
particle.pos, particle.pos,
particle.ori, particle.ori,
particle.scl particle.scl
), )
Color.Hex(0xC75A09FF).ToLinear()
); );
} }

View file

@ -1,26 +0,0 @@
using StereoKit;
using System.Collections.Generic;
namespace slash;
public static class Data
{
}
public class Enemy
{
public Pose pose;
public string col_ref;
public List<Sphere> cols;
public Enemy(string col_ref)
{
this.pose = new();
this.col_ref = col_ref;
this.cols = new();
}
}

View file

@ -23,21 +23,14 @@ static class Mono
} }
public static Mode mode; public static Mode mode;
public static Enemy[] enemy_types;
public static void Init() public static void Init()
{ {
game_time = 0.0; game_time = 0.0;
world_pose = new(0, -1, -2); world_pose = new(0, 0, 0);
menu = new(false); menu = new(true);
menu_pose = new(0, 0, 0); menu_pose = new(0, 0, 0);
menu_scale = 1 * U.cm; menu_scale = 1 * U.cm;
mode = Mode.Mount; mode = Mode.Mount;
enemy_types = new Enemy[] {
new("d"), new("s"), new("h"),
new("ds"), new("sh"), new("hd"),
};
} }
public static void Frame() public static void Frame()

View file

@ -31,7 +31,7 @@ class Program
World.OcclusionEnabled = true; World.OcclusionEnabled = true;
Device.DisplayBlend = DisplayBlend.AnyTransparent; Device.DisplayBlend = DisplayBlend.AnyTransparent;
Renderer.EnableSky = false; Renderer.EnableSky = false;
Renderer.ClearColor = Color.Hex(0x42A590FF).ToLinear();// new Color(0.0f, 0.0f, 0.0f, 0.0f); Renderer.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
Rig.Init(); Rig.Init();
Mono.Init(); Mono.Init();

View file

@ -10,8 +10,6 @@ static class Rig
public static DeltaBool btn_grip = new(false); public static DeltaBool btn_grip = new(false);
public static DeltaBool btn_back = new(false); public static DeltaBool btn_back = new(false);
public static Pose l_hld, l_aim, r_hld, r_aim;
public static Vec3 fullstick = Vec3.Up; public static Vec3 fullstick = Vec3.Up;
public static Pose r_con_stick = Pose.Identity; public static Pose r_con_stick = Pose.Identity;
@ -32,15 +30,6 @@ static class Rig
btn_select.Step(Input.Key(Key.MouseLeft).IsActive()); btn_select.Step(Input.Key(Key.MouseLeft).IsActive());
btn_back.Step(Input.Key(Key.MouseRight).IsActive()); btn_back.Step(Input.Key(Key.MouseRight).IsActive());
r_hld = new Pose(
V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 0.1f, 0.5f, 1.0f),
Quat.FromAngles(0, 0, SKMath.Sin(Time.Totalf * 6f) * 30f)
);
l_aim = new Pose(
V.XYZ(SKMath.Sin(Time.Totalf * 2f) * 0.6f, 0.5f, 0.5f),
Quat.Identity
);
if (Input.Key(Key.A).IsJustActive()) new_dir = new(-1, 0, 0); if (Input.Key(Key.A).IsJustActive()) new_dir = new(-1, 0, 0);
if (Input.Key(Key.S).IsJustActive()) new_dir = new(+1, 0, 0); if (Input.Key(Key.S).IsJustActive()) new_dir = new(+1, 0, 0);
if (Input.Key(Key.W).IsJustActive()) new_dir = new(0, 0, -1); if (Input.Key(Key.W).IsJustActive()) new_dir = new(0, 0, -1);
@ -54,12 +43,6 @@ static class Rig
// Hand r_hand = Input.Hand(Handed.Right); // Hand r_hand = Input.Hand(Handed.Right);
// [!] hand input simulates controller... // [!] hand input simulates controller...
Controller r_con = Input.Controller(Handed.Right); Controller r_con = Input.Controller(Handed.Right);
r_hld = r_con.pose;
r_aim = r_con.aim;
Controller l_con = Input.Controller(Handed.Left);
l_hld = l_con.pose;
l_aim = l_con.aim;
bool con_tracked = r_con.trackedPos > TrackState.Lost; bool con_tracked = r_con.trackedPos > TrackState.Lost;
// bool hand_tracked = Input.HandSource(Handed.Right) > HandSource.None; // bool hand_tracked = Input.HandSource(Handed.Right) > HandSource.None;

View file

@ -16,13 +16,13 @@ static class VFX
} }
} }
public static void Play(Vec3 pos) public static void Play(XYZi pos)
{ {
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
index = (index + 1) % particles.Length; index = (index + 1) % particles.Length;
Particle particle = particles[index]; Particle particle = particles[index];
particle.pos = pos; particle.pos = pos.ToVec3;
particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 6.0f; particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 6.0f;
particle.ori = Quat.Identity; particle.ori = Quat.Identity;
particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle()); particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle());
@ -37,19 +37,17 @@ static class VFX
if (particle.vel.MagnitudeSq > float.Epsilon) if (particle.vel.MagnitudeSq > float.Epsilon)
{ {
particle.pos += particle.vel * Time.Stepf; particle.pos += particle.vel * Time.Stepf;
particle.vel *= 1 - (3 * Time.Stepf); float scl_rad = particle.scl * 0.5f * 0.333f;
particle.scl *= 1 - (3 * Time.Stepf); Vec3 next_pos = V.XYZ(
// float scl_rad = particle.scl * 0.5f * 0.333f; Maths.s_clamp(particle.pos.x, 1 - 0.5f - scl_rad),
// Vec3 next_pos = V.XYZ( Maths.s_clamp(particle.pos.y, 1 - 0.5f - scl_rad),
// Maths.s_clamp(particle.pos.x, 2 - scl_rad), Maths.s_clamp(particle.pos.z, 1 - 0.5f - scl_rad)
// Maths.s_clamp(particle.pos.y, 2 - scl_rad), );
// Maths.s_clamp(particle.pos.z, 2 - scl_rad) if (next_pos.x != particle.pos.x || next_pos.y != particle.pos.y || next_pos.z != particle.pos.z)
// ); {
// if (next_pos.x != particle.pos.x || next_pos.y != particle.pos.y || next_pos.z != particle.pos.z) particle.pos = next_pos;
// { particle.vel = Vec3.Zero;
// particle.pos = next_pos; }
// particle.vel = Vec3.Zero;
// }
} }
} }
} }