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
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.slash"
android:versionCode="7"
android:versionName="1.07"
android:versionCode="48"
android:versionName="1.53"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
@ -17,43 +17,25 @@
<!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> -->
<!-- Generic OpenXR items -->
<uses-feature
android:name="android.hardware.vr.headtracking"
android:required="true"
android:version="1"
/>
<uses-feature 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" />
<queries>
<provider
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>
<provider 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>
</queries>
<!-- Vive specific items -->
<uses-feature
android:name="wave.feature.handtracking"
android:required="false"
/>
<uses-feature android:name="wave.feature.tracker" android:required="false" />
<uses-feature android:name="wave.feature.handtracking" android:required="false" />
<uses-feature android:name="wave.feature.tracker" android:required="false" />
<!-- Snapdragon specific items -->
<uses-permission
android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission"
android:required="false"
/>
<uses-permission android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission" android:required="false" />
<queries>
<package android:name="com.qualcomm.qti.spaces.services" />
<package android:name="com.qualcomm.qti.openxrruntime" />
<intent> <action
android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND"
/> </intent>
<intent> <action android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND" /> </intent>
</queries>
<!-- Oculus specific items -->
@ -63,26 +45,11 @@
<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_SCENE" />
<uses-feature
android:name="com.oculus.feature.PASSTHROUGH"
android:required="true"
/>
<uses-feature
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"
/>
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" />
<uses-feature 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
android:allowBackup="false"
@ -92,23 +59,11 @@
android:supportsRtl="true"
>
<!-- Oculus -->
<meta-data
android:name="com.oculus.supportedDevices"
android:value="quest2|quest3|questpro"
/>
<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.supportedDevices" android:value="quest2|quest3|questpro" />
<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" />
<uses-native-library
android:name="libopenxr_forwardloader.oculus.so"
android:required="false"
/>
<uses-native-library android:name="libopenxr_forwardloader.oculus.so" android:required="false" />
<!-- Pico -->
<meta-data android:name="pvr.app.type" android:value="vr" />
<meta-data android:name="handtracking" android:value="1" />
@ -131,4 +86,4 @@
</intent-filter>
</activity>
</application>
</manifest>
</manifest>

View file

@ -56,11 +56,6 @@ todo
stretch slash
revolver
flick reload
toylike level editor
(no details to get bogged down with)
shape environment
place structures
sprinkle
enemy design
dmg
@ -68,12 +63,7 @@ todo
3 single types *fodder
dmg, spd, def
3 double types *competent
dmg+spd, spd+def(offset annoyance with), 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
dmg+spd, spd+def, def+dmg
bug(s)
...

View file

@ -25,30 +25,10 @@ static class Arts
{
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);
}
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(
@ -75,8 +55,7 @@ static class Arts
Matrix m4_world = Mono.world_pose.ToMatrix();
Hierarchy.Push(m4_world);
// mesh test
meshes["_dmg"].Draw(
meshes["Food"].Draw(
mat_mono,
Matrix.TRS(
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();
Quat blade_ori = Rig.r_hld.orientation;
Vec3 blade_pos = Rig.r_hld.position;
Vec3 tip_pos = blade_pos + blade_ori * V.XYZ(0, 0, 1);
Quat hand_rot = Quat.FromAngles(0, 0, SKMath.Sin(Time.Totalf * 6f) * 30f);
Vec3 hand_pos = V.XYZ(SKMath.Sin(Time.Totalf * 1f) * 0.1f, 0, 0);
Vec3 tip_pos = hand_pos + hand_rot * V.XYZ(0, 1, 0);
mesh.SetData(
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(last_tip_pos, V.XYZ(0,0,1))
},
@ -143,80 +80,22 @@ static class Arts
);
mesh.Draw(
mat_slash,
Matrix.Identity,
Color.Hex(0xF9BF05FF).ToLinear()
Matrix.T(0, -1.0f, -1)
);
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
Particle[] particles = VFX.particles;
for (int i = 0; i < particles.Length; i++)
{
Particle particle = particles[i];
Mesh.Cube.Draw(
mat_unlit,
meshes["FoodParticle"].Draw(
mat_mono,
Matrix.TRS(
particle.pos,
particle.ori,
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 Enemy[] enemy_types;
public static void Init()
{
game_time = 0.0;
world_pose = new(0, -1, -2);
menu = new(false);
world_pose = new(0, 0, 0);
menu = new(true);
menu_pose = new(0, 0, 0);
menu_scale = 1 * U.cm;
mode = Mode.Mount;
enemy_types = new Enemy[] {
new("d"), new("s"), new("h"),
new("ds"), new("sh"), new("hd"),
};
}
public static void Frame()

View file

@ -31,7 +31,7 @@ class Program
World.OcclusionEnabled = true;
Device.DisplayBlend = DisplayBlend.AnyTransparent;
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();
Mono.Init();

View file

@ -10,8 +10,6 @@ static class Rig
public static DeltaBool btn_grip = 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 Pose r_con_stick = Pose.Identity;
@ -32,15 +30,6 @@ static class Rig
btn_select.Step(Input.Key(Key.MouseLeft).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.S).IsJustActive()) new_dir = new(+1, 0, 0);
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 input simulates controller...
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 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++)
{
index = (index + 1) % particles.Length;
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.ori = Quat.Identity;
particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle());
@ -37,19 +37,17 @@ static class VFX
if (particle.vel.MagnitudeSq > float.Epsilon)
{
particle.pos += particle.vel * Time.Stepf;
particle.vel *= 1 - (3 * Time.Stepf);
particle.scl *= 1 - (3 * Time.Stepf);
// float scl_rad = particle.scl * 0.5f * 0.333f;
// Vec3 next_pos = V.XYZ(
// Maths.s_clamp(particle.pos.x, 2 - 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)
// {
// particle.pos = next_pos;
// particle.vel = Vec3.Zero;
// }
float scl_rad = particle.scl * 0.5f * 0.333f;
Vec3 next_pos = V.XYZ(
Maths.s_clamp(particle.pos.x, 1 - 0.5f - scl_rad),
Maths.s_clamp(particle.pos.y, 1 - 0.5f - scl_rad),
Maths.s_clamp(particle.pos.z, 1 - 0.5f - scl_rad)
);
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;
}
}
}
}