Skip to content
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
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
77 changes: 77 additions & 0 deletions Samples/SamplesWithSceneLoaderNuget.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWPWithSceneLoaderNuget", "UWPWithSceneLoaderNuget\UWPWithSceneLoaderNuget.csproj", "{5FB71C86-83B6-41A9-B615-F167BC6BB135}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloComposition", "WPFWithSceneLoaderNuget\HelloComposition.csproj", "{22EE43E6-C315-4210-AD49-BEA973EEE550}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|Any CPU.ActiveCfg = Debug|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM.ActiveCfg = Debug|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM.Build.0 = Debug|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM.Deploy.0 = Debug|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM64.ActiveCfg = Debug|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM64.Build.0 = Debug|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|ARM64.Deploy.0 = Debug|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x64.ActiveCfg = Debug|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x64.Build.0 = Debug|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x64.Deploy.0 = Debug|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x86.ActiveCfg = Debug|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x86.Build.0 = Debug|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Debug|x86.Deploy.0 = Debug|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|Any CPU.ActiveCfg = Release|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM.ActiveCfg = Release|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM.Build.0 = Release|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM.Deploy.0 = Release|ARM
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM64.ActiveCfg = Release|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM64.Build.0 = Release|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|ARM64.Deploy.0 = Release|ARM64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x64.ActiveCfg = Release|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x64.Build.0 = Release|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x64.Deploy.0 = Release|x64
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x86.ActiveCfg = Release|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x86.Build.0 = Release|x86
{5FB71C86-83B6-41A9-B615-F167BC6BB135}.Release|x86.Deploy.0 = Release|x86
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|ARM.ActiveCfg = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|ARM.Build.0 = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|ARM64.Build.0 = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|x64.ActiveCfg = Debug|x64
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|x64.Build.0 = Debug|x64
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|x86.ActiveCfg = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Debug|x86.Build.0 = Debug|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|Any CPU.Build.0 = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|ARM.ActiveCfg = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|ARM.Build.0 = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|ARM64.ActiveCfg = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|ARM64.Build.0 = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|x64.ActiveCfg = Release|x64
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|x64.Build.0 = Release|x64
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|x86.ActiveCfg = Release|Any CPU
{22EE43E6-C315-4210-AD49-BEA973EEE550}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C66DF512-EF06-4365-9BA9-29D049AC1160}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Application
x:Class="UWPWithSceneLoaderNuget.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWPWithSceneLoaderNuget">

</Application>
100 changes: 100 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace UWPWithSceneLoaderNuget
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();

rootFrame.NavigationFailed += OnNavigationFailed;

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}

// Place the frame in the current Window
Window.Current.Content = rootFrame;
}

if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
204 changes: 204 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/Assets/DamagedHelmet.gltf

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Page
x:Class="UWPWithSceneLoaderNuget.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWPWithSceneLoaderNuget"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Loaded="Page_Loaded">

<Grid>

</Grid>
</Page>
78 changes: 78 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI.Composition;
using Windows.UI.Composition.Scenes;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Hosting;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using SceneLoaderComponent;

namespace UWPWithSceneLoaderNuget
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
Compositor compositor;
SceneVisual sceneVisual;

public MainPage()
{
this.InitializeComponent();

compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

var root = compositor.CreateContainerVisual();

root.Size = new System.Numerics.Vector2(1000, 1000);
ElementCompositionPreview.SetElementChildVisual(this, root);

sceneVisual = SceneVisual.Create(compositor);
root.Children.InsertAtTop(sceneVisual);

sceneVisual.Offset = new System.Numerics.Vector3(300, 300, 0);
sceneVisual.RotationAxis = new System.Numerics.Vector3(0, 1, 0);

var rotationAnimation = compositor.CreateScalarKeyFrameAnimation();

rotationAnimation.InsertKeyFrame(0f, 0.0f, compositor.CreateLinearEasingFunction());
rotationAnimation.InsertKeyFrame(0.5f, 360.0f, compositor.CreateLinearEasingFunction());
rotationAnimation.InsertKeyFrame(1f, 0.0f, compositor.CreateLinearEasingFunction());

rotationAnimation.Duration = TimeSpan.FromSeconds(8);
rotationAnimation.IterationBehavior = AnimationIterationBehavior.Forever;

sceneVisual.StartAnimation("RotationAngleInDegrees", rotationAnimation);
}

async Task<SceneNode> LoadGLTF(Uri uri)
{
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(uri);
IBuffer buffer = await FileIO.ReadBufferAsync(storageFile);

var loader = new SceneLoader();
return loader.Load(buffer, compositor);
}

private async void Page_Loaded(object sender, RoutedEventArgs e)
{
var sceneNode = await LoadGLTF(new Uri("ms-appx:///Assets/DamagedHelmet.gltf"));

sceneVisual.Root = sceneNode;
}
}
}
49 changes: 49 additions & 0 deletions Samples/UWPWithSceneLoaderNuget/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">

<Identity
Name="561a5c94-07de-4139-80f7-9e37c7652f55"
Publisher="CN=niadapa"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="561a5c94-07de-4139-80f7-9e37c7652f55" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>UWPWithSceneLoaderNuget</DisplayName>
<PublisherDisplayName>niadapa</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="UWPWithSceneLoaderNuget.App">
<uap:VisualElements
DisplayName="UWPWithSceneLoaderNuget"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="UWPWithSceneLoaderNuget"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
Loading