Compare commits
20 commits
7bfa3e0db3
...
8113b3c567
Author | SHA1 | Date | |
---|---|---|---|
8113b3c567 | |||
bc79d08bbd | |||
e1e15a7119 | |||
3c97e9eadc | |||
c4989222d3 | |||
055513d61d | |||
8a0f93090a | |||
8898da47ce | |||
695d4b7732 | |||
5700f83dab | |||
988ea482c4 | |||
db09cb5495 | |||
e340845c09 | |||
f024e4dd4a | |||
b5e158f4f7 | |||
ccc15ac357 | |||
2c56f6fe52 | |||
76fbe75242 | |||
c4dc1e079f | |||
f5cbacd62e |
9 changed files with 278 additions and 50 deletions
BIN
Assets/meshes/assets.glb
(Stored with Git LFS)
BIN
Assets/meshes/assets.glb
(Stored with Git LFS)
Binary file not shown.
|
@ -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="48"
|
||||
android:versionName="1.53"
|
||||
android:versionCode="7"
|
||||
android:versionName="1.07"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
|
||||
|
@ -17,25 +17,43 @@
|
|||
<!-- <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 -->
|
||||
|
@ -45,11 +63,26 @@
|
|||
<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"
|
||||
|
@ -59,11 +92,23 @@
|
|||
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" />
|
||||
|
@ -86,4 +131,4 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
12
readme.md
12
readme.md
|
@ -56,6 +56,11 @@ todo
|
|||
stretch slash
|
||||
revolver
|
||||
flick reload
|
||||
toylike level editor
|
||||
(no details to get bogged down with)
|
||||
shape environment
|
||||
place structures
|
||||
sprinkle
|
||||
|
||||
enemy design
|
||||
dmg
|
||||
|
@ -63,7 +68,12 @@ todo
|
|||
3 single types *fodder
|
||||
dmg, spd, def
|
||||
3 double types *competent
|
||||
dmg+spd, spd+def, def+dmg
|
||||
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
|
||||
|
||||
bug(s)
|
||||
...
|
||||
|
|
141
src/Arts.cs
141
src/Arts.cs
|
@ -25,10 +25,30 @@ static class Arts
|
|||
{
|
||||
foreach (ModelNode node in assets_model.Nodes)
|
||||
{
|
||||
if (node.Mesh != null)
|
||||
if (node.Mesh != null && node.Child == null) // [!] sloppy way to differentiate
|
||||
{
|
||||
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(
|
||||
|
@ -55,7 +75,8 @@ static class Arts
|
|||
Matrix m4_world = Mono.world_pose.ToMatrix();
|
||||
Hierarchy.Push(m4_world);
|
||||
|
||||
meshes["Food"].Draw(
|
||||
// mesh test
|
||||
meshes["_dmg"].Draw(
|
||||
mat_mono,
|
||||
Matrix.TRS(
|
||||
V.XYZ(0, 0, -1),
|
||||
|
@ -64,13 +85,55 @@ 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 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);
|
||||
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);
|
||||
mesh.SetData(
|
||||
new Vertex[] {
|
||||
new( hand_pos, V.XYZ(0,0,1)),
|
||||
new( blade_pos, V.XYZ(0,0,1)),
|
||||
new( tip_pos, V.XYZ(0,0,1)),
|
||||
new(last_tip_pos, V.XYZ(0,0,1))
|
||||
},
|
||||
|
@ -80,22 +143,80 @@ static class Arts
|
|||
);
|
||||
mesh.Draw(
|
||||
mat_slash,
|
||||
Matrix.T(0, -1.0f, -1)
|
||||
Matrix.Identity,
|
||||
Color.Hex(0xF9BF05FF).ToLinear()
|
||||
);
|
||||
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];
|
||||
meshes["FoodParticle"].Draw(
|
||||
mat_mono,
|
||||
Mesh.Cube.Draw(
|
||||
mat_unlit,
|
||||
Matrix.TRS(
|
||||
particle.pos,
|
||||
particle.ori,
|
||||
particle.scl
|
||||
)
|
||||
),
|
||||
Color.Hex(0xC75A09FF).ToLinear()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
26
src/Data.cs
Normal file
26
src/Data.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
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();
|
||||
}
|
||||
}
|
11
src/Mono.cs
11
src/Mono.cs
|
@ -23,14 +23,21 @@ static class Mono
|
|||
}
|
||||
public static Mode mode;
|
||||
|
||||
public static Enemy[] enemy_types;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
game_time = 0.0;
|
||||
world_pose = new(0, 0, 0);
|
||||
menu = new(true);
|
||||
world_pose = new(0, -1, -2);
|
||||
menu = new(false);
|
||||
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()
|
||||
|
|
|
@ -31,7 +31,7 @@ class Program
|
|||
World.OcclusionEnabled = true;
|
||||
Device.DisplayBlend = DisplayBlend.AnyTransparent;
|
||||
Renderer.EnableSky = false;
|
||||
Renderer.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Renderer.ClearColor = Color.Hex(0x42A590FF).ToLinear();// new Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
Rig.Init();
|
||||
Mono.Init();
|
||||
|
|
17
src/Rig.cs
17
src/Rig.cs
|
@ -10,6 +10,8 @@ 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;
|
||||
|
||||
|
@ -30,6 +32,15 @@ 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);
|
||||
|
@ -43,6 +54,12 @@ 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;
|
||||
|
|
28
src/VFX.cs
28
src/VFX.cs
|
@ -16,13 +16,13 @@ static class VFX
|
|||
}
|
||||
}
|
||||
|
||||
public static void Play(XYZi pos)
|
||||
public static void Play(Vec3 pos)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
index = (index + 1) % particles.Length;
|
||||
Particle particle = particles[index];
|
||||
particle.pos = pos.ToVec3;
|
||||
particle.pos = pos;
|
||||
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,17 +37,19 @@ static class VFX
|
|||
if (particle.vel.MagnitudeSq > float.Epsilon)
|
||||
{
|
||||
particle.pos += particle.vel * Time.Stepf;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue