Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PBR sample ported from Nadrin/PBR #40

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PropertyGroup>
<_Command>dotnet $(_AssetProcessorPath)</_Command>
<_Command>$(_Command) $(_ProcessDir)</_Command>
<_Command>$(_Command) @(Asset->'%(Identity)', ' ')</_Command>
<_Command>$(_Command) @(Asset->'"%(Identity)::%(ProcessorFormat)"', ' ')</_Command>
</PropertyGroup>
<Message Importance="high" Text="Executing: $(_Command)" />
<Exec Command="$(_Command)" />
Expand Down
Binary file added assets/models/cerberus.fbx
Binary file not shown.
23 changes: 23 additions & 0 deletions assets/models/skybox.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
v 10.000000 -10.000000 -9.999999
v 10.000000 -10.000000 10.000000
v -10.000001 -10.000000 9.999998
v -9.999996 -10.000000 -10.000004
v 10.000005 10.000000 -9.999994
v 9.999993 10.000000 10.000006
v -10.000004 10.000000 9.999996
v -9.999999 10.000000 -10.000000
vn 0.0000 1.0000 -0.0000
vn 0.0000 -1.0000 0.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
s off
f 1//1 4//1 3//1 2//1
f 5//2 6//2 7//2 8//2
f 1//3 2//3 6//3 5//3
f 2//4 3//4 7//4 6//4
f 3//5 4//5 8//5 7//5
f 5//6 8//6 4//6 1//6
Binary file added assets/textures/cerberus_A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/cerberus_M.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/cerberus_N.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/cerberus_R.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16,640 changes: 16,640 additions & 0 deletions assets/textures/environment.hdr

Large diffs are not rendered by default.

232 changes: 87 additions & 145 deletions src/AnimatedMesh/Application/AnimatedMesh.cs

Large diffs are not rendered by default.

34 changes: 14 additions & 20 deletions src/AnimatedMesh/Application/AnimatedMesh.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(SrcDir)\Common\Model.cs" Link="Model.cs" />
<Compile Include="$(SrcDir)\Common\RawList.cs" Link="RawList.cs" />
<EmbeddedResource Include="$(SamplesAssetsDir)\models\goblin.dae">
<LogicalName>goblin.dae</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="$(SamplesAssetsDir)\textures\goblin_bc3_unorm.ktx">
<LogicalName>goblin_bc3_unorm.ktx</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Asset Include="$(SamplesAssetsDir)\models\goblin.dae" ProcessorFormat="ProcessedModelVertexElementSemantic=Position,TextureCoordinate,BoneWeights,BoneIndices%26PostProcessSteps=FlipWindingOrder|Triangulate|CalculateTangentSpace|GenerateSmoothNormals" />
<Asset Include="$(SamplesAssetsDir)\textures\goblin_bc3_unorm.ktx" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(SrcDir)\SampleBase\SampleBase.csproj" />
<PackageReference Include="Veldrid.Spirv" Version="$(VeldridSpirvVersion)" />
<PackageReference Include="AssimpNet" Version="$(AssimpNetVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SrcDir)\SampleBase\SampleBase.csproj" />
<PackageReference Include="Veldrid.Spirv" Version="$(VeldridSpirvVersion)" />
<PackageReference Include="AssimpNet" Version="$(AssimpNetVersion)" />
</ItemGroup>

</Project>
41 changes: 0 additions & 41 deletions src/AnimatedMesh/Application/AnimatedVertex.cs

This file was deleted.

31 changes: 0 additions & 31 deletions src/AnimatedMesh/Application/BoneAnimInfo.cs

This file was deleted.

29 changes: 0 additions & 29 deletions src/AnimatedMesh/Application/Extensions.cs

This file was deleted.

16 changes: 8 additions & 8 deletions src/AssetPrimitives/AssetPrimitives.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Veldrid" Version="$(VeldridVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Veldrid" Version="$(VeldridVersion)" />
</ItemGroup>

</Project>
20 changes: 18 additions & 2 deletions src/AssetPrimitives/BinaryExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -31,15 +34,28 @@ public static void WriteByteArray(this BinaryWriter writer, byte[] array)
writer.Write(array);
}

public static void WriteObjectArray<T>(this BinaryWriter writer, T[] array, Action<BinaryWriter, T> writeFunc)
public static void WriteObjectArray<T>(this BinaryWriter writer, ICollection<T> array, Action<BinaryWriter, T> writeFunc)
{
writer.Write(array.Length);
writer.Write(array.Count);
foreach (T item in array)
{
writeFunc(writer, item);
}
}

public static void WriteDictionary<TKey, TValue>(this BinaryWriter writer, IDictionary<TKey, TValue> dictionary, Action<BinaryWriter, TKey> keyWriterFunc, Action<BinaryWriter, TValue> valueWriteFunc)
{
writer.WriteObjectArray(dictionary.Keys, keyWriterFunc);
writer.WriteObjectArray(dictionary.Values, valueWriteFunc);
}

public static IDictionary<TKey, TValue> ReadDictionary<TKey, TValue>(this BinaryReader reader, Func<BinaryReader, TKey> keyReader, Func<BinaryReader, TValue> valueReader)
{
var keys = reader.ReadObjectArray(keyReader);
var values = reader.ReadObjectArray(valueReader);
return Enumerable.Zip(keys, values, Tuple.Create).ToDictionary(kvp => kvp.Item1, kvp => kvp.Item2);
}

public static T[] ReadObjectArray<T>(this BinaryReader reader, Func<BinaryReader, T> readFunc)
{
int length = reader.ReadInt32();
Expand Down
Loading