Skip to content

Commit 6d4d986

Browse files
committed
Initial checkpoint.
0 parents  commit 6d4d986

File tree

89 files changed

+2918
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2918
-0
lines changed

.gitignore

+263
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
syntax: glob
2+
3+
#NuGet things
4+
project.lock.json
5+
6+
### VisualStudio ###
7+
8+
# User-specific files
9+
*.suo
10+
*.user
11+
*.userosscache
12+
*.sln.docstates
13+
14+
# Build results
15+
[Dd]ebug/
16+
[Dd]ebugPublic/
17+
[Rr]elease/
18+
[Rr]eleases/
19+
x64/
20+
x86/
21+
bld/
22+
[Bb]in/
23+
[Oo]bj/
24+
msbuild.log
25+
26+
# Visual Studio 2015
27+
.vs/
28+
29+
# Visual Studio 2015 Pre-CTP6
30+
*.sln.ide
31+
*.ide/
32+
33+
# MSTest test Results
34+
[Tt]est[Rr]esult*/
35+
[Bb]uild[Ll]og.*
36+
37+
#NUNIT
38+
*.VisualState.xml
39+
TestResult.xml
40+
41+
# Build Results of an ATL Project
42+
[Dd]ebugPS/
43+
[Rr]eleasePS/
44+
dlldata.c
45+
46+
*_i.c
47+
*_p.c
48+
*_i.h
49+
*.ilk
50+
*.meta
51+
*.obj
52+
*.pch
53+
*.pdb
54+
*.pgc
55+
*.pgd
56+
*.rsp
57+
*.sbr
58+
*.tlb
59+
*.tli
60+
*.tlh
61+
*.tmp
62+
*.tmp_proj
63+
*.log
64+
*.vspscc
65+
*.vssscc
66+
.builds
67+
*.pidb
68+
*.svclog
69+
*.scc
70+
71+
# Chutzpah Test files
72+
_Chutzpah*
73+
74+
# Visual C++ cache files
75+
ipch/
76+
*.aps
77+
*.ncb
78+
*.opensdf
79+
*.sdf
80+
*.cachefile
81+
82+
# Visual Studio profiler
83+
*.psess
84+
*.vsp
85+
*.vspx
86+
87+
# TFS 2012 Local Workspace
88+
$tf/
89+
90+
# Guidance Automation Toolkit
91+
*.gpState
92+
93+
# ReSharper is a .NET coding add-in
94+
_ReSharper*/
95+
*.[Rr]e[Ss]harper
96+
*.DotSettings.user
97+
98+
# JustCode is a .NET coding addin-in
99+
.JustCode
100+
101+
# TeamCity is a build add-in
102+
_TeamCity*
103+
104+
# DotCover is a Code Coverage Tool
105+
*.dotCover
106+
107+
# NCrunch
108+
_NCrunch_*
109+
.*crunch*.local.xml
110+
111+
# MightyMoose
112+
*.mm.*
113+
AutoTest.Net/
114+
115+
# Web workbench (sass)
116+
.sass-cache/
117+
118+
# Installshield output folder
119+
[Ee]xpress/
120+
121+
# DocProject is a documentation generator add-in
122+
DocProject/buildhelp/
123+
DocProject/Help/*.HxT
124+
DocProject/Help/*.HxC
125+
DocProject/Help/*.hhc
126+
DocProject/Help/*.hhk
127+
DocProject/Help/*.hhp
128+
DocProject/Help/Html2
129+
DocProject/Help/html
130+
131+
# Click-Once directory
132+
publish/
133+
134+
# Publish Web Output
135+
*.[Pp]ublish.xml
136+
*.azurePubxml
137+
*.pubxml
138+
*.publishproj
139+
140+
# NuGet Packages
141+
*.nupkg
142+
**/packages/*
143+
144+
# Windows Azure Build Output
145+
csx/
146+
*.build.csdef
147+
148+
# Windows Store app package directory
149+
AppPackages/
150+
151+
# Others
152+
sql/
153+
*.Cache
154+
ClientBin/
155+
[Ss]tyle[Cc]op.*
156+
~$*
157+
*.dbmdl
158+
*.dbproj.schemaview
159+
*.pfx
160+
*.publishsettings
161+
node_modules/
162+
*.metaproj
163+
*.metaproj.tmp
164+
165+
# RIA/Silverlight projects
166+
Generated_Code/
167+
168+
# Backup & report files from converting an old project file
169+
# to a newer Visual Studio version. Backup files are not needed,
170+
# because we have git ;-)
171+
_UpgradeReport_Files/
172+
Backup*/
173+
UpgradeLog*.XML
174+
UpgradeLog*.htm
175+
176+
# SQL Server files
177+
*.mdf
178+
*.ldf
179+
180+
# Business Intelligence projects
181+
*.rdl.data
182+
*.bim.layout
183+
*.bim_*.settings
184+
185+
# Microsoft Fakes
186+
FakesAssemblies/
187+
188+
### MonoDevelop ###
189+
190+
*.pidb
191+
*.userprefs
192+
193+
### Windows ###
194+
195+
# Windows image file caches
196+
Thumbs.db
197+
ehthumbs.db
198+
199+
# Folder config file
200+
Desktop.ini
201+
202+
# Recycle Bin used on file shares
203+
$RECYCLE.BIN/
204+
205+
# Windows Installer files
206+
*.cab
207+
*.msi
208+
*.msm
209+
*.msp
210+
211+
# Windows shortcuts
212+
*.lnk
213+
214+
### Linux ###
215+
216+
*~
217+
218+
# KDE directory preferences
219+
.directory
220+
221+
### OSX ###
222+
223+
.DS_Store
224+
.AppleDouble
225+
.LSOverride
226+
227+
# Icon must end with two \r
228+
Icon
229+
230+
# Thumbnails
231+
._*
232+
233+
# Files that might appear on external disk
234+
.Spotlight-V100
235+
.Trashes
236+
237+
# Directories potentially created on remote AFP share
238+
.AppleDB
239+
.AppleDesktop
240+
Network Trash Folder
241+
Temporary Items
242+
.apdisk
243+
244+
# vim temporary files
245+
[._]*.s[a-w][a-z]
246+
[._]s[a-w][a-z]
247+
*.un~
248+
Session.vim
249+
.netrwhist
250+
*~
251+
252+
*.ini
253+
*.VC.db
254+
*.nvact
255+
*.opendb
256+
257+
#VS Code stuff
258+
259+
.vscode
260+
launchSettings.json
261+
262+
# Generated shaders
263+
Shaders.Generated

Directory.Build.props

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="OutDir">
2+
<PropertyGroup>
3+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
4+
<RepositoryRootDirectory>$(MSBuildThisFileDirectory)</RepositoryRootDirectory>
5+
<BinDir>$(RepositoryRootDirectory)bin</BinDir>
6+
<OutputPath>$([System.IO.Path]::GetFullPath('$(RepositoryRootDirectory)bin\$(Configuration)'))\$(MSBuildProjectName)</OutputPath>
7+
<BaseIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(RepositoryRootDirectory)bin\obj\$(MSBuildProjectName)'))\</BaseIntermediateOutputPath>
8+
</PropertyGroup>
9+
<PropertyGroup>
10+
<!-- NuGet Package common properties. -->
11+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
12+
<Copyright>Copyright 2017 (c) Eric Mellino. All rights reserved.</Copyright>
13+
<Authors>Eric Mellino</Authors>
14+
</PropertyGroup>
15+
</Project>

src/TestApp/PrimitiveShapes.cs

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using System.Numerics;
2+
3+
namespace TestApp
4+
{
5+
public static partial class PrimitiveShapes
6+
{
7+
public static (VertexPositionNormalTexture[], ushort[]) Plane(int width, int height, int uvUnit)
8+
{
9+
float halfWidth = width / 2;
10+
float halfHeight = height / 2;
11+
12+
Vector2 uvScale = new Vector2(width / uvUnit, height / uvUnit);
13+
14+
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[]
15+
{
16+
new VertexPositionNormalTexture(new Vector3(-halfWidth, 0, -halfHeight), Vector3.UnitY, new Vector2(0, 0) * uvScale),
17+
new VertexPositionNormalTexture(new Vector3(halfWidth, 0, -halfHeight), Vector3.UnitY, new Vector2(1, 0) * uvScale),
18+
new VertexPositionNormalTexture(new Vector3(halfWidth, 0, halfHeight), Vector3.UnitY, new Vector2(1, 1) * uvScale),
19+
new VertexPositionNormalTexture(new Vector3(-halfWidth, 0, halfHeight), Vector3.UnitY, new Vector2(0, 1) * uvScale),
20+
};
21+
22+
ushort[] indices = new ushort[] { 0, 1, 2, 0, 2, 3 };
23+
24+
return (vertices, indices);
25+
}
26+
27+
internal static (VertexPositionNormalTexture[], ushort[]) Box(float width, float height, float depth, float uvUnit)
28+
{
29+
float halfWidth = width / 2;
30+
float halfHeight = height / 2;
31+
float halfDepth = depth / 2;
32+
33+
Vector2 uvScale = new Vector2(width / uvUnit, height / uvUnit);
34+
35+
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[]
36+
{
37+
// Top
38+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, -halfDepth), new Vector3(0,1,0), new Vector2(0, 0) * uvScale),
39+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, -halfDepth), new Vector3(0,1,0), new Vector2(1, 0) * uvScale),
40+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, +halfDepth), new Vector3(0,1,0), new Vector2(1, 1) * uvScale),
41+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, +halfDepth), new Vector3(0,1,0), new Vector2(0, 1) * uvScale),
42+
// Bottom
43+
new VertexPositionNormalTexture(new Vector3(-halfWidth,-halfHeight, +halfDepth), new Vector3(0,-1,0), new Vector2(0, 0) * uvScale),
44+
new VertexPositionNormalTexture(new Vector3(+halfWidth,-halfHeight, +halfDepth), new Vector3(0,-1,0), new Vector2(1, 0) * uvScale),
45+
new VertexPositionNormalTexture(new Vector3(+halfWidth,-halfHeight, -halfDepth), new Vector3(0,-1,0), new Vector2(1, 1) * uvScale),
46+
new VertexPositionNormalTexture(new Vector3(-halfWidth,-halfHeight, -halfDepth), new Vector3(0,-1,0), new Vector2(0, 1) * uvScale),
47+
// Left
48+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, -halfDepth), new Vector3(-1,0,0), new Vector2(0, 0) * uvScale),
49+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, +halfDepth), new Vector3(-1,0,0), new Vector2(1, 0) * uvScale),
50+
new VertexPositionNormalTexture(new Vector3(-halfWidth, -halfHeight, +halfDepth), new Vector3(-1,0,0), new Vector2(1, 1) * uvScale),
51+
new VertexPositionNormalTexture(new Vector3(-halfWidth, -halfHeight, -halfDepth), new Vector3(-1,0,0), new Vector2(0, 1) * uvScale),
52+
// Right
53+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, +halfDepth), new Vector3(1,0,0), new Vector2(0, 0) * uvScale),
54+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, -halfDepth), new Vector3(1,0,0), new Vector2(1, 0) * uvScale),
55+
new VertexPositionNormalTexture(new Vector3(+halfWidth, -halfHeight, -halfDepth), new Vector3(1,0,0), new Vector2(1, 1) * uvScale),
56+
new VertexPositionNormalTexture(new Vector3(+halfWidth, -halfHeight, +halfDepth), new Vector3(1,0,0), new Vector2(0, 1) * uvScale),
57+
// Back
58+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, -halfDepth), new Vector3(0,0,-1), new Vector2(0, 0) * uvScale),
59+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, -halfDepth), new Vector3(0,0,-1), new Vector2(1, 0) * uvScale),
60+
new VertexPositionNormalTexture(new Vector3(-halfWidth, -halfHeight, -halfDepth), new Vector3(0,0,-1), new Vector2(1, 1) * uvScale),
61+
new VertexPositionNormalTexture(new Vector3(+halfWidth, -halfHeight, -halfDepth), new Vector3(0,0,-1), new Vector2(0, 1) * uvScale),
62+
// Front
63+
new VertexPositionNormalTexture(new Vector3(-halfWidth, +halfHeight, +halfDepth), new Vector3(0,0,1), new Vector2(0, 0) * uvScale),
64+
new VertexPositionNormalTexture(new Vector3(+halfWidth, +halfHeight, +halfDepth), new Vector3(0,0,1), new Vector2(1, 0) * uvScale),
65+
new VertexPositionNormalTexture(new Vector3(+halfWidth, -halfHeight, +halfDepth), new Vector3(0,0,1), new Vector2(1, 1) * uvScale),
66+
new VertexPositionNormalTexture(new Vector3(-halfWidth, -halfHeight, +halfDepth), new Vector3(0,0,1), new Vector2(0, 1) * uvScale),
67+
};
68+
69+
ushort[] indices = new ushort[]
70+
{
71+
0,1,2, 0,2,3,
72+
4,5,6, 4,6,7,
73+
8,9,10, 8,10,11,
74+
12,13,14, 12,14,15,
75+
16,17,18, 16,18,19,
76+
20,21,22, 20,22,23,
77+
};
78+
79+
return (vertices, indices);
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)