├── TestViewer
├── Assets
│ ├── StoreLogo.png
│ ├── SplashScreen.scale-200.png
│ ├── LockScreenLogo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ └── Square44x44Logo.targetsize-24_altform-unplated.png
├── TestViewer_TemporaryKey.pfx
├── App.xaml
├── MainPage.xaml.cs
├── MainPage.xaml
├── Properties
│ ├── Default.rd.xml
│ └── AssemblyInfo.cs
├── Package.appxmanifest
├── App.xaml.cs
└── TestViewer.csproj
├── SceneLoader
├── SceneLoaderComponent.def
├── NugetPackager
│ ├── SceneLoaderComponent.props
│ ├── SceneLoaderComponent.targets
│ └── SceneLoaderComponent.nuspec
├── readme.md
├── pch.cpp
├── SceneLoaderComponent.idl
├── packages.config
├── GLTFVisitor_Skin.cpp
├── UtilForIntermingledNamespaces.h
├── GLTFVisitor_Camera.cpp
├── GLTFVisitor_Sampler.cpp
├── GLTFVisitor_Texture.cpp
├── GLTFVisitor_Mesh.cpp
├── GLTFVisitor_Material.cpp
├── SceneLoader.h
├── Bounds3D.h
├── SceneLoader.vcxproj.filters
├── pch.h
├── GLTFVisitor_Node.cpp
├── UtilForIntermingledNamespaces.cpp
├── SceneResourceSet.h
├── GLTFVisitor.h
├── GLTFVisitor.cpp
├── SceneLoader.cpp
├── Bounds3D.cpp
├── GLTFVisitor_MeshPrimitive.cpp
├── GLTFVisitor_Image.cpp
├── SceneResourceSet.cpp
└── SceneLoader.vcxproj
├── version.json
├── Experimental
└── CameraComponent
│ ├── ModelViewer.xaml
│ ├── Projection.cs
│ ├── Animatable.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Camera.cs
│ ├── OrthographicProjection.cs
│ ├── ModelViewer.xaml.cs
│ ├── PerspectiveProjection.cs
│ ├── CameraComponent.csproj
│ ├── FirstPersonCamera.cs
│ ├── OrbitalCamera.cs
│ └── Viewport.cs
├── LICENSE.md
├── settings.xamlstyler
├── README.md
├── azure-pipelines.yml
├── SceneLoader.sln
└── .gitignore
/TestViewer/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/TestViewer/TestViewer_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/TestViewer_TemporaryKey.pfx
--------------------------------------------------------------------------------
/TestViewer/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/TestViewer/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/TestViewer/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/TestViewer/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/TestViewer/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/SceneLoader/SceneLoaderComponent.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
4 |
--------------------------------------------------------------------------------
/SceneLoader/NugetPackager/SceneLoaderComponent.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/TestViewer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CommunityToolkit/SceneLoader/HEAD/TestViewer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/SceneLoader/readme.md:
--------------------------------------------------------------------------------
1 | Steps to run locally:
2 |
3 | 1. Clone the repo
4 | 2. Install Windows SDK 18362
5 | 3. cd ..\build
6 | 4. Run ./build.bat
7 |
8 | Outputs:
9 | The project create a nuget package located in ..\bin\nupkg
--------------------------------------------------------------------------------
/SceneLoader/pch.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
--------------------------------------------------------------------------------
/TestViewer/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SceneLoader/SceneLoaderComponent.idl:
--------------------------------------------------------------------------------
1 | namespace SceneLoaderComponent
2 | {
3 | [default_interface]
4 | runtimeclass SceneLoader
5 | {
6 | SceneLoader();
7 | Windows.UI.Composition.Scenes.SceneNode Load(Windows.Storage.Streams.IBuffer buffer, Windows.UI.Composition.Compositor compositor);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/SceneLoader/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0-build.{height}",
3 | "publicReleaseRefSpec": [
4 | "^refs/heads/master$", // we release out of master
5 | "^refs/heads/dev$", // we release out of dev
6 | "^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N
7 | ],
8 | "nugetPackageVersion":{
9 | "semVer": 2
10 | },
11 | "cloudBuild": {
12 | "buildNumber": {
13 | "enabled": false
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Skin.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | using namespace winrt;
12 |
13 | namespace SceneLoader
14 | {
15 | // Skin
16 | void GLTFVisitor::operator()(const Skin& /*skin*/, VisitState /*alreadyVisited*/, const VisitDefaultAction&)
17 | {
18 | }
19 |
20 |
21 |
22 | }
--------------------------------------------------------------------------------
/SceneLoader/UtilForIntermingledNamespaces.h:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #pragma once
6 |
7 | namespace SceneLoader {
8 | winrt::Windows::Foundation::MemoryBuffer CopyArrayOfBytesToMemoryBuffer(BYTE* data, size_t byteLength);
9 |
10 | std::pair GetDataPointerFromMemoryBuffer(winrt::Windows::Foundation::IMemoryBufferReference);
11 |
12 | winrt::hstring GetHSTRINGFromStdString(const std::string& s);
13 | }
--------------------------------------------------------------------------------
/Experimental/CameraComponent/ModelViewer.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/TestViewer/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace TestViewer
8 | {
9 | ///
10 | /// A page that generates a gltf image using the SceneLoaderComponent.
11 | ///
12 | public sealed partial class MainPage : Page
13 | {
14 | public MainPage()
15 | {
16 | this.InitializeComponent();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Camera.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | namespace winrt {
12 | using namespace Windows::UI::Composition;
13 | using namespace Windows::UI::Composition::Scenes;
14 | }
15 | using namespace winrt;
16 |
17 | namespace SceneLoader
18 | {
19 | // Camera
20 | void GLTFVisitor::operator()(const Camera& /*camera*/, VisitState /*alreadyVisited*/, const VisitDefaultAction&)
21 | {
22 | }
23 | }
--------------------------------------------------------------------------------
/SceneLoader/NugetPackager/SceneLoaderComponent.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | $(MSBuildThisFileDirectory)$(Platform)\SceneLoaderComponent.winmd
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Sampler.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | using namespace winrt;
12 |
13 | namespace SceneLoader
14 | {
15 | void GLTFVisitor::operator()(const Sampler& sampler, VisitState state, const VisitDefaultAction&)
16 | {
17 | if (state == VisitState::New)
18 | {
19 | if (!m_resourceSet->GetGLTFSamplerById(sampler.id, nullptr))
20 | {
21 | m_resourceSet->StoreGLTFSamplerById(sampler.id, sampler);
22 | }
23 | else
24 | {
25 | Microsoft::glTF::Sampler storedSampler;
26 |
27 | m_resourceSet->GetGLTFSamplerById(sampler.id, &storedSampler);
28 |
29 | assert(storedSampler == sampler);
30 | }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Texture.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | using namespace winrt;
12 |
13 | namespace SceneLoader
14 | {
15 | void GLTFVisitor::operator()(const Texture& texture, TextureType /*textureType*/, VisitState state, const VisitDefaultAction&)
16 | {
17 | if (state == VisitState::New)
18 | {
19 | if (!m_resourceSet->GetGLTFTextureById(texture.id, nullptr))
20 | {
21 | m_resourceSet->StoreGLTFTextureById(texture.id, texture);
22 | }
23 | else
24 | {
25 | Microsoft::glTF::Texture storedTexture;
26 |
27 | m_resourceSet->GetGLTFTextureById(texture.id, &storedTexture);
28 |
29 | assert(storedTexture == texture);
30 | }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Mesh.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | namespace winrt {
12 | using namespace Windows::UI::Composition::Scenes;
13 | }
14 | using namespace winrt;
15 | using namespace std;
16 |
17 | namespace SceneLoader
18 | {
19 | // Mesh
20 | void GLTFVisitor::operator()(const Mesh& mesh, VisitState state)
21 | {
22 | if (state == VisitState::New)
23 | {
24 | wstring meshID{ mesh.id.begin(), mesh.id.end() };
25 |
26 | // We'll have a new SceneNode for each GLTF Mesh and another for each GLTF MeshComponent.
27 | auto sceneNodeForTheGLTFMesh = SceneNode::Create(m_compositor);
28 | sceneNodeForTheGLTFMesh.Comment(meshID);
29 |
30 | m_latestSceneNode.Children().Append(sceneNodeForTheGLTFMesh);
31 |
32 | m_latestSceneNode = sceneNodeForTheGLTFMesh;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # Windows Community Toolkit
2 |
3 | Copyright (c) .NET Foundation and Contributors
4 |
5 | All rights reserved.
6 |
7 | # MIT License (MIT)
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 |
--------------------------------------------------------------------------------
/SceneLoader/GLTFVisitor_Material.cpp:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #include "pch.h"
6 |
7 | #include "GLTFVisitor.h"
8 |
9 | using namespace Microsoft::glTF;
10 |
11 | namespace winrt {
12 | using namespace Windows::UI::Composition::Scenes;
13 | }
14 | using namespace winrt;
15 |
16 | namespace SceneLoader
17 | {
18 | // Material
19 | void GLTFVisitor::operator()(const Material& material, VisitState /*alreadyVisited*/, const VisitDefaultAction&)
20 | {
21 | auto curMaterial = m_resourceSet->EnsureMaterialById(material.id);
22 |
23 | if (!m_resourceSet->GetGLTFMaterialById(material.id, nullptr))
24 | {
25 | m_resourceSet->StoreGLTFMaterialById(material.id, material);
26 | }
27 | else
28 | {
29 | Microsoft::glTF::Material storedMaterial;
30 |
31 | m_resourceSet->GetGLTFMaterialById(material.id, &storedMaterial);
32 |
33 | assert(storedMaterial == material);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/TestViewer/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Experimental/CameraComponent/Projection.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using System.Numerics;
6 |
7 | namespace CameraComponent
8 | {
9 | ///
10 | /// An interface that defines properties and functions that a Projection object must implement.
11 | ///
12 | public interface Projection : Animatable
13 | {
14 | ///
15 | /// Distance from the camera to the near plane.
16 | ///
17 | float Near { get; set; }
18 |
19 | ///
20 | /// Distance from the camera to the far plane.
21 | ///
22 | float Far { get; set; }
23 |
24 | ///
25 | /// Returns the matrix created by the near and far planes and other properties of the projection.
26 | ///
27 | /// A Matrix4x4 created from the specific type of projection's properties.
28 | Matrix4x4 GetProjectionMatrix();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TestViewer/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/TestViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using System.Reflection;
6 | using System.Runtime.CompilerServices;
7 | using System.Runtime.InteropServices;
8 |
9 | // General Information about an assembly is controlled through the following
10 | // set of attributes. Change these attribute values to modify the information
11 | // associated with an assembly.
12 | [assembly: AssemblyTitle("TestViewer")]
13 | [assembly: AssemblyDescription("")]
14 | [assembly: AssemblyConfiguration("")]
15 | [assembly: AssemblyCompany("")]
16 | [assembly: AssemblyProduct("TestViewer")]
17 | [assembly: AssemblyCopyright("Copyright © 2019")]
18 | [assembly: AssemblyTrademark("")]
19 | [assembly: AssemblyCulture("")]
20 |
21 | // Version information for an assembly consists of the following four values:
22 | //
23 | // Major Version
24 | // Minor Version
25 | // Build Number
26 | // Revision
27 | //
28 | // You can specify all the values or you can default the Build and Revision Numbers
29 | // by using the '*' as shown below:
30 | // [assembly: AssemblyVersion("1.0.*")]
31 | [assembly: AssemblyVersion("1.0.0.0")]
32 | [assembly: AssemblyFileVersion("1.0.0.0")]
33 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Experimental/CameraComponent/Animatable.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using Windows.UI.Composition;
6 |
7 | namespace CameraComponent
8 | {
9 | ///
10 | /// An interface that defines functions non-Composition objects can implement to become animatable.
11 | ///
12 | public interface Animatable
13 | {
14 | ///
15 | /// Returns an object's set of animatable properties.
16 | ///
17 | CompositionPropertySet GetPropertySet();
18 |
19 | ///
20 | /// Starts a given animation on the specified property.
21 | ///
22 | /// The name of the property to be animated.
23 | /// The animation being applied.
24 | void StartAnimation(string propertyName, CompositionAnimation animation);
25 |
26 | ///
27 | /// Stops any animations on the specified property.
28 | ///
29 | /// The name of the property whose animations we are stopping.
30 | void StopAnimation(string propertyName);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/SceneLoader/SceneLoader.h:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #pragma once
6 |
7 | #include "SceneLoader.g.h"
8 |
9 | namespace winrt::SceneLoaderComponent::implementation
10 | {
11 | struct SceneLoader : SceneLoaderT
12 | {
13 | SceneLoader() = default;
14 |
15 | winrt::Windows::UI::Composition::Scenes::SceneNode Load(winrt::Windows::Storage::Streams::IBuffer buffer, winrt::Windows::UI::Composition::Compositor compositor);
16 |
17 | private:
18 | void ParseGLTF(
19 | BYTE * data,
20 | UINT32 capacity,
21 | winrt::Windows::UI::Composition::Compositor& compositor,
22 | winrt::Windows::UI::Composition::Scenes::SceneNode& rootNode);
23 | void DoIt(
24 | Microsoft::glTF::Document & gltfDoc,
25 | std::shared_ptr resourceReader,
26 | winrt::Windows::UI::Composition::Compositor& compositor,
27 | winrt::Windows::UI::Composition::Scenes::SceneNode& rootNode);
28 | };
29 | }
30 |
31 | namespace winrt::SceneLoaderComponent::factory_implementation
32 | {
33 | struct SceneLoader : SceneLoaderT
34 | {
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/Experimental/CameraComponent/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using System.Reflection;
6 | using System.Runtime.CompilerServices;
7 | using System.Runtime.InteropServices;
8 |
9 | // General Information about an assembly is controlled through the following
10 | // set of attributes. Change these attribute values to modify the information
11 | // associated with an assembly.
12 | [assembly: AssemblyTitle("CameraComponent")]
13 | [assembly: AssemblyDescription("")]
14 | [assembly: AssemblyConfiguration("")]
15 | [assembly: AssemblyCompany("")]
16 | [assembly: AssemblyProduct("CameraComponent")]
17 | [assembly: AssemblyCopyright("Copyright © 2019")]
18 | [assembly: AssemblyTrademark("")]
19 | [assembly: AssemblyCulture("")]
20 |
21 | // Version information for an assembly consists of the following four values:
22 | //
23 | // Major Version
24 | // Minor Version
25 | // Build Number
26 | // Revision
27 | //
28 | // You can specify all the values or you can default the Build and Revision Numbers
29 | // by using the '*' as shown below:
30 | // [assembly: AssemblyVersion("1.0.*")]
31 | [assembly: AssemblyVersion("1.0.0.0")]
32 | [assembly: AssemblyFileVersion("1.0.0.0")]
33 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Experimental/CameraComponent/Camera.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using System.Numerics;
6 |
7 | namespace CameraComponent
8 | {
9 | ///
10 | /// An interface that defines properties and functions that a Camera object must implement.
11 | ///
12 | public interface Camera : Animatable
13 | {
14 | ///
15 | /// A reference to a class that implements the Projection interace.
16 | ///
17 | Projection Projection { get; set; }
18 |
19 | ///
20 | /// Returns the matrix created using the Camera's position and rotation in world space.
21 | ///
22 | /// /// A Matrix4x4 that is the product of the matrices representing the camera's translation and rotation.
23 | Matrix4x4 GetViewMatrix();
24 |
25 | ///
26 | /// Returns the matrix created using the Camera's view matrix and the Camera's Projection's matrix.
27 | ///
28 | /// A Matrix4x4 that is the the product of the matrices representing the camera's transformations in world space and
29 | /// the matrix created by the Camera's Projection property.
30 | Matrix4x4 GetModelViewProjectionMatrix();
31 | }
32 | }
--------------------------------------------------------------------------------
/SceneLoader/NugetPackager/SceneLoaderComponent.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SceneLoaderComponent
5 | $version$
6 | developer
7 | developer
8 | https://github.com/windows-toolkit/SceneLoader
9 | false
10 | Parses a GLTF file and produces a WUC SceneNode.
11 |
12 | Copyright 2019
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/SceneLoader/Bounds3D.h:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #pragma once
6 |
7 | namespace SceneLoader {
8 |
9 | class Bounds3D
10 | {
11 | public:
12 | Bounds3D(winrt::Windows::UI::Composition::Scenes::SceneBoundingBox sceneBounds);
13 |
14 | Bounds3D(winrt::Windows::Foundation::Numerics::float3 _min = winrt::Windows::Foundation::Numerics::float3(FLT_MAX, FLT_MAX, FLT_MAX),
15 | winrt::Windows::Foundation::Numerics::float3 _max = winrt::Windows::Foundation::Numerics::float3(FLT_MIN, FLT_MIN, FLT_MIN));
16 |
17 | static Bounds3D Union(const Bounds3D &lBounds, const Bounds3D &rBounds);
18 | static Bounds3D Transform(const Bounds3D &srcBounds, const winrt::Windows::Foundation::Numerics::float4x4 &transform);
19 |
20 | winrt::Windows::Foundation::Numerics::float3 Min() const;
21 |
22 | winrt::Windows::Foundation::Numerics::float3 Max() const;
23 |
24 | private:
25 | winrt::Windows::Foundation::Numerics::float3 m_min;
26 | winrt::Windows::Foundation::Numerics::float3 m_max;
27 | };
28 |
29 | Bounds3D ComputeTreeBounds(winrt::Windows::UI::Composition::Scenes::SceneNode root,
30 | winrt::Windows::Foundation::Numerics::float4x4 parentTransform);
31 |
32 | void DecomposeMatrix(
33 | const std::array matrix,
34 | winrt::Windows::Foundation::Numerics::float3* pOutScale,
35 | winrt::Windows::Foundation::Numerics::quaternion* pOutRotation,
36 | winrt::Windows::Foundation::Numerics::float3* pOutTranslation
37 | );
38 | }
--------------------------------------------------------------------------------
/TestViewer/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | TestViewer
18 | developer
19 | Assets\StoreLogo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/SceneLoader/SceneLoader.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 670a1d9e-70b7-4796-adc5-1817c10d6040
6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/settings.xamlstyler:
--------------------------------------------------------------------------------
1 | {
2 | "AttributesTolerance": 1,
3 | "KeepFirstAttributeOnSameLine": true,
4 | "MaxAttributeCharatersPerLine": 0,
5 | "MaxAttributesPerLine": 1,
6 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
7 | "SeparateByGroups": false,
8 | "AttributeIndentation": 0,
9 | "AttributeIndentationStyle": 1,
10 | "RemoveDesignTimeReferences": false,
11 | "EnableAttributeReordering": true,
12 | "AttributeOrderingRuleGroups": [
13 | "x:Class",
14 | "xmlns, xmlns:x",
15 | "xmlns:*",
16 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
17 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
18 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
19 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
20 | "*:*, *",
21 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
22 | "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
23 | "Storyboard.*, From, To, Duration"
24 | ],
25 | "FirstLineAttributes": "",
26 | "OrderAttributesByName": true,
27 | "PutEndingBracketOnNewLine": false,
28 | "RemoveEndingTagOfEmptyElement": true,
29 | "SpaceBeforeClosingSlash": true,
30 | "RootElementLineBreakRule": 0,
31 | "ReorderVSM": 2,
32 | "ReorderGridChildren": false,
33 | "ReorderCanvasChildren": false,
34 | "ReorderSetters": 0,
35 | "FormatMarkupExtension": true,
36 | "NoNewLineMarkupExtensions": "x:Bind, Binding",
37 | "ThicknessSeparator": 2,
38 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
39 | "FormatOnSave": true,
40 | "CommentPadding": 2,
41 | "IndentSize": 4
42 | }
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SceneLoader for Windows UI
2 |
3 | SceneLoader is a library for generating [Windows.UI.Composition.Scenes](https://docs.microsoft.com/uwp/api/windows.ui.composition.scenes) scene graphs from 3D file formats such as [glTF](https://www.khronos.org/gltf/). This project aims to simplify the design-to-code workflow for rendering 3D assets in your Windows applications.
4 |
5 | SceneLoader currently produces a [SceneNode](https://docs.microsoft.com/uwp/api/windows.ui.composition.scenes.scenenode), allowing you to programmatically construct your own [Visual](https://docs.microsoft.com/uwp/api/windows.ui.composition.scenes.scenevisual) tree. A [proposed companion Microsoft.UI.Xaml control](https://github.com/microsoft/microsoft-ui-xaml/issues/686) is expected to enable 3D assets to be loaded from markup without requiring explicit management of the Visual tree.
6 |
7 | ## Supported SDKs
8 | * May 2019 Update (18362)
9 |
10 | ## Getting Started
11 | * [Documentation](https://docs.microsoft.com/uwp/api/windows.ui.composition.scenes)
12 | * [Code Sample](https://github.com/windows-toolkit/SceneLoader/blob/master/TestViewer/MainPage.xaml.cs)
13 |
14 | ## Build Status
15 | | Target | Branch | Status | Recommended NuGet package |
16 | | ------ | ------ | ------ | ------ |
17 | | 0.0.1 | master | [](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build/latest?definitionId=80&branchName=master) | ? |
18 |
19 | ## Feedback and Requests
20 | Please use [GitHub Issues](https://github.com/windows-toolkit/SceneLoader/issues) for bug reports and feature requests.
21 |
22 | ## Principles
23 | This project has adopted the code of conduct defined by the [Contributor Covenant](http://contributor-covenant.org/)
24 | to clarify expected behavior in our community.
25 | For more information see the [.NET Foundation Code of Conduct](http://dotnetfoundation.org/code-of-conduct).
26 |
27 | ## .NET Foundation
28 | This project is supported by the [.NET Foundation](http://dotnetfoundation.org).
29 |
30 |
--------------------------------------------------------------------------------
/azure-pipelines.yml:
--------------------------------------------------------------------------------
1 | # Control which branches get CI triggers (defaults to all branches if this parameter is not set)
2 | trigger:
3 | - master
4 | - rel/*
5 |
6 | # Specify the target branches for pull request builds
7 | pr:
8 | - master
9 | - rel/*
10 |
11 | # Microsoft-hosted agent pool for Visual Studio 2017 on Windows Server 2016
12 | pool:
13 | vmImage: vs2017-win2016
14 |
15 | # variables:
16 | # BuildConfiguration: SceneLoader
17 |
18 | steps:
19 | # Setup Environment Variables
20 | - task: BatchScript@1
21 | inputs:
22 | filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
23 | arguments: -no_logo
24 | modifyEnvironment: true
25 | displayName: Setup Environment Variables
26 |
27 | # Install Nuget Tool Installer
28 | - task: NuGetToolInstaller@0
29 | displayName: Use NuGet 4.7.0
30 | inputs:
31 | versionSpec: 4.7.0
32 |
33 | # Install NBGV Tool
34 | - task: DotNetCoreCLI@2
35 | inputs:
36 | command: custom
37 | custom: tool
38 | arguments: install --tool-path . nbgv
39 | displayName: Install NBGV tool
40 |
41 | # Set cloud build variables
42 | - script: nbgv cloud
43 | displayName: Set Version
44 |
45 | # Install Windows SDK 18362 (minimum compatible sdk)
46 | - powershell: .\build\Install-WindowsSdkISO.ps1 18362
47 | displayName: Insider SDK
48 |
49 | # Run cake build
50 | - powershell: .\build.ps1 -target=PackageNuget
51 | displayName: Build
52 | workingDirectory: .\build
53 |
54 | # Sign Nuget package
55 | - task: PowerShell@2
56 | displayName: Authenticode Sign Packages
57 | inputs:
58 | filePath: build/Sign-Package.ps1
59 | env:
60 | SignClientUser: $(SignClientUser)
61 | SignClientSecret: $(SignClientSecret)
62 | ArtifactDirectory: bin\nupkg
63 | condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
64 |
65 | # Publish nuget package
66 | - task: PublishBuildArtifacts@1
67 | displayName: Publish Package Artifacts
68 | inputs:
69 | pathToPublish: .\bin\nupkg
70 | artifactType: container
71 | artifactName: Packages
--------------------------------------------------------------------------------
/SceneLoader/pch.h:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | #pragma once
6 |
7 |
8 | // rapidjson (a dependency of GLTF SDK) uses iterators in a way
9 | // that is deprecated on C++17. We can't got back to C++14 because
10 | // C++/WinRT requires C++17. The following line shuts off
11 | // the C++17 warning about the deprecated way of using iterators.
12 | #define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
13 |
14 | // std
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include