can't get shader to load :(
This commit is contained in:
parent
82d955aa07
commit
d6be9d3d34
4 changed files with 80 additions and 25 deletions
42
Assets/example.hlsl
Normal file
42
Assets/example.hlsl
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include "stereokit.hlsli"
|
||||||
|
|
||||||
|
//--name = sk/unlit
|
||||||
|
//--color:color = 1, 1, 1, 1
|
||||||
|
//--diffuse = white
|
||||||
|
float4 color;
|
||||||
|
Texture2D diffuse : register(t0);
|
||||||
|
SamplerState diffuse_s : register(s0);
|
||||||
|
|
||||||
|
|
||||||
|
struct vsIn {
|
||||||
|
float4 pos : SV_Position;
|
||||||
|
float3 norm : NORMAL0;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float4 col : COLOR0;
|
||||||
|
};
|
||||||
|
struct psIn {
|
||||||
|
float4 pos : SV_POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float4 color : COLOR0;
|
||||||
|
uint view_id : SV_RenderTargetArrayIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
psIn vs(vsIn input, uint id : SV_InstanceID) {
|
||||||
|
psIn o;
|
||||||
|
o.view_id = id % sk_view_count;
|
||||||
|
id = id / sk_view_count;
|
||||||
|
|
||||||
|
float3 world = mul(float4(input.pos.xyz, 1), sk_inst[id].world).xyz;
|
||||||
|
o.pos = mul(float4(world, 1), sk_viewproj[o.view_id]);
|
||||||
|
|
||||||
|
o.uv = input.uv;
|
||||||
|
o.color = input.col * color * sk_inst[id].color;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
float4 ps(psIn input) : SV_TARGET {
|
||||||
|
float4 col = diffuse.Sample(diffuse_s, input.uv);
|
||||||
|
|
||||||
|
col = col * input.color;
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
17
Program.cs
17
Program.cs
|
@ -1,14 +1,17 @@
|
||||||
|
using System;
|
||||||
using StereoKit;
|
using StereoKit;
|
||||||
|
|
||||||
class Program {
|
class Program {
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
// System.Console.WriteLine("Test");
|
SKSettings settings = new SKSettings
|
||||||
SKSettings settings = new SKSettings();
|
{
|
||||||
settings.appName = "oriels";
|
appName = "oriels",
|
||||||
settings.assetsFolder = "Assets";
|
assetsFolder = "Assets",
|
||||||
SK.Initialize(settings);
|
};
|
||||||
|
if (!SK.Initialize(settings))
|
||||||
|
Environment.Exit(1);
|
||||||
|
|
||||||
Model cursor = Model.FromFile("cursor.glb");
|
Model cursor = Model.FromFile("cursor.glb");
|
||||||
|
|
||||||
ColorCube cube = new ColorCube();
|
ColorCube cube = new ColorCube();
|
||||||
OrbitalView.strength = 4;
|
OrbitalView.strength = 4;
|
||||||
|
@ -17,6 +20,8 @@ class Program {
|
||||||
|
|
||||||
ReachCursor reachCursor = new ReachCursor();
|
ReachCursor reachCursor = new ReachCursor();
|
||||||
|
|
||||||
|
Material addMat = new Material(Shader.FromFile("example.hlsl"));
|
||||||
|
|
||||||
while(SK.Step(() => {
|
while(SK.Step(() => {
|
||||||
// Matrix orbitMatrix = OrbitalView.transform;
|
// Matrix orbitMatrix = OrbitalView.transform;
|
||||||
// cube.Step(Matrix.S(Vec3.One * 0.2f) * orbitMatrix);
|
// cube.Step(Matrix.S(Vec3.One * 0.2f) * orbitMatrix);
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net50</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="StereoKit" Version="0.3.4-preview.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Assets/**">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
<Link>Assets/%(RecursiveDir)%(Filename)%(Extension)</Link>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
27
oriels.csproj
Normal file
27
oriels.csproj
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="StereoKit" Version="0.3.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Assets/**">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<!-- <Link>Assets/%(RecursiveDir)%(Filename)%(Extension)</Link> -->
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Assets/example.hlsl" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<SKShader Include="Assets/example.hlsl" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Add table
Reference in a new issue