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

Chapter 3 Part 1: Model Loading #90

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -43,6 +43,7 @@
#*.jpg binary
#*.png binary
#*.gif binary
*.obj binary

###############################################################################
# diff behavior for common document formats
Expand Down
26 changes: 26 additions & 0 deletions Chapter3/1-ModelLoading/1-ModelLoading.csproj
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<RootNamespace>LearnOpenTK</RootNamespace>
<AssemblyName>LearnOpenTK</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>

<ItemGroup>
<None Include="Resources/**" CopyToOutputDirectory="PreserveNewest" />
<None Include="Shaders/**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTK" Version="4.8.2" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
<PackageReference Include="AssimpNet" Version="4.1.0" />
<PackageReference Include="StbImageSharp" Version="2.27.13" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Chapter3/1-ModelLoading/1-ModelLoading.sln
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "1-ModelLoading", "1-ModelLoading.csproj", "{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {57349D06-7972-4770-A2BD-D0B41770C0D5}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions Chapter3/1-ModelLoading/Program.cs
@@ -0,0 +1,25 @@
using OpenTK.Mathematics;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;

namespace LearnOpenTK
{
public static class Program
{
private static void Main()
{
var nativeWindowSettings = new NativeWindowSettings()
{
ClientSize = new Vector2i(800, 600),
Title = "LearnOpenTK - Model Loading",
// This is needed to run on macos
Flags = ContextFlags.ForwardCompatible,
};

using (var window = new Window(GameWindowSettings.Default, nativeWindowSettings))
{
window.Run();
}
}
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Chapter3/1-ModelLoading/Resources/Objects/Backpack/backpack.mtl
@@ -0,0 +1,16 @@
# Blender MTL File: 'None'
# Material Count: 1

newmtl Scene_-_Root
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2
map_Kd diffuse.jpg
map_Bump normal.png
map_Ks specular.jpg